PageSourceSearch

https://libanus.lovable.app/assets/CachacaAtacado-CoaU1Fg6.js

js libanus.lovable.app collected 2026-10-03 03:36:01 UTC 1,646,688 bytes, 2,789 lines download raw bytes

1import{a6 as sw,R as Cf,y as aw,x as lw,z as cw,v as co,bv as hw,bw as uw,aY as dw,r as vo,j as X,C as bo,q as wo,bd as If,b as M_,n as Xs,o as Ys,ab as Af,u as pw,S as fw,a as mw,B as wh,A as _w,ax as S_,aE as gw,f as A0,aG as w0,p as Ef,aI as C0,s as xo,_ as E_,$ as I_,a0 as A_,a1 as C_,a2 as Sf,bn as yw,I as Ws,P as T0,M as xw,t as vw,a5 as bw}from"./index-xEYNsQ86.js";import{S as ww}from"./separator-Cr5XKA_h.js";import{W as P_}from"./waves-B83-6hCQ.js";import{C as Tw}from"./calculator-BwRLJFXG.js";import{P as Sw}from"./package-ud9BTNUf.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const M0=sw("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]),Ew=()=>Cf({queryKey:["cachaca-b2b-skus"],queryFn:async()=>{try{const{data:gi,error:Qi}=await co.from("cachaca_skus").select("*").in("codigo",["CCL-ALB-500-UN","CCL-ALB-500-CX12","CCL-CRV-500-UN","CCL-CRV-500-CX12","CCL-CST-500-UN","CCL-CST-500-CX12"]).eq("ativo",!0).order("unidade_medida",{ascending:!1}).order("preco_venda",{ascending:!0});return Qi?(console.warn("Error fetching SKUs, returning fallback data:",Qi),[{id:"1",codigo:"CCL-ALB-500-UN",nome:"Alambique - Garrafa 500ml",volume_ml:500,preco_venda:65,unidade_medida:"UN",categoria:"Cachaça Premium"},{id:"2",codigo:"CCL-ALB-500-CX12",nome:"Alambique - Caixa 12x500ml",volume_ml:500,preco_venda:720,unidade_medida:"CX",categoria:"Cachaça Premium"},{id:"3",codigo:"CCL-CRV-500-UN",nome:"Carvalho - Garrafa 500ml",volume_ml:500,preco_venda:85,unidade_medida:"UN",categoria:"Cachaça Premium"},{id:"4",codigo:"CCL-CRV-500-CX12",nome:"Carvalho - Caixa 12x500ml",volume_ml:500,preco_venda:960,unidade_medida:"CX",categoria:"Cachaça Premium"},{id:"5",codigo:"CCL-CST-500-UN",nome:"Castanheira - Garrafa 500ml",volume_ml:500,preco_venda:105,unidade_medida:"UN",categoria:"Cachaça Premium"},{id:"6",codigo:"CCL-CST-500-CX12",nome:"Castanheira - Caixa 12x500ml",volume_ml:500,preco_venda:1200,unidade_medida:"CX",categoria:"Cachaça Premium"}]):gi||[]}catch(gi){return console.warn("Network error fetching SKUs, returning fallback data:",gi),[{id:"1",codigo:"CCL-ALB-500-UN",nome:"Alambique - Garrafa 500ml",volume_ml:500,preco_venda:65,unidade_medida:"UN",categoria:"Cachaça Premium"},{id:"2",codigo:"CCL-ALB-500-CX12",nome:"Alambique - Caixa 12x500ml",volume_ml:500,preco_venda:720,unidade_medida:"CX",categoria:"Cachaça Premium"},{id:"3",codigo:"CCL-CRV-500-UN",nome:"Carvalho - Garrafa 500ml",volume_ml:500,preco_venda:85,unidade_medida:"UN",categoria:"Cachaça Premium"},{id:"4",codigo:"CCL-CRV-500-CX12",nome:"Carvalho - Caixa 12x500ml",volume_ml:500,preco_venda:960,unidade_medida:"CX",categoria:"Cachaça Premium"},{id:"5",codigo:"CCL-CST-500-UN",nome:"Castanheira - Garrafa 500ml",volume_ml:500,preco_venda:105,unidade_medida:"UN",categoria:"Cachaça Premium"},{id:"6",codigo:"CCL-CST-500-CX12",nome:"Castanheira - Caixa 12x500ml",volume_ml:500,preco_venda:1200,unidade_medida:"CX",categoria:"Cachaça Premium"}]}}}),Iw=(gi,Qi,ir)=>Cf({queryKey:["preco-b2b",gi,Qi,ir],queryFn:async()=>{try{const{data:_r,error:Vr}=await co.rpc("calcular_preco_b2b",{sku_codigo_param:gi,cidade_param:Qi,tipo_cliente_param:ir});if(Vr){console.warn("Error calculating B2B price, using fallback:",Vr);const Ar=S0(gi),s=ir==="distribuidor"?.25:.15;return{preco_final:Ar*(1-s),preco_base:Ar,percentual_markup:s*100,tem_frete:!0}}const Pr=_r==null?void 0:_r[0];return Pr?{preco_final:Pr.preco_unitario,preco_base:Pr.preco_unitario,percentual_markup:Pr.margem_percentual||0,tem_frete:!0}:{preco_final:0,preco_base:0,percentual_markup:0,tem_frete:!0}}catch(_r){console.warn("Network error calculating B2B price, using fallback:",_r);const Vr=S0(gi),Pr=ir==="distribuidor"?.25:.15;return{preco_final:Vr*(1-Pr),preco_base:Vr,percentual_markup:Pr*100,tem_frete:!0}}},enabled:!!(gi&&Qi&&ir)}),S0=gi=>({"CCL-ALB-500-UN":65,"CCL-ALB-500-CX12":720,"CCL-CRV-500-UN":85,"CCL-CRV-500-CX12":960,"CCL-CST-500-UN":105,"CCL-CST-500-CX12":1200})[gi]||50,Aw=()=>Cf({queryKey:["territorios"],queryFn:async()=>{const{data:gi,error:Qi}=await co.from("territorios_distribuicao").select("*").eq("ativo",!0).order("cidade");return Qi?(console.warn("Failed to fetch territorios - user may 
6need commercial permissions:",Qi),[{id:"1",cidade:"São Paulo",estado:"SP",regiao:"Sudeste",ativo:!0},{id:"2",cidade:"Rio de Janeiro",estado:"RJ",regiao:"Sudeste",ativo:!0},{id:"3",cidade:"Belo Horizonte",estado:"MG",regiao:"Sudeste",ativo:!0},{id:"4",cidade:"Salvador",estado:"BA",regiao:"Nordeste",ativo:!0},{id:"5",cidade:"Recife",estado:"PE",regiao:"Nordeste",ativo:!0}]):gi||[]}}),Cw=()=>{const{toast:gi}=aw(),Qi=lw();return cw({mutationFn:async ir=>{var Di;const{data:{user:_r},error:Vr}=await co.auth.getUser();if(Vr||!_r)throw new Error("Você precisa estar autenticado para se cadastrar como distribuidor");try{await co.rpc("log_distributor_registration_attempt",{email_param:ir.email,success_param:!1,error_param:null})}catch(sr){console.warn("Failed to log registration attempt:",sr)}const{data:Pr}=await co.from("distribuidores_cadastrados").select("id").eq("cnpj",ir.cnpj).maybeSingle();if(Pr){try{await co.rpc("log_distributor_registration_attempt",{email_param:ir.email,success_param:!1,error_param:"CNPJ já cadastrado"})}catch(sr){console.warn("Failed to log registration attempt:",sr)}throw new Error("CNPJ já cadastrado em nosso sistema")}const{data:Ar}=await co.from("territorios_distribuicao").select("id").ilike("cidade",ir.cidade).eq("ativo",!0).maybeSingle(),{data:s}=await co.auth.getUser(),{data:li,error:Vt}=await co.from("distribuidores_cadastrados").insert({...ir,user_id:(Di=s.user)==null?void 0:Di.id,territorio_id:Ar==null?void 0:Ar.id,status:"pendente"}).select().single();if(Vt){try{await co.rpc("log_distributor_registration_attempt",{email_param:ir.email,success_param:!1,error_param:Vt.message})}catch(sr){console.warn("Failed to log registration attempt:",sr)}throw Vt}return li},onSuccess:()=>{hw(),gi({title:"Cadastro realizado com sucesso!",description:"Seu cadastro foi enviado para análise. Entraremos em contato em até 48 horas."}),Qi.invalidateQueries({queryKey:["distribuidores"]})},onError:ir=>{gi({variant:"destructive",title:"Erro no cadastro",description:ir.message||"Ocorreu um erro ao cadastrar. Tente novamente."})}})},Mw=gi=>Cf({queryKey:["verificar-distribuidor",gi],queryFn:async()=>{const{data:Qi,error:ir}=await co.from("distribuidores_cadastrados").select("*").eq("cnpj",gi.replace(/\D/g,"")).maybeSingle();if(ir)throw ir;return Qi},enabled:!!gi&&gi.replace(/\D/g,"").length===14});var P0={exports:{}};(function(gi,Qi){(function(ir,_r){gi.exports=_r()})(uw,function(){var ir,_r,Vr;function Pr(s,li){if(!ir)ir=li;else if(!_r)_r=li;else{var Vt="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+ir+")(sharedChunk); ("+_r+")(sharedChunk); self.onerror = null;",Di={};ir(Di),Vr=li(Di),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(Vr.workerUrl=window.URL.createObjectURL(new Blob([Vt],{type:"text/javascript"})))}}Pr(["exports"],function(s){var li=1e-6,Vt=typeof Float32Array<"u"?Float32Array:Array;function Di(r,e){var i=e[0],o=e[1],a=e[2],h=e[3],u=i*h-a*o;return u?(r[0]=h*(u=1/u),r[1]=-o*u,r[2]=-a*u,r[3]=i*u,r):null}function sr(){var r=new Vt(9);return Vt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function to(r,e){var i=e[0],o=e[1],a=e[2],h=e[3],u=e[4],f=e[5],_=e[6],g=e[7],v=e[8];return r[0]=u*v-f*g,r[1]=a*g-o*v,r[2]=o*f-a*u,r[3]=f*_-h*v,r[4]=i*v-a*_,r[5]=a*h-i*f,r[6]=h*g-u*_,r[7]=o*_-i*g,r[8]=i*u-o*h,r}function qn(r,e,i){var o=e[0],a=e[1],h=e[2],u=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=i[0],I=i[1],A=i[2],P=i[3],R=i[4],O=i[5],j=i[6],V=i[7],G=i[8];return r[0]=w*o+I*u+A*g,r[1]=w*a+I*f+A*v,r[2]=w*h+I*_+A*b,r[3]=P*o+R*u+O*g,r[4]=P*a+R*f+O*v,r[5]=P*h+R*_+O*b,r[6]=j*o+V*u+G*g,r[7]=j*a+V*f+G*v,r[8]=j*h+V*_+G*b,r}function To(){var r=new Vt(16);return Vt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r}function It(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function fr(r,e){var i=e[0],o=e[1],a=e[2],h=e[3],u=e[4],f=e[5],_=e[6],g=e[7],v=e[8],b=e[9],w=e[10],I=e[11],A=e[12],P=e[13],R=e[14],O=e[15],j=i*f-o*u,V=i*_-a*u,G=i*g-h*u,ne=o*_-a*f,ee=o*g-h*f,ie=a*g-h*_,le=v*P-b*A,he=v*R-w*A,Ie=v*O-I*A,pe=b*R-w*P,Ce=b*O-I*P,Ge=w*O-I*R,Pe=j*Ge-V*Ce+G*pe+ne*Ie-ee*he+ie*le;
vendor: 5,128 bytes, line 6
6return Pe?(r[0]=(f*Ge-_*Ce+g*pe)*(Pe=1/Pe),r[1]=(a*Ce-o*Ge-h*pe)*Pe,r[2]=(P*ie-R*ee+O*ne)*Pe,r[3]=(w*ee-b*ie-I*ne)*Pe,r[4]=(_*Ie-u*Ge-g*he)*Pe,r[5]=(i*Ge-a*Ie+h*he)*Pe,r[6]=(R*G-A*ie-O*V)*Pe,r[7]=(v*ie-w*G+I*V)*Pe,r[8]=(u*Ce-f*Ie+g*le)*Pe,r[9]=(o*Ie-i*Ce-h*le)*Pe,r[10]=(A*ee-P*G+O*j)*Pe,r[11]=(b*G-v*ee-I*j)*Pe,r[12]=(f*he-u*pe-_*le)*Pe,r[13]=(i*pe-o*he+a*le)*Pe,r[14]=(P*V-A*ne-R*j)*Pe,r[15]=(v*ne-b*V+w*j)*Pe,r):null}function Wi(r,e,i){var o=e[0],a=e[1],h=e[2],u=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],I=e[10],A=e[11],P=e[12],R=e[13],O=e[14],j=e[15],V=i[0],G=i[1],ne=i[2],ee=i[3];return r[0]=V*o+G*f+ne*b+ee*P,r[1]=V*a+G*_+ne*w+ee*R,r[2]=V*h+G*g+ne*I+ee*O,r[3]=V*u+G*v+ne*A+ee*j,r[4]=(V=i[4])*o+(G=i[5])*f+(ne=i[6])*b+(ee=i[7])*P,r[5]=V*a+G*_+ne*w+ee*R,r[6]=V*h+G*g+ne*I+ee*O,r[7]=V*u+G*v+ne*A+ee*j,r[8]=(V=i[8])*o+(G=i[9])*f+(ne=i[10])*b+(ee=i[11])*P,r[9]=V*a+G*_+ne*w+ee*R,r[10]=V*h+G*g+ne*I+ee*O,r[11]=V*u+G*v+ne*A+ee*j,r[12]=(V=i[12])*o+(G=i[13])*f+(ne=i[14])*b+(ee=i[15])*P,r[13]=V*a+G*_+ne*w+ee*R,r[14]=V*h+G*g+ne*I+ee*O,r[15]=V*u+G*v+ne*A+ee*j,r}function tn(r,e,i){var o,a,h,u,f,_,g,v,b,w,I,A,P=i[0],R=i[1],O=i[2];return e===r?(r[12]=e[0]*P+e[4]*R+e[8]*O+e[12],r[13]=e[1]*P+e[5]*R+e[9]*O+e[13],r[14]=e[2]*P+e[6]*R+e[10]*O+e[14],r[15]=e[3]*P+e[7]*R+e[11]*O+e[15]):(a=e[1],h=e[2],u=e[3],f=e[4],_=e[5],g=e[6],v=e[7],b=e[8],w=e[9],I=e[10],A=e[11],r[0]=o=e[0],r[1]=a,r[2]=h,r[3]=u,r[4]=f,r[5]=_,r[6]=g,r[7]=v,r[8]=b,r[9]=w,r[10]=I,r[11]=A,r[12]=o*P+f*R+b*O+e[12],r[13]=a*P+_*R+w*O+e[13],r[14]=h*P+g*R+I*O+e[14],r[15]=u*P+v*R+A*O+e[15]),r}function Zr(r,e,i){var o=i[0],a=i[1],h=i[2];return r[0]=e[0]*o,r[1]=e[1]*o,r[2]=e[2]*o,r[3]=e[3]*o,r[4]=e[4]*a,r[5]=e[5]*a,r[6]=e[6]*a,r[7]=e[7]*a,r[8]=e[8]*h,r[9]=e[9]*h,r[10]=e[10]*h,r[11]=e[11]*h,r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}function Go(r,e,i){var o=Math.sin(i),a=Math.cos(i),h=e[4],u=e[5],f=e[6],_=e[7],g=e[8],v=e[9],b=e[10],w=e[11];return e!==r&&(r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[4]=h*a+g*o,r[5]=u*a+v*o,r[6]=f*a+b*o,r[7]=_*a+w*o,r[8]=g*a-h*o,r[9]=v*a-u*o,r[10]=b*a-f*o,r[11]=w*a-_*o,r}function So(r,e,i){var o=Math.sin(i),a=Math.cos(i),h=e[0],u=e[1],f=e[2],_=e[3],g=e[8],v=e[9],b=e[10],w=e[11];return e!==r&&(r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=h*a-g*o,r[1]=u*a-v*o,r[2]=f*a-b*o,r[3]=_*a-w*o,r[8]=h*o+g*a,r[9]=u*o+v*a,r[10]=f*o+b*a,r[11]=_*o+w*a,r}function qo(r,e,i){var o=Math.sin(i),a=Math.cos(i),h=e[0],u=e[1],f=e[2],_=e[3],g=e[4],v=e[5],b=e[6],w=e[7];return e!==r&&(r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r[0]=h*a+g*o,r[1]=u*a+v*o,r[2]=f*a+b*o,r[3]=_*a+w*o,r[4]=g*a-h*o,r[5]=v*a-u*o,r[6]=b*a-f*o,r[7]=w*a-_*o,r}function Ks(r,e){return r[0]=e[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=e[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=e[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function io(r,e,i){var o,a,h,u=i[0],f=i[1],_=i[2],g=Math.hypot(u,f,_);return g<li?null:(u*=g=1/g,f*=g,_*=g,o=Math.sin(e),a=Math.cos(e),r[0]=u*u*(h=1-a)+a,r[1]=f*u*h+_*o,r[2]=_*u*h-f*o,r[3]=0,r[4]=u*f*h-_*o,r[5]=f*f*h+a,r[6]=_*f*h+u*o,r[7]=0,r[8]=u*_*h+f*o,r[9]=f*_*h-u*o,r[10]=_*_*h+a,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r)}function Ho(r,e){var i=e[0],o=e[1],a=e[2],h=e[3],u=i+i,f=o+o,_=a+a,g=i*u,v=o*u,b=o*f,w=a*u,I=a*f,A=a*_,P=h*u,R=h*f,O=h*_;return r[0]=1-b-A,r[1]=v+O,r[2]=w-R,r[3]=0,r[4]=v-O,r[5]=1-g-A,r[6]=I+P,r[7]=0,r[8]=w+R,r[9]=I-P,r[10]=1-g-b,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}Math.hypot||(Math.hypot=function(){for(var r=0,e=arguments.length;e--;)r+=arguments[e]*arguments[e];return Math.sqrt(r)});var tc=Wi;function fi(){var r=new Vt(3);return Vt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Js(r){var e=new Vt(3);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e}function jr(r){return Math.hypot(r[0],r[1],r[2])}function gr(r,e,i){var o=new Vt(3);return o[0]=r,o[1]=e,o[2]=i,o}function ur(r,e,i,o){return r[0]=e,r[1]=i,r[2]=o,r}function Ui(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r[2]=e[2]+i[2],r}function xn(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r[2]=e[2]-i[2],r}function Ya(r,e,i){return r[0]=e[0]*i[0],r[1]=e[1]*i[1],r[2]=e[2]*i[2],r}function Eo(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r}function Hn(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r}function Vi(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r}function rn(r,e,i,o){return r[0]=e[0]+i[0]*o,r[1]=e[1]+i[1]*o,r[2]=e[2]+i[2]*o,r}function Qs(r,e){var i=e[0]-r[0],o=e[1]-r[1],a=e[2]-r[2];return i*i+o*o+a*a}function ic(r){var e=r[0],i=r[1],o=r[2];return e*e+i*i+o*o}function $o(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r}function ki(r,e){var i=e[0],o=e[1],a=e[2],h=i*i+o*o+a*a;return h>0&&(h=1/Math.sqrt(h)),r[0]=e[0]*h,r[1]=e[1]*h,r[2]=e[2]*h,r}function ar(r,e){return r[0]*e[0]+r[1]*e[1]+r[2]*e[2]}function yr(r,e,i){var o=e[0],a=e[1],h=e[2],u=i[0],f=i[1],_=i[2];return r[0]=a*_-h*f,r[1]=h*u-o*_,r[2]=o*f-a*u,r}function hn(r,e,i,o){var a=e[0],h=e[1],u=e[2];return r[0]=a+o*(i[0]-a),r[1]=h+o*(i[1]-h),r[2]=u+o*(i[2]-u),r}
6function lr(r,e,i){var o=e[0],a=e[1],h=e[2],u=i[3]*o+i[7]*a+i[11]*h+i[15];return r[0]=(i[0]*o+i[4]*a+i[8]*h+i[12])/(u=u||1),r[1]=(i[1]*o+i[5]*a+i[9]*h+i[13])/u,r[2]=(i[2]*o+i[6]*a+i[10]*h+i[14])/u,r}function Zo(r,e,i){var o=e[0],a=e[1],h=e[2];return r[0]=o*i[0]+a*i[3]+h*i[6],r[1]=o*i[1]+a*i[4]+h*i[7],r[2]=o*i[2]+a*i[5]+h*i[8],r}function Wo(r,e,i){var o=i[0],a=i[1],h=i[2],u=e[0],f=e[1],_=e[2],g=a*_-h*f,v=h*u-o*_,b=o*f-a*u,w=a*b-h*v,I=h*g-o*b,A=o*v-a*g,P=2*i[3];return v*=P,b*=P,I*=2,A*=2,r[0]=u+(g*=P)+(w*=2),r[1]=f+v+I,r[2]=_+b+A,r}function Ka(r){return r[0]=0,r[1]=0,r[2]=0,r}function $n(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]}var cr=xn,un=Ya,Xo=jr;function Ja(){var r=new Vt(4);return Vt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0,r[3]=0),r}function Io(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r[2]=e[2]*i,r[3]=e[3]*i,r}function An(r,e){var i=e[0],o=e[1],a=e[2],h=e[3],u=i*i+o*o+a*a+h*h;return u>0&&(u=1/Math.sqrt(u)),r[0]=i*u,r[1]=o*u,r[2]=a*u,r[3]=h*u,r}function vn(r,e,i){var o=e[0],a=e[1],h=e[2],u=e[3];return r[0]=i[0]*o+i[4]*a+i[8]*h+i[12]*u,r[1]=i[1]*o+i[5]*a+i[9]*h+i[13]*u,r[2]=i[2]*o+i[6]*a+i[10]*h+i[14]*u,r[3]=i[3]*o+i[7]*a+i[11]*h+i[15]*u,r}function Ao(){var r=new Vt(4);return Vt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Co(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function Ss(r,e,i){i*=.5;var o=e[0],a=e[1],h=e[2],u=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_+u*f,r[1]=a*_+h*f,r[2]=h*_-a*f,r[3]=u*_-o*f,r}function ea(r,e,i){i*=.5;var o=e[0],a=e[1],h=e[2],u=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_-h*f,r[1]=a*_+u*f,r[2]=h*_+o*f,r[3]=u*_-a*f,r}fi(),Ja();var dn,Cn,Qa,Mo=An,ta=(dn=fi(),Cn=gr(1,0,0),Qa=gr(0,1,0),function(r,e,i){var o=ar(e,i);return o<-.999999?(yr(dn,Cn,e),Xo(dn)<1e-6&&yr(dn,Qa,e),ki(dn,dn),function(a,h,u){u*=.5;var f=Math.sin(u);a[0]=f*h[0],a[1]=f*h[1],a[2]=f*h[2],a[3]=Math.cos(u)}(r,dn,Math.PI),r):o>.999999?(r[0]=0,r[1]=0,r[2]=0,r[3]=1,r):(yr(dn,e,i),r[0]=dn[0],r[1]=dn[1],r[2]=dn[2],r[3]=1+o,Mo(r,r))});function Wr(){var r=new Vt(2);return Vt!=Float32Array&&(r[0]=0,r[1]=0),r}function Mn(r,e){var i=new Vt(2);return i[0]=r,i[1]=e,i}function Yo(r,e,i){return r[0]=e[0]+i[0],r[1]=e[1]+i[1],r}function Po(r,e,i){return r[0]=e[0]-i[0],r[1]=e[1]-i[1],r}function Ko(r,e,i){return r[0]=e[0]*i,r[1]=e[1]*i,r}function Jo(r){return Math.hypot(r[0],r[1])}function ia(r,e){var i=e[0],o=e[1],a=i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),r[0]=e[0]*a,r[1]=e[1]*a,r}function Bi(r,e){return r[0]*e[0]+r[1]*e[1]}Ao(),Ao(),sr();var el,tl,Pn=Po;function il(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}Wr();var Th=function(){if(tl)return el;function r(e,i,o,a){this.cx=3*e,this.bx=3*(o-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*i,this.by=3*(a-i)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=i,this.p2x=o,this.p2y=a}return tl=1,el=r,r.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,i){if(i===void 0&&(i=1e-6),e<0)return 0;if(e>1)return 1;for(var o=e,a=0;a<8;a++){var h=this.sampleCurveX(o)-e;if(Math.abs(h)<i)return o;var u=this.sampleCurveDerivativeX(o);if(Math.abs(u)<1e-6)break;o-=h/u}var f=0,_=1;for(o=e,a=0;a<20&&(h=this.sampleCurveX(o),!(Math.abs(h-e)<i));a++)e>h?f=o:_=o,o=.5*(_-f)+f;return o},solve:function(e,i){return this.sampleCurveY(this.solveCurveX(e,i))}},el}(),ra=il(Th);function Be(r,e){this.x=r,this.y=e}function zo(r,e){if(Array.isArray(r)){if(!Array.isArray(e)||r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(!zo(r[i],e[i]))return!1;return!0}if(typeof r=="object"&&r!==null&&e!==null){if(typeof e!="object"||Object.keys(r).length!==Object.keys(e).length)return!1;for(const i in r)if(!zo(r[i],e[i]))return!1;return!0}return r===e}Be.prototype={clone(){return new Be(this.x,this.y)},add(r){return this.clone()._add(r)},sub(r){return this.clone()._sub(r)},multByPoint(r){return this.clone()._multByPoint(r)},divByPoint(r){return this.clone()._divByPoint(r)},mult(r){return this.clone()._mult(r)},div(r){return this.clone()._div(r)},rotate(r){return this.clone()._rotate(r)}
vendor: 1,309 bytes, line 6
6,rotateAround(r,e){return this.clone()._rotateAround(r,e)},matMult(r){return this.clone()._matMult(r)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(r){return this.x===r.x&&this.y===r.y},dist(r){return Math.sqrt(this.distSqr(r))},distSqr(r){const e=r.x-this.x,i=r.y-this.y;return e*e+i*i},angle(){return Math.atan2(this.y,this.x)},angleTo(r){return Math.atan2(this.y-r.y,this.x-r.x)},angleWith(r){return this.angleWithSep(r.x,r.y)},angleWithSep(r,e){return Math.atan2(this.x*e-this.y*r,this.x*r+this.y*e)},_matMult(r){const e=r[2]*this.x+r[3]*this.y;return this.x=r[0]*this.x+r[1]*this.y,this.y=e,this},_add(r){return this.x+=r.x,this.y+=r.y,this},_sub(r){return this.x-=r.x,this.y-=r.y,this},_mult(r){return this.x*=r,this.y*=r,this},_div(r){return this.x/=r,this.y/=r,this},_multByPoint(r){return this.x*=r.x,this.y*=r.y,this},_divByPoint(r){return this.x/=r.x,this.y/=r.y,this},_unit(){return this._div(this.mag()),this},_perp(){const r=this.y;return this.y=this.x,this.x=-r,this},_rotate(r){const e=Math.cos(r),i=Math.sin(r),o=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=o,this},_rotateAround(r,e){const i=Math.cos(r),o=Math.sin(r),a=e.y+o*(this.x-e.x)+i*(this.y-e.y);
vendor: 4,157 bytes, line 6
6return this.x=e.x+i*(this.x-e.x)-o*(this.y-e.y),this.y=a,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:Be},Be.convert=function(r){if(r instanceof Be)return r;if(Array.isArray(r))return new Be(+r[0],+r[1]);if(r.x!==void 0&&r.y!==void 0)return new Be(+r.x,+r.y);throw new Error("Expected [x, y] or {x, y} point format")};const Sh=Math.PI/180,rl=180/Math.PI;function ii(r){return r*Sh}function ye(r){return r*rl}const k=[[0,0],[1,0],[1,1],[0,1]];function B(r){if(r<=0)return 0;if(r>=1)return 1;const e=r*r,i=e*r;return 4*(r<.5?i:3*(r-e)+i-.75)}function Z(r,e,i,o){const a=new ra(r,e,i,o);return function(h){return a.solve(h)}}const oe=Z(.25,.1,.25,1);function W(r,e,i){return Math.min(i,Math.max(e,r))}function ce(r,e,i){return(i=W((i-r)/(e-r),0,1))*i*(3-2*i)}function be(r,e,i){const o=i-e,a=((r-e)%o+o)%o+e;return a===e?i:a}function ue(r,e,i){if(!r.length)return i(null,[]);let o=r.length;const a=new Array(r.length);let h=null;r.forEach((u,f)=>{e(u,(_,g)=>{_&&(h=_),a[f]=g,--o==0&&i(h,a)})})}function xe(r,...e){for(const i of e)for(const o in i)r[o]=i[o];return r}let He=1;function ze(){return He++}function ft(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))}function wt(r,e){r.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function Et(r,e,i){const o={};for(const a in r)o[a]=e.call(this,r[a],a,r);return o}function Gt(r,e,i){const o={};for(const a in r)e.call(this,r[a],a,r)&&(o[a]=r[a]);return o}function kt(r){return Array.isArray(r)?r.map(kt):typeof r=="object"&&r?Et(r,kt):r}function qt(r,e){for(let i=0;i<r.length;i++)if(e.indexOf(r[i])>=0)return!0;return!1}const Ei={};function Ht(r){Ei[r]||(typeof console<"u"&&console.warn(r),Ei[r]=!0)}function rr(r,e,i){return(i.y-r.y)*(e.x-r.x)>(e.y-r.y)*(i.x-r.x)}function Cr(r){let e=0;for(let i,o,a=0,h=r.length,u=h-1;a<h;u=a++)i=r[a],o=r[u],e+=(o.x-i.x)*(i.y+o.y);return e}function br([r,e,i]){const o=ii(e+90),a=ii(i);return{x:r*Math.cos(o)*Math.sin(a),y:r*Math.sin(o)*Math.sin(a),z:r*Math.cos(a),azimuthal:e,polar:i}}function bi(r){return(typeof self<"u"||r!==void 0)&&typeof WorkerGlobalScope<"u"&&(r!==void 0?r:self)instanceof WorkerGlobalScope}function oi(r){const e={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,o,a,h)=>{const u=a||h;return e[o]=!u||u.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let er=null;function Xi(r,e){return[r[4*e],r[4*e+1],r[4*e+2],r[4*e+3]]}function Gi(r,e,i,o){for(;e<i;){const a=e+i>>1;r[a]<o?e=a+1:i=a}return e}function Dr(r,e,i,o){for(;e<i;){const a=e+i>>1;r[a]<=o?e=a+1:i=a}return e}function pn(r){return r>0?1/(1.001-r):1+r}function Xr(r){return r>0?1-1/(1.001-r):-r}function nl(r,e,i){return(r-e.min)*(i.max-i.min)/(e.max-e.min)+i.min}const Br={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(!Br.API_URL)return null;try{const r=new URL(Br.API_URL);return r.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":r.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MES
6HOPT_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.1.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Qo(r){return Br.API_URL_REGEX.test(r)}function rc(r){return Br.API_SPRITE_REGEX.test(r)}let ol,sl,nc,oc,Es,al;function sc(){return ol==null&&(ol=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),ol}const ro={now:()=>oc!==void 0?oc:performance.now(),setNow(r){oc=r},restoreNow(){oc=void 0},frame(r){const e=requestAnimationFrame(r);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(r,e=0){const{width:i,height:o}=r;Es||(Es=document.createElement("canvas"));const a=Es.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return(i>Es.width||o>Es.height)&&(Es.width=i,Es.height=o),a.clearRect(-e,-e,i+2*e,o+2*e),a.drawImage(r,0,0,i,o),a.getImageData(-e,-e,i+2*e,o+2*e)},resolveURL:r=>(sl||(sl=document.createElement("a")),sl.href=r,sl.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(nc==null&&(nc=window.matchMedia("(prefers-reduced-motion: reduce)")),nc.matches)},hasCanvasFingerprintNoise(){if(al!==void 0)return al;if(!sc())return al=!1,!1;const r=new OffscreenCanvas(85,1),e=r.getContext("2d",{willReadFrequently:!0});let i=0;for(let a=0;a<r.width;++a)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(a,0,1,1);const o=e.getImageData(0,0,r.width,r.height);i=0;for(let a=0;a<o.data.length;++a)if(a%4!=3&&i++!==o.data[a])return al=!0,!0;return al=!1,!1}};function zn(r,e){const i=r.indexOf("?");if(i<0)return`${r}?${new URLSearchParams(e).toString()}`;
6const o=new URLSearchParams(r.slice(i));for(const a in e)o.set(a,e[a]);return`${r.slice(0,i)}?${o.toString()}`}function Zn(r,e={persistentParams:[]}){const i=r.indexOf("?");if(i<0)return r;const o=new URLSearchParams,a=new URLSearchParams(r.slice(i));for(const u of e.persistentParams){const f=a.get(u);f&&o.set(u,f)}const h=o.toString();return`${r.slice(0,i)}${h.length>0?`?${h}`:""}`}const Ro="mapbox-tiles";let no=500,Do=50;const ll=["language","worldview","jobid"];let ho,cl;function Is(){try{return caches}catch{}}function na(){const r=Is();r&&ho==null&&(ho=r.open(Ro))}let Eh=1/0;const Ih={supported:!1,testSupport:function(r){!hl&&As&&(oa?Ed(r):fn=r)}};let fn,As,hl=!1,oa=!1;const Sd=typeof self<"u"?self:{};function Ed(r){const e=r.createTexture();r.bindTexture(r.TEXTURE_2D,e);try{if(r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,As),r.isContextLost())return;Ih.supported=!0}catch{}r.deleteTexture(e),hl=!0}Sd.document&&(As=Sd.document.createElement("img"),As.onload=function(){fn&&Ed(fn),fn=null,oa=!0},As.onerror=function(){hl=!0,fn=null},As.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const ul={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(ul);class Kt extends Error{constructor(e,i,o){i===401&&Qo(o)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=i,this.url=o}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const ac=bi()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,sa=function(r,e){if(!(/^file:/.test(i=r.url)||/^file:/.test(ac())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(o,a){const h=new AbortController,u=new Request(o.url,{method:o.method||"GET",body:o.body,credentials:o.credentials,headers:o.headers,referrer:ac(),referrerPolicy:o.referrerPolicy,signal:h.signal});let f=!1,_=!1;const g=(v=u.url).indexOf("sku=")>0&&Qo(v);var v;o.type==="json"&&u.headers.set("Accept","application/json");const b=(I,A,P)=>{if(_)return;if(I&&I.message!=="SecurityError"&&Ht(I.toString()),A&&P)return w(A);const R=Date.now();fetch(u).then(O=>{if(O.ok){const j=g?O.clone():null;return w(O,j,R)}return a(new Kt(O.statusText,O.status,o.url))}).catch(O=>{O.name!=="AbortError"&&a(new Error(`${O.message} ${o.url}`))})},w=(I,A,P)=>{(o.type==="arrayBuffer"?I.arrayBuffer():o.type==="json"?I.json():I.text()).then(R=>{_||(A&&P&&function(O,j,V){if(na(),ho==null)return;const G=oi(j.headers.get("Cache-Control")||"");if(G["no-store"])return;const ne={status:j.status,statusText:j.statusText,headers:new Headers};j.headers.forEach((le,he)=>ne.headers.set(he,le)),G["max-age"]&&ne.headers.set("Expires",new Date(V+1e3*G["max-age"]).toUTCString());const ee=ne.headers.get("Expires");if(!ee||new Date(ee).getTime()-V<42e4)return;
6let ie=Zn(O.url,{persistentParams:ll});if(j.status===206){const le=O.headers.get("Range");if(!le)return;ne.status=200,ie=zn(ie,{range:le})}(function(le,he){if(cl===void 0)try{new Response(new ReadableStream),cl=!0}catch{cl=!1}cl?he(le.body):le.blob().then(he).catch(Ie=>Ht(Ie.message))})(j,le=>{const he=new Response((Ie=j.status)!==200&&Ie!==404&&[101,103,204,205,304].includes(Ie)?null:le,ne);var Ie;na(),ho!=null&&ho.then(pe=>pe.put(ie,he)).catch(pe=>Ht(pe.message))})}(u,A,P),f=!0,a(null,R,I.headers.get("Cache-Control"),I.headers.get("Expires")))}).catch(R=>{_||a(new Error(R.message))})};return g?function(I,A){if(na(),ho==null)return A(null);ho.then(P=>{let R=Zn(I.url,{persistentParams:ll});const O=I.headers.get("Range");O&&(R=zn(R,{range:O})),P.match(R).then(j=>{const V=function(G){if(!G)return!1;const ne=new Date(G.headers.get("Expires")||0),ee=oi(G.headers.get("Cache-Control")||"");return Number(ne)>Date.now()&&!ee["no-cache"]}(j);P.delete(R).catch(A),V&&P.put(R,j.clone()).catch(A),A(null,j,V)}).catch(A)}).catch(A)}(u,b):b(null,null),{cancel:()=>{_=!0,f||h.abort()}}}(r,e);if(bi(self)&&self.worker.actor)return self.worker.actor.send("getResource",r,e,void 0,!0)}var i;return function(o,a){const h=new XMLHttpRequest;h.open(o.method||"GET",o.url,!0),o.type==="arrayBuffer"&&(h.responseType="arraybuffer");for(const u in o.headers)h.setRequestHeader(u,o.headers[u]);return o.type==="json"&&(h.responseType="text",h.setRequestHeader("Accept","application/json")),h.withCredentials=o.credentials==="include",h.onerror=()=>{a(new Error(h.statusText))},h.onload=()=>{if((h.status>=200&&h.status<300||h.status===0)&&h.response!==null){let u=h.response;if(o.type==="json")try{u=JSON.parse(h.response)}catch(f){return a(f)}a(null,u,h.getResponseHeader("Cache-Control"),h.getResponseHeader("Expires"))}else a(new Kt(h.statusText,h.status,o.url))},h.send(o.body),{cancel:()=>h.abort()}}(r,e)},dl=function(r,e){return sa(xe(r,{type:"arrayBuffer"}),e)};function Mf(r){const e=document.createElement("a");return e.href=r,e.protocol===location.protocol&&e.host===location.host}const pl="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let Cs,es;Cs=[],es=0;const fl=function(r,e){if(Ih.supported&&(r.headers||(r.headers={}),r.headers.accept="image/webp,*/*"),es>=Br.MAX_PARALLEL_IMAGE_REQUESTS){const h={requestParameters:r,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return Cs.push(h),h}es++;let i=!1;const o=()=>{if(!i)for(i=!0,es--;Cs.length&&es<Br.MAX_PARALLEL_IMAGE_REQUESTS;){const h=Cs.shift(),{requestParameters:u,callback:f,cancelled:_}=h;_||(h.cancel=fl(u,f).cancel)}},a=dl(r,(h,u,f,_)=>{o(),h?e(h):u&&(self.createImageBitmap?function(g,v){const b=new Blob([new Uint8Array(g)],{type:"image/png"});createImageBitmap(b).then(w=>{v(null,w)}).catch(w=>{v(new Error(`Could not load image because of ${w.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(u,(g,v)=>e(g,v,f,_)):function(g,v){const b=new Image;b.onload=()=>{v(null,b),URL.revokeObjectURL(b.src),b.onload=null,requestAnimationFrame(()=>{b.src=pl})},b.onerror=()=>v(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 w=new Blob([new Uint8Array(g)],{type:"image/png"});b.src=g.byteLength?URL.createObjectURL(w):pl}(u,(g,v)=>e(g,v,f,_)))});return{cancel:()=>{a.cancel(),o()}}};var Id,lc,Ad,aa={exports:{}},Ms={exports:{}},Cd={exports:{}},ml=function(){if(Ad)return aa.exports;Ad=1;var r=(Id||(Id=1,Ms.exports=function(i,o){var a,h,u,f,_,g,v,b;for(h=i.length-(a=3&i.length),u=o,_=3432918353,g=461845907,b=0;b<h;)v=255&i.charCodeAt(b)|(255&i.charCodeAt(++b))<<8|(255&i.charCodeAt(++b))<<16|(255&i.charCodeAt(++b))<<24,++b,u=27492+(65535&(f=5*(65535&(u=(u^=v=(65535&(v=(v=(65535&v)*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*g+(((v>>>16)*g&65535)<<16)&4294967295)<<13|u>>>19))+((5*(u>>>16)&65535)<<16)&4294967295))+((58964+(f>>>16)&65535)<<16);switch(v=0,a){case 3:v^=(255&i.charCodeAt(b+2))<<16;
6case 2:v^=(255&i.charCodeAt(b+1))<<8;case 1:u^=v=(65535&(v=(v=(65535&(v^=255&i.charCodeAt(b)))*_+(((v>>>16)*_&65535)<<16)&4294967295)<<15|v>>>17))*g+(((v>>>16)*g&65535)<<16)&4294967295}return u^=i.length,u=2246822507*(65535&(u^=u>>>16))+((2246822507*(u>>>16)&65535)<<16)&4294967295,u=3266489909*(65535&(u^=u>>>13))+((3266489909*(u>>>16)&65535)<<16)&4294967295,(u^=u>>>16)>>>0}),Ms.exports),e=(lc||(lc=1,Cd.exports=function(i,o){for(var a,h=i.length,u=o^h,f=0;h>=4;)a=1540483477*(65535&(a=255&i.charCodeAt(f)|(255&i.charCodeAt(++f))<<8|(255&i.charCodeAt(++f))<<16|(255&i.charCodeAt(++f))<<24))+((1540483477*(a>>>16)&65535)<<16),u=1540483477*(65535&u)+((1540483477*(u>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),h-=4,++f;switch(h){case 3:u^=(255&i.charCodeAt(f+2))<<16;case 2:u^=(255&i.charCodeAt(f+1))<<8;case 1:u=1540483477*(65535&(u^=255&i.charCodeAt(f)))+((1540483477*(u>>>16)&65535)<<16)}return u=1540483477*(65535&(u^=u>>>13))+((1540483477*(u>>>16)&65535)<<16),(u^=u>>>15)>>>0}),Cd.exports);return aa.exports=r,aa.exports.murmur3=r,aa.exports.murmur2=e,aa.exports}(),la=il(ml);class Lo{constructor(e,...i){xe(this,i[0]||{}),this.type=e}}class Rn extends Lo{constructor(e,i={}){super("error",xe({error:e},i))}}function Ah(r,e,i){i[r]&&i[r].indexOf(e)!==-1||(i[r]=i[r]||[],i[r].push(e))}function Ch(r,e,i){if(i&&i[r]){const o=i[r].indexOf(e);o!==-1&&i[r].splice(o,1)}}class Ps{on(e,i){return this._listeners=this._listeners||{},Ah(e,i,this._listeners),this}off(e,i){return Ch(e,i,this._listeners),Ch(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Ah(e,i,this._oneTimeListeners),this):new Promise(o=>{this.once(e,o)})}fire(e,i){const o=typeof e=="string"?new Lo(e,i):e,a=o.type;if(this.listens(a)){o.target=this;const h=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const _ of h)_.call(this,o);const u=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const _ of u)Ch(a,_,this._oneTimeListeners),_.call(this,o);const f=this._eventedParent;f&&(xe(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),f.fire(o))}else o instanceof Rn&&console.error(o.error);return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,i){return this._eventedParent=e,this._eventedParentData=i,this}}class bn{constructor(e){typeof e=="string"?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new bn(e)}static toString(e){return e.iconsetId?`${e.name}�${e.iconsetId}`:e.name}static parse(e){const[i,o]=e.split("�");return new bn({name:i,iconsetId:o})}static isEqual(e,i){return e.name===i.name&&e.iconsetId===i.iconsetId}toString(){return bn.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var Mh,cc={},Ph=function(){if(Mh)return cc;Mh=1;var r={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]};
6function e(h){return(h=Math.round(h))<0?0:h>255?255:h}function i(h){return e(h[h.length-1]==="%"?parseFloat(h)/100*255:parseInt(h))}function o(h){return(u=h[h.length-1]==="%"?parseFloat(h)/100:parseFloat(h))<0?0:u>1?1:u;var u}function a(h,u,f){return f<0?f+=1:f>1&&(f-=1),6*f<1?h+(u-h)*f*6:2*f<1?u:3*f<2?h+(u-h)*(2/3-f)*6:h}try{cc.parseCSSColor=function(h){var u,f=h.replace(/ /g,"").toLowerCase();if(f in r)return r[f].slice();if(f[0]==="#")return f.length===4?(u=parseInt(f.substr(1),16))>=0&&u<=4095?[(3840&u)>>4|(3840&u)>>8,240&u|(240&u)>>4,15&u|(15&u)<<4,1]:null:f.length===7&&(u=parseInt(f.substr(1),16))>=0&&u<=16777215?[(16711680&u)>>16,(65280&u)>>8,255&u,1]:null;var _=f.indexOf("("),g=f.indexOf(")");if(_!==-1&&g+1===f.length){var v=f.substr(0,_),b=f.substr(_+1,g-(_+1)).split(","),w=1;switch(v){case"rgba":if(b.length!==4)return null;w=o(b.pop());case"rgb":return b.length!==3?null:[i(b[0]),i(b[1]),i(b[2]),w];case"hsla":if(b.length!==4)return null;w=o(b.pop());case"hsl":if(b.length!==3)return null;var I=(parseFloat(b[0])%360+360)%360/360,A=o(b[1]),P=o(b[2]),R=P<=.5?P*(A+1):P+A-P*A,O=2*P-R;return[e(255*a(O,R,I+1/3)),e(255*a(O,R,I)),e(255*a(O,R,I-1/3)),w];default:return null}}return null}}catch{}return cc}();class ui{constructor(e,i,o,a=1){this.r=e,this.g=i,this.b=o,this.a=a}static parse(e){if(!e)return;if(e instanceof ui)return e;if(typeof e!="string")return;const i=Ph.parseCSSColor(e);return i?new ui(i[0]/255,i[1]/255,i[2]/255,i[3]):void 0}toString(){const[e,i,o,a]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*i)},${Math.round(255*o)},${a})`}toNonPremultipliedRenderColor(e){const{r:i,g:o,b:a,a:h}=this;return new ca(e,i,o,a,h)}toPremultipliedRenderColor(e){const{r:i,g:o,b:a,a:h}=this;return new Md(e,i*h,o*h,a*h,h)}clone(){return new ui(this.r,this.g,this.b,this.a)}}class _l{constructor(e,i,o,a,h,u=!1){if(this.premultiplied=!1,this.premultiplied=u,e){const f=e.image.height,_=f*f;this.premultiplied?(i=h===0?0:i/h*(f-1),o=h===0?0:o/h*(f-1),a=h===0?0:a/h*(f-1)):(i*=f-1,o*=f-1,a*=f-1);const g=Math.floor(i),v=Math.floor(o),b=Math.floor(a),w=Math.ceil(i),I=Math.ceil(o),A=Math.ceil(a),P=i-g,R=o-v,O=a-b,j=e.image.data,V=4*(g+v*_+b*f),G=4*(g+v*_+A*f),ne=4*(g+I*_+b*f),ee=4*(g+I*_+A*f),ie=4*(w+v*_+b*f),le=4*(w+v*_+A*f),he=4*(w+I*_+b*f),Ie=4*(w+I*_+A*f);if(V<0||Ie>=j.length)throw new Error("out of range");this.r=mt(mt(mt(j[V],j[G],O),mt(j[ne],j[ee],O),R),mt(mt(j[ie],j[le],O),mt(j[he],j[Ie],O),R),P)/255*(this.premultiplied?h:1),this.g=mt(mt(mt(j[V+1],j[G+1],O),mt(j[ne+1],j[ee+1],O),R),mt(mt(j[ie+1],j[le+1],O),mt(j[he+1],j[Ie+1],O),R),P)/255*(this.premultiplied?h:1),this.b=mt(mt(mt(j[V+2],j[G+2],O),mt(j[ne+2],j[ee+2],O),R),mt(mt(j[ie+2],j[le+2],O),mt(j[he+2],j[Ie+2],O),R),P)/255*(this.premultiplied?h:1),this.a=h}else this.r=i,this.g=o,this.b=a,this.a=h}toArray(){const{r:e,g:i,b:o,a}=this;return[255*e,255*i,255*o,a]}toHslaArray(){let{r:e,g:i,b:o,a}=this;if(this.premultiplied){if(a===0)return[0,0,0,0];e/=a,i/=a,o/=a}const h=Math.min(Math.max(e,0),1),u=Math.min(Math.max(i,0),1),f=Math.min(Math.max(o,0),1),_=Math.min(h,u,f),g=Math.max(h,u,f),v=(_+g)/2;if(_===g)return[0,0,100*v,a];const b=g-_,w=v>.5?b/(2-g-_):b/(g+_);let I=0;return g===h?I=(u-f)/b+(u<f?6:0):g===u?I=(f-h)/b+2:g===f&&(I=(h-u)/b+4),I*=60,[Math.min(Math.max(I,0),360),Math.min(Math.max(100*w,0),100),Math.min(Math.max(100*v,0),100),a]}toArray01(){const{r:e,g:i,b:o,a}=this;return[e,i,o,a]}toArray01Scaled(e){const{r:i,g:o,b:a}=this;return[i*e,o*e,a*e]}toArray01Linear(){const{r:e,g:i,b:o,a}=this;return[Math.pow(e,2.2),Math.pow(i,2.2),Math.pow(o,2.2),a]}}class ca extends _l{constructor(e,i,o,a,h){super(e,i,o,a,h,!1)}}class Md extends _l{constructor(e,i,o,a,h){super(e,i,o,a,h,!0)}}function mt(r,e,i){return r*(1-i)+e*i}function Pd(r,e,i){return r.map((o,a)=>mt(o,e[a],i))}ui.black=new ui(0,0,0,1),ui.white=new ui(1,1,1,1),ui.transparent=new ui(0,0,0,0),ui.red=new ui(1,0,0,1),ui.blue=new ui(0,0,1,1);var gl=Object.freeze({__proto__:null,array:Pd,color:function(r,e,i){return new ui(mt(r.r,e.r,i),mt(r.g,e.g,i),mt(r.b,e.b,i),mt(r.a,e.a,i))},number:mt});function zs(r,...e){for(const i of e)for(const o in i)r[o]=i[o];return r}
vendor: 10,732 bytes, line 6
6class Dn extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class zh{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[o,a]of i)this.bindings[o]=a}concat(e){return new zh(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const ha={kind:"null"},dt={kind:"number"},ci={kind:"string"},hi={kind:"boolean"},wn={kind:"color"},Fo={kind:"object"},di={kind:"value"},hc={kind:"collator"},yl={kind:"formatted"},xl={kind:"resolvedImage"};function Yr(r,e){return{kind:"array",itemType:r,N:e}}function wr(r){if(r.kind==="array"){const e=wr(r.itemType);return typeof r.N=="number"?`array<${e}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${e}>`}return r.kind}const Pf=[ha,dt,ci,hi,wn,yl,Fo,Yr(di),xl];function ua(r,e){if(e.kind==="error")return null;if(r.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!ua(r.itemType,e.itemType))&&(typeof r.N!="number"||r.N===e.N))return null}else{if(r.kind===e.kind)return null;if(r.kind==="value"){for(const i of Pf)if(!ua(i,e))return null}}return`Expected ${wr(r)} but found ${wr(e)} instead.`}function ts(r,e){return e.some(i=>i.kind===r.kind)}function vl(r,e){return e.some(i=>i==="null"?r===null:i==="array"?Array.isArray(r):i==="object"?r&&!Array.isArray(r)&&typeof r=="object":i===typeof r)}function uc(r,e){return r.kind==="array"&&e.kind==="array"?r.N===e.N&&uc(r.itemType,e.itemType):r.kind===e.kind}class bl{constructor(e,i,o){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=o,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,i){return this.collator.compare(e,i)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class dc{constructor(e,i,o,a,h){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=o,this.fontStack=a,this.textColor=h}}class nn{constructor(e){this.sections=e}static fromString(e){return new nn([new dc(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof nn?e:nn.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const i of this.sections){if(i.image){const a=i.image.getPrimary().id.toString();e.push(["image",a]);continue}e.push(i.text);const o={};i.fontStack&&(o["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(o["font-scale"]=i.scale),i.textColor&&(o["text-color"]=["rgba"].concat(i.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(o)}return e}}class Oo{constructor(e,i={}){if(this.id=bn.from(e),this.options=Object.assign({},i),i.transform){const{a:o,b:a,c:h,d:u,e:f,f:_}=i.transform;this.options.transform=new DOMMatrix([o,a,h,u,f,_])}else this.options.transform=new DOMMatrix([1,0,0,1,0,0])}toString(){const{a:e,b:i,c:o,d:a,e:h,f:u}=this.options.transform;return JSON.stringify({name:this.id.name,iconsetId:this.id.iconsetId,params:this.options.params,transform:{a:e,b:i,c:o,d:a,e:h,f:u}})}static parse(e){let i,o,a,h;try{({name:i,iconsetId:o,params:a,transform:h}=JSON.parse(e)||{})}catch{return null}if(!i)return null;const{a:u,b:f,c:_,d:g,e:v,f:b}=h||{};return new Oo({name:i,iconsetId:o},{params:a,transform:new DOMMatrix([u,f,_,g,v,b])})}scaleSelf(e,i){return this.options.transform.scaleSelf(e,i),this}}class mn{constructor(e,i,o,a,h=!1){this.primaryId=bn.from(e),this.primaryOptions=i,o&&(this.secondaryId=bn.from(o)),this.secondaryOptions=a,this.available=h}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Oo(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Oo(this.secondaryId,this.secondaryOptions):null}static from(e){return typeof e=="string"?mn.build({name:e}):e}static build(e,i,o,a){return!e||typeof e=="object"&&!("name"in e)?null:new mn(e,o,i,a)}}function Rs(r,e,i,o){return typeof r=="number"&&r>=0&&r<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?o===void 0||typeof o=="number"&&o>=0&&o<=1?null:`Invalid rgba value [${[r,e,i,o].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof o=="number"?[r,e,i,o]:[r,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Rt(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof ui||r instanceof bl||r instanceof nn||r instanceof mn)return!0;if(Array.isArray(r)){for(const e of r)if(!Rt(e))return!1;return!0}if(typeof r=="object"){for(const e in r)if(!Rt(r[e]))return!1;return!0}return!1}function rt(r){if(r===null)return ha;if(typeof r=="string")return ci;if(typeof r=="boolean")return hi;if(typeof r=="number")return dt;if(r instanceof ui)return wn;if(r instanceof bl)return hc;if(r instanceof nn)return yl;if(r instanceof mn)return xl;if(Array.isArray(r)){const e=r.length;let i;for(const o of r){const a=rt(o);if(i){if(i===a)continue;i=di;break}i=a}return Yr(i||di,e)}return Fo}function Wn(r){const e=typeof r;return r===null?"":e==="string"||e==="number"||e==="boolean"?String(r):r instanceof nn||r instanceof mn||r instanceof ui?r.toString():JSON.stringify(r)}class vt{constructor(e,i){this.type=e,this.value=i}static parse(e,i){if(e.length!==2)return i.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!Rt(e[1]))return i.error("invalid value");const o=e[1];let a=rt(o);const h=i.expectedType;return a.kind!=="array"||a.N!==0||!h||h.kind!=="array"||typeof h.N=="number"&&h.N!==0||(a=h),new vt(a,o)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof ui?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof nn?this.value.serialize():this.value}}class xr{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const wl={string:ci,number:dt,boolean:hi,object:Fo};class _t{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");let o,a=1;const h=e[0];if(h==="array"){let f,_;if(e.length>2){const g=e[1];if(typeof g!="string"||!(g in wl)||g==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);f=wl[g],a++}else f=di;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return i.error('The length argument to "array" must be a positive integer literal',2);_=e[2],a++}o=Yr(f,_)}else o=wl[h];const u=[];for(;a<e.length;a++){const f=i.parse(e[a],a,di);if(!f)return null;u.push(f)}return new _t(o,u)}evaluate(e){for(let i=0;i<this.args.length;i++){const o=this.args[i].evaluate(e);if(!ua(this.type,rt(o)))return o;if(i===this.args.length-1)throw new xr(`The expression ${JSON.stringify(this.args[i].serialize())} evaluated to ${wr(rt(o))} but was expected to be of type ${wr(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,i=[e.kind];if(e.kind==="array"){const o=e.itemType;if(o.kind==="string"||o.kind==="number"||o.kind==="boolean"){i.push(o.kind);const a=e.N;(typeof a=="number"||this.args.length>1)&&i.push(a)}}return i.concat(this.args.map(o=>o.serialize()))}}class da{constructor(e){this.type=yl,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const o=e[1];if(!Array.isArray(o)&&typeof o=="object")return i.error("First argument must be an image or text section.");const a=[];let h=!1;for(let u=1;u<=e.length-1;++u){const f=e[u];if(h&&typeof f=="object"&&!Array.isArray(f)){h=!1;let _=null;if(f["font-scale"]&&(_=i.parseObjectValue(f["font-scale"],u,"font-scale",dt),!_))return null;let g=null;if(f["text-font"]&&(g=i.parseObjectValue(f["text-font"],u,"text-font",Yr(ci)),!g))return null;let v=null;if(f["text-color"]&&(v=i.parseObjectValue(f["text-color"],u,"text-color",wn),!v))return null;const b=a[a.length-1];b.scale=_,b.font=g,b.textColor=v}else{const _=i.parse(e[u],u,di);if(!_)return null;const g=_.type.kind;if(g!=="string"&&g!=="value"&&g!=="null"&&g!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");h=!0,a.push({content:_,scale:null,font:null,textColor:null})}}return new da(a)}evaluate(e){return new nn(this.sections.map(i=>{const o=i.content.evaluate(e);return uc(rt(o),xl)?new dc("",o,null,null,null):new dc(Wn(o),null,i.scale?i.scale.evaluate(e):null,i.font?i.font.evaluate(e).join(","):null,i.textColor?i.textColor.evaluate(e):null)}))}eachChild(e){for(const i of this.sections)e(i.content),i.scale&&e(i.scale),i.font&&e(i.font),i.textColor&&e(i.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const i of this.sections){e.push(i.content.serialize());const o={};i.scale&&(o["font-scale"]=i.scale.serialize()),i.font&&(o["text-font"]=i.font.serialize()),i.textColor&&(o["text-color"]=i.textColor.serialize()),e.push(o)}return e}}class pa{constructor(e,i,o,a){this._imageWarnHistory={},this.type=xl,this.namePrimary=e,this.nameSecondary=i,o&&(this.paramsPrimary=o.params,this.iconsetIdPrimary=o.iconset?o.iconset.id:void 0),a&&(this.paramsSecondary=a.params,this.iconsetIdSecondary=a.iconset?a.iconset.id:void 0)}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");let o=1;const a=[];function h(){if(o<e.length){const f=i.parse(e[o],o++,ci);return f?(a.push({image:f,options:{}}),!0):(i.error(a.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function u(){if(o<e.length){const _=e[o];if((f=_)===null||typeof f!="object"||Array.isArray(f))return!0;const g=_.params,v=_.iconset,b=i.concat(o);if(!g&&!v)return o++,!0;if(g){if(typeof g!="object"||g.constructor!==Object)return b.error('Image options "params" should be an object'),!1;const w={},I=b.concat(void 0,"params");for(const A in g){if(!A)return I.error("Image parameter name should be non-empty"),!1;const P=I.concat(void 0,A).parse(g[A],void 0,wn,void 0,{typeAnnotation:"coerce"});if(!P)return!1;w[A]=P}a[a.length-1].options.params=w}if(v){if(typeof v!="object"||v.constructor!==Object)return b.error('Image options "iconset" should be an object'),!1;if(!v.id)return b.error('Image options "iconset" should have an "i
6d" property'),!1;a[a.length-1].options.iconset=v}return o++,!0}var f;return!0}for(let f=0;f<2;f++)if(!h()||!u())return;return new pa(a[0].image,a[1]?a[1].image:void 0,a[0].options,a[1]?a[1].options:void 0)}evaluateParams(e,i){const o={};if(i){for(const a in i)if(i[a])try{o[a]=i[a].evaluate(e)}catch{continue}if(Object.keys(o).length!==0)return{params:o}}}evaluate(e){const i={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},o=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,a=mn.build(i,o,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(a&&e.availableImages){const h=a.getPrimary().id;if(a.available=e.availableImages.some(u=>bn.isEqual(u,h)),a.available){const u=a.getSecondary()?a.getSecondary().id:null;u&&(a.available=e.availableImages.some(f=>bn.isEqual(f,u)))}}return a}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const i in this.paramsPrimary)this.paramsPrimary[i]&&e(this.paramsPrimary[i]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const i in this.paramsSecondary)this.paramsSecondary[i]&&e(this.paramsSecondary[i])}outputDefined(){return!1}serializeOptions(e,i){const o={};if(i&&(o.iconset={id:i}),e){o.params={};for(const a in e)e[a]&&(o.params[a]=e[a].serialize())}return Object.keys(o).length>0?o:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const i=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);i&&e.push(i)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const i=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);i&&e.push(i)}return e}}function is(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}const zd={"to-boolean":hi,"to-color":wn,"to-number":dt,"to-string":ci};class Xn{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const o=e[0],a=[];let h=ha;if(o==="to-array"){if(!Array.isArray(e[1]))return null;const u=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);h=Yr(i.expectedType.itemType,u)}else{if(!(u>0&&Rt(e[1][0])))return null;h=Yr(rt(e[1][0]),u)}for(let f=0;f<u;f++){const _=e[1][f];let g;if(is(_)==="array")g=i.parse(_,void 0,h.itemType);else{const v=is(_);if(v!==h.itemType.kind)return i.error(`Expected ${h.itemType.kind} but found ${v}.`);g=i.registry.literal.parse(["literal",_===void 0?null:_],i)}if(!g)return null;a.push(g)}}else{if((o==="to-boolean"||o==="to-string")&&e.length!==2)return i.error("Expected one argument.");h=zd[o];for(let u=1;u<e.length;u++){const f=i.parse(e[u],u,di);if(!f)return null;a.push(f)}}return new Xn(h,a)}evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,o;for(const a of this.args){if(i=a.evaluate(e),o=null,i instanceof ui)return i;if(typeof i=="string"){const h=e.parseColor(i);if(h)return h}else if(Array.isArray(i)&&(o=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Rs(i[0],i[1],i[2],i[3]),!o))return new ui(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new xr(o||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const o of this.args){if(i=o.evaluate(e),i===null)return 0;const a=Number(i);if(!isNaN(a))return a}throw new xr(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?nn.fromString(Wn(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?mn.build(Wn(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):Wn(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}
vendor: 5,443 bytes, line 6
6serialize(){if(this.type.kind==="formatted")return new da([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new pa(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const on=["Unknown","Point","LineString","Polygon"];class Tl{constructor(e,i){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=i}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?on[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,i=this.featureDistanceData.scale,{x:o,y:a}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(o*i-e[0])+this.featureDistanceData.bearing[1]*(a*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=ui.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class Lr{constructor(e,i,o,a,h){this.name=e,this.type=i,this._evaluate=o,this.args=a,this._overloadIndex=h}evaluate(e){if(!this._evaluate){const i=Lr.definitions[this.name];this._evaluate=Array.isArray(i)?i[2]:i.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,i){const o=e[0],a=Lr.definitions[o];if(!a)return i.error(`Unknown expression "${o}". If you wanted a literal array, use ["literal", [...]].`,0);const h=Array.isArray(a)?a[0]:a.type,u=Array.isArray(a)?[[a[1],a[2]]]:a.overloads,f=[];let _=null,g=-1;for(const[v,b]of u){if(Array.isArray(v)&&v.length!==e.length-1)continue;f.push(v),g++,_=new Ec(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);const w=[];let I=!1;for(let A=1;A<e.length;A++){const P=e[A],R=Array.isArray(v)?v[A-1]:v.type,O=_.parse(P,1+w.length,R);if(!O){I=!0;break}w.push(O)}if(!I)if(Array.isArray(v)&&v.length!==w.length)_.error(`Expected ${v.length} arguments, but found ${w.length} instead.`);else{for(let A=0;A<w.length;A++){const P=Array.isArray(v)?v[A]:v.type,R=w[A];_.concat(A+1).checkSubtype(P,R.type)}if(_.errors.length===0)return new Lr(o,h,b,w,g)}}if(f.length===1)i.errors.push(..._.errors);else{const v=(f.length?f:u.map(([w])=>w)).map(Rh).join(" | "),b=[];for(let w=1;w<e.length;w++){const I=i.parse(e[w],1+b.length);if(!I)return null;b.push(wr(I.type))}i.error(`Expected arguments of type ${v}, but found (${b.join(", ")}) instead.`)}return null}static register(e,i){Lr.definitions=i;for(const o in i)e[o]=Lr}}function Rh(r){return Array.isArray(r)?`(${r.map(wr).join(", ")})`:`(${wr(r.type)}...)`}class uo{constructor(e,i,o){this.type=hc,this.locale=o,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const o=e[1];if(typeof o!="object"||Array.isArray(o))return i.error("Collator options argument must be an object.");const a=o["case-sensitive"]===void 0?i.parse(!1,1,hi):i.parseObjectValue(o["case-sensitive"],1,"case-sensitive",hi);if(!a)return null;const h=o["diacritic-sensitive"]===void 0?i.parse(!1,1,hi):i.parseObjectValue(o["diacritic-sensitive"],1,"diacritic-sensitive",hi);if(!h)return null;let u=null;return o.locale&&(u=i.parseObjectValue(o.locale,1,"locale",ci),!u)?null:new uo(a,h,u)}evaluate(e){return new bl(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function Kr(r,e,i=0,o=r.length-1,a=zf){for(;o>i;){if(o-i>600){const _=o-i+1,g=e-i+1,v=Math.log(_),b=.5*Math.exp(2*v/3),w=.5*Math.sqrt(v*b*(_-b)/_)*(g-_/2<0?-1:1);Kr(r,e,Math.max(i,Math.floor(e-g*b/_+w)),Math.min(o,Math.floor(e+(_-g)*b/_+w)),a)}const h=r[e];let u=i,f=o;for(Sl(r,i,e),a(r[o],h)>0&&Sl(r,i,o);u<f;){for(Sl(r,u,f),u++,f--;a(r[u],h)<0;)u++;for(;a(r[f],h)>0;)f--}a(r[i],h)===0?Sl(r,i,f):(f++,Sl(r,f,o)),f<=e&&(i=f+1),e<=f&&(o=f-1)}}function Sl(r,e,i){const o=r[e];r[e]=r[i],r[i]=o}function zf(r,e){return r<e?-1:r>e?1:0}function Rf(r){let e=0;for(let i,o,a=0,h=r.length,u=h-1;a<h;u=a++)i=r[a],o=r[u],e+=(o.x-i.x)*(i.y+o.y);return e}function rs(r,e){r[0]=Math.min(r[0],e[0]),r[1]=Math.min(r[1],e[1]),r[2]=Math.max(r[2],e[0]),r[3]=Math.max(r[3],e[1])}function fa(r,e){return!(r[0]<=e[0]||r[2]>=e[2]||r[1]<=e[1]||r[3]>=e[3])}function Ds(r,e,i){const o=r[0]-e[0],a=r[1]-e[1],h=r[0]-i[0],u=r[1]-i[1];return o*u-h*a==0&&o*h<=0&&a*u<=0}function ma(r,e,i=!1){let o=!1;for(let f=0,_=e.length;f<_;f++){const g=e[f];for(let v=0,b=g.length,w=b-1;v<b;w=v++){const I=g[w],A=g[v];if(Ds(r,I,A))return i;
6(h=I)[1]>(a=r)[1]!=(u=A)[1]>a[1]&&a[0]<(u[0]-h[0])*(a[1]-h[1])/(u[1]-h[1])+h[0]&&(o=!o)}}var a,h,u;return o}function Rd(r,e,i,o){const a=o[0]-i[0],h=o[1]-i[1],u=(r[0]-i[0])*h-a*(r[1]-i[1]),f=(e[0]-i[0])*h-a*(e[1]-i[1]);return u>0&&f<0||u<0&&f>0}function pc(r,e,i,o){return(a=[o[0]-i[0],o[1]-i[1]])[0]*(h=[e[0]-r[0],e[1]-r[1]])[1]-a[1]*h[0]!=0&&!(!Rd(r,e,i,o)||!Rd(i,o,r,e));var a,h}function Dh(r){const e=new Be(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),i=new Be(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const o of r[0])e.x>o.x&&(e.x=o.x),e.y>o.y&&(e.y=o.y),i.x<o.x&&(i.x=o.x),i.y<o.y&&(i.y=o.y);return{min:e,max:i}}const ns=8192;function Df(r,e){const i=(180+r[0])/360,o=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,a=Math.pow(2,e.z);return[Math.round(i*a*ns),Math.round(o*a*ns)]}function Dd(r,e){for(let i=0;i<e.length;i++)if(ma(r,e[i]))return!0;return!1}function Lf(r,e,i){for(const o of i)for(let a=0,h=o.length,u=h-1;a<h;u=a++)if(pc(r,e,o[u],o[a]))return!0;return!1}function Ld(r,e){for(let i=0;i<r.length;++i)if(!ma(r[i],e))return!1;for(let i=0;i<r.length-1;++i)if(Lf(r[i],r[i+1],e))return!1;return!0}function Fd(r,e){for(let i=0;i<e.length;i++)if(Ld(r,e[i]))return!0;return!1}function Lh(r,e,i){const o=[];for(let a=0;a<r.length;a++){const h=[];for(let u=0;u<r[a].length;u++){const f=Df(r[a][u],i);rs(e,f),h.push(f)}o.push(h)}return o}function os(r,e,i){const o=[];for(let a=0;a<r.length;a++){const h=Lh(r[a],e,i);o.push(h)}return o}function Od(r,e,i,o){if(r[0]<i[0]||r[0]>i[2]){const a=.5*o;let h=r[0]-i[0]>a?-o:i[0]-r[0]>a?o:0;h===0&&(h=r[0]-i[2]>a?-o:i[2]-r[0]>a?o:0),r[0]+=h}rs(e,r)}function kd(r,e,i,o){const a=Math.pow(2,o.z)*ns,h=[o.x*ns,o.y*ns],u=[];
6if(!r)return u;for(const f of r)for(const _ of f){const g=[_.x+h[0],_.y+h[1]];Od(g,e,i,a),u.push(g)}return u}function fc(r,e,i,o){const a=Math.pow(2,o.z)*ns,h=[o.x*ns,o.y*ns],u=[];if(!r)return u;for(const _ of r){const g=[];for(const v of _){const b=[v.x+h[0],v.y+h[1]];rs(e,b),g.push(b)}u.push(g)}if(e[2]-e[0]<=a/2){(f=e)[0]=f[1]=1/0,f[2]=f[3]=-1/0;for(const _ of u)for(const g of _)Od(g,e,i,a)}var f;return u}class ss{constructor(e,i){this.type=hi,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(Rt(e[1])){const o=e[1];if(o.type==="FeatureCollection")for(let a=0;a<o.features.length;++a){const h=o.features[a].geometry.type;if(h==="Polygon"||h==="MultiPolygon")return new ss(o,o.features[a].geometry)}else if(o.type==="Feature"){const a=o.geometry.type;if(a==="Polygon"||a==="MultiPolygon")return new ss(o,o.geometry)}else if(o.type==="Polygon"||o.type==="MultiPolygon")return new ss(o,o)}return i.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(e.geometry()!=null&&e.canonicalID()!=null){if(e.geometryType()==="Point")return function(i,o){const a=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(!u)return!1;if(o.type==="Polygon"){const f=Lh(o.coordinates,h,u),_=kd(i.geometry(),a,h,u);if(!fa(a,h))return!1;for(const g of _)if(!ma(g,f))return!1}if(o.type==="MultiPolygon"){const f=os(o.coordinates,h,u),_=kd(i.geometry(),a,h,u);if(!fa(a,h))return!1;for(const g of _)if(!Dd(g,f))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(i,o){const a=[1/0,1/0,-1/0,-1/0],h=[1/0,1/0,-1/0,-1/0],u=i.canonicalID();if(!u)return!1;if(o.type==="Polygon"){const f=Lh(o.coordinates,h,u),_=fc(i.geometry(),a,h,u);if(!fa(a,h))return!1;for(const g of _)if(!Ld(g,f))return!1}if(o.type==="MultiPolygon"){const f=os(o.coordinates,h,u),_=fc(i.geometry(),a,h,u);if(!fa(a,h))return!1;for(const g of _)if(!Fd(g,f))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const El={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},Yn=1/298.257223563,Fh=Yn*(2-Yn),_a=Math.PI/180;class ga{static fromTile(e,i,o){const a=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),h=Math.atan(.5*(Math.exp(a)-Math.exp(-a)))/_a;return new ga(h,o)}static get units(){return El}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!El[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(El).join(", ")}`);const o=6378.137*_a*(i?El[i]:1),a=Math.cos(e*_a),h=1/(1-Fh*(1-a*a)),u=Math.sqrt(h);this.kx=o*u*a,this.ky=o*u*h*(1-Fh)}distance(e,i){const o=Ln(e[0]-i[0])*this.kx,a=(e[1]-i[1])*this.ky;return Math.sqrt(o*o+a*a)}bearing(e,i){const o=Ln(i[0]-e[0])*this.kx;return Math.atan2(o,(i[1]-e[1])*this.ky)/_a}destination(e,i,o){const a=o*_a;return this.offset(e,Math.sin(a)*i,Math.cos(a)*i)}offset(e,i,o){return[e[0]+i/this.kx,e[1]+o/this.ky]}lineDistance(e){let i=0;for(let o=0;o<e.length-1;o++)i+=this.distance(e[o],e[o+1]);return i}area(e){let i=0;for(let o=0;o<e.length;o++){const a=e[o];for(let h=0,u=a.length,f=u-1;h<u;f=h++)i+=Ln(a[h][0]-a[f][0])*(a[h][1]+a[f][1])*(o?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let o=0;if(i<=0)return e[0];for(let a=0;a<e.length-1;a++){const h=e[a],u=e[a+1],f=this.distance(h,u);if(o+=f,o>i)return mc(h,u,(i-(o-f))/f)}return e[e.length-1]}pointToSegmentDistance(e,i,o){let[a,h]=i,u=Ln(o[0]-a)*this.kx,f=(o[1]-h)*this.ky;if(u!==0||f!==0){const _=(Ln(e[0]-a)*this.kx*u+(e[1]-h)*this.ky*f)/(u*u+f*f);_>1?(a=o[0],h=o[1]):_>0&&(a+=u/this.kx*_,h+=f/this.ky*_)}return u=Ln(e[0]-a)*this.kx,f=(e[1]-h)*this.ky,Math.sqrt(u*u+f*f)}pointOnLine(e,i){let o=1/0,a=e[0][0],h=e[0][1],u=0,f=0;for(let _=0;_<e.length-1;_++){let g=e[_][0],v=e[_][1],b=Ln(e[_+1][0]-g)*this.kx,w=(e[_+1][1]-v)*this.ky,I=0;b===0&&w===0||(I=(Ln(i[0]-g)*this.kx*b+(i[1]-v)*this.ky*w)/(b*b+w*w),I>1?(g=e[_+1][0],v=e[_+1][1]):I>0&&(g+=b/this.kx*I,v+=w/this.ky*I)),b=Ln(i[0]-g)*this.kx,w=(i[1]-v)*this.ky;const A=b*b+w*w;A<o&&(o=A,a=g,h=v,u=_,f=I)}return{point:[a,h],index:u,t:Math.max(0,Math.min(1,f))}}lineSlice(e,i,o){let a=this.pointOnLine(o,e),h=this.pointOnLine(o,i);if(a.index>h.index||a.index===h.index&&a.t>h.t){const g=a;a=h,h=g}const u=[a.point],f=a.index+1,_=h.index;!Oh(o[f],u[0])&&f<=_&&u.push(o[f]);for(let g=f+1;g<=_;g++)u.push(o[g]);return Oh(o[_],h.point)||u.push(h.point),u}lineSliceAlong(e,i,o){let a=0;const h=[];for(let u=0;u<o.length-1;u++){const f=o[u],_=o[u+1],g=this.distance(f,_);if(a+=g,a>e&&h.length===0&&h.push(mc(f,_,(e-(a-g))/g)),a>=i)return h.push(mc(f,_,(i-(a-g))/g)),h;a>e&&h.push(_)}return h}bufferPoint(e,i){const o=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-o,e[0]+a,e[1]+o]}bufferBBox(e,i){const o=i/this.ky,a=i/this.kx;return[e[0]-a,e[1]-o,e[2]+a,e[3]+o]}insideBBox(e,i){return Ln(e[0]-i[0])>=0&&Ln(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function Oh(r,e){return r[0]===e[0]&&r[1]===e[1]}function mc(r,e,i){const o=Ln(e[0]-r[0]);return[r[0]+o*i,r[1]+(e[1]-r[1])*i]}function Ln(r){for(;r<-180;)r+=360;for(;r>180;)r-=360;return r}class _c{constructor(e=[],i=(o,a)=>o<a?-1:o>a?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let o=(this.length>>1)-1;o>=0;o--)this._down(o)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(this.length===0)return;const e=this.data[0],i=this.data.pop();return--this.length>0&&(this.data[0]=i,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:i,compare:o}=this,a=i[e];for(;e>0;){const h=e-1>>1,u=i[h];if(o(a,u)>=0)break;i[e]=u,e=h}i[e]=a}_down(e){const{data:i,compare:o}=this,a=this.length>>1,h=i[e];for(;e<a;){let u=1+(e<<1);const f=u+1;if(f<this.length&&o(i[f],i[u])<0&&(u=f),o(i[u],h)>=0)break;i[e]=i[u],e=u}i[e]=h}}var Xe=8192;function kh(r,e){return e.dist-r.dist}const gc=100,yc=50;function Il(r){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==r.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==r[i])return!1;return!0}function Ls(r){return r[1]-r[0]+1}function Kn(r,e){const i=r[1]>=r[0]&&r[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function xc(r,e){if(r[0]>
vendor: 4,541 bytes, line 6
6r[1])return[null,null];const i=Ls(r);if(e){if(i===2)return[r,null];const o=Math.floor(i/2);return[[r[0],r[0]+o],[r[0]+o,r[1]]]}{if(i===1)return[r,null];const o=Math.floor(i/2)-1;return[[r[0],r[0]+o],[r[0]+o+1,r[1]]]}}function as(r,e){const i=[1/0,1/0,-1/0,-1/0];if(!Kn(e,r.length))return i;for(let o=e[0];o<=e[1];++o)rs(i,r[o]);return i}function Al(r){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<r.length;++i)for(let o=0;o<r[i].length;++o)rs(e,r[i][o]);return e}function oo(r,e,i){if(Il(r)||Il(e))return NaN;let o=0,a=0;return r[2]<e[0]&&(o=e[0]-r[2]),r[0]>e[2]&&(o=r[0]-e[2]),r[1]>e[3]&&(a=r[1]-e[3]),r[3]<e[1]&&(a=e[1]-r[3]),i.distance([0,0],[o,a])}function Zt(r){return 360*r-180}function Ff(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Bh(r,e){const i=Math.pow(2,e.z),o=(r.y/Xe+e.y)/i;return[Zt((r.x/Xe+e.x)/i),Ff(o)]}function Of(r,e){const i=[];for(let o=0;o<r.length;++o)i.push(Bh(r[o],e));return i}function Nh(r,e,i){const o=i.pointOnLine(e,r).point;return i.distance(r,o)}function Bd(r,e,i,o,a){const h=i.slice(o[0],o[1]+1);let u=1/0;for(let f=e[0];f<=e[1];++f)if((u=Math.min(u,Nh(r[f],h,a)))===0)return 0;return u}function ji(r,e,i,o,a){const h=Math.min(a.pointToSegmentDistance(r,i,o),a.pointToSegmentDistance(e,i,o)),u=Math.min(a.pointToSegmentDistance(i,r,e),a.pointToSegmentDistance(o,r,e));return Math.min(h,u)}function kf(r,e,i,o,a){if(!Kn(e,r.length)||!Kn(o,i.length))return NaN;let h=1/0;for(let u=e[0];u<e[1];++u)for(let f=o[0];f<o[1];++f){if(pc(r[u],r[u+1],i[f],i[f+1]))return 0;h=Math.min(h,ji(r[u],r[u+1],i[f],i[f+1],a))}return h}function Bf(r,e,i,o,a){if(!Kn(e,r.length)||!Kn(o,i.length))return NaN;let h=1/0;for(let u=e[0];u<=e[1];++u)for(let f=o[0];f<=o[1];++f)if((h=Math.min(h,a.distance(r[u],i[f])))===0)return h;return h}function Nf(r,e,i){if(ma(r,e,!0))return 0;let o=1/0;for(const a of e){const h=a.length;if(h<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(a[0]!==a[h-1]&&(o=Math.min(o,i.pointToSegmentDistance(r,a[h-1],a[0])))===0||(o=Math.min(o,Nh(r,a,i)))===0)return o}return o}function Vf(r,e,i,o){if(!Kn(e,r.length))return NaN;for(let h=e[0];h<=e[1];++h)if(ma(r[h],i,!0))return 0;let a=1/0;for(let h=e[0];h<e[1];++h)for(const u of i)for(let f=0,_=u.length,g=_-1;f<_;g=f++){if(pc(r[h],r[h+1],u[g],u[f]))return 0;a=Math.min(a,ji(r[h],r[h+1],u[g],u[f],o))}return a}function Nd(r,e){for(const i of r)for(let o=0;o<=i.length-1;++o)if(ma(i[o],e,!0))return!0;return!1}function jf(r,e,i,o=1/0){const a=Al(r),h=Al(e);if(o!==1/0&&oo(a,h,i)>=o)return o;if(fa(a,h)){if(Nd(r,e))return 0}else if(Nd(e,r))return 0;let u=o;for(const f of r)for(let _=0,g=f.length,v=g-1;_<g;v=_++)for(const b of e)for(let w=0,I=b.length,A=I-1;w<I;A=w++){if(pc(f[v],f[_],b[A],b[w]))return 0;u=Math.min(u,ji(f[v],f[_],b[A],b[w],i))}return u}function vc(r,e,i,o,a,h,u){if(h===null||u===null)return;const f=oo(as(o,h),as(a,u),i);f<e&&r.push({dist:f,range1:h,range2:u})}function Uf(r,e,i,o,a=1/0){let h=Math.min(o.distance(r[0],i[0][0]),a);if(h===0)return h;const u=new _c([{dist:0,range1:[0,r.length-1],range2:[0,0]}],kh),f=e?yc:gc,_=Al(i);for(;u.length;){const g=u.pop();if(g.dist>=h)continue;const v=g.range1;if(Ls(v)<=f){if(!Kn(v,r.length))return NaN;if(e){const b=Vf(r,v,i,o);if((h=Math.min(h,b))===0)return h}else for(let b=v[0];b<=v[1];++b){const w=Nf(r[b],i,o);if((h=Math.min(h,w))===0)return h}}else{const b=xc(v,e);if(b[0]!==null){const w=oo(as(r,b[0]),_,o);w<h&&u.push({dist:w,range1:b[0],range2:[0,0]})}if(b[1]!==null){const w=oo(as(r,b[1]),_,o);w<h&&u.push({dist:w,range1:b[1],range2:[0,0]})}}}return h}function Vd(r,e,i,o,a,h=1/0){let u=Math.min(h,a.distance(r[0],i[0]));if(u===0)return u;const f=new _c([{dist:0,range1:[0,r.length-1],range2:[0,i.length-1]}],kh),_=e?yc:gc,g=o?yc:gc;for(;f.length;){const v=f.pop();if(v.dist>=u)continue;const b=v.range1,w=v.range2;if(Ls(b)<=_&&Ls(w)<=g){if(!Kn(b,r.length)||!Kn(w,i.length))return NaN;if(e&&o?u=Math.min(u,kf(r,b,i,w,a)):e||o?e&&!o?u=Math.min(u,Bd(i,w,r,b,a)):!e&&o&&(u=Math.min(u,Bd(r,b,i,w,a))):u=Math.min(u,Bf(r,b,i,w,a)),u===0)return u}else{const I=xc(b,e),A=xc(w,o);vc(f,u,a,r,i,I[0],A[0]),vc(f,u,a,r,i,I[0],A[1]),vc(f,u,a,r,i,I[1],A[0]),vc(f,u,a,r,i,I[1],A[1])}}return u}function Vh(r,e,i,o,a=1/0){let h=a;const u=as(r,[0,r.length-1]);for(const f of i)if(!(h!==1/0&&oo(u,as(f,[0,f.length-1]),o)>=h)&&(h=Math.min(h,Vd(r,e,f,!0,o,h)),h===0))return h;return h}function bc(r,e,i,o,a=1/0){let h=a;const u=as(r,[0,r.length-1]);for(const f of i){if(h!==1/0&&oo(u,Al(f),o)>=h)continue;const _=Uf(r,e,f,o,h);if(isNaN(_))return _;
6if((h=Math.min(h,_))===0)return h}return h}function jh(r){return r==="Point"||r==="MultiPoint"||r==="LineString"||r==="MultiLineString"||r==="Polygon"||r==="MultiPolygon"}class Fs{constructor(e,i){this.type=dt,this.geojson=e,this.geometries=i}static parse(e,i){if(e.length!==2)return i.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(Rt(e[1])){const o=e[1];if(o.type==="FeatureCollection"){for(let a=0;a<o.features.length;++a)if(jh(o.features[a].geometry.type))return new Fs(o,o.features[a].geometry)}else if(o.type==="Feature"){if(jh(o.geometry.type))return new Fs(o,o.geometry)}else if(jh(o.type))return new Fs(o,o)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),o=e.canonicalID();if(i!=null&&o!=null){if(e.geometryType()==="Point")return function(a,h,u){const f=[];for(const g of a)for(const v of g)f.push(Bh(v,h));const _=new ga(f[0][1],"meters");return u.type==="Point"||u.type==="MultiPoint"||u.type==="LineString"?Vd(f,!1,u.type==="Point"?[u.coordinates]:u.coordinates,u.type==="LineString",_):u.type==="MultiLineString"?Vh(f,!1,u.coordinates,_):u.type==="Polygon"||u.type==="MultiPolygon"?bc(f,!1,u.type==="Polygon"?[u.coordinates]:u.coordinates,_):null}(i,o,this.geometries);if(e.geometryType()==="LineString")return function(a,h,u){const f=[];for(const g of a){const v=[];for(const b of g)v.push(Bh(b,h));f.push(v)}const _=new ga(f[0][0][1],"meters");if(u.type==="Point"||u.type==="MultiPoint"||u.type==="LineString")return Vh(u.type==="Point"?[u.coordinates]:u.coordinates,u.type==="LineString",f,_);if(u.type==="MultiLineString"){let g=1/0;for(let v=0;v<u.coordinates.length;v++){const b=Vh(u.coordinates[v],!0,f,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}if(u.type==="Polygon"||u.type==="MultiPolygon"){let g=1/0;for(let v=0;v<f.length;v++){const b=bc(f[v],!0,u.type==="Polygon"?[u.coordinates]:u.coordinates,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return null}(i,o,this.geometries);if(e.geometryType()==="Polygon")return function(a,h,u){const f=[];for(const g of function(v,b){const w=v.length;if(w<=1)return[v];const I=[];let A,P;for(let R=0;R<w;R++){const O=Rf(v[R]);O!==0&&(v[R].area=Math.abs(O),P===void 0&&(P=O<0),P===O<0?(A&&I.push(A),A=[v[R]]):A.push(v[R]))}return A&&I.push(A),I}(a)){const v=[];for(let b=0;b<g.length;++b)v.push(Of(g[b],h));f.push(v)}const _=new ga(f[0][0][0][1],"meters");if(u.type==="Point"||u.type==="MultiPoint"||u.type==="LineString")return bc(u.type==="Point"?[u.coordinates]:u.coordinates,u.type==="LineString",f,_);if(u.type==="MultiLineString"){let g=1/0;for(let v=0;v<u.coordinates.length;v++){const b=bc(u.coordinates[v],!0,f,_,g);if(isNaN(b))return b;if((g=Math.min(g,b))===0)return g}return g}return u.type==="Polygon"||u.type==="MultiPolygon"?function(g,v,b){let w=1/0;for(const I of g)for(const A of v){const P=jf(I,A,b,w);if(isNaN(P))return P;if((w=Math.min(w,P))===0)return w}return w}(u.type==="Polygon"?[u.coordinates]:u.coordinates,f,_):null}(i,o,this.geometries);console.warn("Distance Expression: currently only evaluates valid Point/LineString/Polygon geometries.")}else console.warn("Distance Expression: requirs valid feature and canonical information.");return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function ya(r){if(r instanceof Lr&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof ss||r instanceof Fs)return!1;if(r instanceof va)return r.featureConstant;let e=!0;return r.eachChild(i=>{e&&!ya(i)&&(e=!1)}),e}function wc(r){if(r instanceof Lr&&r.name==="feature-state")return!1;let e=!0;return r.eachChild(i=>{e&&!wc(i)&&(e=!1)}),e}function Tc(r){if(r instanceof va)return new Set([r.key]);let e=new Set;return r.eachChild(i=>{e=new Set([...e,...Tc(i)])}),e}function xa(r,e){if(r instanceof Lr&&e.indexOf(r.name)>=0)return!1;let i=!0;return r.eachChild(o=>{i&&!xa(o,e)&&(i=!1)}),i}
vendor: 9,620 bytes, line 6
6function jd(r,e,i){return[r,e,i].filter(Boolean).join("�")}function Uh(r,e){switch(r){case"string":return Wn(e);case"number":return+e;case"boolean":return!!e;case"color":return ui.parse(e);case"formatted":return nn.fromString(Wn(e));case"resolvedImage":return mn.build(Wn(e))}return e}function Ud(r,e,i,o){return o!==void 0&&(r=o*Math.round(r/o)),e!==void 0&&r<e&&(r=e),i!==void 0&&r>i&&(r=i),r}class va{constructor(e,i,o,a=!1){this.type=e,this.key=i,this.scope=o,this.featureConstant=a}static parse(e,i){let o=i.expectedType;if(o==null&&(o=di),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const a=i.parse(e[1],1);if(!(a instanceof vt))return i.error("Key name of 'config' expression must be a string literal.");let h,u=!0;const f=Wn(a.value);if(e.length>=3){const _=i.parse(e[2],2);if(!(_ instanceof vt))return i.error("Scope of 'config' expression must be a string literal.");h=Wn(_.value)}if(i.options){const _=jd(f,h,i._scope),g=i.options.get(_);g&&(u=ya(g.value||g.default))}return new va(o,f,h,u)}evaluate(e){const i=jd(this.key,this.scope,e.scope),o=e.getConfig(i);if(!o)return null;const{type:a,value:h,values:u,minValue:f,maxValue:_,stepValue:g}=o,v=o.default.evaluate(e);let b=v;if(h){const w=e.scope;e.scope=(w||"").split("�").slice(1).join("�"),b=h.evaluate(e),e.scope=w}return a&&(b=Uh(a,b)),b===void 0||f===void 0&&_===void 0&&g===void 0||(typeof b=="number"?b=Ud(b,f,_,g):Array.isArray(b)&&(b=b.map(w=>typeof w=="number"?Ud(w,f,_,g):w))),h!==void 0&&b!==void 0&&u&&!u.includes(b)&&(b=v,a&&(b=Uh(a,b))),(a&&a!==this.type||b!==void 0&&!uc(rt(b),this.type))&&(b=Uh(this.type.kind,b)),b}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class Sc{constructor(e,i){this.type=i.type,this.name=e,this.boundExpression=i}static parse(e,i){if(e.length!==2||typeof e[1]!="string")return i.error("'var' expression requires exactly one string literal argument.");const o=e[1];return i.scope.has(o)?new Sc(o,i.scope.get(o)):i.error(`Unknown variable "${o}". Make sure "${o}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Ec{constructor(e,i=[],o,a=new zh,h=[],u,f){this.registry=e,this.path=i,this.key=i.map(_=>typeof _=="string"?`['${_}']`:`[${_}]`).join(""),this.scope=a,this.errors=h,this.expectedType=o,this._scope=u,this.options=f}parse(e,i,o,a,h={}){return i||o?this.concat(i,null,o,a)._parse(e,h):this._parse(e,h)}parseObjectValue(e,i,o,a,h,u={}){return this.concat(i,o,a,h)._parse(e,u)}_parse(e,i){function o(a,h,u){return u==="assert"?new _t(h,[a]):u==="coerce"?new Xn(h,[a]):a}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const a=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(a){let h=a.parse(e,this);if(!h)return null;if(this.expectedType){const u=this.expectedType,f=h.type;if(u.kind!=="string"&&u.kind!=="number"&&u.kind!=="boolean"&&u.kind!=="object"&&u.kind!=="array"||f.kind!=="value")if(u.kind!=="color"&&u.kind!=="formatted"&&u.kind!=="resolvedImage"||f.kind!=="value"&&f.kind!=="string"){if(this.checkSubtype(u,f))return null}else h=o(h,u,i.typeAnnotation||"coerce");else h=o(h,u,i.typeAnnotation||"assert")}if(!(h instanceof vt)&&h.type.kind!=="resolvedImage"&&Gh(h)){const u=new Tl(this._scope,this.options);try{h=new vt(h.type,h.evaluate(u))}catch(f){return this.error(f.message),null}}return h}return Xn.parse(["to-array",e],this)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,i,o,a){let h=typeof e=="number"?this.path.concat(e):this.path;h=typeof i=="string"?h.concat(i):h;const u=a?this.scope.concat(a):this.scope;return new Ec(this.registry,h,o||null,u,this.errors,this._scope,this.options)}error(e,...i){const o=`${this.key}${i.map(a=>`[${a}]`).join("")}`;this.errors.push(new Dn(o,e))}checkSubtype(e,i){const o=ua(e,i);return o&&this.error(o),o}}function Gh(r){if(r instanceof Sc)return Gh(r.boundExpression);if(r instanceof Lr&&r.name==="error"||r instanceof uo||r instanceof ss||r instanceof Fs||r instanceof va)return!1;const e=r instanceof Xn||r instanceof _t;let i=!0;return r.eachChild(o=>{i=e?i&&Gh(o):i&&o instanceof vt}),!!i&&ya(r)&&xa(r,["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 Ic(r,e){const i=r.length-1;let o,a,h=0,u=i,f=0;for(;h<=u;)if(f=Math.floor((h+u)/2),o=r[f],a=r[f+1],o<=e){if(f===i||e<a)return f;h=f+1}else{if(!(o>e))throw new xr("Input is not a number.");u=f-1}return 0}class Cl{constructor(e,i,o){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[a,h]of o)this.labels.push(a),this.outputs.push(h)}static parse(e,i){if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return i.error("Expected an even number of arguments.");const o=i.parse(e[1],1,dt);if(!o)return null;const a=[];let h=null;i.expectedType&&i.expectedType.kind!=="value"&&(h=i.expectedType);for(let u=1;u<e.length;u+=2){const f=u===1?-1/0:e[u],_=e[u+1],g=u,v=u+1;if(typeof f!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',g);if(a.length&&a[a.length-1][0]>=f)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',g);const b=i.parse(_,v,h);if(!b)return null;h=h||b.type,a.push([f,b])}return new Cl(h,o,a)}evaluate(e){const i=this.labels,o=this.outputs;if(i.length===1)return o[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return o[0].evaluate(e);const h=i.length;return a>=i[h-1]?o[h-1].evaluate(e):o[Ic(i,a)].evaluate(e)}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let i=0;i<this.labels.length;i++)i>0&&e.push(this.labels[i]),e.push(this.outputs[i].serialize());return e}}const Gd=.95047,qd=1.08883,Hd=4/29,ba=6/29,$d=3*ba*ba,qh=ba*ba*ba,Gf=Math.PI/180,Zd=180/Math.PI;function Hh(r){return r>qh?Math.pow(r,1/3):r/$d+Hd}function $h(r){return r>ba?r*r*r:$d*(r-Hd)}function Zh(r){return 255*(r<=.0031308?12.92*r:1.055*Math.pow(r,1/2.4)-.055)}function Ac(r){return(r/=255)<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Wh(r){const e=Ac(r.r),i=Ac(r.g),o=Ac(r.b),a=Hh((.4124564*e+.3575761*i+.1804375*o)/Gd),h=Hh((.2126729*e+.7151522*i+.072175*o)/1);return{l:116*h-16,a:500*(a-h),b:200*(h-Hh((.0193339*e+.119192*i+.9503041*o)/qd)),alpha:r.a}}function Os(r){let e=(r.l+16)/116,i=isNaN(r.a)?e:e+r.a/500,o=isNaN(r.b)?e:e-r.b/200;return e=1*$h(e),i=Gd*$h(i),o=qd*$h(o),new ui(Zh(3.2404542*i-1.5371385*e-.4985314*o),Zh(-.969266*i+1.8760108*e+.041556*o),Zh(.0556434*i-.2040259*e+1.0572252*o),r.alpha)}function Wd(r,e,i){const o=e-r;return r+i*(o>180||o<-180?o-360*Math.round(o/360):o)}const wa={forward:Wh,reverse:Os,interpolate:function(r,e,i){return{l:mt(r.l,e.l,i),a:mt(r.a,e.a,i),b:mt(r.b,e.b,i),alpha:mt(r.alpha,e.alpha,i)}}},Ml={forward:function(r){const{l:e,a:i,b:o}=Wh(r),a=Math.atan2(o,i)*Zd;return{h:a<0?a+360:a,c:Math.sqrt(i*i+o*o),l:e,alpha:r.a}},reverse:function(r){const e=r.h*Gf,i=r.c;return Os({l:r.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:r.alpha})},interpolate:function(r,e,i){return{h:Wd(r.h,e.h,i),c:mt(r.c,e.c,i),l:mt(r.l,e.l,i),alpha:mt(r.alpha,e.alpha,i)}}};var Cc=Object.freeze({__proto__:null,hcl:Ml,lab:wa});class _n{constructor(e,i,o,a,h){this.type=e,this.operator=i,this.interpolation=o,this.input=a,this.labels=[],this.outputs=[];for(const[u,f]of h)this.labels.push(u),this.outputs.push(f)}static interpolationFactor(e,i,o,a){let h=0;if(e.name==="exponential")h=Xh(i,e.base,o,a);else if(e.name==="linear")h=Xh(i,1,o,a);else if(e.name==="cubic-bezier"){const u=e.controlPoints;h=new ra(u[0],u[1],u[2],u[3]).solve(Xh(i,1,o,a))}return h}static parse(e,i){let[o,a,h,...u]=e;if(!Array.isArray(a)||a.length===0)return i.error("Expected an interpolation type expression.",1);if(a[0]==="linear")a={name:"linear"};else if(a[0]==="exponential"){const g=a[1];if(typeof g!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);a={name:"exponential",base:g}}else{if(a[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(a[0])}`,1,0);{const g=a.slice(1);if(g.length!==4||g.some(v=>typeof v!="number"||v<0||v>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);a={name:"cubic-bezier",controlPoints:g}}}if(e.length-1<4)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return i.error("Expected an even number of arguments.");if(h=i.parse(h,2,dt),!h)return null;const f=[];let _=null;o==="interpolate-hcl"||o==="interpolate-lab"?_=wn:i.expectedType&&i.expectedType.kind!=="value"&&(_=i.expectedType);for(let g=0;g<u.length;g+=2){const v=u[g],b=u[g+1],w=g+3,I=g+4;if(typeof v!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not c
6omputed expressions) for the input values.',w);if(f.length&&f[f.length-1][0]>=v)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',w);const A=i.parse(b,I,_);if(!A)return null;_=_||A.type,f.push([v,A])}return _.kind==="number"||_.kind==="color"||_.kind==="array"&&_.itemType.kind==="number"&&typeof _.N=="number"?new _n(_,o,a,h,f):i.error(`Type ${wr(_)} is not interpolatable.`)}evaluate(e){const i=this.labels,o=this.outputs;if(i.length===1)return o[0].evaluate(e);const a=this.input.evaluate(e);if(a<=i[0])return o[0].evaluate(e);const h=i.length;if(a>=i[h-1])return o[h-1].evaluate(e);const u=Ic(i,a),f=_n.interpolationFactor(this.interpolation,a,i[u],i[u+1]),_=o[u].evaluate(e),g=o[u+1].evaluate(e);return this.operator==="interpolate"?gl[this.type.kind.toLowerCase()](_,g,f):this.operator==="interpolate-hcl"?Ml.reverse(Ml.interpolate(Ml.forward(_),Ml.forward(g),f)):wa.reverse(wa.interpolate(wa.forward(_),wa.forward(g),f))}eachChild(e){e(this.input);for(const i of this.outputs)e(i)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const i=[this.operator,e,this.input.serialize()];for(let o=0;o<this.labels.length;o++)i.push(this.labels[o],this.outputs[o].serialize());return i}}function Xh(r,e,i,o){const a=o-i,h=r-i;return a===0?0:e===1?h/a:(Math.pow(e,h)-1)/(Math.pow(e,a)-1)}class Mc{constructor(e,i){this.type=e,this.args=i}static parse(e,i){if(e.length<2)return i.error("Expectected at least one argument.");let o=null;const a=i.expectedType;a&&a.kind!=="value"&&(o=a);const h=[];for(const f of e.slice(1)){const _=i.parse(f,1+h.length,o,void 0,{typeAnnotation:"omit"});if(!_)return null;o=o||_.type,h.push(_)}const u=a&&h.some(f=>ua(a,f.type));return new Mc(u?di:o,h)}evaluate(e){let i,o=null,a=0;for(const h of this.args){if(a++,o=h.evaluate(e),o&&o instanceof mn&&!o.available&&(i||(i=o),o=null,a===this.args.length))return i;if(o!==null)break}return o}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class Pl{constructor(e,i){this.type=i.type,this.bindings=[].concat(e),this.result=i}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const i of this.bindings)e(i[1]);e(this.result)}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const o=[];for(let h=1;h<e.length-1;h+=2){const u=e[h];if(typeof u!="string")return i.error(`Expected string, but found ${typeof u} instead.`,h);if(/[^a-zA-Z0-9_]/.test(u))return i.error("Variable names must contain only alphanumeric characters or '_'.",h);const f=i.parse(e[h+1],h+1);if(!f)return null;o.push([u,f])}const a=i.parse(e[e.length-1],e.length-1,i.expectedType,o);return a?new Pl(o,a):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,o]of this.bindings)e.push(i,o.serialize());return e.push(this.result.serialize()),e}}class Pc{constructor(e,i,o){this.type=e,this.index=i,this.input=o}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,dt),a=i.parse(e[2],2,Yr(i.expectedType||di));return o&&a?new Pc(a.type.itemType,o,a):null}evaluate(e){const i=this.index.evaluate(e),o=this.input.evaluate(e);if(i<0)throw new xr(`Array index out of bounds: ${i} < 0.`);if(i>=o.length)throw new xr(`Array index out of bounds: ${i} > ${o.length-1}.`);if(i!==Math.floor(i))throw new xr(`Array index must be an integer, but found ${i} instead. Use at-interpolated to retrieve interpolated result with a fractional index.`);return o[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Yh{constructor(e,i,o){this.type=e,this.index=i,this.input=o}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,dt),a=i.parse(e[2],2,Yr(i.expectedType||di));return o&&a?new Yh(a.type.itemType,o,a):null}evaluate(e){const i=this.index.evaluate(e),o=this.input.evaluate(e);if(i<0)throw new xr(`Array index out of bounds: ${i} < 0.`);if(i>o.length-1)throw new xr(`Array index out of bounds: ${i} > ${o.length-1}.`);if(i===Math.floor(i))return o[i];const a=Math.floor(i),h=Math.ceil(i),u=o[a],f=o[h];if(typeof u!="number"||typeof f!="number")throw new xr(`Cannot interpolate between non-number values at index ${i}.`);const _=i-a;return u*(1-_)+f*_}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Kh{constructor(e,i){this.type=hi,this.needle=e,this.haystack=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,di),a=i.parse(e[2],2,di);return o&&a?ts(o.type,[hi,ci,dt,ha,di])?new Kh(o,a):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${wr(o.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(o==null)return!1;if(!vl(i,["boolean","string","number","null"]))throw new xr(`Expected first argument to be of type boolean, string, number or null, but found ${wr(rt(i))} instead.`);if(!vl(o,["string","array"]))throw new xr(`Expected second argument to be of type array or string, but found ${wr(rt(o))} instead.`);return o.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class zc{constructor(e,i,o){this.type=dt,this.needle=e,this.haystack=i,this.fromIndex=o}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,di),a=i.parse(e[2],2,di);if(!o||!a)return null;if(!ts(o.type,[hi,ci,dt,ha,di]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${wr(o.type)} instead`);if(e.length===4){const h=i.parse(e[3],3,dt);return h?new zc(o,a,h):null}return new zc(o,a)}evaluate(e){const i=this.needle.evaluate(e),o=this.haystack.evaluate(e);if(!vl(i,["boolean","string","number","null"]))throw new xr(`Expected first argument to be of type boolean, string, number or null, but found ${wr(rt(i))} instead.`);if(!vl(o,["string","array"]))throw new xr(`Expected second argument to be of type array or string, but found ${wr(rt(o))} instead.`);if(this.fromIndex){const a=this.fromIndex.evaluate(e);return o.indexOf(i,a)}return o.indexOf(i)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Rc{constructor(e,i,o,a,h,u){this.inputType=e,this.type=i,this.input=o,this.cases=a,this.outputs=h,this.otherwise=u}static parse(e,i){if(e.length<5)return i.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return i.error("Expected an even number of arguments.");let o,a;i.expectedType&&i.expectedType.kind!=="value"&&(a=i.expectedType);const h={},u=[];for(let g=2;g<e.length-1;g+=2){let v=e[g];const b=e[g+1];Array.isArray(v)||(v=[v]);const w=i.concat(g);if(v.length===0)return w.error("Expected at least one branch label.");for(const A of v){if(typeof A!="number"&&typeof A!="string")return w.error("Branch labels must be numbers or strings.");if(typeof A=="number"&&Math.abs(A)>Number.MAX_SAFE_INTEGER)return w.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof A=="number"&&Math.floor(A)!==A)return w.error("Numeric branch labels must be integer values.");if(o){if(w.checkSubtype(o,rt(A)))return null}else o=rt(A);if(h[String(A)]!==void 0)return w.error("Branch labels must be unique.");h[String(A)]=u.length}const I=i.parse(b,g,a);if(!I)return null;a=a||I.type,u.push(I)}const f=i.parse(e[1],1,di);if(!f)return null;const _=i.parse(e[e.length-1],e.length-1,a);return _?f.type.kind!=="value"&&i.concat(1).checkSubtype(o,f.type)?null:new Rc(o,a,f,h,u,_):null}evaluate(e){const i=this.input.evaluate(e);return(uc(rt(i),this.inputType)&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}
vendor: 18,534 bytes, line 6
6eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),o=[],a={};for(const u of i){const f=a[this.cases[u]];f===void 0?(a[this.cases[u]]=o.length,o.push([this.cases[u],[u]])):o[f][1].push(u)}const h=u=>this.inputType.kind==="number"?Number(u):u;for(const[u,f]of o)e.push(f.length===1?h(f[0]):f.map(h)),e.push(this.outputs[u].serialize());return e.push(this.otherwise.serialize()),e}}class Dc{constructor(e,i,o){this.type=e,this.branches=i,this.otherwise=o}static parse(e,i){if(e.length<4)return i.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return i.error("Expected an odd number of arguments.");let o;i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const a=[];for(let u=1;u<e.length-1;u+=2){const f=i.parse(e[u],u,hi);if(!f)return null;const _=i.parse(e[u+1],u+1,o);if(!_)return null;a.push([f,_]),o=o||_.type}const h=i.parse(e[e.length-1],e.length-1,o);return h?new Dc(o,a,h):null}evaluate(e){for(const[i,o]of this.branches)if(i.evaluate(e))return o.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,o]of this.branches)e(i),e(o);e(this.otherwise)}outputDefined(){return this.branches.every(([e,i])=>i.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(i=>{e.push(i.serialize())}),e}}class ks{constructor(e,i,o,a){this.type=e,this.input=i,this.beginIndex=o,this.endIndex=a}static parse(e,i){if(e.length<=2||e.length>=5)return i.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,di),a=i.parse(e[2],2,dt);if(!o||!a)return null;if(!ts(o.type,[Yr(di),ci,di]))return i.error(`Expected first argument to be of type array or string, but found ${wr(o.type)} instead`);if(e.length===4){const h=i.parse(e[3],3,dt);return h?new ks(o.type,o,a,h):null}return new ks(o.type,o,a)}evaluate(e){const i=this.input.evaluate(e),o=this.beginIndex.evaluate(e);if(!vl(i,["string","array"]))throw new xr(`Expected first argument to be of type array or string, but found ${wr(rt(i))} instead.`);if(this.endIndex){const a=this.endIndex.evaluate(e);return i.slice(o,a)}return i.slice(o)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class Jh{constructor(e,i){this.type=Yr(ci),this.str=e,this.delimiter=i}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const o=i.parse(e[1],1,ci),a=i.parse(e[2],2,ci);return o&&a?new Jh(o,a):void 0}evaluate(e){const i=this.str.evaluate(e),o=this.delimiter.evaluate(e);return i.split(o)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function Qh(r,e){return r==="=="||r==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function Xd(r,e,i,o){return o.compare(e,i)===0}function Ta(r,e,i){const o=r!=="=="&&r!=="!=";return class z0{constructor(h,u,f){this.type=hi,this.lhs=h,this.rhs=u,this.collator=f,this.hasUntypedArgument=h.type.kind==="value"||u.type.kind==="value"}static parse(h,u){if(h.length!==3&&h.length!==4)return u.error("Expected two or three arguments.");const f=h[0];let _=u.parse(h[1],1,di);if(!_)return null;if(!Qh(f,_.type))return u.concat(1).error(`"${f}" comparisons are not supported for type '${wr(_.type)}'.`);let g=u.parse(h[2],2,di);if(!g)return null;if(!Qh(f,g.type))return u.concat(2).error(`"${f}" comparisons are not supported for type '${wr(g.type)}'.`);if(_.type.kind!==g.type.kind&&_.type.kind!=="value"&&g.type.kind!=="value")return u.error(`Cannot compare types '${wr(_.type)}' and '${wr(g.type)}'.`);o&&(_.type.kind==="value"&&g.type.kind!=="value"?_=new _t(g.type,[_]):_.type.kind!=="value"&&g.type.kind==="value"&&(g=new _t(_.type,[g])));let v=null;if(h.length===4){if(_.type.kind!=="string"&&g.type.kind!=="string"&&_.type.kind!=="value"&&g.type.kind!=="value")return u.error("Cannot use collator to compare non-string types.");if(v=u.parse(h[3],3,hc),!v)return null}return new z0(_,g,v)}evaluate(h){const u=this.lhs.evaluate(h),f=this.rhs.evaluate(h);if(o&&this.hasUntypedArgument){const _=rt(u),g=rt(f);if(_.kind!==g.kind||_.kind!=="string"&&_.kind!=="number")throw new xr(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${_.kind}, ${g.kind}) instead.`)}if(this.collator&&!o&&this.hasUntypedArgument){const _=rt(u),g=rt(f);if(_.kind!=="string"||g.kind!=="string")return e(h,u,f)}return this.collator?i(h,u,f,this.collator.evaluate(h)):e(h,u,f)}eachChild(h){h(this.lhs),h(this.rhs),this.collator&&h(this.collator)}outputDefined(){return!0}serialize(){const h=[r];return this.eachChild(u=>{h.push(u.serialize())}),h}}}const Yd=Ta("==",function(r,e,i){return e===i},Xd),Kd=Ta("!=",function(r,e,i){return e!==i},function(r,e,i,o){return!Xd(0,e,i,o)}),qf=Ta("<",function(r,e,i){return e<i},function(r,e,i,o){return o.compare(e,i)<0}),Hf=Ta(">",function(r,e,i){return e>i},function(r,e,i,o){return o.compare(e,i)>0}),$f=Ta("<=",function(r,e,i){return e<=i},function(r,e,i,o){return o.compare(e,i)<=0}),Lc=Ta(">=",function(r,e,i){return e>=i},function(r,e,i,o){return o.compare(e,i)>=0});class eu{constructor(e,i,o,a,h,u){this.type=ci,this.number=e,this.locale=i,this.currency=o,this.unit=a,this.minFractionDigits=h,this.maxFractionDigits=u}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const o=i.parse(e[1],1,dt);if(!o)return null;const a=e[2];if(typeof a!="object"||Array.isArray(a))return i.error("NumberFormat options argument must be an object.");let h=null;if(a.locale&&(h=i.parseObjectValue(a.locale,2,"locale",ci),!h))return null;let u=null;if(a.currency&&(u=i.parseObjectValue(a.currency,2,"currency",ci),!u))return null;let f=null;if(a.unit&&(f=i.parseObjectValue(a.unit,2,"unit",ci),!f))return null;let _=null;if(a["min-fraction-digits"]&&(_=i.parseObjectValue(a["min-fraction-digits"],2,"min-fraction-digits",dt),!_))return null;let g=null;return a["max-fraction-digits"]&&(g=i.parseObjectValue(a["max-fraction-digits"],2,"max-fraction-digits",dt),!g)?null:new eu(o,h,u,f,_,g)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class tu{constructor(e){this.type=dt,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const o=i.parse(e[1],1);return o?o.type.kind!=="array"&&o.type.kind!=="string"&&o.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${wr(o.type)} instead.`):new tu(o):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new xr(`Expected value to be of type string or array, but found ${wr(rt(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function Jd(r){return function(){r=1831565813+(r|=0)|0;let e=Math.imul(r^r>>>15,1|r);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const Sa={"==":Yd,"!=":Kd,">":Hf,"<":qf,">=":Lc,"<=":$f,array:_t,at:Pc,"at-interpolated":Yh,boolean:_t,case:Dc,coalesce:Mc,collator:uo,format:da,image:pa,in:Kh,"index-of":zc,interpolate:_n,"interpolate-hcl":_n,"interpolate-lab":_n,length:tu,let:Pl,literal:vt,match:Rc,number:_t,"number-format":eu,object:_t,slice:ks,step:Cl,string:_t,"to-boolean":Xn,"to-color":Xn,"to-number":Xn,"to-string":Xn,var:Sc,within:ss,distance:Fs,config:va,split:Jh};function iu(r,[e,i,o,a]){e=e.evaluate(r),i=i.evaluate(r),o=o.evaluate(r);const h=a?a.evaluate(r):1,u=Rs(e,i,o,h);if(u)throw new xr(u);return new ui(e/255,i/255,o/255,h)}function Qd(r,[e,i,o,a]){e=e.evaluate(r),i=i.evaluate(r),o=o.evaluate(r);const h=a?a.evaluate(r):1,u=function(g,v,b,w){return typeof g=="number"&&g>=0&&g<=360?typeof v=="number"&&v>=0&&v<=100&&typeof b=="number"&&b>=0&&b<=100?w===void 0||typeof w=="number"&&w>=0&&w<=1?null:`Invalid hsla value [${[g,v,b,w].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof w=="number"?[g,v,b,w]:[g,v,b]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof w=="number"?[g,v,b,w]:[g,v,b]).join(", ")}]: 'h' must be between 0 and 360.`}(e,i,o,h);if(u)throw new xr(u);const f=`hsla(${e}, ${i}%, ${o}%, ${h})`,_=ui.parse(f);if(!_)throw new xr(`Failed to parse HSLA color: ${f}`);return _}function ep(r,e){return r in e}function Fc(r,e){const i=e[r];return i===void 0?null:i}function ls(r){return{type:r}}function ru(r){return{result:"success",value:r}}function cs(r){return{result:"error",value:r}}function hs(r,e){return!!r&&!!r.parameters&&r.parameters.indexOf(e)>-1}function Oc(r){return r["property-type"]==="data-driven"}function tp(r){return hs(r.expression,"measure-light")}function ip(r){return hs(r.expression,"zoom")}function kc(r){return!!r.expression&&r.expression.interpolated}function Bc(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function rp(r){return r}function nu(r,e){const i=e.type==="color",o=r.stops&&typeof r.stops[0][0]=="object",a=o||!(o||r.property!==void 0),h=r.type||(kc(e)?"exponential":"interval");if(i&&((r=zs({},r)).stops&&(r.stops=r.stops.map(g=>[g[0],ui.parse(g[1])])),r.default=ui.parse(r.default?r.default:e.default)),r.colorSpace&&r.colorSpace!=="rgb"&&!Cc[r.colorSpace])throw new Error(`Unknown color space: ${r.colorSpace}`);let u,f,_;if(h==="exponential")u=op;else if(h==="interval")u=np;else if(h==="categorical"){u=ou,f=Object.create(null);for(const g of r.stops)f[g[0]]=g[1];_=typeof r.stops[0][0]}else{if(h!=="identity")throw new Error(`Unknown function type "${h}"`);u=us}if(o){const g={},v=[];for(let I=0;I<r.stops.length;I++){const A=r.stops[I],P=A[0].zoom;g[P]===void 0&&(g[P]={zoom:P,type:r.type,property:r.property,default:r.default,stops:[]},v.push(P)),g[P].stops.push([A[0].value,A[1]])}const b=[];for(const I of v)b.push([g[I].zoom,nu(g[I],e)]);const w={name:"linear"};return{kind:"composite",interpolationType:w,interpolationFactor:_n.interpolationFactor.bind(void 0,w),zoomStops:b.map(I=>I[0]),evaluate:({zoom:I},A)=>op({stops:b,base:r.base},e,I).evaluate(I,A)}}if(a){const g=h==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:g,interpolationFactor:_n.interpolationFactor.bind(void 0,g),zoomStops:r.stops.map(v=>v[0]),evaluate:({zoom:v})=>u(r,e,v,f,_)}}return{kind:"source",evaluate(g,v){const b=v&&v.properties?v.properties[r.property]:void 0;return b===void 0?Bs(r.default,e.default):u(r,e,b,f,_)}}}function Bs(r,e,i){return r!==void 0?r:e!==void 0?e:i!==void 0?i:void 0}function ou(r,e,i,o,a){return Bs(typeof i===a?o[i]:void 0,r.default,e.default)}function np(r,e,i){if(is(i)!=="number")return Bs(r.default,e.default);const o=r.stops.length;if(o===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[o-1][0])return r.stops[o-1][1];const a=Ic(r.stops.map(h=>h[0]),i);return r.stops[a][1]}function op(r,e,i){const o=r.base!==void 0?r.base:1;if(is(i)!=="number")return Bs(r.default,e.default);const a=r.stops.length;if(a===1||i<=r.stops[0][0])return r.stops[0][1];if(i>=r.stops[a-1][0])return r.stops[a-1][1];const h=Ic(r.stops.map(v=>v[0]),i),u=function(v,b,w,I){const A=I-w,P=v-w;return A===0?0:b===1?P/A:(Math.pow(b,P)-1)/(Math.pow(b,A)-1)}(i,o,r.stops[h][0],r.stops[h+1][0]),f=r.stops[h][1],_=r.stops[h+1][1];let g=gl[e.type]||rp;if(r.colorSpace&&r.colorSpace!=="rgb"){const v=Cc[r.colorSpace];g=(b,w)=>v.reverse(v.interpolate(v.forward(b),v.forward(w),u))}return typeof f.evaluate=="function"?{evaluate(...v){const b=f.evaluate.apply(void 0,v),w=_.evaluate.apply(void 0,v);if(b!==void 0&&w!==void 0)return g(b,w,u)}}:g(f,_,u)}function us(r,e,i){return e.type==="color"?i=ui.parse(i):e.type==="formatted"?i=nn.fromString(i.toString()):e.type==="resolvedImage"?i=mn.build(i.toString()):is(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),Bs(i,r.default,e.default)}Lr.register(Sa,{error:[{kind:"error"},[ci],(r,[e])=>{throw new xr(e.evaluate(r))}],typeof:[ci,[di],(r,[e])=>wr(rt(e.evaluate(r)))],"to-rgba":[Yr(dt,4),[wn],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Yr(dt,4),[wn],(r,[e])=>e.evaluate(r).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[wn,[dt,dt,dt],iu],rgba:[wn,[dt,dt,dt,dt],iu],hsl:[wn,[dt,dt,dt],Qd],hsla:[wn,[dt,dt,dt,dt],Qd],has:{type:hi,overloads:[[[ci],(r,[e])=>ep(e.evaluate(r),r.properties())],[[ci,Fo],(r,[e,i])=>ep(e.evaluate(r),i.evaluate(r))]]},get:{type:di,overloads:[[[ci],(r,[e])=>Fc(e.evaluate(r),r.properties())],[[ci,Fo],(r,[e,i])=>Fc(e.evaluate(r),i.evaluate(r))]]},"feature-state":[di,[ci],(r,[e])=>Fc(e.evaluate(r),r.featureState||{})],properties:[Fo,[],r=>r.properties()],"geometry-type":[ci,[],r=>r.geometryType()],worldview:[ci,[],r=>r.globals.worldview||""],id:[di,[],r=>r.id()],zoom:[dt,[],r=>r.globals.zoom],pitch:[dt,[],r=>r.globals.pitch||0],"distance-from-center":[dt,[],r=>r.distanceFromCenter()],"measure-light":[dt,[ci],(r,[e])=>r.measureLight(e.evaluate(r))],"heatmap-density":[dt,[],r=>r.globals.heatmapDensity||0],"line-progress":[dt,[],r=>r.globals.lineProgress||0],"raster-value":[dt,[],r=>r.globals.rasterValue||0],"raster-particle-speed":[dt,[],r=>r.globals.rasterParticleSpeed||0],"sky-radial-progress":[dt,[],r=>r.globals.skyRadialProgress||0],accumulated:[di,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[dt,ls(dt),(r,e)=>{let i=0;for(const o of e)i+=o.evaluate(r);return i}],"*":[dt,ls(dt),(r,e)=>{let i=1;for(const o of e)i*=o.evaluate(r);return i}],"-":{type:dt,overloads:[[[dt,dt],(r,[e,i])=>e.evaluate(r)-i.evaluate(r)],[[dt],(r,[e])=>-e.evaluate(r)]]},"/":[dt,[dt,dt],(r,[e,i])=>e.evaluate(r)/i.evaluate(r)],"%":[dt,[dt,dt],(r,[e,i])=>e.evaluate(r)%i.evaluate(r)],ln2:[dt,[],()=>Math.LN2],pi:[dt,[],()=>Math.PI],e:[dt,[],()=>Math.E],"^":[dt,[dt,dt],(r,[e,i])=>Math.pow(e.evaluate(r),i.evaluate(r))],sqrt:[dt,[dt],(r,[e])=>Math.sqrt(e.evaluate(r))],log10:[dt,[dt],(r,[e])=>Math.log(e.evaluate(r))/Math.LN10],ln:[dt,[dt],(r,[e])=>Math.log(e.evaluate(r))],log2:[dt,[dt],(r,[e])=>Math.log(e.evaluate(r))/Math.LN2],sin:[dt,[dt],(r,[e])=>Math.sin(e.evaluate(r))],cos:[dt,[dt],(r,[e])=>Math.cos(e.evaluate(r))],tan:[dt,[dt],(r,[e])=>Math.tan(e.evaluate(r))],asin:[dt,[dt],(r,[e])=>Math.asin(e.evaluate(r))],acos:[dt,[dt],(r,[e])=>Math.acos(e.evaluate(r))],atan:[dt,[dt],(r,[e])=>Math.atan(e.evaluate(r))],min:[dt,ls(dt),(r,e)=>Math.min(...e.map(i=>i.evaluate(r)))],max:[dt,ls(dt),(r,e)=>Math.max(...e.map(i=>i.evaluate(r)))],abs:[dt,[dt],(r,[e])=>Math.abs(e.evaluate(r))],round:[dt,[dt],(r,[e])=>{const i=e.evaluate(r);return i<0?-Math.round(-i):Math.round(i)}],floor:[dt,[dt],(r,[e])=>Math.floor(e.evaluate(r))],ceil:[dt,[dt],(r,[e])=>Math.ceil(e.evaluate(r))],"filter-==":[hi,[ci,di],(r,[e,i])=>r.properties()[e.value]===i.value],"filter-id-==":[hi,[di],(r,[e])=>r.id()===e.value],"filter-type-==":[hi,[ci],(r,[e])=>r.geometryType()===e.value],"filter-<":[hi,[ci,di],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o<a}],"filter-id-<":[hi,[di],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i<o}],"filter->":[hi,[ci,di],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o>a}],"filter-id->":[hi,[di],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i>o}],"filter-<=":[hi,[ci,di],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o<=a}],"filter-id-<=":[hi,[di],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i<=o}],"filter->=":[hi,[ci,di],(r,[e,i])=>{const o=r.properties()[e.value],a=i.value;return typeof o==typeof a&&o>=a}],"filter-id->=":[hi,[di],(r,[e])=>{const i=r.id(),o=e.value;return typeof i==typeof o&&i>=o}],"filter-has":[hi,[di],(r,[e])=>e.value in r.properties()],"filter-has-id":[hi,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[hi,[Yr(ci)],(r,[e])=>e.value.indexOf(r.geometryType())>=0],"filter-id-in":[hi,[Yr(di)],(r,[e])=>e.value.indexOf(r.id())>=0],"filter-in-small":[hi,[ci,Yr(di)],(r,[e,i])=>i.value.indexOf(r.properties()[e.value])>=0],"filter-in-large":[hi,[ci,Yr(di)],(r,[e,i])=>function(o,a,h,u){for(;h<=u;){const f=h+u>>1;if(a[f]===o)return!0;a[f]>o?u=f-1:h=f+1}return!1}(r.properties()[e.value],i.value,0,i.value.length-1)],all:{type:hi,overloads:[[[hi,hi],(r,[e,i])=>e.evaluate(r)&&i.evaluate(r)],[ls(hi),(r,e)=>{for(const i of e)if(!i.evaluate(r))return!1;return!0}]]},any:{type:hi,overloads:[[[hi,hi],(r,[e,i])=>e.evaluate(r)||i.evaluate(r)],[ls(hi),(r,e)=>{for(const i of e)if(i.evaluate(r))return!0;return!1}]]},"!":[hi,[hi],(r,[e])=>!e.evaluate(r)],"is-supported-script":[hi,[ci],(r,[e])=>{const i=r.globals&&r.globals.isSupportedScript;return!i||i(e.evaluate(r))}],upcase:[ci,[ci],(r,[e])=>e.evaluate(r).toUpperCase()],downcase:[ci,[ci],(r,[e])=>e.evaluate(r).toLowerCase()],concat:[ci,ls(di),(r,e)=>e.map(i=>Wn(i.evaluate(r))).join("")],"resolved-locale":[ci,[hc],(r,[e])=>e.evaluate(r).resolvedLocale()],random:[dt,[dt,dt,di],(r,e)=>{const[i,o,a]=e.map(u=>u.evaluate(r));if(i>o||i===o)return i;let h;
6if(typeof a=="string")h=function(u){let f=0;if(u.length===0)return f;for(let _=0;_<u.length;_++)f=(f<<5)-f+u.charCodeAt(_),f|=0;return f}(a);else{if(typeof a!="number")throw new xr(`Invalid seed input: ${a}`);h=a}return i+Jd(h)()*(o-i)}]});class su{constructor(e,i,o,a){this.expression=e,this._warningHistory={},this._evaluator=new Tl(o,a),this._defaultValue=i?function(h){return h.type==="color"&&(Bc(h.default)||Array.isArray(h.default))?new ui(0,0,0,0):h.type==="color"?ui.parse(h.default)||null:h.default===void 0?null:h.default}(i):null,this._enumValues=i&&i.type==="enum"?i.values:null,this.configDependencies=Tc(e)}evaluateWithoutErrorHandling(e,i,o,a,h,u,f,_){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=o,this._evaluator.canonical=a||null,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=u,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,o,a,h,u,f,_){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=o||null,this._evaluator.canonical=a||null,this._evaluator.availableImages=h||null,this._evaluator.formattedSection=u||null,this._evaluator.featureTileCoord=f||null,this._evaluator.featureDistanceData=_||null;try{const g=this.expression.evaluate(this._evaluator);if(g==null||typeof g=="number"&&g!=g)return this._defaultValue;if(this._enumValues&&!(g in this._enumValues))throw new xr(`Expected value to be one of ${Object.keys(this._enumValues).map(v=>JSON.stringify(v)).join(", ")}, but found ${JSON.stringify(g)} instead.`);return g}catch(g){return this._warningHistory[g.message]||(this._warningHistory[g.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${g.message}`)),this._defaultValue}}}function au(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Sa}function Ns(r,e,i,o){const a=new Ec(Sa,[],e?function(u){const f={color:wn,string:ci,number:dt,enum:ci,boolean:hi,formatted:yl,resolvedImage:xl};return u.type==="array"?Yr(f[u.value]||di,u.length):f[u.type]}(e):void 0,void 0,void 0,i,o),h=a.parse(r,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?ru(new su(h,e,i,o)):cs(a.errors)}class Nc{constructor(e,i,o,a){this.kind=e,this._styleExpression=i,this.isLightConstant=o,this.isLineProgressConstant=a,this.isStateDependent=e!=="constant"&&!wc(i.expression),this.configDependencies=Tc(i.expression)}evaluateWithoutErrorHandling(e,i,o,a,h,u){return this._styleExpression.evaluateWithoutErrorHandling(e,i,o,a,h,u)}evaluate(e,i,o,a,h,u){return this._styleExpression.evaluate(e,i,o,a,h,u)}}class ds{constructor(e,i,o,a,h,u){this.kind=e,this.zoomStops=o,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!wc(i.expression),this.isLightConstant=h,this.isLineProgressConstant=u,this.configDependencies=Tc(i.expression),this.interpolationType=a}evaluateWithoutErrorHandling(e,i,o,a,h,u){return this._styleExpression.evaluateWithoutErrorHandling(e,i,o,a,h,u)}evaluate(e,i,o,a,h,u){return this._styleExpression.evaluate(e,i,o,a,h,u)}interpolationFactor(e,i,o){return this.interpolationType?_n.interpolationFactor(this.interpolationType,e,i,o):0}}function lu(r,e,i,o){if((r=Ns(r,e,i,o)).result==="error")return r;const a=r.value.expression,h=ya(a);if(!h&&!Oc(e))return cs([new Dn("","data expressions not supported")]);const u=xa(a,["zoom","pitch","distance-from-center"]);if(!u&&!ip(e))return cs([new Dn("","zoom expressions not supported")]);const f=xa(a,["measure-light"]);if(!f&&!tp(e))return cs([new Dn("","measure-light expression not supported")]);const _=xa(a,["line-progress"]);if(!_&&!function(b){return hs(b.expression,"line-progress")}(e))return cs([new Dn("","line-progress expression not supported")]);const g=e.expression&&e.expression.relaxZoomRestriction,v=zl(a);return v||u||g?v instanceof Dn?cs([v]):v instanceof _n&&!kc(e)?cs([new Dn("",'"interpolate" expressions cannot be used with this property')]):ru(v?new ds(h&&_?"camera":"composite",r.value,v.labels,v instanceof _n?v.interpolation:void 0,f,_):new Nc(h&&_?"constant":"source",r.value,f,_)):cs([new Dn("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Vs{constructor(e,i){this._parameters=e,this._specification=i,zs(this,nu(this._parameters,this._specification))}static deserialize(e){return new Vs(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function zl(r){let e=null;if(r instanceof Pl)e=zl(r.result);else if(r instanceof Mc){for(const i of r.args)if(e=zl(i),e)break}else(r instanceof Cl||r instanceof _n)&&r.input instanceof Lr&&r.input.name==="zoom"&&(e=r);return e instanceof Dn||r.eachChild(i=>{const o=zl(i);o instanceof Dn?e=o:e&&o&&e!==o&&(e=new Dn("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var cu,sp,hu=function(){if(sp)return cu;sp=1,cu=e;var r=3;function e(i,o,a){var h=this.cells=[];if(i instanceof ArrayBuffer){this.arrayBuffer=i;var u=new Int32Array(this.arrayBuffer);i=u[0],this.d=(o=u[1])+2*(a=u[2]);for(var f=0;f<this.d*this.d;f++){var _=u[r+f],g=u[r+f+1];h.push(_===g?null:u.subarray(_,g))}var v=u[r+h.length+1];this.keys=u.subarray(u[r+h.length],v),this.bboxes=u.subarray(v),this.insert=this._insertReadonly}else{this.d=o+2*a;for(var b=0;b<this.d*this.d;b++)h.push([]);this.keys=[],this.bboxes=[]}this.n=o,this.extent=i,this.padding=a,this.scale=o/i,this.uid=0;var w=a/o*i;this.min=-w,this.max=i+w}
6return e.prototype.insert=function(i,o,a,h,u){this._forEachCell(o,a,h,u,this._insertCell,this.uid++),this.keys.push(i),this.bboxes.push(o),this.bboxes.push(a),this.bboxes.push(h),this.bboxes.push(u)},e.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},e.prototype._insertCell=function(i,o,a,h,u,f){this.cells[u].push(f)},e.prototype.query=function(i,o,a,h,u){var f=this.min,_=this.max;if(i<=f&&o<=f&&_<=a&&_<=h&&!u)return Array.prototype.slice.call(this.keys);var g=[];return this._forEachCell(i,o,a,h,this._queryCell,g,{},u),g},e.prototype._queryCell=function(i,o,a,h,u,f,_,g){var v=this.cells[u];if(v!==null)for(var b=this.keys,w=this.bboxes,I=0;I<v.length;I++){var A=v[I];if(_[A]===void 0){var P=4*A;(g?g(w[P+0],w[P+1],w[P+2],w[P+3]):i<=w[P+2]&&o<=w[P+3]&&a>=w[P+0]&&h>=w[P+1])?(_[A]=!0,f.push(b[A])):_[A]=!1}}},e.prototype._forEachCell=function(i,o,a,h,u,f,_,g){for(var v=this._convertToCellCoord(i),b=this._convertToCellCoord(o),w=this._convertToCellCoord(a),I=this._convertToCellCoord(h),A=v;A<=w;A++)for(var P=b;P<=I;P++){var R=this.d*P+A;if((!g||g(this._convertFromCellCoord(A),this._convertFromCellCoord(P),this._convertFromCellCoord(A+1),this._convertFromCellCoord(P+1)))&&u.call(this,i,o,a,h,R,f,_,g))return}},e.prototype._convertFromCellCoord=function(i){return(i-this.padding)/this.scale},e.prototype._convertToCellCoord=function(i){return Math.max(0,Math.min(this.d-1,Math.floor(i*this.scale)+this.padding))},e.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var i=this.cells,o=r+this.cells.length+1+1,a=0,h=0;h<this.cells.length;h++)a+=this.cells[h].length;var u=new Int32Array(o+a+this.keys.length+this.bboxes.length);u[0]=this.extent,u[1]=this.n,u[2]=this.padding;for(var f=o,_=0;_<i.length;_++){var g=i[_];u[r+_]=f,u.set(g,f),f+=g.length}return u[r+i.length]=f,u.set(this.keys,f),u[r+i.length+1]=f+=this.keys.length,u.set(this.bboxes,f),f+=this.bboxes.length,u.buffer},cu}(),ps=il(hu);const Rl={};function nt(r,e,i={}){Object.defineProperty(r,"_classRegistryKey",{value:e,writable:!1}),Rl[e]={klass:r,omit:i.omit||[]}}nt(Object,"Object"),ps.serialize=function(r,e){const i=r.toArrayBuffer();return e&&e.add(i),{buffer:i}},ps.deserialize=function(r){return new ps(r.buffer)},Object.defineProperty(ps,"name",{value:"Grid"}),nt(ps,"Grid"),delete Be.prototype.constructor,typeof DOMMatrix<"u"&&nt(DOMMatrix,"DOMMatrix"),nt(ui,"Color"),nt(Error,"Error"),nt(nn,"Formatted"),nt(dc,"FormattedSection"),nt(Kt,"AJAXError"),nt(mn,"ResolvedImage"),nt(Vs,"StylePropertyFunction"),nt(su,"StyleExpression",{omit:["_evaluator"]}),nt(bn,"ImageId"),nt(Oo,"ImageVariant"),nt(ds,"ZoomDependentExpression"),nt(Nc,"ZoomConstantExpression"),nt(Lr,"CompoundExpression",{omit:["_evaluate"]});for(const r in Sa)Rl[Sa[r]._classRegistryKey]||nt(Sa[r],`Expression${r}`);function Vc(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Dl(r){return self.ImageBitmap&&r instanceof ImageBitmap}function ko(r,e){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp)return r;if(Vc(r)||Dl(r))return e&&e.add(r),r;if(ArrayBuffer.isView(r))return e&&e.add(r.buffer),r;if(r instanceof ImageData)return e&&e.add(r.data.buffer),r;if(Array.isArray(r)){const i=[];for(const o of r)i.push(ko(o,e));return i}if(r instanceof Map){const i={$name:"Map",entries:[]};for(const[o,a]of r.entries())i.entries.push(ko(o),ko(a,e));return i}if(r instanceof Set){const i={$name:"Set"};let o=0;for(const a of r.values())i[++o]=ko(a);return i}if(r instanceof DOMMatrix){const i={$name:"DOMMatrix"},o=["is2D","m11","m12","m13","m14","m21","m22","m23","m24","m31","m32","m33","m34","m41","m42","m43","m44","a","b","c","d","e","f"];for(const a of o)i[a]=r[a];return i}if(typeof r=="bigint")return{$name:"BigInt",value:r.toString()};if(typeof r=="object"){const i=r.constructor,o=i._classRegistryKey;if(!o)throw new Error(`Can't serialize object of unregistered class "${i.name}".`);const a=i.serialize?i.serialize(r,e):{};if(!i.serialize){for(const h in r)r.hasOwnProperty(h)&&(Rl[o].omit.indexOf(h)>=0||(a[h]=ko(r[h],e)));r instanceof Error&&(a.message=r.message)}if(a.$name)throw new Error("$name property is reserved for worker serialization logic.");return o!=="Object"&&(a.$name=o),a}throw new Error("can't serialize object of type "+typeof r)}function gn(r){if(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||Vc(r)||Dl(r)||ArrayBuffer.isView(r)||r instanceof ImageData)return r;if(Array.isArray(r))return r.map(gn);if(typeof r=="object"){const e=r.$name||"Object";if(e==="Map"){const a=r.entries||[],h=new Map;for(let u=0;u<a.length;u+=2)h.set(gn(a[u]),gn(a[u+1]));return h}if(e==="Set"){const a=new Set;for(const h of Object.keys(r))h!=="$name"&&a.add(gn(r[h]));return a}if(e==="DOMMatrix"){let a;return a=r.is2D?[r.a,r.b,r.c,r.d,r.e,r.f]:[r.m11,r.m12,r.m13,r.m14,r.m21,r.m22,r.m23,r.m24,r.m31,r.m32,r.m33,r.m34,r.m41,r.m42,r.m43,r.m44],new DOMMatrix(a)}if(e==="BigInt")return BigInt(r.value);const{klass:i}=Rl[e];if(!i)throw new Error(`Can't deserialize unregistered class "${e}".`);if(i.deserialize)return i.deserialize(r);const o=Object.create(i.prototype);for(const a of Object.keys(r))a!=="$name"&&(o[a]=gn(r[a]));return o}throw new Error("can't deserialize object of type "+typeof r)}const yt={"Latin-1 Supplement":r=>r>=128&&r<=255,Arabic:r=>r>=1536&&r<=1791,"Arabic Supplement":r=>r>=1872&&r<=1919,"Arabic Extended-A":r=>r>=2208&&r<=2303,"Hangul Jamo":r=>r>=4352&&r<=4607,"Unified Canadian Aboriginal Syllabics":r=>r>=5120&&r<=5759,Khmer:r=>r>=6016&&r<=6143,"Unified Canadian Aboriginal Syllabics Extended":r=>r>=6320&&r<=6399,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"CJK Radicals Supplement":r=>r>=11904&&r<=12031,"Kangxi Radicals":r=>r>=12032&&r<=12255,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Bopomofo:r=>r>=12544&&r<=12591,"Hangul Compatibility Jamo":r=>r>=12592&&r<=12687,Kanbun:r=>r>=12688&&r<=12703,"Bopomofo Extended":r=>r>=12704&&r<=12735,"CJK Strokes":r=>r>
6=12736&&r<=12783,"Katakana Phonetic Extensions":r=>r>=12784&&r<=12799,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"CJK Unified Ideographs Extension A":r=>r>=13312&&r<=19903,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Yi Syllables":r=>r>=40960&&r<=42127,"Yi Radicals":r=>r>=42128&&r<=42191,"Hangul Jamo Extended-A":r=>r>=43360&&r<=43391,"Hangul Syllables":r=>r>=44032&&r<=55215,"Hangul Jamo Extended-B":r=>r>=55216&&r<=55295,"Private Use Area":r=>r>=57344&&r<=63743,"CJK Compatibility Ideographs":r=>r>=63744&&r<=64255,"Arabic Presentation Forms-A":r=>r>=64336&&r<=65023,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Arabic Presentation Forms-B":r=>r>=65136&&r<=65279,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519,Osage:r=>r>=66736&&r<=66815,"CJK Unified Ideographs Extension B":r=>r>=131072&&r<=173791};function uu(r){for(const e of r)if(jc(e.charCodeAt(0)))return!0;return!1}function Zf(r){for(const e of r)if(!Wf(e.charCodeAt(0)))return!1;return!0}function Wf(r){return!(yt.Arabic(r)||yt["Arabic Supplement"](r)||yt["Arabic Extended-A"](r)||yt["Arabic Presentation Forms-A"](r)||yt["Arabic Presentation Forms-B"](r))}function jc(r){return!(r!==746&&r!==747&&(r<4352||!(yt["Bopomofo Extended"](r)||yt.Bopomofo(r)||yt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||yt["CJK Compatibility Ideographs"](r)||yt["CJK Compatibility"](r)||yt["CJK Radicals Supplement"](r)||yt["CJK Strokes"](r)||!(!yt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||yt["CJK Unified Ideographs Extension A"](r)||yt["CJK Unified Ideographs"](r)||yt["Enclosed CJK Letters and Months"](r)||yt["Hangul Compatibility Jamo"](r)||yt["Hangul Jamo Extended-A"](r)||yt["Hangul Jamo Extended-B"](r)||yt["Hangul Jamo"](r)||yt["Hangul Syllables"](r)||yt.Hiragana(r)||yt["Ideographic Description Characters"](r)||yt.Kanbun(r)||yt["Kangxi Radicals"](r)||yt["Katakana Phonetic Extensions"](r)||yt.Katakana(r)&&r!==12540||!(!yt["Halfwidth and Fullwidth Forms"](r)||r===65288||r===65289||r===65293||r>=65306&&r<=65310||r===65339||r===65341||r===65343||r>=65371&&r<=65503||r===65507||r>=65512&&r<=65519)||!(!yt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||yt["Unified Canadian Aboriginal Syllabics"](r)||yt["Unified Canadian Aboriginal Syllabics Extended"](r)||yt["Vertical Forms"](r)||yt["Yijing Hexagram Symbols"](r)||yt["Yi Syllables"](r)||yt["Yi Radicals"](r))))}function Uc(r){return!(jc(r)||function(e){return!!(yt["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||yt["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||yt["Letterlike Symbols"](e)||yt["Number Forms"](e)||yt["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||yt["Control Pictures"](e)&&e!==9251||yt["Optical Character Recognition"](e)||yt["Enclosed Alphanumerics"](e)||yt["Geometric Shapes"](e)||yt["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||yt["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||yt["CJK Symbols and Punctuation"](e)||yt.Katakana(e)||yt["Private Use Area"](e)||yt["CJK Compatibility Forms"](e)||yt["Small Form Variants"](e)||yt["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(r))}function ap(r){return yt.Arabic(r)||yt["Arabic Supplement"](r)||yt["Arabic Extended-A"](r)||yt["Arabic Presentation Forms-A"](r)||yt["Arabic Presentation Forms-B"](r)}function Gc(r){return r>=1424&&r<=2303||yt["Arabic Presentation Forms-A"](r)||yt["Arabic Presentation Forms-B"](r)}function Xf(r,e){return!(!e&&Gc(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||yt.Khmer(r))}function Yf(r){for(const e of r)if(Gc(e.charCodeAt(0)))return!0;return!1}const Tn={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let du=null,sn=Tn.unavailable,fs=null;const lp=function(r){r&&typeof r=="string"&&r.indexOf("NetworkError")>-1&&(sn=Tn.error),du&&du(r)};function pu(){fu.fire(new Lo("pluginStateChange",{pluginStatus:sn,pluginURL:fs}))}const fu=new Ps,mu=function(){return sn},cp=function(){if(sn!==Tn.deferred||!fs)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");sn=Tn.loading,pu(),fs&&dl({url:fs},r=>{r?lp(r):(sn=Tn.loaded,pu())})},po={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>sn===Tn.loaded||po.applyArabicShaping!=null,isLoading:()=>sn===Tn.loading,setState(r){sn=r.pluginStatus,fs=r.pluginURL},isParsing:()=>sn===Tn.parsing,isParsed:()=>sn===Tn.parsed,getPluginURL:()=>fs};class yi{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness,this.worldview=i.worldview):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(i,o){for(const a of i)if(!Xf(a.charCo
vendor: 10,325 bytes, line 6
6deAt(0),o))return!1;return!0}(e,po.isLoaded())}}class Ll{constructor(e,i,o,a){this.property=e,this.value=i,this.expression=function(h,u,f,_){if(Bc(h))return new Vs(h,u);if(au(h)||Array.isArray(h)&&h.length>0){const g=lu(h,u,f,_);if(g.result==="error")throw new Error(g.value.map(v=>`${v.key}: ${v.message}`).join(", "));return g.value}{let g=h;return typeof h=="string"&&u.type==="color"&&(g=ui.parse(h)),{kind:"constant",configDependencies:new Set,evaluate:()=>g}}}(i===void 0?e.specification.default:i,e.specification,o,a)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,o){return this.property.possiblyEvaluate(this,e,i,o)}}class qc{constructor(e,i,o){this.property=e,this.value=new Ll(e,void 0,i,o)}transitioned(e,i){return new hp(this.property,this.value,i,xe({},e.transition,this.transition),e.now)}untransitioned(){return new hp(this.property,this.value,null,{},0)}}class Fl{constructor(e,i,o){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=o,this.configDependencies=new Set}getValue(e){return kt(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new qc(this._values[e].property,this._scope,this._options)),this._values[e].value=new Ll(this._values[e].property,i===null?void 0:kt(i),this._scope,this._options),this._values[e].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]))}setTransitionOrValue(e,i){i&&(this._options=i);const o=this._properties.properties;if(e)for(const a in e){const h=e[a];if(a.endsWith("-transition")){const u=a.slice(0,-11);o[u]&&this.setTransition(u,h)}else o.hasOwnProperty(a)&&this.setValue(a,h)}}getTransition(e){return kt(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new qc(this._values[e].property)),this._values[e].transition=kt(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const o=this.getValue(i);o!==void 0&&(e[i]=o);const a=this.getTransition(i);a!==void 0&&(e[`${i}-transition`]=a)}return e}transitioned(e,i){const o=new up(this._properties);for(const a of Object.keys(this._values))o._values[a]=this._values[a].transitioned(e,i._values[a]);return o}untransitioned(){const e=new up(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class hp{constructor(e,i,o,a,h){const u=a.delay||0,f=a.duration||0;h=h||0,this.property=e,this.value=i,this.begin=h+u,this.end=this.begin+f,e.specification.transition&&(a.delay||a.duration)&&(this.prior=o)}possiblyEvaluate(e,i,o){const a=e.now||0,h=this.value.possiblyEvaluate(e,i,o),u=this.prior;if(u){if(a>this.end)return this.prior=null,h;if(this.value.isDataDriven())return this.prior=null,h;if(a<this.begin)return u.possiblyEvaluate(e,i,o);{const f=(a-this.begin)/(this.end-this.begin);return this.property.interpolate(u.possiblyEvaluate(e,i,o),h,B(f))}}return h}}class up{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,o){const a=new so(this._properties);for(const h of Object.keys(this._values))a._values[h]=this._values[h].possiblyEvaluate(e,i,o);return a}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class ms{constructor(e,i,o){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=o,this.configDependencies=new Set}getValue(e){return kt(this._values[e].value)}setValue(e,i){this._values[e]=new Ll(this._values[e].property,i===null?void 0:kt(i),this._scope,this._options),this._values[e].expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[e].expression.configDependencies]))}serialize(){const e={};for(const i of Object.keys(this._values)){const o=this.getValue(i);o!==void 0&&(e[i]=o)}return e}possiblyEvaluate(e,i,o){const a=new so(this._properties);for(const h of Object.keys(this._values))a._values[h]=this._values[h].possiblyEvaluate(e,i,o);return a}}class js{constructor(e,i,o){this.property=e,this.value=i,this.parameters=o}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,o,a){return this.property.evaluate(this.value,this.parameters,e,i,o,a)}}class so{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class qe{constructor(e){this.specification=e}possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,o){const a=gl[this.specification.type];return a?a(e,i,o):e}}class Qe{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,o,a){return new js(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},o,a)}:e.expression,i)}interpolate(e,i,o){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new js(this,{kind:"constant",value:void 0},e.parameters);const a=gl[this.specification.type];return a?new js(this,{kind:"constant",value:a(e.value.value,i.value.value,o)},e.parameters):e}evaluate(e,i,o,a,h,u){return e.kind==="constant"?e.value:e.evaluate(i,o,a,h,u)}}class Ea{constructor(e){this.specification=e}possiblyEvaluate(e,i,o,a){return!!e.expression.evaluate(i,null,{},o,a)}interpolate(){return!1}}class tr{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new yi(0,{});for(const o in e){const a=e[o];a.specification.overridable&&this.overridableProperties.push(o);const h=this.defaultPropertyValues[o]=new Ll(a,void 0),u=this.defaultTransitionablePropertyValues[o]=new qc(a);this.defaultTransitioningPropertyValues[o]=u.untransitioned(),this.defaultPossiblyEvaluatedValues[o]=h.possiblyEvaluate(i)}}}nt(Qe,"DataDrivenProperty"),nt(qe,"DataConstantProperty"),nt(Ea,"ColorRampProperty");var de=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","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},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"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}},"properties_light_flat":{"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}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}}
6,"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"expression"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
6,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":0.1,"maximum":10,"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"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":{"floorplanFeaturesetId":{"type":"string","expression":{}},"buildingFeaturesetId":{"type":"string","expression":{}}},"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":{"ty
6pe":"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":{}}},"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"}
6,"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"]}},"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"]}},"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":{"int
6erpolated":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]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function dp(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Ol(r){if(Array.isArray(r))return r.map(Ol);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const e={};for(const i in r)e[i]=Ol(r[i]);return e}return dp(r)}function kl(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const e of r.slice(1))if(!kl(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function Ia(r,e="",i=null,o="fill"){if(r==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};kl(r)||(r=$c(r));const a=r;let h=!0;try{h=function(v){if(!Aa(v))return v;let b=Ol(v);return Hc(b),b=_u(b),b}(a)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
7This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
8and paste the contents of this message in the report.
9Thank you!
10Filter Expression:
11${JSON.stringify(a,null,2)}
12        `)}let u=null,f=null;if(o!=="background"&&o!=="sky"&&o!=="slot"){f=de[`filter_${o}`];const v=Ns(h,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));u=(b,w,I)=>v.value.evaluate(b,w,{},I)}let _=null,g=null;if(h!==a){const v=Ns(a,f,e,i);if(v.result==="error")throw new Error(v.value.map(b=>`${b.key}: ${b.message}`).join(", "));_=(b,w,I,A,P)=>v.value.evaluate(b,w,{},I,void 0,void 0,A,P),g=!ya(v.value.expression)}return{filter:u,dynamicFilter:_||void 0,needGeometry:gu(h),needFeature:!!g}}function _u(r){if(!Array.isArray(r))return r;const e=function(i){if(fo.has(i[0])){for(let o=1;o<i.length;o++)if(Aa(i[o]))return!0}return i}(r);return e===!0?e:e.map(i=>_u(i))}function Hc(r){let e=!1;const i=[];if(r[0]==="case"){for(let o=1;o<r.length-1;o+=2)e=e||Aa(r[o]),i.push(r[o+1]);i.push(r[r.length-1])}else if(r[0]==="match"){e=e||Aa(r[1]);for(let o=2;o<r.length-1;o+=2)i.push(r[o+1]);i.push(r[r.length-1])}else if(r[0]==="step"){e=e||Aa(r[1]);for(let o=1;o<r.length-1;o+=2)i.push(r[o+1])}e&&(r.length=0,r.push("any",...i));for(let o=1;o<r.length;o++)Hc(r[o])}function Aa(r){if(!Array.isArray(r))return!1;if((e=r[0])==="pitch"||e==="distance-from-center")return!0;var e;
vendor: 4,231 bytes, line 12
12for(let i=1;i<r.length;i++)if(Aa(r[i]))return!0;return!1}const fo=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function Kf(r,e){return r<e?-1:r>e?1:0}function gu(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let e=1;e<r.length;e++)if(gu(r[e]))return!0;return!1}function $c(r){if(!r)return!0;const e=r[0];return r.length<=1?e!=="any":e==="=="?yu(r[1],r[2],"=="):e==="!="?Zc(yu(r[1],r[2],"==")):e==="<"||e===">"||e==="<="||e===">="?yu(r[1],r[2],e):e==="any"?(i=r.slice(1),["any"].concat(i.map($c))):e==="all"?["all"].concat(r.slice(1).map($c)):e==="none"?["all"].concat(r.slice(1).map($c).map(Zc)):e==="in"?pp(r[1],r.slice(2)):e==="!in"?Zc(pp(r[1],r.slice(2))):e==="has"?fp(r[1]):e!=="!has"||Zc(fp(r[1]));var i}function yu(r,e,i){switch(r){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,r,e]}}function pp(r,e){if(e.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",r,["literal",e.sort(Kf)]]:["filter-in-small",r,["literal",e]]}}function fp(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Zc(r){return["!",r]}const Bl="�";function Ca(r,e){return e?`${r}${Bl}${e}`:r}const mp="-transition",Jf=new Set(["fill","line","background","hillshade","raster"]);class Jr extends Ps{constructor(e,i,o,a,h){if(super(),this.id=e.id,this.fqid=Ca(this.id,o),this.type=e.type,this.scope=o,this.lut=a,this.options=h,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.configDependencies=new Set,e.type!=="custom"){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const u=Ns(this.filter,de[`filter_${e.type}`]);u.result!=="error"&&(this.configDependencies=new Set([...this.configDependencies,...u.value.configDependencies]))}if(e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new ms(i.layout,this.scope,h),this.configDependencies=new Set([...this.configDependencies,...this._unevaluatedLayout.configDependencies])),i.paint){this._transitionablePaint=new Fl(i.paint,this.scope,h);for(const u in e.paint)this.setPaintProperty(u,e.paint[u]);for(const u in e.layout)this.setLayoutProperty(u,e.layout[u]);this.configDependencies=new Set([...this.configDependencies,...this._transitionablePaint.configDependencies]),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new so(i.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&Jf.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const o=this._unevaluatedLayout;o._properties.properties[e]&&(o.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...o.configDependencies]),e==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(mp)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){const o=this._transitionablePaint,a=o._properties.properties;if(e.endsWith(mp)){const b=e.slice(0,-11);return a[b]&&o.setTransition(b,i||void 0),!1}if(!a[e])return!1;const h=o._values[e],u=h.value.isDataDriven(),f=h.value;o.setValue(e,i),this.configDependencies=new Set([...this.configDependencies,...o.configDependencies]),this._handleSpecialPaintPropertyUpdate(e);const _=o._values[e].value,g=_.isDataDriven(),v=e.endsWith("pattern")||e==="line-dasharray";return g||u||v||this._handleOverridablePaintPropertyUpdate(e,f,_)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,o){return null}_handleOverridablePaintPropertyUpdate(e,i,o){return!1}
12isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,i){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,i)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,i)}serialize(){return Gt({id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()},(e,i)=>!(e===void 0||i==="layout"&&!Object.keys(e).length||i==="paint"&&!Object.keys(e).length))}is3D(e){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 e in this.paint._values){const i=this.paint.get(e);if(i instanceof js&&Oc(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=Ia(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&(e.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}queryRadius(e){}queryIntersectsFeature(e,i,o,a,h,u,f,_,g){}}const Qf={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Nl{constructor(e,i){this._structArray=e,this._pos1=i*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Li{constructor(){this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&i.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const i=Object.create(this.prototype);return i.arrayBuffer=e.arrayBuffer,i.length=e.length,i.capacity=e.arrayBuffer.byteLength/i.bytesPerElement,i._refreshViews(),i}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const i=this.uint8;this._refreshViews(),i&&this.uint8.set(i)}}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){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 Wt(r,e=1){let i=0,o=0;return{members:r.map(a=>{const h=Qf[a.type].BYTES_PER_ELEMENT,u=i=xu(i,Math.max(e,h)),f=a.components||1;return o=Math.max(o,h),i+=h*f,{name:a.name,type:a.type,components:f,offset:u}}),size:xu(i,Math.max(o,e)),alignment:e}}function xu(r,e){return Math.ceil(r/e)*e}class yn extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.int16[a+0]=i,this.int16[a+1]=o,e}}yn.prototype.bytesPerElement=4,nt(yn,"StructArrayLayout2i4");class Ma extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const h=3*e;return this.int16[h+0]=i,this.int16[h+1]=o,this.int16[h+2]=a,e}}Ma.prototype.bytesPerElement=6,nt(Ma,"StructArrayLayout3i6");class Pa extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a)}emplace(e,i,o,a,h){const u=4*e;return this.int16[u+0]=i,this.int16[u+1]=o,this.int16[u+2]=a,this.int16[u+3]=h,e}}Pa.prototype.bytesPerElement=8,nt(Pa,"StructArrayLayout4i8");class Us extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.float32[1*e+0]=i,e}}
vendor: 17,467 bytes, line 12
12Us.prototype.bytesPerElement=4,nt(Us,"StructArrayLayout1f4");class vu extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const h=4*e,u=2*e;return this.int16[h+0]=i,this.int16[h+1]=o,this.float32[u+1]=a,e}}vu.prototype.bytesPerElement=8,nt(vu,"StructArrayLayout2i1f8");class bu extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const h=4*e;return this.int16[h+0]=i,this.int16[h+1]=o,this.int16[h+2]=a,e}}bu.prototype.bytesPerElement=8,nt(bu,"StructArrayLayout3i8");class Wc extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a,h)}emplace(e,i,o,a,h,u){const f=5*e;return this.int16[f+0]=i,this.int16[f+1]=o,this.int16[f+2]=a,this.int16[f+3]=h,this.int16[f+4]=u,e}}Wc.prototype.bytesPerElement=10,nt(Wc,"StructArrayLayout5i10");class Xc extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,h,u,f)}emplace(e,i,o,a,h,u,f,_){const g=6*e,v=12*e,b=3*e;return this.int16[g+0]=i,this.int16[g+1]=o,this.uint8[v+4]=a,this.uint8[v+5]=h,this.uint8[v+6]=u,this.uint8[v+7]=f,this.float32[b+2]=_,e}}Xc.prototype.bytesPerElement=12,nt(Xc,"StructArrayLayout2i4ub1f12");class Fn extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const h=3*e;return this.float32[h+0]=i,this.float32[h+1]=o,this.float32[h+2]=a,e}}Fn.prototype.bytesPerElement=12,nt(Fn,"StructArrayLayout3f12");class _s extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a,h)}emplace(e,i,o,a,h,u){const f=6*e,_=3*e;return this.uint16[f+0]=i,this.uint16[f+1]=o,this.uint16[f+2]=a,this.uint16[f+3]=h,this.float32[_+2]=u,e}}_s.prototype.bytesPerElement=12,nt(_s,"StructArrayLayout4ui1f12");class za extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a)}emplace(e,i,o,a,h){const u=4*e;return this.uint16[u+0]=i,this.uint16[u+1]=o,this.uint16[u+2]=a,this.uint16[u+3]=h,e}}za.prototype.bytesPerElement=8,nt(za,"StructArrayLayout4ui8");class Yc extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,h,u)}emplace(e,i,o,a,h,u,f){const _=6*e;return this.int16[_+0]=i,this.int16[_+1]=o,this.int16[_+2]=a,this.int16[_+3]=h,this.int16[_+4]=u,this.int16[_+5]=f,e}}Yc.prototype.bytesPerElement=12,nt(Yc,"StructArrayLayout6i12");class Kc extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f,_,g,v,b,w){const I=this.length;return this.resize(I+1),this.emplace(I,e,i,o,a,h,u,f,_,g,v,b,w)}emplace(e,i,o,a,h,u,f,_,g,v,b,w,I){const A=12*e;return this.int16[A+0]=i,this.int16[A+1]=o,this.int16[A+2]=a,this.int16[A+3]=h,this.uint16[A+4]=u,this.uint16[A+5]=f,this.uint16[A+6]=_,this.uint16[A+7]=g,this.int16[A+8]=v,this.int16[A+9]=b,this.int16[A+10]=w,this.int16[A+11]=I,e}}Kc.prototype.bytesPerElement=24,nt(Kc,"StructArrayLayout4i4ui4i24");class Ra extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,h,u)}emplace(e,i,o,a,h,u,f){const _=10*e,g=5*e;return this.int16[_+0]=i,this.int16[_+1]=o,this.int16[_+2]=a,this.float32[g+2]=h,this.float32[g+3]=u,this.float32[g+4]=f,e}}Ra.prototype.bytesPerElement=20,nt(Ra,"StructArrayLayout3i3f20");class gs extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a)}emplace(e,i,o,a,h){const u=4*e;return this.float32[u+0]=i,this.float32[u+1]=o,this.float32[u+2]=a,this.float32[u+3]=h,e}}gs.prototype.bytesPerElement=16,nt(gs,"StructArrayLayout4f16");class wu extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint32[1*e+0]=i,e}}wu.prototype.bytesPerElement=4,nt(wu,"StructArrayLayout1ul4");class mo extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.uint16[a+0]=i,this.uint16[a+1]=o,e}}mo.prototype.bytesPerElement=4,nt(mo,"StructArrayLayout2ui4");class Tu extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f,_,g,v,b,w,I){const A=this.length;return this.resize(A+1),this.emplace(A,e,i,o,a,h,u,f,_,g,v,b,w,I)}emplace(e,i,o,a,h,u,f,_,g,v,b,w,I,A){const P=20*e,R=10*e;return this.int16[P+0]=i,this.int16[P+1]=o,this.int16[P+2]=a,this.int16[P+3]=h,this.int16[P+4]=u,this.float32[R+3]=f,this.float32[R+4]=_,this.float32[R+5]=g,this.float32[R+6]=v,this.int16[P+14]=b,this.uint32[R+8]=w,this.uint16[P+18]=I,this.uint16[P+19]=A,e}}Tu.prototype.bytesPerElement=40,nt(Tu,"StructArrayLayout5i4f1i1ul2ui40");class Jc extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,h,u,f)}emplace(e,i,o,a,h,u,f,_){const g=8*e;return this.int16[g+0]=i,this.int16[g+1]=o,this.int16[g+2]=a,this.int16[g+4]=h,this.int16[g+5]=u,this.int16[g+6]=f,this.int16[g+7]=_,e}}Jc.prototype.bytesPerElement=16,nt(Jc,"StructArrayLayout3i2i2i16");class Da extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a,h)}emplace(e,i,o,a,h,u){const f=4*e,_=8*e;return this.float32[f+0]=i,this.float32[f+1]=o,this.float32[f+2]=a,this.int16[_+6]=h,this.int16[_+7]=u,e}}Da.prototype.bytesPerElement=16,nt(Da,"StructArrayLayout2f1f2i16");class La extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,h,u)}emplace(e,i,o,a,h,u,f){const _=20*e,g=5*e;return this.uint8[_+0]=i,this.uint8[_+1]=o,this.float32[g+1]=a,this.float32[g+2]=h,this.float32[g+3]=u,this.float32[g+4]=f,e}}La.prototype.bytesPerElement=20,nt(La,"StructArrayLayout2ub4f20");class Ni extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,i,o)}emplace(e,i,o,a){const h=3*e;return this.uint16[h+0]=i,this.uint16[h+1]=o,this.uint16[h+2]=a,e}}Ni.prototype.bytesPerElement=6,nt(Ni,"StructArrayLayout3ui6");class Fa extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,j,V,G,ne){const ee=this.length;return this.resize(ee+1),this.emplace(ee,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,j,V,G,ne)}emplace(e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,j,V,G,ne,ee){const ie=30*e,le=15*e,he=60*e;return this.int16[ie+0]=i,this.int16[ie+1]=o,this.int16[ie+2]=a,this.float32[le+2]=h,this.float32[le+3]=u,this.uint16[ie+8]=f,this.uint16[ie+9]=_,this.uint32[le+5]=g,this.uint32[le+6]=v,this.uint32[le+7]=b,this.uint16[ie+16]=w,this.uint16[ie+17]=I,this.uint16[ie+18]=A,this.float32[le+10]=P,this.float32[le+11]=R,this.uint8[he+48]=O,this.uint8[he+49]=j,this.uint8[he+50]=V,this.uint32[le+13]=G,this.int16[ie+28]=ne,this.uint8[he+58]=ee,e}}Fa.prototype.bytesPerElement=60,nt(Fa,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Su extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,j,V,G,ne,ee,ie,le,he,Ie,pe,Ce,Ge,Pe,Oe,je,Se){const ke=this.length;return this.resize(ke+1),this.emplace(ke,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,j,V,G,ne,ee,ie,le,he,Ie,pe,Ce,Ge,Pe,Oe,je,Se)}emplace(e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,j,V,G,ne,ee,ie,le,he,Ie,pe,Ce,Ge,Pe,Oe,je,Se,ke){const fe=20*e,Ee=40*e,$e=80*e;return this.float32[fe+0]=i,this.float32[fe+1]=o,this.int16[Ee+4]=a,this.int16[Ee+5]=h,this.int16[Ee+6]=u,this.int16[Ee+7]=f,this.int16[Ee+8]=_,this.int16[Ee+9]=g,this.int16[Ee+10]=v,this.int16[Ee+11]=b,this.int16[Ee+12]=w,this.uint16[Ee+13]=I,this.uint16[Ee+14]=A,this.uint16[Ee+15]=P,this.uint16[Ee+16]=R,this.uint16[Ee+17]=O,this.uint16[Ee+18]=j,this.uint16[Ee+19]=V,this.uint16[Ee+20]=G,this.uint16[Ee+21]=ne,this.uint16[Ee+22]=ee,this.uint16[Ee+23]=ie,this.uint16[Ee+24]=le,this.uint16[Ee+25]=he,this.uint16[Ee+26]=Ie,this.uint16[Ee+27]=pe,this.uint32[fe+14]=Ce,this.float32[fe+15]=Ge,this.float32[fe+16]=Pe,this.float32[fe+17]=Oe,this.float32[fe+18]=je,this.uint8[$e+76]=Se,this.uint16[Ee+39]=ke,e}}Su.prototype.bytesPerElement=80,nt(Su,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class Eu extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u){const f=this.length;return this.resize(f+1),this.emplace(f,e,i,o,a,h,u)}emplace(e,i,o,a,h,u,f){const _=6*e;return this.float32[_+0]=i,this.float32[_+1]=o,this.float32[_+2]=a,this.float32[_+3]=h,this.float32[_+4]=u,this.float32[_+5]=f,e}}Eu.prototype.bytesPerElement=24,nt(Eu,"StructArrayLayout6f24");class Gs extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h){const u=this.length;return this.resize(u+1),this.emplace(u,e,i,o,a,h)}emplace(e,i,o,a,h,u){const f=5*e;return this.float32[f+0]=i,this.float32[f+1]=o,this.float32[f+2]=a,this.float32[f+3]=h,this.float32[f+4]=u,e}}Gs.prototype.bytesPerElement=20,nt(Gs,"StructArrayLayout5f20");class Iu extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,h,u,f)}emplace(e,i,o,a,h,u,f,_){const g=7*e;return this.float32[g+0]=i,this.float32[g+1]=o,this.float32[g+2]=a,this.float32[g+3]=h,this.float32[g+4]=u,this.float32[g+5]=f,this.float32[g+6]=_,e}}Iu.prototype.bytesPerElement=28,nt(Iu,"StructArrayLayout7f28");class Vl extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f,_,g,v,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,i,o,a,h,u,f,_,g,v,b)}emplace(e,i,o,a,h,u,f,_,g,v,b,w){const I=11*e;return this.float32[I+0]=i,this.float32[I+1]=o,this.float32[I+2]=a,this.float32[I+3]=h,this.float32[I+4]=u,this.float32[I+5]=f,this.float32[I+6]=_,this.float32[I+7]=g,this.float32[I+8]=v,this.float32[I+9]=b,this.float32[I+10]=w,e}}Vl.prototype.bytesPerElement=44,nt(Vl,"StructArrayLayout11f44");class Au extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f,_,g){const v=this.length;return this.resize(v+1),this.emplace(v,e,i,o,a,h,u,f,_,g)}emplace(e,i,o,a,h,u,f,_,g,v){const b=9*e;return this.float32[b+0]=i,this.float32[b+1]=o,this.float32[b+2]=a,this.float32[b+3]=h,this.float32[b+4]=u,this.float32[b+5]=f,this.float32[b+6]=_,this.float32[b+7]=g,this.float32[b+8]=v,e}}Au.prototype.bytesPerElement=36,nt(Au,"StructArrayLayout9f36");class ys extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const o=this.length;return this.resize(o+1),this.emplace(o,e,i)}emplace(e,i,o){const a=2*e;return this.float32[a+0]=i,this.float32[a+1]=o,e}}ys.prototype.bytesPerElement=8,nt(ys,"StructArrayLayout2f8");class Cu extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,o,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,i,o,a)}emplace(e,i,o,a,h){const u=6*e;return this.uint32[3*e+0]=i,this.uint16[u+2]=o,this.uint16[u+3]=a,this.uint16[u+4]=h,e}}Cu.prototype.bytesPerElement=12,nt(Cu,"StructArrayLayout1ul3ui12");class Mu extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint16[1*e+0]=i,e}}Mu.prototype.bytesPerElement=2,nt(Mu,"StructArrayLayout1ui2");class Qc extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R){const O=this.length;return this.resize(O+1),this.emplace(O,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R)}emplace(e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O){const j=16*e;return this.float32[j+0]=i,this.float32[j+1]=o,this.float32[j+2]=a,this.float32[j+3]=h,this.float32[j+4]=u,this.float32[j+5]=f,this.float32[j+6]=_,this.float32[j+7]=g,this.float32[j+8]=v,this.float32[j+9]=b,this.float32[j+10]=w,this.float32[j+11]=I,this.float32[j+12]=A,this.float32[j+13]=P,this.float32[j+14]=R,this.float32[j+15]=O,e}}Qc.prototype.bytesPerElement=64,nt(Qc,"StructArrayLayout16f64");class Oa extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,o,a,h,u,f){const _=this.length;return this.resize(_+1),this.emplace(_,e,i,o,a,h,u,f)}emplace(e,i,o,a,h,u,f,_){const g=10*e,v=5*e;return this.uint16[g+0]=i,this.uint16[g+1]=o,this.uint16[g+2]=a,this.uint16[g+3]=h,this.float32[v+2]=u,this.float32[v+3]=f,this.float32[v+4]=_,e}}Oa.prototype.bytesPerElement=20,nt(Oa,"StructArrayLayout4ui3f20");class Pu extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.int16[1*e+0]=i,e}}Pu.prototype.bytesPerElement=2,nt(Pu,"StructArrayLayout1i2");class eh extends Li{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const i=this.length;return this.resize(i+1),this.emplace(i,e)}emplace(e,i){return this.uint8[1*e+0]=i,e}}eh.prototype.bytesPerElement=1,nt(eh,"StructArrayLayout1ub1");class zu extends Nl{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]}}zu.prototype.size=40;class _p extends Tu{get(e){return new zu(this,e)}}nt(_p,"CollisionBoxArray");class th extends Nl{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}
vendor: 22,045 bytes, line 12
12get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}th.prototype.size=60;class jl extends Fa{get(e){return new th(this,e)}}nt(jl,"PlacedSymbolArray");class Ru extends Nl{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}Ru.prototype.size=80;class gp extends Su{get(e){return new Ru(this,e)}}nt(gp,"SymbolInstanceArray");class Du extends Us{getoffsetX(e){return this.float32[1*e+0]}}nt(Du,"GlyphOffsetArray");class yp extends yn{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}nt(yp,"SymbolLineVertexArray");class ih extends Nl{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]}}ih.prototype.size=12;class xp extends Cu{get(e){return new ih(this,e)}}nt(xp,"FeatureIndexArray");class vp extends mo{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}nt(vp,"FillExtrusionCentroidArray");class bp extends Nl{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]}}bp.prototype.size=6;class wp extends Ma{get(e){return new bp(this,e)}}nt(wp,"FillExtrusionWallArray");const Tp=Wt([{name:"a_pos",components:2,type:"Int16"}],4),em=Wt([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),tm=Wt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class qi{constructor(e=[]){this.segments=e}_prepareSegment(e,i,o,a){let h=this.segments[this.segments.length-1];return e>qi.MAX_VERTEX_ARRAY_LENGTH&&Ht(`Max vertices per segment is ${qi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!h||h.vertexLength+e>qi.MAX_VERTEX_ARRAY_LENGTH||h.sortKey!==a)&&(h={vertexOffset:i,primitiveOffset:o,vertexLength:0,primitiveLength:0},a!==void 0&&(h.sortKey=a),this.segments.push(h)),h}prepareSegment(e,i,o,a){return this._prepareSegment(e,i.length,o.length,a)}get(){return this.segments}destroy(){for(const e of this.segments)for(const i in e.vaos)e.vaos[i].destroy()}static simpleSegment(e,i,o,a){return new qi([{vertexOffset:e,primitiveOffset:i,vertexLength:o,primitiveLength:a,vaos:{},sortKey:0}])}}function Sp(r,e){return 256*(r=W(Math.floor(r),0,255))+W(Math.floor(e),0,255)}qi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,nt(qi,"SegmentVector");const im=Wt([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),Lu=Wt([{name:"a_pattern_b",components:4,type:"Uint16"}]),rm=Wt([{name:"a_dash",components:4,type:"Uint16"}]);class Ul{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,i,o,a){this.ids.push(Gl(e)),this.positions.push(i,o,a)}eachPosition(e,i){const o=Gl(e);let a=0,h=this.ids.length-1;for(;a<h;){const u=a+h>>1;this.ids[u]>=o?h=u:a=u+1}for(;this.ids[a]===o;)i(this.positions[3*a],this.positions[3*a+1],this.positions[3*a+2]),a++}static serialize(e,i){const o=new Float64Array(e.ids),a=new Uint32Array(e.positions);return Fu(o,a,0,o.length-1),i&&(i.add(o.buffer),i.add(a.buffer)),{ids:o,positions:a}}static deserialize(e){const i=new Ul;let o;i.ids=e.ids,i.positions=e.positions;for(const a of i.ids)a!==o&&i.uniqueIds.push(a),o=a;return i.indexed=!0,i}}function Gl(r){const e=+r;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:la(String(r))}function Fu(r,e,i,o){for(;i<o;){const a=r[i+o>>1];let h=i-1,u=o+1;for(;;){do h++;while(r[h]<a);do u--;while(r[u]>a);if(h>=u)break;rh(r,h,u),rh(e,3*h,3*u),rh(e,3*h+1,3*u+1),rh(e,3*h+2,3*u+2)}u-i<o-u?(Fu(r,e,i,u),i=u+1):(Fu(r,e,u+1,o),o=u)}}function rh(r,e,i){const o=r[e];r[e]=r[i],r[i]=o}nt(Ul,"FeaturePositionMap");class Jn{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,i){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,i),this.initialized=!0),!!this.location}set(e,i,o){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class nh extends Jn{constructor(e){super(e),this.current=0}set(e,i,o){this.fetchUniformLocation(e,i)&&this.current!==o&&(this.current=o,this.gl.uniform1i(this.location,o))}}class dr extends Jn{constructor(e){super(e),this.current=0}set(e,i,o){this.fetchUniformLocation(e,i)&&this.current!==o&&(this.current=o,this.gl.uniform1f(this.location,o))}}class _o extends Jn{constructor(e){super(e),this.current=[0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]||(this.current=o,this.gl.uniform2f(this.location,o[0],o[1])))}}class ka extends Jn{constructor(e){super(e),this.current=[0,0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]||(this.current=o,this.gl.uniform3f(this.location,o[0],o[1],o[2])))}}class ql extends Jn{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,o){this.fetchUniformLocation(e,i)&&(o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]&&o[3]===this.current[3]||(this.current=o,this.gl.uniform4f(this.location,o[0],o[1],o[2],o[3])))}}class Ou extends Jn{constructor(e){super(e),this.current=ui.transparent.toPremultipliedRenderColor(null)}set(e,i,o){this.fetchUniformLocation(e,i)&&(o.r===this.current.r&&o.g===this.current.g&&o.b===this.current.b&&o.a===this.current.a||(this.current=o,this.gl.uniform4f(this.location,o.r,o.g,o.b,o.a)))}}const Ep=new Float32Array(16);class Hl extends Jn{constructor(e){super(e),this.current=Ep}set(e,i,o){if(this.fetchUniformLocation(e,i)){if(o[12]!==this.current[12]||o[0]!==this.current[0])return this.current=o,void this.gl.uniformMatrix4fv(this.location,!1,o);for(let a=1;a<16;a++)if(o[a]!==this.current[a]){this.current=o,this.gl.uniformMatrix4fv(this.location,!1,o);break}}}}const nm=new Float32Array(9),Ip=new Float32Array(4);class ku extends Jn{constructor(e){super(e),this.current=Ip}set(e,i,o){if(this.fetchUniformLocation(e,i)){for(let a=0;a<4;a++)if(o[a]!==this.current[a]){this.current=o,this.gl.uniformMatrix2fv(this.location,!1,o);break}}}}function Bu(r){return[Sp(255*r.r,255*r.g),Sp(255*r.b,255*r.a)]}class $l{constructor(e,i,o,a){this.value=e,this.uniformNames=i.map(h=>`u_${h}`),this.type=o,this.context=a}setUniform(e,i,o,a,h){const u=a.constantOr(this.value);i.set(e,h,u instanceof ui?u.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.value==="none"?null:this.context.lut):u)}getBinding(e,i){return this.type==="color"?new Ou(e):new dr(e)}}class Ba{constructor(e,i){this.uniformNames=i.map(o=>`u_${o}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,i){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=i?i.tl.concat(i.br):this.pattern}setUniform(e,i,o,a,h){let u=null;h!=="u_pattern"&&h!=="u_dash"||(u=this.pattern),h==="u_pattern_b"&&(u=this.patternTransition),h==="u_pixel_ratio"&&(u=this.pixelRatio),u&&i.set(e,h,u)}getBinding(e,i){return i==="u_pattern"||i==="u_pattern_b"||i==="u_dash"?new ql(e):new dr(e)}}class Bo{constructor(e,i,o,a){this.expression=e,this.type=o,this.maxValue=0,this.paintVertexAttributes=i.map(h=>({name:`a_${h}`,type:"Float32",components:o==="color"?2:1,offset:0})),this.paintVertexArray=new a}populatePaintArray(e,i,o,a,h,u,f,_){const g=this.paintVertexArray.length,v=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new yi(0,{brightness:u,worldview:_}),i,{},h,a,f):this.expression.kind==="constant"&&this.expression.value,b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new yi(0,{brightness:u,worldview:_}),i,{},h,a,f):this.lutExpression.value)==="none";this.paintVertexArray.resize(e),this._setPaintValue(g,e,v,b?null:this.context.lut)}updatePaintArray(e,i,o,a,h,u,f,_){const g=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:f,worldview:_},o,a,void 0,h):this.expression.kind==="constant"&&this.expression.value,v=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new yi(0,{brightness:f,worldview:_}),o,a,void 0,h):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v?null:this.context.lut)}_setPaintValue(e,i,o,a){if(this.type==="color"){const h=Bu(o.toPremultipliedRenderColor(a));for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,h[0],h[1])}else{for(let h=e;h<i;h++)this.paintVertexArray.emplace(h,o);this.maxValue=Math.max(this.maxValue,Math.abs(o))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&this.lutExpression.kind!=="constant"&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||this.expression.kind!=="constant"&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Qn{constructor(e,i,o,a,h,u){this.expression=e,this.uniformNames=i.map(f=>`u_${f}_t`),this.type=o,this.useIntegerZoom=a,this.context=h,this.maxValue=0,this.paintVertexAttributes=i.map(f=>({name:`a_${f}`,type:"Float32",components:o==="color"?4:2,offset:0})),this.paintVertexArray=new u}populatePaintArray(e,i,o,a,h,u,f,_){const g=this.expression.evaluate(new yi(this.context.zoom,{brightness:u,worldview:_}),i,{},h,a,f),v=this.expression.evaluate(new yi(this.context.zoom+1,{brightness:u,worldview:_}),i,{},h,a,f),b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new yi(0,{brightness:u,worldview:_}),i,{},h,a,f):this.lutExpression.value)==="none",w=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(w,e,g,v,b?null:this.context.lut)}updatePaintArray(e,i,o,a,h,u,f,_){const g=this.expression.evaluate({zoom:this.context.zoom,brightness:f,worldview:_},o,a,void 0,h),v=this.expression.evaluate({zoom:this.context.zoom+1,brightness:f,worldview:_},o,a,void 0,h),b=!!this.lutExpression&&(this.lutExpression.kind==="composite"||this.lutExpression.kind==="source"?this.lutExpression.evaluate(new yi(0,{brightness:f,worldview:_}),o,a,void 0,h):this.lutExpression.value)==="none";this._setPaintValue(e,i,g,v,b?null:this.context.lut)}_setPaintValue(e,i,o,a,h){if(this.type==="color"){const u=Bu(o.toPremultipliedRenderColor(h)),f=Bu(o.toPremultipliedRenderColor(h));for(let _=e;_<i;_++)this.paintVertexArray.emplace(_,u[0],u[1],f[0],f[1])}else{for(let u=e;u<i;u++)this.paintVertexArray.emplace(u,o,a);this.maxValue=Math.max(this.maxValue,Math.abs(o),Math.abs(a))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,o,a,h){const u=this.useIntegerZoom?Math.floor(o.zoom):o.zoom,f=W(this.expression.interpolationFactor(u,this.context.zoom,this.context.zoom+1),0,1);i.set(e,h,f)}getBinding(e,i){return new dr(e)}}class On{constructor(e,i,o,a,h){this.expression=e,this.layerId=h,this.paintVertexAttributes=(o==="array"?rm:im).members;for(let u=0;u<i.length;++u);this.paintVertexArray=new a,this.paintTransitionVertexArray=new za}populatePaintArray(e,i,o,a){const h=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(h,e,i.patterns&&i.patterns[this.layerId],o)}updatePaintArray(e,i,o,a,h,u,f){this._setPaintValues(e,i,o.patterns&&o.patterns[this.layerId],u)}_setPaintValues(e,i,o,a){if(!a||!o)return;const h=a[o[0]],u=a[o[1]];if(h){if(h){const{tl:f,br:_,pixelRatio:g}=h;for(let v=e;v<i;v++)this.paintVertexArray.emplace(v,f[0],f[1],_[0],_[1],g)}if(u){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:f,br:_}=u;for(let g=e;g<i;g++)this.paintTransitionVertexArray.emplace(g,f[0],f[1],_[0],_[1])}}}upload(e){const i=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,i)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,Lu.members,i))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class an{constructor(e,i,o=()=>!0){this.binders={},this._buffers=[],this.context=i;const a=[];for(const h in e.paint._values){const u=e.paint.get(h);if(h.endsWith("-use-theme")||!o(h)||!(u instanceof js&&Oc(u.property.specification)))continue;const f=sm(h,e.type),_=u.value,g=u.property.specification.type,v=!!u.property.useIntegerZoom,b=h==="line-dasharray"||h.endsWith("pattern"),w=e.paint.get(`${h}-use-theme`),I=h==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant"||w&&w.value.kind!=="constant";if(_.kind!=="constant"||I)if(_.kind==="source"||I||b){const A=Ap(h,g,"source");this.binders[h]=b?new On(_,f,g,A,e.id):new Bo(_,f,g,A),a.push(`/a_${h}`)}else{const A=Ap(h,g,"composite");this.binders[h]=new Qn(_,f,g,v,i,A),a.push(`/z_${h}`)}else this.binders[h]=b?new Ba(_.value,f):new $l(_.value,f,g,i),a.push(`/u_${h}`);w&&(this.binders[h].lutExpression=w.value)}this.cacheKey=a.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof Bo||i instanceof Qn?i.maxValue:0}populatePaintArrays(e,i,o,a,h,u,f,_){for(const g in this.binders){const v=this.binders[g];v.context=this.context,(v instanceof Bo||v instanceof Qn||v instanceof On)&&v.populatePaintArray(e,i,o,a,h,u,f,_)}}setConstantPatternPositions(e,i){for(const o in this.binders){const a=this.binders[o];a instanceof Ba&&a.setConstantPatternPositions(e,i)}}getPatternTransitionVertexBuffer(e){const i=this.binders[e];return i instanceof On?i.paintTransitionVertexBuffer:null}updatePaintArrays(e,i,o,a,h,u,f,_,g,v){let b=!1;const w=Object.keys(e),I=w.length!==0&&!_,A=I?w:i.uniqueIds;this.context.lut=h.lut;for(const P in this.binders){const R=this.binders[P];if(R.context=this.context,(R instanceof Bo||R instanceof Qn||R instanceof On)&&R.expression&&R.expression.kind&&R.expression.kind!=="constant"&&(R.expression.isStateDependent===!0||R.expression.isLightConstant===!1)){const O=h.paint.get(P);R.expression=O.value;for(const j of A){const V=e[j.toString()];i.eachPosition(j,(G,ne,ee)=>{const ie=a.feature(G);R.updatePaintArray(ne,ee,ie,V,u,f,g,v)})}if(!I)for(const j of o.uniqueIds){const V=e[j.toString()];o.eachPosition(j,(G,ne,ee)=>{const ie=a.feature(G);R.updatePaintArray(ne,ee,ie,V,u,f,g,v)})}b=!0}}return b}defines(){const e=[];for(const i in this.binders){const o=this.binders[i];(o instanceof $l||o instanceof Ba)&&e.push(...o.uniformNames.map(a=>`#define HAS_UNIFORM_${a}`))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const o=this.binders[i];if(o instanceof Bo||o instanceof Qn||o instanceof On)for(let a=0;a<o.paintVertexAttributes.length;a++)e.push(o.paintVertexAttributes[a].name);if(o instanceof On)for(let a=0;a<Lu.members.length;a++)e.push(Lu.members[a].name)}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const o=this.binders[i];if(o instanceof $l||o instanceof Ba||o instanceof Qn)for(const a of o.uniformNames)e.push(a)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const o in this.binders){const a=this.binders[o];if(a instanceof $l||a instanceof Ba||a instanceof Qn)for(const h of a.uniformNames)i.push({name:h,property:o,binding:a.getBinding(e,h)})}return i}setUniforms(e,i,o,a,h){for(const{name:u,property:f,binding:_}of o)this.binders[f].setUniform(e,_,h,a.get(f),u)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof Bo||i instanceof Qn||i instanceof On)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer),i instanceof On&&i.paintTransitionVertexBuffer&&this._buffers.push(i.paintTransitionVertexBuffer)}}upload(e){for(const i in this.binders){const o=this.binders[i];(o instanceof Bo||o instanceof Qn||o instanceof On)&&o.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof Bo||i instanceof Qn||i instanceof On)&&i.destroy()}}}class kn{constructor(e,i,o=()=>!0){this.programConfigurations={};for(const a of e)this.programConfigurations[a.id]=new an(a,i,o);this.needsUpload=!1,this._featureMap=new Ul,this._featureMapWithoutIds=new Ul,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,o,a,h,u,f,_,g){for(const v in this.programConfigurations)this.programConfigurations[v].populatePaintArrays(e,i,a,h,u,f,_,g);i.id!==void 0?this._featureMap.add(i.id,o,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,o,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,o,a,h,u,f,_){for(const g of o)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,g,a,h,u,f||0,_)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const i in this.programConfigurations)this.programConfigurations[i].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}const om={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["ga
12pwidth"],"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 sm(r,e){return om[r]||[r.replace(`${e}-`,"").replace(/-/g,"_")]}const am={"line-pattern":{source:_s,composite:_s},"fill-pattern":{source:_s,composite:_s},"fill-extrusion-pattern":{source:_s,composite:_s},"line-dasharray":{source:za,composite:za}},lm={color:{source:ys,composite:gs},number:{source:Us,composite:ys}};function Ap(r,e,i){const o=am[r];return o&&o[i]||lm[e][i]}nt($l,"ConstantBinder"),nt(Ba,"PatternConstantBinder"),nt(Bo,"SourceExpressionBinder"),nt(On,"PatternCompositeBinder"),nt(Qn,"CompositeExpressionBinder"),nt(an,"ProgramConfiguration",{omit:["_buffers"]}),nt(kn,"ProgramConfigurationSet");const Qr=Xe/Math.PI/2,Cp=5,l=6,t=16383,n=64,c=[n,32,16],d=-Qr,p=Qr;function m(r,e,i,o=Qr){return i=ii(i),[r*Math.sin(i)*o,-e*o,r*Math.cos(i)*o]}function y(r,e,i){return m(Math.cos(ii(r)),Math.sin(ii(r)),e,i)}const x=63710088e-1,T=2*Math.PI*x;class S{constructor(e,i){if(isNaN(e)||isNaN(i))throw new Error(`Invalid LngLat object: (${e}, ${i})`);if(this.lng=+e,this.lat=+i,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new S(be(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const i=Math.PI/180,o=this.lat*i,a=e.lat*i,h=Math.sin(o)*Math.sin(a)+Math.cos(o)*Math.cos(a)*Math.cos((e.lng-this.lng)*i);return x*Math.acos(Math.min(h,1))}
vendor: 5,892 bytes, line 12
12toBounds(e=0){const i=360*e/40075017,o=i/Math.cos(Math.PI/180*this.lat);return new C({lng:this.lng-o,lat:this.lat-i},{lng:this.lng+o,lat:this.lat+i})}toEcef(e){return y(this.lat,this.lng,Qr+e*Qr/x)}static convert(e){if(e instanceof S)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new S(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new S(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class C{constructor(e,i){if(e)if(i)this.setSouthWest(e).setNorthEast(i);else if(e.length===4){const o=e;this.setSouthWest([o[0],o[1]]).setNorthEast([o[2],o[3]])}else{const o=e;this.setSouthWest(o[0]).setNorthEast(o[1])}}setNorthEast(e){return this._ne=e instanceof S?new S(e.lng,e.lat):S.convert(e),this}setSouthWest(e){return this._sw=e instanceof S?new S(e.lng,e.lat):S.convert(e),this}extend(e){const i=this._sw,o=this._ne;let a,h;if(e instanceof S)a=e,h=e;else{if(!(e instanceof C))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(C.convert(e)):this.extend(S.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(S.convert(e)):this;if(a=e._sw,h=e._ne,!a||!h)return this}return i||o?(i.lng=Math.min(a.lng,i.lng),i.lat=Math.min(a.lat,i.lat),o.lng=Math.max(h.lng,o.lng),o.lat=Math.max(h.lat,o.lat)):(this._sw=new S(a.lng,a.lat),this._ne=new S(h.lng,h.lat)),this}getCenter(){return new S((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 S(this.getWest(),this.getNorth())}getSouthEast(){return new S(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:o}=S.convert(e);let a=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(a=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=o&&o<=this._ne.lat&&a}static convert(e){if(e)return e instanceof C?e:new C(e)}}const E=0,M=25.5;function D(r){return T*Math.cos(r*Math.PI/180)}function z(r){return(180+r)/360}function F(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function L(r,e){return r/D(e)}function N(r){return 360*r-180}function U(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function q(r,e){return r*D(U(e))}const Y=85.051129;function te(r){return Math.cos(ii(W(r,-Y,Y)))}function re(r,e){const i=W(e,E,M),o=Math.pow(2,i);return te(r)*T/(512*o)}function K(r){return 1/Math.cos(r*Math.PI/180)}function J(r,e=0){const i=Math.exp(Math.PI*(1-(r.y+e/Xe)/(1<<r.z)*2));return 80150034*i/(i*i+1)/Xe/(1<<r.z)}class Q{constructor(e,i,o=0){this.x=+e,this.y=+i,this.z=+o}static fromLngLat(e,i=0){const o=S.convert(e);return new Q(z(o.lng),F(o.lat),L(i,o.lat))}toLngLat(){return new S(N(this.x),U(this.y))}toAltitude(){return q(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/T*K(U(this.y))}}function me(r,e,i,o,a,h,u,f,_){const g=(e+o)/2,v=(i+a)/2,b=new Be(g,v);f(b),function(w,I,A,P,R,O){const j=A-R,V=P-O;return Math.abs((P-I)*j-(A-w)*V)/Math.hypot(j,V)}(b.x,b.y,h.x,h.y,u.x,u.y)>=_?(me(r,e,i,g,v,h,b,f,_),me(r,g,v,o,a,b,u,f,_)):r.push(u)}function ae(r,e,i){let o=r[0],a=o.x,h=o.y;e(o);const u=[o];for(let f=1;f<r.length;f++){const _=r[f],{x:g,y:v}=_;e(_),me(u,a,h,g,v,o,_,e,i),a=g,h=v,o=_}return u}function Ae(r,e,i,o){if(o(e,i)){const a=e.add(i)._mult(.5);Ae(r,e,a,o),Ae(r,a,i,o)}else r.push(i)}function ve(r,e){let i=r[0];const o=[i];for(let a=1;a<r.length;a++){const h=r[a];Ae(o,i,h,e),i=h}return o}const Me=Math.pow(2,14)-1,Ue=-Me-1;function _e(r,e){const i=Math.round(r.x*e),o=Math.round(r.y*e);return r.x=W(i,Ue,Me),r.y=W(o,Ue,Me),(i<r.x||i>r.x+1||o<r.y||o>r.y+1)&&Ht("Geometry exceeds allowed extent, reduce your vector tile buffer size"),r}function se(r,e,i){const o=r.loadGeometry(),a=r.extent,h=Xe/a;if(e&&i&&i.projection.isReprojectedInTileSpace){const u=1<<e.z,{scale:f,x:_,y:g,projection:v}=i,b=w=>{const I=N((e.x+w.x/a)/u),A=U((e.y+w.y/a)/u),P=v.project(I,A);w.x=(P.x*f-_)*a,w.y=(P.y*f-g)*a};for(let w=0;w<o.length;w++)if(r.type!==1)o[w]=ae(o[w],b,1);else{const I=[];for(const A of o[w])A.x<0||A.x>=a||A.y<0||A.y>=a||(b(A),I.push(A));o[w]=I}}for(const u of o)for(const f of u)_e(f,h);return o}function Te(r,e){return{type:r.type,id:r.id,properties:r.properties,geometry:e?se(r):[]}}class ge{constructor(e,i,o,a,h){this.properties={},this.extent=o,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=a,this._values=h,e.readFields(Re,this,i)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos,o=[];let a,h=1,u=0,f=0,_=0;for(;e.pos<i;){if(u<=0){const g=e.readVarint();h=7&g,u=g>>3}if(u--,h===1||h===2)f+=e.readSVarint(),_+=e.readSVarint(),h===1&&(a&&o.push(a),a=[]),a&&a.push(new Be(f,_));else{if(h!==7)throw new Error(`unknown command ${h}`);a&&a.push(a[0].clone())}}return a&&o.push(a),o}bbox(){const e=this._pbf;e.pos=this._geometry;const i=e.readVarint()+e.pos;let o=1,a=0,h=0,u=0,f=1/0,_=-1/0,g=1/0,v=-1/0;for(;e.pos<i;){if(a<=0){const b=e.readVarint();o=7&b,a=b>>3}if(a--,o===1||o===2)h+=e.readSVarint(),u+=e.readSVarint(),h<f&&(f=h),h>_&&(_=h),u<g&&(g=u),u>v&&(v=u);else if(o!==7)throw new Error(`unknown command ${o}`)}return[f,g,_,v]}toGeoJSON(e,i,o){const a=this.extent*Math.pow(2,o),h=this.extent*e,u=this.extent*i,f=this.loadGeometry();function _(w){return[360*(w.x+h)/a-180,360/Math.PI*Math.atan(Math.exp((1-2*(w.y+u)/a)*Math.PI))-90]}function g(w){return w.map(_)}let v;
12if(this.type===1){const w=[];for(const A of f)w.push(A[0]);const I=g(w);v=w.length===1?{type:"Point",coordinates:I[0]}:{type:"MultiPoint",coordinates:I}}else if(this.type===2){const w=f.map(g);v=w.length===1?{type:"LineString",coordinates:w[0]}:{type:"MultiLineString",coordinates:w}}else{if(this.type!==3)throw new Error("unknown feature type");{const w=function(A){const P=A.length;if(P<=1)return[A];const R=[];let O,j;for(let V=0;V<P;V++){const G=De(A[V]);G!==0&&(j===void 0&&(j=G<0),j===G<0?(O&&R.push(O),O=[A[V]]):O&&O.push(A[V]))}return O&&R.push(O),R}(f),I=[];for(const A of w)I.push(A.map(g));v=I.length===1?{type:"Polygon",coordinates:I[0]}:{type:"MultiPolygon",coordinates:I}}}const b={type:"Feature",geometry:v,properties:this.properties};return this.id!=null&&(b.id=this.id),b}}function Re(r,e,i){r===1?e.id=i.readVarint():r===2?function(o,a){const h=o.readVarint()+o.pos;for(;o.pos<h;){const u=a._keys[o.readVarint()],f=a._values[o.readVarint()];a.properties[u]=f}}(i,e):r===3?e.type=i.readVarint():r===4&&(e._geometry=i.pos)}function De(r){let e=0;for(let i,o,a=0,h=r.length,u=h-1;a<h;u=a++)i=r[a],o=r[u],e+=(o.x-i.x)*(i.y+o.y);return e}ge.types=["Unknown","Point","LineString","Polygon"];class Fe{constructor(e,i){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(We,this,i),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const i=this._pbf.readVarint()+this._pbf.pos;return new ge(this._pbf,i,this.extent,this._keys,this._values)}}function We(r,e,i){r===15?e.version=i.readVarint():r===1?e.name=i.readString():r===5?e.extent=i.readVarint():r===2?e._features.push(i.pos):r===3?e._keys.push(i.readString()):r===4&&e._values.push(function(o){let a=null;const h=o.readVarint()+o.pos;for(;o.pos<h;){const u=o.readVarint()>>3;a=u===1?o.readString():u===2?o.readFloat():u===3?o.readDouble():u===4?o.readVarint64():u===5?o.readVarint():u===6?o.readSVarint():u===7?o.readBoolean():null}if(a==null)throw new Error("unknown feature value");return a}(i))}class lt{constructor(e,i){this.layers=e.readFields(pt,{},i)}}function pt(r,e,i){if(r===3){const o=new Fe(i,i.readVarint()+i.pos);o.length&&(e[o.name]=o)}}const et="3d_elevation_id",ut="level";class ct{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(e,i){return this._valid&&e(i(this._geometry)),this}require(e,i,o){return this.get(e,!0,i,o)}optional(e,i,o){return this.get(e,!1,i,o)}success(){return this._valid}get(e,i,o,a){const h=this.feature.properties.hasOwnProperty(e)?+this.feature.properties[e]:void 0;return this._valid&&h!==void 0&&!Number.isNaN(h)?o(a?a(h):h):i&&(this._valid=!1),this}}class Tt{constructor(e,i){this.featureFunc=e,this.vertexFunc=i}parseFeature(e,i,o){return this.featureFunc(e,i,o)}parseVertex(e,i,o){return this.vertexFunc(e,i,o)}}const Mt=new Tt((r,e,i)=>r.reset(e).require(et,o=>{i.id=o}).optional("fixed_height_relative",o=>{i.constantHeight=o},Jt.decodeRelativeHeight).geometry(o=>{i.bounds=o},Dh).success(),(r,e,i)=>r.reset(e).require(et,o=>{i.id=o}).require("elevation_idx",o=>{i.idx=o}).require("extent",o=>{i.extent=o}).require("height_relative",o=>{i.height=o},Jt.decodeRelativeHeight).geometry(o=>{i.position=o},Jt.getPoint).success()),Bt=new Tt((r,e,i)=>r.reset(e).require(et,o=>{i.id=o}).optional("fixed_height",o=>{i.constantHeight=o},Jt.decodeMetricHeight).geometry(o=>{i.bounds=o},Dh).success(),(r,e,i)=>r.reset(e).require(et,o=>{i.id=o}).require("elevation_idx",o=>{i.idx=o}).require("extent",o=>{i.extent=o}).require("height",o=>{i.height=o},Jt.decodeMetricHeight).geometry(o=>{i.position=o},Jt.getPoint).success());class Jt{static getPoint(e){return Mn(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static parse(e){const i=[],o=[],a=e.length,h=new ct;for(let f=0;f<a;f++){const _=e.feature(f),g=_.properties.version,v=(u=g)?u==="1.0.1"?Bt:void 0:Mt;if(v===void 0){Ht(`Unknown elevation feature version number ${g||"(unknown)"}`);continue}const b=_.properties.hasOwnProperty("type")?_.properties.type:void 0;if(b){if(ge.types[_.type]==="Point"&&b==="curve_point"){const w={};v.parseVertex(h,_,w)&&i.push(w)}else if(ge.types[_.type]==="Polygon"&&b==="curve_meta"){const w={};v.parseFeature(h,_,w)&&o.push(w)}}}var u;return{vertices:i,features:o}}}class At{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,o){const a=Bi(i,this.dir);if(Math.abs(a)<1e-6)return!1;const h=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1])/a;return o[0]=this.pos[0]+this.dir[0]*h,o[1]=this.pos[1]+this.dir[1]*h,!0}}class Qt{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,o){const a=ar(i,this.dir);if(Math.abs(a)<1e-6)return!1;const h=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/a;return o[0]=this.pos[0]+this.dir[0]*h,o[1]=this.pos[1]+this.dir[1]*h,o[2]=this.pos[2]+this.dir[2]*h,!0}closestPointOnSphere(e,i,o){if(function(I,A){var P=I[0],R=I[1],O=I[2],j=A[0],V=A[1],G=A[2];return Math.abs(P-j)<=li*Math.max(1,Math.abs(P),Math.abs(j))&&Math.abs(R-V)<=li*Math.max(1,Math.abs(R),Math.abs(V))&&Math.abs(O-G)<=li*Math.max(1,Math.abs(O),Math.abs(G))}(this.pos,e)||i===0)return o[0]=o[1]=o[2]=0,!1;const[a,h,u]=this.dir,f=this.pos[0]-e[0],_=this.pos[1]-e[1],g=this.pos[2]-e[2],v=a*
vendor: 6,893 bytes, line 12
12a+h*h+u*u,b=2*(f*a+_*h+g*u),w=b*b-4*v*(f*f+_*_+g*g-i*i);if(w<0){const I=Math.max(-b/2,0),A=f+a*I,P=_+h*I,R=g+u*I,O=Math.hypot(A,P,R);return o[0]=A*i/O,o[1]=P*i/O,o[2]=R*i/O,!1}{const I=(-b-Math.sqrt(w))/(2*v);if(I<0){const A=Math.hypot(f,_,g);return o[0]=f*i/A,o[1]=_*i/A,o[2]=g*i/A,!1}return o[0]=f+a*I,o[1]=_+h*I,o[2]=g+u*I,!0}}}class ri{constructor(e,i,o,a,h){this.TL=e,this.TR=i,this.BR=o,this.BL=a,this.horizon=h}static fromInvProjectionMatrix(e,i,o){const a=[-1,1,1],h=[1,1,1],u=[1,-1,1],f=[-1,-1,1],_=lr(a,a,e),g=lr(h,h,e),v=lr(u,u,e),b=lr(f,f,e);return new ri(_,g,v,b,i/o)}}function Si(r,e,i){let o=1/0,a=-1/0;const h=[];for(const u of r){cr(h,u,e);const f=ar(h,i);o=Math.min(o,f),a=Math.max(a,f)}return[o,a]}function Ft(r,e){let i=!0;for(let o=0;o<r.planes.length;o++){const a=r.planes[o];let h=0;for(let u=0;u<e.length;u++)h+=ar(a,e[u])+a[3]>=0;if(h===0)return 0;h!==e.length&&(i=!1)}return i?2:1}function ei(r,e){for(const i of r.projections){const o=Si(e,r.points[0],i.axis);if(i.projection[1]<o[0]||i.projection[0]>o[1])return 0}return 1}function ti(r,e){let i=0;const o=[0,0,0,0];for(let u=0;u<r.length;u++)o[0]=r[u][0],o[1]=r[u][1],o[2]=r[u][2],o[3]=1,(a=o)[0]*(h=e)[0]+a[1]*h[1]+a[2]*h[2]+a[3]*h[3]>=0&&i++;var a,h;return i}class si{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([0,0,0,0]),this.bounds=Nt.fromPoints(this.points),this.projections=[],this.frustumEdges=[cr([],this.points[2],this.points[3]),cr([],this.points[0],this.points[3]),cr([],this.points[4],this.points[0]),cr([],this.points[5],this.points[1]),cr([],this.points[6],this.points[2]),cr([],this.points[7],this.points[3])];for(const o of this.frustumEdges){const a=[0,-o[2],o[1]],h=[o[2],0,-o[0]];this.projections.push({axis:a,projection:Si(this.points,this.points[0],a)}),this.projections.push({axis:h,projection:Si(this.points,this.points[0],h)})}}static fromInvProjectionMatrix(e,i,o,a){const h=Math.pow(2,o),u=[[-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(g=>{const v=vn([],g,e),b=1/v[3]/i*h;return(w=v)[0]=(I=v)[0]*(A=[b,b,a?1/v[3]:b,b])[0],w[1]=I[1]*A[1],w[2]=I[2]*A[2],w[3]=I[3]*A[3],w;var w,I,A}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(g=>{const v=ki([],yr([],cr([],u[g[0]],u[g[1]]),cr([],u[g[2]],u[g[1]]))),b=-ar(v,u[g[1]]);return v.concat(b)}),_=[];for(let g=0;g<u.length;g++)_.push([u[g][0],u[g][1],u[g][2]]);return new si(_,f)}intersectsPrecise(e,i,o){for(let a=0;a<i.length;a++)if(!ti(e,i[a]))return 0;for(let a=0;a<this.planes.length;a++)if(!ti(e,this.planes[a]))return 0;for(const a of o)for(const h of this.frustumEdges){const u=yr([],a,h),f=jr(u);if(f===0)continue;Vi(u,u,1/f);const _=Si(this.points,this.points[0],u),g=Si(e,this.points[0],u);if(_[0]>g[1]||g[0]>_[1])return 0}return 1}containsPoint(e){for(const i of this.planes){const o=i[3];if(ar([i[0],i[1],i[2]],e)+o<0)return!1}return!0}}class Nt{static fromPoints(e){const i=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(const a of e)Eo(i,i,a),Hn(o,o,a);return new Nt(i,o)}static fromTileIdAndHeight(e,i,o){const a=1<<e.canonical.z,h=e.canonical.x,u=e.canonical.y;return new Nt([h/a,u/a,i],[(h+1)/a,(u+1)/a,o])}static applyTransform(e,i){const o=e.getCorners();for(let a=0;a<o.length;++a)lr(o[a],o[a],i);return Nt.fromPoints(o)}static applyTransformFast(e,i){const o=[i[12],i[13],i[14]],a=[...o];for(let h=0;h<3;h++)for(let u=0;u<3;u++){const f=i[4*u+h],_=f*e.min[u],g=f*e.max[u];o[h]+=Math.min(_,g),a[h]+=Math.max(_,g)}return new Nt(o,a)}static projectAabbCorners(e,i){const o=e.getCorners();for(let a=0;a<o.length;++a)lr(o[a],o[a],i);return o}constructor(e,i){this.min=e,this.max=i,this.center=Vi([],Ui([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],o=Js(this.min),a=Js(this.max);for(let h=0;h<i.length;h++)o[h]=i[h]?this.min[h]:this.center[h],a[h]=i[h]?this.center[h]:this.max[h];return a[2]=this.max[2],new Nt(o,a)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,i=this.max;return[[e[0],e[1],e[2]],[i[0],e[1],e[2]],[i[0],i[1],e[2]],[e[0],i[1],e[2]],[e[0],e[1],i[2]],[i[0],e[1],i[2]],[i[0],i[1],i[2]],[e[0],i[1],i[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?Ft(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?Ft(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,i){return i||this.intersects(e)?ei(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?ei(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let i=0;i<3;++i)if(this.min[i]>e.max[i]||e.min[i]>this.max[i])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e.min[i]),this.max[i]=Math.max(this.max[i],e.max[i])}encapsulatePoint(e){for(let i=0;i<3;i++)this.min[i]=Math.min(this.min[i],e[i]),this.max[i]=Math.max(this.max[i],e[i])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}nt(Nt,"Aabb");class mi{constructor(e,i){this.feature=e,this.metersToTile=i,this.index=0}get(){const e=this.feature.vertices[this.index],i=this.feature.vertexProps[this.index].dir,o=i[1],a=-i[0],h=(e.extent+1)*this.metersToTile;return[new Be(Math.trunc(e.position[0]+o*h),Math.trunc(e.position[1]+a*h)),new Be(Math.trunc(e.position[0]-o*h),Math.trunc(e.position[1]-a*h))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class ni{constructor(e,i,o,a,h,u){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this.id=e,this.heightRange={min:o,max:o},this.safeArea=i,this.constantHeight=o,this.constantHeight==null&&(this.constantHeight!=null||a.length!==0)){this.vertices=a,this.edges=h,this.edges=this.edges.filter(f=>{return f.a<this.vertices.length&&f.b<this.vertices.length&&!((_=this.vertices[f.a].position)[0]===(g=this.vertices[f.b].position)[0]&&_[1]===g[1]);var _,g}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const f of this.vertices)this.vertexProps.push({dir:Mn(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,f.height),this.heightRange.max=Math.max(this.heightRange.max,f.height);for(const f of this.edges){const _=this.vertices[f.a].position,g=this.vertices[f.b].position,v=Po(Wr(),g,_),b=Jo(v),w=Ko(Wr(),v,1/b);this.edgeProps.push({vec:v,dir:w,len:b});const I=this.vertexProps[f.a].dir,A=this.vertexProps[f.b].dir;
12Yo(I,I,w),Yo(A,A,w)}for(const f of this.vertexProps)f.dir[0]===0&&f.dir[1]===0||ia(f.dir,f.dir);this.tessellate(u)}}pointElevation(e){if(this.constantHeight!=null)return this.constantHeight;const i=this.getClosestEdge(e);if(i==null)return 0;const[o,a]=i;return mt(this.vertices[this.edges[o].a].height,this.vertices[this.edges[o].b].height,a)}computeSlopeNormal(e,i){const o=this.getClosestEdge(e);if(!o)return gr(0,0,1);const a=o[0],h=this.edges[a],u=this.edgeProps[a].vec,f=gr(u[0],u[1],(this.vertices[h.b].height-this.vertices[h.a].height)*i),_=gr(f[1],-f[0],0);yr(_,_,f);const g=jr(_);return g>0?Vi(_,_,1/g):gr(0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(this.edges.length===0)return;let i=0,o=Number.POSITIVE_INFINITY,a=0;const h=Mn(e.x,e.y);for(let u=0;u<this.edges.length;u++){const f=this.edges[u],_=this.edgeProps[u].dir,g=new At(h,this.edgeProps[u].dir),v=this.vertices[f.a].position,b=this.vertices[f.b].position,w=Wr(),I=Wr(),A=g.intersectsPlane(v,this.vertexProps[f.a].dir,w),P=g.intersectsPlane(b,this.vertexProps[f.b].dir,I);if(!A||!P)continue;const R=Po(Wr(),I,w),O=Po(Wr(),h,w),j=Bi(R,R),V=j>0?Bi(O,R)/j:0,G=W(V,0,1),ne=Math.abs((V-G)*this.edgeProps[u].len),ee=Po(Wr(),h,v),ie=ne+Math.abs(Bi(ee,Mn(_[1],-_[0])));ie<o&&(i=u,o=ie,a=G)}return[i,a]}tessellate(e){for(let i=this.edges.length-1;i>=0;--i){const o=this.edges[i].a,a=this.edges[i].b,{position:h,height:u,extent:f}=this.vertices[o],{position:_,height:g,extent:v}=this.vertices[a],b=this.vertexProps[o].dir,w=this.vertexProps[a].dir,I=gr(h[0]/e,h[1]/e,u),A=gr(_[0]/e,_[1]/e,g),P=gr(b[1],-b[0],0);Vi(P,P,f);const R=gr(w[1],-w[0],0);if(Vi(R,R,v),this.distSqLines(gr(I[0]+.5*P[0],I[1]+.5*P[1],I[2]+.5*P[2]),gr(A[0]-.5*R[0],A[1]-.5*R[1],A[2]-.5*R[2]),gr(I[0]-.5*P[0],I[1]-.5*P[1],I[2]-.5*P[2]),gr(A[0]+.5*R[0],A[1]+.5*R[1],A[2]+.5*R[2]))<=.0025000000000000005)continue;const O=this.vertices.length,j=Yo(Wr(),h,_);this.vertices.push({position:Ko(j,j,.5),height:.5*(u+g),extent:.5*(f+v)});const V=Yo(Wr(),b,w);this.vertexProps.push({dir:ia(V,V)}),this.edges.splice(i,1),this.edgeProps.splice(i,1),this.edges.push({a:o,b:O}),this.edges.push({a:O,b:a});const G=Po(Wr(),this.vertices[O].position,h),ne=Jo(G),ee={vec:G,dir:Ko(Wr(),G,1/ne),len:ne};this.edgeProps.push(ee),this.edgeProps.push(ee)}}distSqLines(e,i,o,a){const h=xn(fi(),i,e),u=xn(fi(),a,o),f=xn(fi(),e,o),_=ar(h,h),g=ar(h,u),v=ar(h,f),b=ar(u,u),w=ar(u,f),I=_*b-g*g;if(I===0){const R=ar(f,u)/ar(u,u);return Qs(hn(fi(),o,a,R),e)}const A=(g*w-v*b)/I,P=(_*w-g*v)/I;return Qs(hn(fi(),e,i,A),hn(fi(),o,a,P))}}class Hi{static parseFrom(e,i){const o=Jt.parse(e);if(!o)return[];let{vertices:a,features:h}=o;const u=1/J(i);h.sort((v,b)=>v.id-b.id),a.sort((v,b)=>v.id-b.id||v.idx-b.idx),a=a.filter((v,b,w)=>b===w.findIndex(I=>I.id===v.id&&I.idx===v.idx));const f=new Array;let _=0;const g=a.length;for(const v of h){if(v.constantHeight){f.push(new ni(v.id,v.bounds,v.constantHeight));continue}for(;_!==g&&a[_].id<v.id;)_++;if(_===g||a[_].id!==v.id)continue;const b=new Array,w=new Array,I=_;for(;_!==g&&a[_].id===v.id;){const A=a[_];if(b.push({position:A.position,height:A.height,extent:A.extent}),_!==I&&a[_-1].idx===A.idx-1){const P=_-I;w.push({a:P-1,b:P})}_++}f.push(new ni(v.id,v.bounds,void 0,b,w,u))}return f}static getElevationFeature(e,i){if(!i)return;const o=+e.properties[et];return Number.isNaN(o)?void 0:i.find(a=>a.id===o)}}class Yt{constructor(e,i){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(i)||(this.zScale=Math.pow(2,i.z-e.z),this.xOffset=(e.x*this.zScale-i.x)*Xe,this.yOffset=(e.y*this.zScale-i.y)*Xe)}constantElevation(e,i){if(e.constantHeight!=null)return this.computeBiasedHeight(e.constantHeight,i)}pointElevation(e,i,o){const a=this.constantElevation(i,o);return a??(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(i.pointElevation(e),o))}computeBiasedHeight(e,i){return i<=0?e:e+i*ce(0,i,e>=0?e:Math.abs(.5*e))}}nt(ni,"ElevationFeature");class ai{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new yn,this.indexArray=new Ni,this.segments=new qi,this.programConfigurations=new kn(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>
vendor: 10,389 bytes, line 12
12i.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new Us),this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,o,a){const h=this.layers[0],u=[];let f=null;h.type==="circle"&&(f=h.layout.get("circle-sort-key"));for(const{feature:g,id:v,index:b,sourceLayerIndex:w}of e){const I=this.layers[0]._featureFilter.needGeometry,A=Te(g,I);if(!this.layers[0]._featureFilter.filter(new yi(this.zoom,{worldview:this.worldview}),A,o))continue;const P=f?f.evaluate(A,{},o):void 0,R={id:v,properties:g.properties,type:g.type,sourceLayerIndex:w,index:b,geometry:I?A.geometry:se(g,o,a),patterns:{},sortKey:P};u.push(R)}f&&u.sort((g,v)=>g.sortKey-v.sortKey);let _=null;a.projection.name==="globe"&&(this.globeExtVertexArray=new Yc,_=a.projection);for(const g of u){const{geometry:v,index:b,sourceLayerIndex:w}=g,I=e[b].feature;this.addFeature(g,v,b,i.availableImages,o,_,i.brightness,i.elevationFeatures),i.featureIndex.insert(I,v,b,w,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,i,o,a,h,u,f){this.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Tp.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,tm.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,em.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(e,i,o,a,h,u,f,_){let g;this.elevationMode!=="none"&&(g=Hi.getElevationFeature(e,_));for(const v of i)for(const b of v){const w=b.x,I=b.y;if(w<0||w>=Xe||I<0||I>=Xe)continue;if(u){const R=u.projectTilePoint(w,I,h),O=u.upVector(h,w,I);this.addGlobeExtVertex(R,O),this.addGlobeExtVertex(R,O),this.addGlobeExtVertex(R,O),this.addGlobeExtVertex(R,O)}const A=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),P=A.vertexLength;if(this.addCircleVertex(w,I,-1,-1),this.addCircleVertex(w,I,1,-1),this.addCircleVertex(w,I,1,1),this.addCircleVertex(w,I,-1,1),this.elevationMode!=="none"){const R=g?g.pointElevation(new Be(w,I)):0;this.hasElevation=this.hasElevation||R!==0;for(let O=0;O<4;O++)this.elevatedLayoutVertexArray.emplaceBack(R)}this.indexArray.emplaceBack(P,P+1,P+2),this.indexArray.emplaceBack(P,P+2,P+3),A.vertexLength+=4,A.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,{},a,h,f,void 0,this.worldview)}addCircleVertex(e,i,o,a){this.layoutVertexArray.emplaceBack(2*e+(o+1)/2,2*i+(a+1)/2)}addGlobeExtVertex(e,i){this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}}function wi(r,e){for(let i=0;i<r.length;i++)if(Gr(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Gr(r,e[i]))return!0;return!!Fr(r,e)}function pr(r,e,i){return!!Gr(r,e)||!!Ur(e,r,i)}function hr(r,e){if(r.length===1)return eo(e,r[0]);for(let i=0;i<e.length;i++){const o=e[i];for(let a=0;a<o.length;a++)if(Gr(r,o[a]))return!0}for(let i=0;i<r.length;i++)if(eo(e,r[i]))return!0;for(let i=0;i<e.length;i++)if(Fr(r,e[i]))return!0;return!1}function mr(r,e,i){if(r.length>1){if(Fr(r,e))return!0;for(let o=0;o<e.length;o++)if(Ur(e[o],r,i))return!0}for(let o=0;o<r.length;o++)if(Ur(r[o],e,i))return!0;return!1}function Fr(r,e){if(r.length===0||e.length===0)return!1;for(let i=0;i<r.length-1;i++){const o=r[i],a=r[i+1];for(let h=0;h<e.length-1;h++)if(ao(o,a,e[h],e[h+1]))return!0}return!1}function ao(r,e,i,o){return rr(r,i,o)!==rr(e,i,o)&&rr(r,e,i)!==rr(r,e,o)}function ln(r,e,i){return(r.x-i.x)*(e.y-i.y)-(r.y-i.y)*(e.x-i.x)}function Sn(r,e,i,o){const a=ln(r,e,o),h=ln(r,e,i);if(Math.sign(a)===Math.sign(h))return;const u=ln(i,o,r),f=u+h-a;return Math.sign(u)!==Math.sign(f)?[u/(u-f),h/(h-a)]:void 0}function Ur(r,e,i){const o=i*i;if(e.length===1)return r.distSqr(e[0])<o;for(let a=1;a<e.length;a++)if(Bn(r,e[a-1],e[a])<o)return!0;return!1}function Bn(r,e,i){const o=e.distSqr(i);if(o===0)return r.distSqr(e);const a=((r.x-e.x)*(i.x-e.x)+(r.y-e.y)*(i.y-e.y))/o;return r.distSqr(a<0?e:a>1?i:i.sub(e)._mult(a)._add(e))}function eo(r,e){let i,o,a,h=!1;for(let u=0;u<r.length;u++){i=r[u];for(let f=0,_=i.length-1;f<i.length;_=f++)o=i[f],a=i[_],o.y>e.y!=a.y>e.y&&e.x<(a.x-o.x)*(e.y-o.y)/(a.y-o.y)+o.x&&(h=!h)}return h}function Gr(r,e){let i=!1;for(let o=0,a=r.length-1;o<r.length;a=o++){const h=r[o],u=r[a];h.y>e.y!=u.y>e.y&&e.x<(u.x-h.x)*(e.y-h.y)/(u.y-h.y)+h.x&&(i=!i)}return i}function nr(r,e,i,o,a){for(const u of r)if(e<=u.x&&i<=u.y&&o>=u.x&&a>=u.y)return!0;const h=[new Be(e,i),new Be(e,a),new Be(o,a),new Be(o,i)];if(r.length>2){for(const u of h)if(Gr(r,u))return!0}for(let u=0;u<r.length-1;u++)if(Ki(r[u],r[u+1],h))return!0;return!1}function Ki(r,e,i){const o=i[0],a=i[2];if(r.x<o.x&&e.x<o.x||r.x>a.x&&e.x>a.x||r.y<o.y&&e.y<o.y||r.y>a.y&&e.y>a.y)return!1;const h=rr(r,e,i[0]);return h!==rr(r,e,i[1])||h!==rr(r,e,i[2])||h!==rr(r,e,i[3])}function Ii(r,e,i,o,a,h){let u=e.y-r.y,f=r.x-e.x;if(h=h||0){const _=u*u+f*f;if(_===0)return!0;const g=Math.sqrt(_);u/=g,f/=g}return!((i.x-r.x)*u+(i.y-r.y)*f-h<0||(o.x-r.x)*u+(o.y-r.y)*f-h<0||(a.x-r.x)*u+(a.y-r.y)*f-h<0)}function Tr(r,e,i,o,a,h,u){return!(Ii(r,e,o,a,h,u)||Ii(e,i,o,a,h,u)||Ii(i,r,o,a,h,u)||Ii(o,a,r,e,i,u)||Ii(a,h,r,e,i,u)||Ii(h,o,r,e,i,u))}function Or(r,e,i){const o=e.paint.get(r).value;return o.kind==="constant"?o.value:i.programConfigurations.get(e.id).getMaxValue(r)}function or(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Nn(r,e,i,o,a){if(!e[0]&&!e[1])return r;const h=Be.convert(e)._mult(a);i==="viewport"&&h._rotate(-o);const u=[];for(let f=0;f<r.length;f++)u.push(r[f].sub(h));return u}function qs(r,e,i,o){const a=Be.convert(r)._mult(o);return e==="viewport"&&a._rotate(-i),a}let xs,Na;function Va(r,e,i){var o=2*Math.PI*6378137/256/Math.pow(2,i);return[r*o-2*Math.PI*6378137/2,e*o-2*Math.PI*6378137/2]}nt(ai,"CircleBucket",{omit:["layers"]});class Vn{constructor(e,i,o){this.z=e,this.x=i,this.y=o,this.key=jn(0,e,e,i,o)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}isChildOf(e){const i=this.z-e.z;return e.z===0||e.z<this.z&&e.x===this.x>>i&&e.y===this.y>>i}url(e,i){const o=function(h,u,f){var _=Va(256*h,256*(u=Math.pow(2,f)-u-1),f),g=Va(256*(h+1),256*(u+1),f);return _[0]+","+_[1]+","+g[0]+","+g[1]}(this.x,this.y,this.z),a=function(h,u,f){let _,g="";for(let v=h;v>0;v--)_=1<<v-1,g+=(u&_?1:0)+(f&_?2:0);return g}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(i==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",a).replace("{bbox-epsg-3857}",o)}toString(){return`${this.z}/${this.x}/${this.y}`}}class go{constructor(e,i){this.wrap=e,this.canonical=i,this.key=jn(e,i.z,i.z,i.x,i.y)}}class Sr{constructor(e,i,o,a,h){this.overscaledZ=e,this.wrap=i,this.canonical=new Vn(o,+a,+h),this.key=i===0&&e===o?this.canonical.key:jn(i,e,o,a,h)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const i=this.canonical.z-e;return e>this.canonical.z?new Sr(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Sr(e,this.wrap,e,this.canonical.x>>i,this.canonical.y>>i)}calculateScaledKey(e,i=!0){if(this.overscaledZ===e&&i)return this.key;if(e>this.canonical.z)return jn(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const o=this.canonical.z-e;return jn(this.wrap*+i,e,e,this.canonical.x>>o,this.canonical.y>>o)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const i=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>i&&e.canonical.y===this.canonical.y>>i}children(e){if(this.overscaledZ>=e)return[new Sr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,o=2*this.canonical.x,a=2*this.canonical.y;return[new Sr(i,this.wrap,i,o,a),new Sr(i,this.wrap,i,o+1,a),new Sr(i,this.wrap,i,o,a+1),new Sr(i,this.wrap,i,o+1,a+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Sr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Sr(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new go(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function jn(r,e,i,o,a){const h=1<<Math.min(i,22);let u=h*(a%h)+o%h;return r&&i<22&&(u+=h*h*((r<0?-2*r-1:2*r)%(1<<2*(22-i)))),16*(32*u+i)+(e-i)}const Hs=[r=>{let e=r.canonical.x-1,i=r.wrap;return e<0&&(e=(1<<r.canonical.z)-1,i--),new Sr(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>{let e=r.canonical.x+1,i=r.wrap;return e===1<<r.canonical.z&&(e=0,i++),new Sr(r.overscaledZ,i,r.canonical.z,e,r.canonical.y)},r=>new Sr(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,(r.canonical.y===0?1<<r.canonical.z:r.canonical.y)-1),r=>new Sr(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y===(1<<r.canonical.z)-1?0:r.canonical.y+1)];nt(Vn,"CanonicalTileID"),nt(Sr,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const D0=Wt([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Mp}=D0,L0=Wt([{name:"a_pos_3",components:3,type:"Int16"}]);var D_=Wt([{name:"a_pos",type:"Int16",components:2}]);function Pp(r){return r*Qr/x}const F0=[new Nt([d,d,d],[p,p,p]),new Nt([d,d,d],[0,0,p]),new Nt([
vendor: 5,501 bytes, line 12
120,d,d],[p,0,p]),new Nt([d,0,d],[0,p,p]),new Nt([0,0,d],[p,p,p])];function L_(r,e,i,o=!0){const a=Vi([],r._camera.position,r.worldSize),h=[e,i,1,1];vn(h,h,r.pixelMatrixInverse),Io(h,h,1/h[3]);const u=ki([],cr([],h,a)),f=r.globeMatrix,_=[f[12],f[13],f[14]],g=cr([],_,a),v=jr(g),b=ki([],g),w=r.worldSize/(2*Math.PI),I=ar(b,u),A=Math.asin(w/v);if(A<Math.acos(I)){if(!o)return null;const Ie=[],pe=[];Vi(Ie,u,v/I),ki(pe,cr(pe,Ie,g)),ki(u,Ui(u,g,Vi(u,pe,Math.tan(A)*v)))}const P=[];new Qt(a,u).closestPointOnSphere(_,w,P);const R=ki([],Xi(f,0)),O=ki([],Xi(f,1)),j=ki([],Xi(f,2)),V=ar(R,P),G=ar(O,P),ne=ar(j,P),ee=ye(Math.asin(-G/w));let ie=ye(Math.atan2(V,ne));ie=r.center.lng+function(Ie,pe){const Ce=(pe-Ie+180)%360-180;return Ce<-180?Ce+360:Ce}(r.center.lng,ie);const le=z(ie),he=W(F(ee),0,1);return new Q(le,he)}class O0{constructor(e,i,o){this.a=cr([],e,o),this.b=cr([],i,o),this.center=o;const a=ki([],this.a),h=ki([],this.b);this.angle=Math.acos(ar(a,h))}}function cm(r,e){if(r.angle===0)return null;let i;return i=r.a[e]===0?1/r.angle*.5*Math.PI:1/r.angle*Math.atan(r.b[e]/r.a[e]/Math.sin(r.angle)-1/Math.tan(r.angle)),i<0||i>1?null:function(o,a,h,u){const f=Math.sin(h);return o*(Math.sin((1-u)*h)/f)+a*(Math.sin(u*h)/f)}(r.a[e],r.b[e],r.angle,W(i,0,1))+r.center[e]}function vs(r){if(r.z<=1)return F0[r.z+2*r.y+r.x];const e=hm(zp(r));return Nt.fromPoints(e)}function $s(r,e,i){return Vi(r,r,1-i),rn(r,r,e,i)}function F_(r,e,i){for(const o of r)lr(o,o,e),Vi(o,o,i)}function O_(r,e,i,o){const a=e/r.worldSize,h=r.globeMatrix;if(i.z<=1){const he=vs(i).getCorners();return F_(he,h,a),Nt.fromPoints(he)}const u=zp(i,o),f=hm(u,Qr+Pp(r._tileCoverLift));F_(f,h,a);const _=Number.MAX_VALUE,g=[-_,-_,-_],v=[_,_,_];if(u.contains(r.center)){for(const pe of f)Eo(v,v,pe),Hn(g,g,pe);g[2]=0;const he=r.point,Ie=[he.x*a,he.y*a,0];return Eo(v,v,Ie),Hn(g,g,Ie),new Nt(v,g)}if(r._tileCoverLift>0){for(const he of f)Eo(v,v,he),Hn(g,g,he);return new Nt(v,g)}const b=[h[12]*a,h[13]*a,h[14]*a],w=u.getCenter(),I=W(r.center.lat,-Y,Y),A=W(w.lat,-Y,Y),P=z(r.center.lng),R=F(I);let O=P-z(w.lng);const j=R-F(A);O>.5?O-=1:O<-.5&&(O+=1);let V=0;Math.abs(O)>Math.abs(j)?V=O>=0?1:3:(V=j>=0?0:2,rn(b,b,[h[4]*a,h[5]*a,h[6]*a],-Math.sin(ii(j>=0?u.getSouth():u.getNorth()))*Qr));const G=f[V],ne=f[(V+1)%4],ee=new O0(G,ne,b),ie=[cm(ee,0)||G[0],cm(ee,1)||G[1],cm(ee,2)||G[2]],le=ja(r.zoom);if(le>0){const he=function({x:pe,y:Ce,z:Ge},Pe,Oe,je,Se){const ke=1/(1<<Ge);let fe=pe*ke,Ee=fe+ke,$e=Ce*ke,Ne=$e+ke,ht=0;const ot=(fe+Ee)/2-je;return ot>.5?ht=-1:ot<-.5&&(ht=1),fe=((fe+ht)*Pe-(je*=Pe))*Oe+je,Ee=((Ee+ht)*Pe-je)*Oe+je,$e=($e*Pe-(Se*=Pe))*Oe+Se,Ne=(Ne*Pe-Se)*Oe+Se,[[fe,Ne,0],[Ee,Ne,0],[Ee,$e,0],[fe,$e,0]]}(i,e,r._pixelsPerMercatorPixel,P,R);for(let pe=0;pe<f.length;pe++)$s(f[pe],he[pe],le);const Ie=Ui([],he[V],he[(V+1)%4]);Vi(Ie,Ie,.5),$s(ie,Ie,le)}for(const he of f)Eo(v,v,he),Hn(g,g,he);return v[2]=Math.min(G[2],ne[2]),Eo(v,v,ie),Hn(g,g,ie),new Nt(v,g)}function zp({x:r,y:e,z:i},o=!1){const a=1/(1<<i),h=new S(N(r*a),e===(1<<i)-1&&o?-90:U((e+1)*a)),u=new S(N((r+1)*a),e===0&&o?90:U(e*a));return new C(h,u)}function hm(r,e=Qr){const i=ii(r.getNorth()),o=ii(r.getSouth()),a=Math.cos(i),h=Math.cos(o),u=Math.sin(i),f=Math.sin(o),_=r.getWest(),g=r.getEast();return[m(h,f,_,e),m(h,f,g,e),m(a,u,g,e),m(a,u,_,e)]}function Nu(r,e,i,o){const a=1<<i.z,h=(r/Xe+i.x)/a;return y(U((e/Xe+i.y)/a),N(h),o)}function Rp({min:r,max:e}){return t/Math.max(e[0]-r[0],e[1]-r[1],e[2]-r[2])}const k_=new Float64Array(16);function Dp(r){const e=Rp(r),i=Ks(k_,[e,e,e]);return tn(i,i,$o([],r.min))}function um(r){const e=(o=r.min,(i=k_)[0]=1,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=1,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=1,i[11]=0,i[12]=o[0],i[13]=o[1],i[14]=o[2],i[15]=1,i);var i,o;const a=1/Rp(r);return Zr(e,e,[a,a,a])}function dm(r){const e=Xe/(2*Math.PI);return r/(2*Math.PI)/e}function B_(r,e){return Xe/(512*Math.pow(2,r))*Rp(vs(e))}function N_(r,e,i,o,a){const h=dm(i),u=[r,e,-i/(2*Math.PI)],f=It(new Float64Array(16));return tn(f,f,u),Zr(f,f,[h,h,h]),Go(f,f,ii(-a)),So(f,f,ii(-o)),f}function ja(r){return ce(Cp,l,r)}function V_(r,e){const i=y(e.lat,e.lng),o=function(A){const P=y(A._center.lat,A._center.lng);let R=yr([],gr(0,1,0),P);const O=io([],-A.angle,P);R=lr(R,R,O),io(O,-A._pitch,R);const j=ki([],P);return Vi(j,j,Pp(A.cameraToCenterDistance/A.pixelsPerMeter)),lr(j,j,O),Ui([],P,j)}(r);return u=(a=xn([],o,i))[0],f=a[1],_=a[2],g=(h=i)[0],v=h[1],b=h[2],I=(w=Math.sqrt(u*u+f*f+_*_)*Math.sqrt(g*g+v*v+b*b))&&ar(a,h)/w,Math.acos(Math.min(Math.max(I,-1),1));var a,h,u,f,_,g,v,b,w,I}function pm(r,e){return V_(r,e)>Math.PI/2*1.01}const j_=ii(85),k0=Math.cos(j_),B0=Math.sin(j_),N0=To(),U_=r=>{const e=[];return r.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),r.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function G_(r,e,i,o,a,h,u,f,_){if(h&&r.queryGeometry.isAboveHorizon)return!1;h&&(_*=r.pixelToTileUnitsFactor);const g=r.tileID.canonical,v=i.projection.upVectorScale(g,i.center.lat,i.worldSize).metersToTile;for(const b of e)for(const w of b){const I=w.add(f),A=a&&i.elevation?i.elevation.exaggeration()*a.getElevationAt(I.x,I.y,!0):0,P=i.projection.projectTilePoint(I.x,I.y,g);if(A>0){const V=i.projection.upVector(g,I.x,I.y);P.x+=V[0]*v*A,P.y+=V[1]*v*A,P.z+=V[2]*v*A}const R=h?I:V0(P.x,P.y,P.z,o),O=h?r.tilespaceRays.map(V=>U0(V,A)):r.queryGeometry.screenGeometry,j=vn([],[P.x,P.y,P.z,1],o);if(!u&&h?_*=j[3]/i.cameraToCenterDistance:u&&!h&&(_*=i.cameraToCenterDistance/j[3]),h){const V=U((w.y/Xe+g.y
vendor: 4,202 bytes, line 12
12)/(1<<g.z));_/=i.projection.pixelsPerMeter(V,1)/L(1,V)}if(pr(O,R,_))return!0}return!1}function V0(r,e,i,o){const a=vn([],[r,e,i,1],o);return new Be(a[0]/a[3],a[1]/a[3])}const q_=gr(0,0,0),j0=gr(0,0,1);function U0(r,e){const i=fi();return q_[2]=e,r.intersectsPlane(q_,j0,i),new Be(i[0],i[1])}class H_ extends ai{}let $_,Z_,W_,X_;function Y_(r,{width:e,height:i},o,a){if(a){if(a instanceof Uint8ClampedArray)a=new Uint8Array(a.buffer);else if(a.length!==e*i*o)throw new RangeError("mismatched image size")}else a=new Uint8Array(e*i*o);return r.width=e,r.height=i,r.data=a,r}function K_(r,e,i){const{width:o,height:a}=e;o===r.width&&a===r.height||(fm(r,e,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,o),height:Math.min(r.height,a)},i,null),r.width=o,r.height=a,r.data=e.data)}function fm(r,e,i,o,a,h,u,f){if(a.width===0||a.height===0)return e;if(a.width>r.width||a.height>r.height||i.x>r.width-a.width||i.y>r.height-a.height)throw new RangeError("out of range source coordinates for image copy");if(a.width>e.width||a.height>e.height||o.x>e.width-a.width||o.y>e.height-a.height)throw new RangeError("out of range destination coordinates for image copy");const _=r.data,g=e.data,v=h===4&&f;for(let b=0;b<a.height;b++){const w=((i.y+b)*r.width+i.x)*h,I=((o.y+b)*e.width+o.x)*h;if(v)for(let A=0;A<a.width;A++){const P=w+A*h+3,R=I+A*h;g[R+0]=255,g[R+1]=255,g[R+2]=255,g[R+3]=_[P]}else if(u)for(let A=0;A<a.width;A++){const P=w+A*h,R=I+A*h,O=new ui(_[P+0]/255,_[P+1]/255,_[P+2]/255,_[P+3]).toNonPremultipliedRenderColor(u).toArray();g[R+0]=O[0],g[R+1]=O[1],g[R+2]=O[2],g[R+3]=O[3]}else for(let A=0;A<a.width*h;A++)g[I+A]=_[w+A]}return e}nt(H_,"HeatmapBucket",{omit:["layers"]});class Ua{constructor(e,i){Y_(this,e,1,i)}resize(e){K_(this,new Ua(e),1)}clone(){return new Ua({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,o,a,h){fm(e,i,o,a,h,1,null)}}class qr{constructor(e,i){Y_(this,e,4,i)}resize(e){K_(this,new qr(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new qr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,o,a,h,u,f){fm(e,i,o,a,h,4,u,f)}}class J_{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}function Vu(r){const e={},i=r.resolution||256,o=r.clips?r.clips.length:1,a=r.image||new qr({width:i,height:o}),h=(u,f,_)=>{e[r.evaluationKey]=_;const g=r.expression.evaluate(e),v=g?g.toNonPremultipliedRenderColor(null):null;v&&(a.data[u+f+0]=Math.floor(255*v.r),a.data[u+f+1]=Math.floor(255*v.g),a.data[u+f+2]=Math.floor(255*v.b),a.data[u+f+3]=Math.floor(255*v.a))};if(r.clips)for(let u=0,f=0;u<o;++u,f+=4*i)for(let _=0,g=0;_<i;_++,g+=4){const v=_/(i-1),{start:b,end:w}=r.clips[u];h(f,g,b*(1-v)+w*v)}else for(let u=0,f=0;u<i;u++,f+=4)h(0,f,u/(i-1));return a}nt(Ua,"AlphaImage"),nt(qr,"RGBAImage");const G0=Wt([{name:"a_pos",components:2,type:"Int16"}],4),q0=Wt([{name:"a_road_z_offset",components:1,type:"Float32"}],4),H0=Wt([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),$0=Wt([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function oh(r,e,i=2){const o=e&&e.length,a=o?e[0]*i:r.length;let h=Q_(r,0,a,i,!0);const u=[];if(!h||h.next===h.prev)return u;let f,_,g;if(o&&(h=function(v,b,w,I){const A=[];for(let P=0,R=b.length;P<R;P++){const O=Q_(v,b[P]*I,P<R-1?b[P+1]*I:v.length,I,!1);O===O.next&&(O.steiner=!0),A.push(ev(O))}A.sort(K0);for(let P=0;P<A.length;P++)w=J0(A[P],w);return w}(r,e,h,i)),r.length>80*i){f=r[0],_=r[1];let v=f,b=_;for(let w=i;w<a;w+=i){const I=r[w],A=r[w+1];I<f&&(f=I),A<_&&(_=A),I>v&&(v=I),A>b&&(b=A)}g=Math.max(v-f,b-_),g=g!==0?32767/g:0}return ju(h,u,i,f,_,g,0),u}function Q_(r,e,i,o,a){let h;if(a===function(u,f,_,g){let v=0;for(let b=f,w=_-g;b<_;b+=g)v+=(u[w]-u[b])*(u[b+1]+u[w+1]),w=b;return v}(r,e,i,o)>0)for(let u=e;u<i;u+=o)h=rg(u/o|0,r[u],r[u+1],h);else for(let u=i-o;u>=e;u-=o)h=rg(u/o|0,r[u],r[u+1],h);return h&&sh(h,h.next)&&(qu(h),h=h.next),h}function Zl(r,e){if(!r)return r;e||(e=r);let i,o=r;do if(i=!1,o.steiner||!sh(o,o.next)&&Rr(o.prev,o,o.next)!==0)o=o.next;else{if(qu(o),o=e=o.prev,o===o.next)break;
vendor: 2,275 bytes, line 12
12i=!0}while(i||o!==e);return e}function ju(r,e,i,o,a,h,u){if(!r)return;!u&&h&&function(_,g,v,b){let w=_;do w.z===0&&(w.z=mm(w.x,w.y,g,v,b)),w.prevZ=w.prev,w.nextZ=w.next,w=w.next;while(w!==_);w.prevZ.nextZ=null,w.prevZ=null,function(I){let A,P=1;do{let R,O=I;I=null;let j=null;for(A=0;O;){A++;let V=O,G=0;for(let ee=0;ee<P&&(G++,V=V.nextZ,V);ee++);let ne=P;for(;G>0||ne>0&&V;)G!==0&&(ne===0||!V||O.z<=V.z)?(R=O,O=O.nextZ,G--):(R=V,V=V.nextZ,ne--),j?j.nextZ=R:I=R,R.prevZ=j,j=R;O=V}j.nextZ=null,P*=2}while(A>1)}(w)}(r,o,a,h);let f=r;for(;r.prev!==r.next;){const _=r.prev,g=r.next;if(h?W0(r,o,a,h):Z0(r))e.push(_.i,r.i,g.i),qu(r),r=g.next,f=g.next;else if((r=g)===f){u?u===1?ju(r=X0(Zl(r),e),e,i,o,a,h,2):u===2&&Y0(r,e,i,o,a,h):ju(Zl(r),e,i,o,a,h,1);break}}}function Z0(r){const e=r.prev,i=r,o=r.next;if(Rr(e,i,o)>=0)return!1;const a=e.x,h=i.x,u=o.x,f=e.y,_=i.y,g=o.y,v=Math.min(a,h,u),b=Math.min(f,_,g),w=Math.max(a,h,u),I=Math.max(f,_,g);let A=o.next;for(;A!==e;){if(A.x>=v&&A.x<=w&&A.y>=b&&A.y<=I&&Uu(a,f,h,_,u,g,A.x,A.y)&&Rr(A.prev,A,A.next)>=0)return!1;A=A.next}return!0}function W0(r,e,i,o){const a=r.prev,h=r,u=r.next;if(Rr(a,h,u)>=0)return!1;const f=a.x,_=h.x,g=u.x,v=a.y,b=h.y,w=u.y,I=Math.min(f,_,g),A=Math.min(v,b,w),P=Math.max(f,_,g),R=Math.max(v,b,w),O=mm(I,A,e,i,o),j=mm(P,R,e,i,o);let V=r.prevZ,G=r.nextZ;for(;V&&V.z>=O&&G&&G.z<=j;){if(V.x>=I&&V.x<=P&&V.y>=A&&V.y<=R&&V!==a&&V!==u&&Uu(f,v,_,b,g,w,V.x,V.y)&&Rr(V.prev,V,V.next)>=0||(V=V.prevZ,G.x>=I&&G.x<=P&&G.y>=A&&G.y<=R&&G!==a&&G!==u&&Uu(f,v,_,b,g,w,G.x,G.y)&&Rr(G.prev,G,G.next)>=0))return!1;G=G.nextZ}for(;V&&V.z>=O;){if(V.x>=I&&V.x<=P&&V.y>=A&&V.y<=R&&V!==a&&V!==u&&Uu(f,v,_,b,g,w,V.x,V.y)&&Rr(V.prev,V,V.next)>=0)return!1;V=V.prevZ}for(;G&&G.z<=j;){if(G.x>=I&&G.x<=P&&G.y>=A&&G.y<=R&&G!==a&&G!==u&&Uu(f,v,_,b,g,w,G.x,G.y)&&Rr(G.prev,G,G.next)>=0)return!1;G=G.nextZ}return!0}function X0(r,e){let i=r;do{const o=i.prev,a=i.next.next;!sh(o,a)&&tg(o,i,i.next,a)&&Gu(o,a)&&Gu(a,o)&&(e.push(o.i,i.i,a.i),qu(i),qu(i.next),i=r=a),i=i.next}while(i!==r);return Zl(i)}function Y0(r,e,i,o,a,h){let u=r;do{let f=u.next.next;for(;f!==u.prev;){if(u.i!==f.i&&tv(u,f)){let _=ig(u,f);return u=Zl(u,u.next),_=Zl(_,_.next),ju(u,e,i,o,a,h,0),void ju(_,e,i,o,a,h,0)}f=f.next}u=u.next}while(u!==r)}function K0(r,e){let i=r.x-e.x;
vendor: 18,730 bytes, line 12
12return i===0&&(i=r.y-e.y,i===0)&&(i=(r.next.y-r.y)/(r.next.x-r.x)-(e.next.y-e.y)/(e.next.x-e.x)),i}function J0(r,e){const i=function(a,h){let u=h;const f=a.x,_=a.y;let g,v=-1/0;if(sh(a,u))return u;do{if(sh(a,u.next))return u.next;if(_<=u.y&&_>=u.next.y&&u.next.y!==u.y){const P=u.x+(_-u.y)*(u.next.x-u.x)/(u.next.y-u.y);if(P<=f&&P>v&&(v=P,g=u.x<u.next.x?u:u.next,P===f))return g}u=u.next}while(u!==h);if(!g)return null;const b=g,w=g.x,I=g.y;let A=1/0;u=g;do{if(f>=u.x&&u.x>=w&&f!==u.x&&eg(_<I?f:v,_,w,I,_<I?v:f,_,u.x,u.y)){const P=Math.abs(_-u.y)/(f-u.x);Gu(u,a)&&(P<A||P===A&&(u.x>g.x||u.x===g.x&&Q0(g,u)))&&(g=u,A=P)}u=u.next}while(u!==b);return g}(r,e);if(!i)return e;const o=ig(i,r);return Zl(o,o.next),Zl(i,i.next)}function Q0(r,e){return Rr(r.prev,r,e.prev)<0&&Rr(e.next,r,r.next)<0}function mm(r,e,i,o,a){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-i)*a|0)|r<<8))|r<<4))|r<<2))|r<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-o)*a|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function ev(r){let e=r,i=r;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==r);return i}function eg(r,e,i,o,a,h,u,f){return(a-u)*(e-f)>=(r-u)*(h-f)&&(r-u)*(o-f)>=(i-u)*(e-f)&&(i-u)*(h-f)>=(a-u)*(o-f)}function Uu(r,e,i,o,a,h,u,f){return!(r===u&&e===f)&&eg(r,e,i,o,a,h,u,f)}function tv(r,e){return r.next.i!==e.i&&r.prev.i!==e.i&&!function(i,o){let a=i;do{if(a.i!==i.i&&a.next.i!==i.i&&a.i!==o.i&&a.next.i!==o.i&&tg(a,a.next,i,o))return!0;a=a.next}while(a!==i);return!1}(r,e)&&(Gu(r,e)&&Gu(e,r)&&function(i,o){let a=i,h=!1;const u=(i.x+o.x)/2,f=(i.y+o.y)/2;do a.y>f!=a.next.y>f&&a.next.y!==a.y&&u<(a.next.x-a.x)*(f-a.y)/(a.next.y-a.y)+a.x&&(h=!h),a=a.next;while(a!==i);return h}(r,e)&&(Rr(r.prev,r,e.prev)||Rr(r,e.prev,e))||sh(r,e)&&Rr(r.prev,r,r.next)>0&&Rr(e.prev,e,e.next)>0)}function Rr(r,e,i){return(e.y-r.y)*(i.x-e.x)-(e.x-r.x)*(i.y-e.y)}function sh(r,e){return r.x===e.x&&r.y===e.y}function tg(r,e,i,o){const a=Fp(Rr(r,e,i)),h=Fp(Rr(r,e,o)),u=Fp(Rr(i,o,r)),f=Fp(Rr(i,o,e));return a!==h&&u!==f||!(a!==0||!Lp(r,i,e))||!(h!==0||!Lp(r,o,e))||!(u!==0||!Lp(i,r,o))||!(f!==0||!Lp(i,e,o))}function Lp(r,e,i){return e.x<=Math.max(r.x,i.x)&&e.x>=Math.min(r.x,i.x)&&e.y<=Math.max(r.y,i.y)&&e.y>=Math.min(r.y,i.y)}function Fp(r){return r>0?1:r<0?-1:0}function Gu(r,e){return Rr(r.prev,r,r.next)<0?Rr(r,e,r.next)>=0&&Rr(r,r.prev,e)>=0:Rr(r,e,r.prev)<0||Rr(r,r.next,e)<0}function ig(r,e){const i=_m(r.i,r.x,r.y),o=_m(e.i,e.x,e.y),a=r.next,h=e.prev;return r.next=e,e.prev=r,i.next=a,a.prev=i,o.next=i,i.prev=o,h.next=o,o.prev=h,o}function rg(r,e,i,o){const a=_m(r,e,i);return o?(a.next=o.next,a.prev=o,o.next.prev=a,o.next=a):(a.prev=a,a.next=a),a}function qu(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function _m(r,e,i){return{i:r,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Hu(r,e){const i=r.length;if(i<=1)return[r];const o=[];let a,h;for(let u=0;u<i;u++){const f=Cr(r[u]);f!==0&&(r[u].area=Math.abs(f),h===void 0&&(h=f<0),h===f<0?(a&&o.push(a),a=[r[u]]):a.push(r[u]))}if(a&&o.push(a),e>1)for(let u=0;u<o.length;u++)o[u].length<=e||(Kr(o[u],e,1,o[u].length-1,iv),o[u]=o[u].slice(0,e));return o}function iv(r,e){return e.area-r.area}function ng(r,e,i=1){if(!r)return null;const o=typeof r=="string"?mn.from(r).getPrimary():r.getPrimary(),a=typeof r=="string"?null:r.getSecondary();for(const h of[o,a]){if(!h)continue;const u=h.id.toString();e.has(u)||e.set(u,[]),h.scaleSelf(i),e.get(u).push(h)}return{primary:o.toString(),secondary:a?a.toString():null}}function gm(r,e,i,o){const a=o.patternDependencies;let h=!1;for(const u of e){const f=u.paint.get(`${r}-pattern`);f.isConstant()||(h=!0),ng(f.constantOr(null),a,i)&&(h=!0)}return h}function ym(r,e,i,o,a,h){const u=h.patternDependencies;for(const f of e){const _=f.paint.get(`${r}-pattern`).value;if(_.kind!=="constant"){let g=_.evaluate({zoom:o},i,{},h.availableImages);g=g&&g.name?g.name:g;const v=ng(g,u,a);if(!v)continue;const{primary:b,secondary:w}=v;b&&(i.patterns[f.id]=[b,w].filter(Boolean))}}return i}class og{constructor(){this.polygons=new Map}add(e,...i){this.polygons.has(e)?this.polygons.get(e).push(...i):this.polygons.set(e,i)}merge(e){for(const[i,o]of e.polygons)this.add(i,...o)}}class Wl{constructor(){this.portals=[]}static evaluate(e){if(e.length===0)return new Wl;let i=[];for(const g of e)i.push(...g.portals);if(i.length===0)return new Wl;const o=(g,v)=>g<=0&&v<=0||g>=Xe&&v>=Xe;for(const g of i){const v=g.va,b=g.vb;(o(v.x,b.x)||o(v.y,b.y))&&(g.type="border")}const a=i.filter(g=>g.type!=="unevaluated"),h=i.filter(g=>g.type==="unevaluated");if(h.length===0)return new Wl;h.sort((g,v)=>g.hash===v.hash?g.isTunnel===v.isTunnel?0:g.isTunnel?-1:1:g.hash<v.hash?1:-1),i=a.concat(h);let u=a.length,f=u,_=u;do if(f++,f===i.length||i[u].hash!==i[f].hash){if(f-u==2){_<u&&(i[_]=i[u],i[u]=null);const g=i[_],v=i[f-1];g.type=g.isTunnel!==v.isTunnel?"tunnel":"polygon",g.connection={a:g.connection.a,b:v.connection.a},_++}u=f}while(u!==i.length);return i.splice(_),i.sort((g,v)=>g.hash<v.hash?1:-1),{portals:i}}}nt(Wl,"ElevationPortalGraph"),nt(og,"ElevationPolygons");class rv{constructor(e,i,o){this.outPositions=e,this.outNormals=i,this.outIndices=o,this.vertexLookup=new Map,this.buffer=new ArrayBuffer(4),this.view=new DataView(this.buffer)}addVertex(e,i,o){let a=e[2];o!=null&&(a*=o);const h=this.getVec3Bits(e)<<96n|this.getVec3Bits(i),u=this.vertexLookup.get(h);if(u!=null)return u;const f=this.outPositions.length;this.vertexLookup.set(h,f);const _=Math.trunc(16384*i[0]),g=Math.trunc(16384*i[1]),v=Math.trunc(16384*i[2]);return this.outPositions.emplaceBack(e[0],e[1],a),this.outNormals.emplaceBack(_,g,v),f}addTriangle(e,i,o){this.outIndices.emplaceBack(e,i,o)}addTriangles(e,i,o){if(e.length===0)return;const a=o.length===1,h=fi(),u=fi();for(let f=0;f<e.length;f+=3){const _=i[e[f+0]],g=i[e[f+1]],v=i[e[f+2]],b=a?o[0]:o[e[f+1]],w=a?o[0]:o[e[f+2]];ur(h,_.x,_.y,a?o[0]:o[e[f+0]]);const I=this.addVertex(h,u);ur(h,g.x,g.y,b);const A=this.addVertex(h,u);ur(h,v.x,v.y,w);const P=this.addVertex(h,u);this.outIndices.emplaceBack(I,A,P)}}addQuad(e,i,o,a,h,u){const f=this.addVertex(e,h,u),_=this.addVertex(i,h,u),g=this.addVertex(o,h,u),v=this.addVertex(a,h,u);this.addTriangle(f,_,g),this.addTriangle(g,v,f)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}getBits(e){return this.view.setFloat32(0,e),BigInt(this.view.getUint32(0))}getVec3Bits(e){return this.getBits(e[0])<<64n|this.getBits(e[1])<<32n|this.getBits(e[2])}}class Un{constructor(e,i,o,a){this.unevaluatedPortals=new Wl,this.portalPolygons=new og,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new vu,this.vertexNormals=new bu,this.indexArray=new Ni,this.tileToMeters=J(e),this.bridgeProgramConfigurations=new kn(i,{zoom:o,lut:a},h=>h!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new kn(i,{zoom:o,lut:a},h=>h!=="fill-bridge-guard-rail-color")}addVertices(e,i){const o=this.unevalVertices.length;for(let a=0;a<e.length;a++)this.unevalVertices.push(e[a]),this.unevalHeights.push(i[a]);return o}addTriangles(e,i,o){const a=o?this.unevalTunnelTriangles:this.unevalTriangles;for(const h of e)a.push(h+i)}addRenderableRing(e,i,o,a,h,u){const f=[new Be(h.min.x,h.min.y),new Be(h.max.x,h.min.y),new Be(h.max.x,h.max.y),new Be(h.min.x,h.max.y)];for(let _=0;_<o-1;_++){const g=i+_,v=g+1,b=this.unevalVertices[g],w=this.unevalVertices[v];if(!(b.x>=h.min.x&&b.x<=h.max.x&&b.y>=h.min.y&&b.y<=h.max.y||w.x>=h.min.x&&w.x<=h.max.x&&w.y>=h.min.y&&w.y<=h.max.y||Ki(b,w,f))||this.isOnBorder(b.x,w.x)||this.isOnBorder(b.y,w.y))continue;const I=Un.computeEdgeHash(this.unevalVertices[g],this.unevalVertices[v]);let A,P=this.vertexHashLookup.get(Un.computePosHash(b));P!=null?A=P.next:(P=this.vertexHashLookup.get(Un.computePosHash(w)),A=P!=null?P.prev:I),this.unevalEdges.push({polygonIdx:e,a:g,b:v,hash:I,portalHash:A,isTunnel:a,type:"unevaluated",featureInfo:u})}}addPortalCandidates(e,i,o,a,h){if(i.length===0)return;this.portalPolygons.add(e,{geometry:i,zLevel:h});const u=i[0];this.vertexHashLookup.clear();let f=Un.computeEdgeHash(u[u.length-2],u[u.length-1]);for(let _=0;_<u.length-1;_++){const g=u[_+0],v=u[_+1],b=Mn(v.x-g.x,v.y-g.y),w=Jo(b);if(w===0)continue;let I="unevaluated";const A=a.pointElevation(g),P=a.pointElevation(v);Math.abs(A)<.01&&Math.abs(P)<.01?I="entrance":(this.isOnBorder(g.x,v.x)||this.isOnBorder(g.y,v.y))&&(I="border");const R=Un.computeEdgeHash(g,v);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:g,vb:v,vab:b,length:w,hash:R,isTunnel:o,type:I});const O=Un.computePosHash(g);this.vertexHashLookup.set(O,{prev:f,next:R}),f=R}}construct(e){if(this.unevalVertices.length===0)return;const i=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),o=w=>{w.primitiveLength=this.indexArray.length-w.primitiveOffset},a=new rv(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const h=i(),u=i(),f=i(),_=(w,I)=>{w.sort((P,R)=>P.type===I&&R.type!==I?-1:P.type!==I&&R.type===I?1:0);const A=w.findIndex(P=>P.type!==I);return A>=0?A:w.length};let g=0;this.unevalEdges.length>0&&(g=_(this.unevalEdges,"none"),this.constructBridgeStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},this.tileToMeters)),o(f);const v=i(),b=i();if(this.unevalEdges.length>0){const w=this.unevalEdges.splice(g),I=_(w,"tunnel")+g;this.unevalEdges.push(...w),this.constructTunnelStructures(a,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:g},{min:g,max:I})}o(v),a.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),o(b),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),o(u),a.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),o(h),this.maskSegments=qi.simpleSegment(0,b.primitiveOffset,0,b.primitiveLength),this.depthSegments=qi.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength),this.renderableBridgeSegments=qi.simpleSegment(0,f.primitiveOffset,0,f.primitiveLength),this.renderableTunnelSegments=qi.simpleSegment(0,v.primitiveOffset,0,v.primitiveLength),this.shadowCasterSegments=qi.simpleSegment(0,h.primitiveOffset,0,h.primitiveLength)}update(e,i,o,a,h,u,f,_){this.bridgeProgramConfigurations.updatePaintArrays(e,i,h,o,a,u,f,_),this.tunnelProgramConfigurations.updatePaintArrays(e,i,h,o,a,u,f,_)}upload(e){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,H0.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,$0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}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(e,i,o,a,h){const u=(f,_)=>{for(let g=0;g<_.length-1;g++){const v=_[g].featureIndex,b=_[g+1].vertexStart,w=e.feature(v);f.populatePaintArrays(b,w,v,{},o,i,a,void 0,h)}};u(this.bridgeProgramConfigurations,this.bridgeFeatureSections),u(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,i,o,a,h){const u=new Map;for(let f=a;f<h;f++){const _=o[f],g=_.a,v=_.b,b=Un.computePosHash(e[g]),w=Un.computePosHash(e[v]);let I=u.get(b);I||(I={},u.set(b,I));let A=u.get(w);A||(A={},u.set(w,A)),i[g]<=0&&i[v]<=0||(I.to=v,A.from=g)}return u}isTerminalVertex(e,i){const o=Un.computePosHash(this.unevalVertices[e]),a=i.get(o);return!a||!a.from||!a.to}constructBridgeStructures(e,i,o,a,h,u){e.clearVertexLookup();const f=this.computeVertexConnections(i,o,a,h.min,h.max),_=1/u,g=.5*_,v=(Oe,je)=>ur(Oe,i[je].x,i[je].y,o[je]*_),b=fi(),w=fi(),I=fi(),A=fi(),P=fi(),R=(Oe,je)=>{const Se=f.get(Un.computePosHash(i[je])),ke=Se.from,fe=Se.to;if(!ke||!fe)return;v(b,ke),v(w,je),v(I,fe),Ka(A),$n(b,w)||(cr(P,w,b),ki(A,P)),$n(I,w)||(cr(P,I,w),Ui(A,A,ki(P,P)));const Ee=Xo(A);return Ee>0?Vi(Oe,A,1/Ee):void 0};let O=Number.POSITIVE_INFINITY;this.sortSubarray(a,h.min,h.max,(Oe,je)=>Oe.featureInfo.featureIndex-je.featureInfo.featureIndex);const j=fi(),V=fi(),G=fi(),ne=fi(),ee=fi(),ie=fi(),le=fi(),he=fi(),Ie=fi(),pe=[fi(),fi(),fi(),fi()],Ce=[fi(),fi(),fi(),fi()],Ge=[{coord:new Be(0,0),height:0},{coord:new Be(0,0),height:0}],Pe=(Oe,je)=>Oe>je;for(let Oe=h.min;Oe<h.max;Oe++){const je=a[Oe];if(!je.featureInfo.guardRailEnabled||!this.prepareEdgePoints(Ge,i,o,je,Pe))continue;const[Se,ke]=Ge;if(ur(j,Se.coord.x,Se.coord.y,_*Se.height),ur(V,ke.coord.x,ke.coord.y,_*ke.height),$n(j,V))continue;cr(G,V,j),ki(G,G);const fe=R(he,je.a)||G,Ee=R(Ie,je.b)||G;ur(ne,fe[1],-fe[0],0),ki(ne,ne),ur(ee,Ee[1],-Ee[0],0),ki(ee,ee),yr(he,ne,fe),ki(ie,he),yr(he,ee,Ee),ki(le,he),Ui(pe[0],j,Vi(he,cr(he,ne,ie),g)),Ui(pe[1],j,Vi(he,Ui(he,ne,ie),g)),Ui(pe[2],j,Vi(he,ie,g)),pe[3]=j,Ui(Ce[0],V,Vi(he,cr(he,ee,le),g)),Ui(Ce[1],V,Vi(he,Ui(he,ee,le),g)),Ui(Ce[2],V,Vi(he,le,g)),Ce[3]=V,O=this.addFeatureSection(je.featureInfo.featureIndex,O,this.bridgeFeatureSections,e);const $e=e.addVertex(pe[0],ne,u),Ne=e.addVertex(pe[1],ne,u),ht=e.addVertex(Ce[0],ee,u),ot=e.addVertex(Ce[1],ee,u);e.addTriangle($e,Ne,ht),e.addTriangle(Ne,ot,ht);const Le=e.addVertex(pe[1],ie,u),Ve=e.addVertex(pe[2],ie,u),at=e.addVertex(Ce[1],le,u),tt=e.addVertex(Ce[2],le,u);e.addTriangle(Le,Ve,at),e.addTriangle(Ve,tt,at),$o(ne,ne),$o(ee,ee);const Ye=e.addVertex(pe[2],ne,u),it=e.addVertex(pe[3],ne,u),gt=e.addVertex(Ce[2],ee,u),St=e.addVertex(Ce[3],ee,u);e.addTriangle(Ye,it,gt),e.addTriangle(it,St,gt);const Pt=this.isTerminalVertex(je.a,f),Ct=this.isTerminalVertex(je.b,f);Se.height<.01&&Pt&&e.addQuad(pe[3],pe[2],pe[1],pe[0],$o(fe,fe),u),ke.height<.01&&Ct&&e.addQuad(Ce[0],Ce[1],Ce[2],Ce[3],Ee,u)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,i,o,a,h,u){e.clearVertexLookup();let f=Number.POSITIVE_INFINITY;const _=(O,j)=>O.featureInfo.featureIndex-j.featureInfo.featureIndex;this.sortSubarray(a,h.min,h.max,_),this.sortSubarray(a,u.min,u.max,_);const g=O=>ki(O,O),v=[{coord:new Be(0,0),height:0},{coord:new Be(0,0),height:0}],b=(O,j)=>O<j,w=fi(),I=fi(),A=fi(),P=fi(),R=fi();for(let O=h.min;O<h.max;O++){if(!this.prepareEdgePoints(v,i,o,a[O],b))continue;const[j,V]=v,G=g(ur(R,-(V.coord.y-j.coord.y),V.coord.x-j.coord.x,0));f=this.addFeatureSection(a[O].featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(ur(w,j.coord.x,j.coord.y,j.height),ur(I,V.coord.x,V.coord.y,V.height),ur(A,V.coord.x,V.coord.y,a[O].isTunnel?-.1:0),ur(P,j.coord.x,j.coord.y,a[O].isTunnel?-.1:0),G)}for(let O=u.min;O<u.max;O++){const j=a[O];j.isTunnel&&([j.a,j.b]=[j.b,j.a]);const V=i[j.a],G=i[j.b],ne=g(ur(R,-(G.y-V.y),G.x-V.x,0));f=this.addFeatureSection(j.featureInfo.featureIndex,f,this.tunnelFeatureSections,e),e.addQuad(ur(w,G.x,G.y,0),ur(I,V.x,V.y,0),ur(A,V.x,V.y,o[j.a]+4),ur(P,G.x,G.y,o[j.b]+4),ne),e.addQuad(ur(w,V.x,V.y,0),ur(I,G.x,G.y,0),ur(A,G.x,G.y,o[j.b]+4),ur(P,V.x,V.y,o[j.a]+4),ne)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,i,o,a){e.coord.x=i,e.coord.y=o,e.height=a}prepareEdgePoints(e,i,o,a,h){let u=i[a.a].x,f=i[a.a].y,_=i[a.b].x,g=i[a.b].y,v=o[a.a],b=o[a.b];const w=h(v,0),I=h(b,0);if(w&&I)return this.setElevatedPoint(e[0],u,f,v),this.setElevatedPoint(e[1],_,g,b),!0;if(!w&&!I)return!1;if(w){if(!I){const A=b/(b-v);_=mt(_,u,A),g=mt(g,f,A),b=mt(b,v,A)}}else{const A=v/(v-b);u=mt(u,_,A),f=mt(f,g,A),v=mt(v,b,A)}return this.setElevatedPoint(e[0],u,f,v),this.setElevatedPoint(e[1],_,g,b),!0}prepareEdges(e,i){if(i.length===0)return;i.sort((f,_)=>f.hash===_.hash?_.polygonIdx-f.polygonIdx:_.hash>f.hash?1:-1);let o=0,a=0,h=0,u=i[o].polygonIdx;do a++,(a===i.length||i[o].hash!==i[a].hash)&&((a-o==1||i[a-1].polygonIdx!==u)&&(h<o&&(i[h]=i[o],i[o]=null),i[h].type="none",h++),o=a,o!==i.length&&(u=i[o].polygonIdx));while(o!==i.length);if(i.splice(h),i.length!==0&&e.length!==0){i.sort((g,v)=>g.portalHash<v.portalHash?1:-1);let f=0,_=0;for(;f!==i.length&&_!==e.length;){const g=i[f],v=e[_];g.portalHash>v.hash?f++:v.hash>g.portalHash?_++:(g.type=v.type,f++)}}}isOnBorder(e,i){return e<=0&&i<=0||e>=Xe&&i>=Xe}addFeatureSection(e,i,o,a){return e!==i&&(i=e,o.push({featureIndex:e,vertexStart:a.getVertexCount()}),a.clearVertexLookup()),i}sortSubarray(e,i,o,a){const h=e.slice(i,o);h.sort(a),e.splice(i,h.length,...h)}static computeEdgeHash(e,i){return(e.y===i.y&&e.x>i.x||e.y>i.y)&&([e,i]=[i,e]),BigInt(Un.computePosHash(e))<<32n|BigInt(Un.computePosHash(i))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}var sg,ag={exports:{}},lg=(sg||(sg=1,function(r,e){(function(i){function o(H,$){return H>$?1:H<$?-1:0}var a=function(H,$){H===void 0&&(H=o),$===void 0&&($=!1),this._compare=H,this._root=null,this._size=0,this._noDuplicates=!!$},h={size:{configurable:!0}};function u(H,$,we,Ze,Je){var Ke=Je-Ze;if(Ke>0){var st=Ze+Math.floor(Ke/2),bt={key:$[st],data:we[st],parent:H};return bt.left=u(bt,$,we,Ze,st),bt.right=u(bt,$,we,st+1,Je),bt}return null}function f(H,$,we,Ze,Je){if(!(we>=Ze)){for(var Ke=H[we+Ze>>1],st=we-1,bt=Ze+1;;){do st++;while(Je(H[st],Ke)<0);do bt--;while(Je(H[bt],Ke)>0);if(st>=bt)break;var jt=H[st];H[st]=H[bt],H[bt]=jt,jt=$[st],$[st]=$[bt],$[bt]=jt}f(H,$,we,bt,Je),f(H,$,bt+1,Ze,Je)}}a.prototype.rotateLeft=function(H){var $=H.right;$&&(H.right=$.left,$.left&&($.left.parent=H),$.parent=H.parent),H.parent?H===H.parent.left?H.parent.left=$:H.parent.right=$:this._root=$,$&&($.left=H),H.parent=$},a.prototype.rotateRight=function(H){var $=H.left;$&&(H.left=$.right,$.right&&($.right.parent=H),$.parent=H.parent),H.parent?H===H.parent.left?H.parent.left=$:H.parent.right=$:this._root=$,$&&($.right=H),H.parent=$},a.prototype._splay=function(H){for(;H.parent;){var $=H.parent;$.parent?$.left===H&&$.parent.left===$?(this.rotateRight($.parent),this.rotateRight($)):$.right===H&&$.parent.right===$?(this.rotateLeft($.parent),this.rotateLeft($)):$.left===H&&$.parent.right===$?(this.rotateRight($),this.rotateLeft($)):(this.rotateLeft($),this.rotateRight($)):$.left===H?this.rotateRight($):this.rotateLeft($)}},a.prototype.splay=function(H){for(var $,we,Ze,Je,Ke;H.parent;
12)(we=($=H.parent).parent)&&we.parent?((Ze=we.parent).left===we?Ze.left=H:Ze.right=H,H.parent=Ze):(H.parent=null,this._root=H),Je=H.left,Ke=H.right,H===$.left?(we&&(we.left===$?($.right?(we.left=$.right,we.left.parent=we):we.left=null,$.right=we,we.parent=$):(Je?(we.right=Je,Je.parent=we):we.right=null,H.left=we,we.parent=H)),Ke?($.left=Ke,Ke.parent=$):$.left=null,H.right=$,$.parent=H):(we&&(we.right===$?($.left?(we.right=$.left,we.right.parent=we):we.right=null,$.left=we,we.parent=$):(Ke?(we.left=Ke,Ke.parent=we):we.left=null,H.right=we,we.parent=H)),Je?($.right=Je,Je.parent=$):$.right=null,H.left=$,$.parent=H)},a.prototype.replace=function(H,$){H.parent?H===H.parent.left?H.parent.left=$:H.parent.right=$:this._root=$,$&&($.parent=H.parent)},a.prototype.minNode=function(H){if(H===void 0&&(H=this._root),H)for(;H.left;)H=H.left;return H},a.prototype.maxNode=function(H){if(H===void 0&&(H=this._root),H)for(;H.right;)H=H.right;return H},a.prototype.insert=function(H,$){var we=this._root,Ze=null,Je=this._compare;if(this._noDuplicates)for(;we;){if(Ze=we,Je(we.key,H)===0)return;we=Je(we.key,H)<0?we.right:we.left}else for(;we;)Ze=we,we=Je(we.key,H)<0?we.right:we.left;return we={key:H,data:$,left:null,right:null,parent:Ze},Ze?Je(Ze.key,we.key)<0?Ze.right=we:Ze.left=we:this._root=we,this.splay(we),this._size++,we},a.prototype.find=function(H){for(var $=this._root,we=this._compare;$;){var Ze=we($.key,H);if(Ze<0)$=$.right;else{if(!(Ze>0))return $;$=$.left}}return null},a.prototype.contains=function(H){for(var $=this._root,we=this._compare;$;){var Ze=we(H,$.key);if(Ze===0)return!0;$=Ze<0?$.left:$.right}return!1},a.prototype.remove=function(H){var $=this.find(H);if(!$)return!1;if(this.splay($),$.left)if($.right){var we=this.minNode($.right);we.parent!==$&&(this.replace(we,we.right),we.right=$.right,we.right.parent=we),this.replace($,we),we.left=$.left,we.left.parent=we}else this.replace($,$.left);else this.replace($,$.right);return this._size--,!0},a.prototype.removeNode=function(H){if(!H)return!1;if(this.splay(H),H.left)if(H.right){var $=this.minNode(H.right);$.parent!==H&&(this.replace($,$.right),$.right=H.right,$.right.parent=$),this.replace(H,$),$.left=H.left,$.left.parent=$}else this.replace(H,H.left);else this.replace(H,H.right);return this._size--,!0},a.prototype.erase=function(H){var $=this.find(H);if($){this.splay($);var we=$.left,Ze=$.right,Je=null;we&&(we.parent=null,Je=this.maxNode(we),this.splay(Je),this._root=Je),Ze&&(we?Je.right=Ze:this._root=Ze,Ze.parent=Je),this._size--}},a.prototype.pop=function(){var H=this._root,$=null;if(H){for(;H.left;)H=H.left;$={key:H.key,data:H.data},this.remove(H.key)}return $},a.prototype.next=function(H){var $=H;if($)if($.right)for($=$.right;$&&$.left;)$=$.left;else for($=H.parent;$&&$.right===H;)H=$,$=$.parent;return $},a.prototype.prev=function(H){var $=H;if($)if($.left)for($=$.left;$&&$.right;)$=$.right;else for($=H.parent;$&&$.left===H;)H=$,$=$.parent;return $},a.prototype.forEach=function(H){for(var $=this._root,we=[],Ze=!1,Je=0;!Ze;)$?(we.push($),$=$.left):we.length>0?(H($=we.pop(),Je++),$=$.right):Ze=!0;return this},a.prototype.range=function(H,$,we,Ze){for(var Je=[],Ke=this._compare,st=this._root;Je.length!==0||st;)if(st)Je.push(st),st=st.left;else{if(Ke((st=Je.pop()).key,$)>0)break;if(Ke(st.key,H)>=0&&we.call(Ze,st))return this;st=st.right}return this},a.prototype.keys=function(){for(var H=this._root,$=[],we=[],Ze=!1;!Ze;)H?($.push(H),H=H.left):$.length>0?(H=$.pop(),we.push(H.key),H=H.right):Ze=!0;return we},a.prototype.values=function(){for(var H=this._root,$=[],we=[],Ze=!1;!Ze;)H?($.push(H),H=H.left):$.length>0?(H=$.pop(),we.push(H.data),H=H.right):Ze=!0;return we},a.prototype.at=function(H){for(var $=this._root,we=[],Ze=!1,Je=0;!Ze;)if($)we.push($),$=$.left;else if(we.length>0){if($=we.pop(),Je===H)return $;Je++,$=$.right}else Ze=!0;return null},a.prototype.load=function(H,$,we){if(H===void 0&&(H=[]),$===void 0&&($=[]),we===void 0&&(we=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var Ze=H.length;return we&&f(H,$,0,Ze-1,this._compare),this._root=u(null,H,$,0,Ze),this._size=Ze,this},a.prototype.min=function(){var H=this.minNode(this._root);return H?H.key:null},a.prototype.max=function(){var H=this.maxNode(this._root);return H?H.key:null},a.prototype.isEmpty=function(){return this._root===null},h.size.get=function(){return this._size},a.createTree=function(H,$,we,Ze,Je){return new a(we,Je).load(H,$,Ze)},Object.defineProperties(a.prototype,h);var _=0,g=1,v=2,b=3,w=0,I=1,A=2,P=3;function R(H,$,we){$===null?(H.inOut=!1,H.otherInOut=!0):(H.isSubject===$.isSubject?(H.inOut=!$.inOut,H.otherInOut=$.otherInOut):(H.inOut=!$.otherInOut,H.otherInOut=$.isVertical()?!$.inOut:$.inOut),$&&(H.prevInResult=!O($,we)||$.isVertical()?$.prevInResult:$));var Ze=O(H,we);H.resultTransition=Ze?function(Je,Ke){var st,bt=!Je.inOut,jt=!Je.otherInOut;switch(Ke){case w:st=bt&&jt;break;case I:st=bt||jt;break;case P:st=bt^jt;break;case A:st=Je.isSubject?bt&&!jt:jt&&!bt}return st?1:-1}(H,we):0}function O(H,$){switch(H.type){case _:switch($){case w:return!H.otherInOut;case I:return H.otherInOut;case A:return H.isSubject&&H.otherInOut||!H.isSubject&&!H.otherInOut;case P:return!0}break;case v:return $===w||$===I;case b:return $===A;case g:return!1}return!1}var j=function(H,$,we,Ze,Je){this.left=$,this.point=H,this.otherEvent=we,this.isSubject=Ze,this.type=Je||_,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},V={inResult:{configurable:!0}};function G(H,$){return H[0]===$[0]&&H[1]===$[1]}j.prototype.isBelow=function(H){var $=this.point,we=this.otherEvent.point;
12return this.left?($[0]-H[0])*(we[1]-H[1])-(we[0]-H[0])*($[1]-H[1])>0:(we[0]-H[0])*($[1]-H[1])-($[0]-H[0])*(we[1]-H[1])>0},j.prototype.isAbove=function(H){return!this.isBelow(H)},j.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},V.inResult.get=function(){return this.resultTransition!==0},j.prototype.clone=function(){var H=new j(this.point,this.left,this.otherEvent,this.isSubject,this.type);return H.contourId=this.contourId,H.resultTransition=this.resultTransition,H.prevInResult=this.prevInResult,H.isExteriorRing=this.isExteriorRing,H.inOut=this.inOut,H.otherInOut=this.otherInOut,H},Object.defineProperties(j.prototype,V);var ne=11102230246251565e-32,ee=134217729,ie=(3+8*ne)*ne;function le(H,$,we,Ze,Je){var Ke,st,bt,jt,Ut=$[0],Dt=Ze[0],xi=0,Yi=0;Dt>Ut==Dt>-Ut?(Ke=Ut,Ut=$[++xi]):(Ke=Dt,Dt=Ze[++Yi]);var zt=0;if(xi<H&&Yi<we)for(Dt>Ut==Dt>-Ut?(bt=Ke-((st=Ut+Ke)-Ut),Ut=$[++xi]):(bt=Ke-((st=Dt+Ke)-Dt),Dt=Ze[++Yi]),Ke=st,bt!==0&&(Je[zt++]=bt);xi<H&&Yi<we;)Dt>Ut==Dt>-Ut?(bt=Ke-((st=Ke+Ut)-(jt=st-Ke))+(Ut-jt),Ut=$[++xi]):(bt=Ke-((st=Ke+Dt)-(jt=st-Ke))+(Dt-jt),Dt=Ze[++Yi]),Ke=st,bt!==0&&(Je[zt++]=bt);for(;xi<H;)bt=Ke-((st=Ke+Ut)-(jt=st-Ke))+(Ut-jt),Ut=$[++xi],Ke=st,bt!==0&&(Je[zt++]=bt);for(;Yi<we;)bt=Ke-((st=Ke+Dt)-(jt=st-Ke))+(Dt-jt),Dt=Ze[++Yi],Ke=st,bt!==0&&(Je[zt++]=bt);return Ke===0&&zt!==0||(Je[zt++]=Ke),zt}function he(H){return new Float64Array(H)}var Ie=33306690738754716e-32,pe=22204460492503146e-32,Ce=11093356479670487e-47,Ge=he(4),Pe=he(8),Oe=he(12),je=he(16),Se=he(4);function ke(H,$,we){var Ze=function(Je,Ke,st,bt,jt,Ut){var Dt=(Ke-Ut)*(st-jt),xi=(Je-jt)*(bt-Ut),Yi=Dt-xi;if(Dt===0||xi===0||Dt>0!=xi>0)return Yi;var zt=Math.abs(Dt+xi);return Math.abs(Yi)>=Ie*zt?Yi:-function(Fi,Ai,pi,$i,zi,Ci,Mi){var _i,Lt,vi,Zi,xt,Xt,Ri,Ji,Oi,Er,Ti,vr,En,Hr,Nr,In,Ts,Ir,zr=Fi-zi,$r=pi-zi,cn=Ai-Ci,en=$i-Ci;Ge[0]=(Nr=(Ji=zr-(Ri=(Xt=ee*zr)-(Xt-zr)))*(Er=en-(Oi=(Xt=ee*en)-(Xt-en)))-((Hr=zr*en)-Ri*Oi-Ji*Oi-Ri*Er))-((Ti=Nr-(Ts=(Ji=cn-(Ri=(Xt=ee*cn)-(Xt-cn)))*(Er=$r-(Oi=(Xt=ee*$r)-(Xt-$r)))-((In=cn*$r)-Ri*Oi-Ji*Oi-Ri*Er)))+(xt=Nr-Ti))+(xt-Ts),Ge[1]=(En=Hr-((vr=Hr+Ti)-(xt=vr-Hr))+(Ti-xt))-((Ti=En-In)+(xt=En-Ti))+(xt-In),Ge[2]=vr-((Ir=vr+Ti)-(xt=Ir-vr))+(Ti-xt),Ge[3]=Ir;var Xa=function(Lw,v0){for(var b0=v0[0],T_=1;T_<4;T_++)b0+=v0[T_];return b0}(0,Ge),wd=pe*Mi;if(Xa>=wd||-Xa>=wd||(_i=Fi-(zr+(xt=Fi-zr))+(xt-zi),vi=pi-($r+(xt=pi-$r))+(xt-zi),Lt=Ai-(cn+(xt=Ai-cn))+(xt-Ci),Zi=$i-(en+(xt=$i-en))+(xt-Ci),_i===0&&Lt===0&&vi===0&&Zi===0)||(wd=Ce*Mi+ie*Math.abs(Xa),(Xa+=zr*Zi+en*_i-(cn*vi+$r*Lt))>=wd||-Xa>=wd))return Xa;Se[0]=(Nr=(Ji=_i-(Ri=(Xt=ee*_i)-(Xt-_i)))*(Er=en-(Oi=(Xt=ee*en)-(Xt-en)))-((Hr=_i*en)-Ri*Oi-Ji*Oi-Ri*Er))-((Ti=Nr-(Ts=(Ji=Lt-(Ri=(Xt=ee*Lt)-(Xt-Lt)))*(Er=$r-(Oi=(Xt=ee*$r)-(Xt-$r)))-((In=Lt*$r)-Ri*Oi-Ji*Oi-Ri*Er)))+(xt=Nr-Ti))+(xt-Ts),Se[1]=(En=Hr-((vr=Hr+Ti)-(xt=vr-Hr))+(Ti-xt))-((Ti=En-In)+(xt=En-Ti))+(xt-In),Se[2]=vr
12-((Ir=vr+Ti)-(xt=Ir-vr))+(Ti-xt),Se[3]=Ir;var rw=le(4,Ge,4,Se,Pe);Se[0]=(Nr=(Ji=zr-(Ri=(Xt=ee*zr)-(Xt-zr)))*(Er=Zi-(Oi=(Xt=ee*Zi)-(Xt-Zi)))-((Hr=zr*Zi)-Ri*Oi-Ji*Oi-Ri*Er))-((Ti=Nr-(Ts=(Ji=cn-(Ri=(Xt=ee*cn)-(Xt-cn)))*(Er=vi-(Oi=(Xt=ee*vi)-(Xt-vi)))-((In=cn*vi)-Ri*Oi-Ji*Oi-Ri*Er)))+(xt=Nr-Ti))+(xt-Ts),Se[1]=(En=Hr-((vr=Hr+Ti)-(xt=vr-Hr))+(Ti-xt))-((Ti=En-In)+(xt=En-Ti))+(xt-In),Se[2]=vr-((Ir=vr+Ti)-(xt=Ir-vr))+(Ti-xt),Se[3]=Ir;var nw=le(rw,Pe,4,Se,Oe);Se[0]=(Nr=(Ji=_i-(Ri=(Xt=ee*_i)-(Xt-_i)))*(Er=Zi-(Oi=(Xt=ee*Zi)-(Xt-Zi)))-((Hr=_i*Zi)-Ri*Oi-Ji*Oi-Ri*Er))-((Ti=Nr-(Ts=(Ji=Lt-(Ri=(Xt=ee*Lt)-(Xt-Lt)))*(Er=vi-(Oi=(Xt=ee*vi)-(Xt-vi)))-((In=Lt*vi)-Ri*Oi-Ji*Oi-Ri*Er)))+(xt=Nr-Ti))+(xt-Ts),Se[1]=(En=Hr-((vr=Hr+Ti)-(xt=vr-Hr))+(Ti-xt))-((Ti=En-In)+(xt=En-Ti))+(xt-In),Se[2]=vr-((Ir=vr+Ti)-(xt=Ir-vr))+(Ti-xt),Se[3]=Ir;var ow=le(nw,Oe,4,Se,je);return je[ow-1]}(Je,Ke,st,bt,jt,Ut,zt)}(H[0],H[1],$[0],$[1],we[0],we[1]);return Ze>0?-1:Ze<0?1:0}function fe(H,$){var we=H.point,Ze=$.point;return we[0]>Ze[0]?1:we[0]<Ze[0]?-1:we[1]!==Ze[1]?we[1]>Ze[1]?1:-1:function(Je,Ke,st,bt){return Je.left!==Ke.left?Je.left?1:-1:ke(st,Je.otherEvent.point,Ke.otherEvent.point)!==0?Je.isBelow(Ke.otherEvent.point)?-1:1:!Je.isSubject&&Ke.isSubject?1:-1}(H,$,we)}function Ee(H,$,we){var Ze=new j($,!1,H,H.isSubject),Je=new j($,!0,H.otherEvent,H.isSubject);return G(H.point,H.otherEvent.point)&&console.warn("what is that, a collapsed segment?",H),Ze.contourId=Je.contourId=H.contourId,fe(Je,H.otherEvent)>0&&(H.otherEvent.left=!0,Je.left=!1),H.otherEvent.otherEvent=Je,H.otherEvent=Ze,we.push(Je),we.push(Ze),we}function $e(H,$){return H[0]*$[1]-H[1]*$[0]}function Ne(H,$){return H[0]*$[0]+H[1]*$[1]}function ht(H,$,we){var Ze=function(jt,Ut,Dt,xi,Yi){var zt=[Ut[0]-jt[0],Ut[1]-jt[1]],Fi=[xi[0]-Dt[0],xi[1]-Dt[1]];function Ai(Xt,Ri,Ji){return[Xt[0]+Ri*Ji[0],Xt[1]+Ri*Ji[1]]}var pi=[Dt[0]-jt[0],Dt[1]-jt[1]],$i=$e(zt,Fi),zi=$i*$i,Ci=Ne(zt,zt);if(zi>0){var Mi=$e(pi,Fi)/$i;if(Mi<0||Mi>1)return null;var _i=$e(pi,zt)/$i;return _i<0||_i>1?null:Mi===0||Mi===1?[Ai(jt,Mi,zt)]:_i===0||_i===1?[Ai(Dt,_i,Fi)]:[Ai(jt,Mi,zt)]}if((zi=($i=$e(pi,zt))*$i)>0)return null;var Lt=Ne(zt,pi)/Ci,vi=Lt+Ne(zt,Fi)/Ci,Zi=Math.min(Lt,vi),xt=Math.max(Lt,vi);return Zi<=1&&xt>=0?Zi===1?[Ai(jt,Zi>0?Zi:0,zt)]:xt===0?[Ai(jt,xt<1?xt:1,zt)]:[Ai(jt,Zi>0?Zi:0,zt),Ai(jt,xt<1?xt:1,zt)]:null}(H.point,H.otherEvent.point,$.point,$.otherEvent.point),Je=Ze?Ze.length:0;if(Je===0||Je===1&&(G(H.point,$.point)||G(H.otherEvent.point,$.otherEvent.point))||Je===2&&H.isSubject===$.isSubject)return 0;if(Je===1)return G(H.point,Ze[0])||G(H.otherEvent.point,Ze[0])||Ee(H,Ze[0],we),G($.point,Ze[0])||G($.otherEvent.point,Ze[0])||Ee($,Ze[0],we),1;var Ke=[],st=!1,bt=!1;return G(H.point,$.point)?st=!0:fe(H,$)===1?Ke.push($,H):Ke.push(H,$),G(H.otherEvent.point,$.otherEvent.point)?bt=!0:fe(H.otherEvent,$.otherEvent)===1?Ke.push($.otherEvent,H.otherEvent):Ke.push(H.otherEvent,$.otherEvent),st&&bt||st?($.type=g,H.type=$.inOut===H.inOut?v:b,st&&!bt&&Ee(Ke[1].otherEvent,Ke[0].point,we),2):bt?(Ee(Ke[0],Ke[1].point,we),3):Ke[0]!==Ke[3].otherEvent?(Ee(Ke[0],Ke[1].point,we),Ee(Ke[1],Ke[2].point,we),3):(Ee(Ke[0],Ke[1].point,we),Ee(Ke[3].otherEvent,Ke[2].point,we),3)}function ot(H,$){if(H===$)return 0;if(ke(H.point,H.otherEvent.point,$.point)!==0||ke(H.point,H.otherEvent.point,$.otherEvent.point)!==0)return G(H.point,$.point)?H.isBelow($.otherEvent.point)?-1:1:H.point[0]===$.point[0]?H.point[1]<$.point[1]?-1:1:fe(H,$)===1?$.isAbove(H.point)?-1:1:H.isBelow($.point)?-1:1;if(H.isSubject!==$.isSubject)return H.isSubject?-1:1;var we=H.point,Ze=$.point;return we[0]===Ze[0]&&we[1]===Ze[1]?(we=H.otherEvent.point)[0]===(Ze=$.otherEvent.point)[0]&&we[1]===Ze[1]?0:H.contourId>$.contourId?1:-1:fe(H,$)===1?1:-1}var Le=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function Ve(H,$,we,Ze){var Je,Ke=H+1,st=$[H].point,bt=$.length;for(Ke<bt&&(Je=$[Ke].point);Ke<bt&&Je[0]===st[0]&&Je[1]===st[1];){if(!we[Ke])return Ke;++Ke<bt&&(Je=$[Ke].point)}for(Ke=H-1;we[Ke]&&Ke>Ze;)Ke--;return Ke}Le.prototype.isExterior=function(){return this.holeOf==null};var at=Ye,tt=Ye;function Ye(H,$){if(!(this instanceof Ye))return new Ye(H,$);
12if(this.data=H||[],this.length=this.data.length,this.compare=$||it,this.length>0)for(var we=(this.length>>1)-1;we>=0;we--)this._down(we)}function it(H,$){return H<$?-1:H>$?1:0}Ye.prototype={push:function(H){this.data.push(H),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var H=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),H}},peek:function(){return this.data[0]},_up:function(H){for(var $=this.data,we=this.compare,Ze=$[H];H>0;){var Je=H-1>>1,Ke=$[Je];if(we(Ze,Ke)>=0)break;$[H]=Ke,H=Je}$[H]=Ze},_down:function(H){for(var $=this.data,we=this.compare,Ze=this.length>>1,Je=$[H];H<Ze;){var Ke=1+(H<<1),st=Ke+1,bt=$[Ke];if(st<this.length&&we($[st],bt)<0&&(Ke=st,bt=$[st]),we(bt,Je)>=0)break;$[H]=bt,H=Ke}$[H]=Je}},at.default=tt;var gt=Math.max,St=Math.min,Pt=0;function Ct(H,$,we,Ze,Je,Ke){var st,bt,jt,Ut,Dt,xi;for(st=0,bt=H.length-1;st<bt;st++)if(Ut=H[st+1],Dt=new j(jt=H[st],!1,void 0,$),xi=new j(Ut,!1,Dt,$),Dt.otherEvent=xi,jt[0]!==Ut[0]||jt[1]!==Ut[1]){Dt.contourId=xi.contourId=we,Ke||(Dt.isExteriorRing=!1,xi.isExteriorRing=!1),fe(Dt,xi)>0?xi.left=!0:Dt.left=!0;var Yi=jt[0],zt=jt[1];Je[0]=St(Je[0],Yi),Je[1]=St(Je[1],zt),Je[2]=gt(Je[2],Yi),Je[3]=gt(Je[3],zt),Ze.push(Dt),Ze.push(xi)}}var $t=[];function Ot(H,$,we){typeof H[0][0][0]=="number"&&(H=[H]),typeof $[0][0][0]=="number"&&($=[$]);var Ze=function(zt,Fi,Ai){var pi=null;return zt.length*Fi.length==0&&(Ai===w?pi=$t:Ai===A?pi=zt:Ai!==I&&Ai!==P||(pi=zt.length===0?Fi:zt)),pi}(H,$,we);if(Ze)return Ze===$t?null:Ze;var Je=[1/0,1/0,-1/0,-1/0],Ke=[1/0,1/0,-1/0,-1/0],st=function(zt,Fi,Ai,pi,$i){var zi,Ci,Mi,_i,Lt,vi,Zi=new at(null,fe);for(Mi=0,_i=zt.length;Mi<_i;Mi++)for(Lt=0,vi=(zi=zt[Mi]).length;Lt<vi;Lt++)(Ci=Lt===0)&&Pt++,Ct(zi[Lt],!0,Pt,Zi,Ai,Ci);for(Mi=0,_i=Fi.length;Mi<_i;Mi++)for(Lt=0,vi=(zi=Fi[Mi]).length;Lt<vi;Lt++)Ci=Lt===0,$i===A&&(Ci=!1),Ci&&Pt++,Ct(zi[Lt],!1,Pt,Zi,pi,Ci);return Zi}(H,$,Je,Ke,we);if(Ze=function(zt,Fi,Ai,pi,$i){var zi=null;return(Ai[0]>pi[2]||pi[0]>Ai[2]||Ai[1]>pi[3]||pi[1]>Ai[3])&&($i===w?zi=$t:$i===A?zi=zt:$i!==I&&$i!==P||(zi=zt.concat(Fi))),zi}(H,$,Je,Ke,we))return Ze===$t?null:Ze;for(var bt=function(zt){var Fi,Ai,pi=function(Mi){var _i,Lt,vi,Zi,xt=[];for(Lt=0,vi=Mi.length;Lt<vi;Lt++)((_i=Mi[Lt]).left&&_i.inResult||!_i.left&&_i.otherEvent.inResult)&&xt.push(_i);for(var Xt=!1;!Xt;)for(Xt=!0,Lt=0,vi=xt.length;Lt<vi;Lt++)Lt+1<vi&&fe(xt[Lt],xt[Lt+1])===1&&(Zi=xt[Lt],xt[Lt]=xt[Lt+1],xt[Lt+1]=Zi,Xt=!1);for(Lt=0,vi=xt.length;Lt<vi;Lt++)(_i=xt[Lt]).otherPos=Lt;for(Lt=0,vi=xt.length;Lt<vi;Lt++)(_i=xt[Lt]).left||(Zi=_i.otherPos,_i.otherPos=_i.otherEvent.otherPos,_i.otherEvent.otherPos=Zi);return xt}(zt),$i={},zi=[],Ci=function(){if(!$i[Fi]){var Mi=zi.length,_i=function(xt,Xt,Ri){var Ji=new Le;if(xt.prevInResult!=null){var Oi=xt.prevInResult,Er=Oi.outputContourId;if(Oi.resultTransition>0){var Ti=Xt[Er];if(Ti.holeOf!=null){var vr=Ti.holeOf;Xt[vr].holeIds.push(Ri),Ji.holeOf=vr,Ji.depth=Xt[Er].depth}else Xt[Er].holeIds.push(Ri),Ji.holeOf=Er,Ji.depth=Xt[Er].depth+1}else Ji.holeOf=null,Ji.depth=Xt[Er].depth}else Ji.holeOf=null,Ji.depth=0;return Ji}(pi[Fi],zi,Mi),Lt=function(xt){$i[xt]=!0,xt<pi.length&&pi[xt]&&(pi[xt].outputContourId=Mi)},vi=Fi,Zi=Fi;for(_i.points.push(pi[Fi].point);Lt(vi),Lt(vi=pi[vi].otherPos),_i.points.push(pi[vi].point),!((vi=Ve(vi,pi,$i,Zi))==Zi||vi>=pi.length)&&pi[vi];);zi.push(_i)}};for(Fi=0,Ai=pi.length;Fi<Ai;Fi++)Ci();return zi}(function(zt,Fi,Ai,pi,$i,zi){for(var Ci,Mi,_i,Lt=new a(ot),vi=[],Zi=Math.min(pi[2],$i[2]);zt.length!==0;){var xt=zt.pop();if(vi.push(xt),zi===w&&xt.point[0]>Zi||zi===A&&xt.point[0]>pi[2])break;if(xt.left){Mi=Ci=Lt.insert(xt),Ci=Ci!==(_i=Lt.minNode())?Lt.prev(Ci):null,Mi=Lt.next(Mi);var Xt=Ci?Ci.key:null;if(R(xt,Xt,zi),Mi&&ht(xt,Mi.key,zt)===2&&(R(xt,Xt,zi),R(Mi.key,xt,zi)),Ci&&ht(Ci.key,xt,zt)===2){var Ri=Ci;R(Xt,(Ri=Ri!==_i?Lt.prev(Ri):null)?Ri.key:null,zi),R(xt,Xt,zi)}}else Mi=Ci=Lt.find(xt=xt.otherEvent),Ci&&Mi&&(Ci=Ci!==_i?Lt.prev(Ci):null,Mi=Lt.next(Mi),Lt.remove(xt),Mi&&Ci&&ht(Ci.key,Mi.key,zt))}return vi}(st,0,0,Je,Ke,we)),jt=[],Ut=0;Ut<bt.length;Ut++){var Dt=bt[Ut];if(Dt.isExterior()){for(var xi=[Dt.points],Yi=0;Yi<Dt.holeIds.length;Yi++)xi.push(bt[Dt.holeIds[Yi]].points);jt.push(xi)}}return jt}var Pi={UNION:I,DIFFERENCE:A,INTERSECTION:w,XOR:P};i.diff=function(H,$){return Ot(H,$,A)},i.intersection=function(H,$){return Ot(H,$,w)},i.operations=Pi,i.union=function(H,$){return Ot(H,$,I)},i.xor=function(H,$){return Ot(H,$,P)},Object.defineProperty(i,"__esModule",{value:!0})})(e)}(0,ag.exports)),ag.exports);/**
13 * martinez v0.7.4
14 * Martinez polygon clipping algorithm, does boolean operation on polygons (multipolygons, polygons with holes etc): intersection, union, difference, xor
15 *
16 * @author Alex Milevski <[email protected]>
17 * @license MIT
18 * @preserve
19 */function Op(r,e,i,o){const a=[],h=o===0?(u,f,_,g,v,b)=>
19{u.push(new Be(b,_+(b-f)/(g-f)*(v-_)))}:(u,f,_,g,v,b)=>{u.push(new Be(f+(b-_)/(v-_)*(g-f),b))};for(const u of r){const f=[];for(const _ of u){if(_.length<=2)continue;const g=[];for(let w=0;w<_.length-1;w++){const I=_[w].x,A=_[w].y,P=_[w+1].x,R=_[w+1].y,O=o===0?I:A,j=o===0?P:R;O<e?j>e&&h(g,I,A,P,R,e):O>i?j<i&&h(g,I,A,P,R,i):g.push(_[w]),j<e&&O>=e&&h(g,I,A,P,R,e),j>i&&O<=i&&h(g,I,A,P,R,i)}let v=_[_.length-1];const b=o===0?v.x:v.y;b>=e&&b<=i&&g.push(v),g.length&&(v=g[g.length-1],g[0].x===v.x&&g[0].y===v.y||g.push(g[0]),f.push(g))}f.length&&a.push(f)}return a}function nv(r,e){const i=xm(r),o=xm([e]),a=lg.intersection(i,o);return a==null?[]:cg(a)}function ov(r,e){let o=xm(r,65536);for(;e.valid();e.next()){const[a,h]=e.get(),u=a.x*65536,f=a.y*65536,_=h.x*65536,g=h.y*65536,v=_-u,b=g-f,w=Math.hypot(v,b),I=Math.trunc(b/w*3),A=-Math.trunc(v/w*3);o=lg.diff(o,[[[u,f],[_,g],[_+I,g+A],[u+I,f+A],[u,f]]])}return cg(o,1/65536)}function xm(r,e=1){return[r.map(i=>i.map(o=>[o.x*e,o.y*e]))]}function cg(r,e=1){return r.map(i=>i.map((o,a)=>{const h=o.map(u=>new Be(u[0]*e,u[1]*e).round());return a>0&&h.reverse(),h}))}class vm{constructor(e,i){this.layoutVertexArray=new yn,this.indexArray=new Ni,this.lineIndexArray=new mo,this.triangleSegments=new qi,this.lineSegments=new qi,this.programConfigurations=new kn(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,i&&(this.elevatedLayoutVertexArray=new Us)}update(e,i,o,a,h,u,f,_){this.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f,_)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,G0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,q0.members))),this.programConfigurations.upload(e),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(e,i,o,a,h,u,f){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,i,o,a,h,u,void 0,f)}}class bm{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new vm(e,!1),this.elevationBufferData=new vm(e,!0),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.sourceLayerIndex,this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,o,a){this.hasPattern=gm("fill",this.layers,this.pixelRatio,i);const h=this.layers[0].layout.get("fill-sort-key"),u=[];for(const{feature:f,id:_,index:g,sourceLayerIndex:v}of e){const b=this.layers[0]._featureFilter.needGeometry,w=Te(f,b);if(!this.layers[0]._featureFilter.filter(new yi(this.zoom,{worldview:this.worldview}),w,o))continue;const I=h?h.evaluate(w,{},o,i.availableImages):void 0,A={id:_,properties:f.properties,type:f.type,sourceLayerIndex:v,index:g,geometry:b?w.geometry:se(f,o,a),patterns:{},sortKey:I};u.push(A)}h&&u.sort((f,_)=>f.sortKey-_.sortKey);for(const f of u){const{geometry:_,index:g,sourceLayerIndex:v}=f;if(this.hasPattern){const b=ym("fill",this.layers,f,this.zoom,this.pixelRatio,i);this.patternFeatures.push(b)}else this.addFeature(f,_,g,o,{},i.availableImages,i.brightness,i.elevationFeatures);i.featureIndex.insert(e[g].feature,_,g,v,this.index)}}update(e,i,o,a,h,u,f){this.bufferData.update(e,i,o,a,h,u,f,this.worldview),this.elevationBufferData.update(e,i,o,a,h,u,f,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,i,o,a,h,u,f,this.worldview)}addFeatures(e,i,o,a,h,u){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,o,a,u,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}
19addFeature(e,i,o,a,h,u=[],f,_){const g=Hu(i,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(e,g,a,o,_):this.addGeometry(g,this.bufferData),this.bufferData.populatePaintArrays(e,o,h,u,a,f,this.worldview),this.elevationBufferData.populatePaintArrays(e,o,h,u,a,f,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(e,i,o,a,h){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(i,o,a,h,this.worldview))}addElevatedRoadFeature(e,i,o,a,h){const u=new Array,f=Hi.getElevationFeature(e,h);if(!f)return void this.addGeometry(i,this.bufferData);{const g=this.clipPolygonsToTile(i,1);g.length>0&&u.push({polygons:g,elevationFeature:f,elevationTileID:o})}const _={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},o),featureIndex:a};for(const g of u)if(g.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Un(g.elevationTileID,this.layers,this.zoom,this.lut));const b=g.elevationFeature.isTunnel();let w=0;e.properties.hasOwnProperty(ut)&&(w=+e.properties[ut]);for(const I of g.polygons)this.elevatedStructures.addPortalCandidates(g.elevationFeature.id,I,b,g.elevationFeature,w)}g.elevationFeature.constantHeight==null&&(g.polygons=this.prepareElevatedPolygons(g.polygons,g.elevationFeature,g.elevationTileID));const v=new Yt(o,g.elevationTileID);this.addElevatedGeometry(g.polygons,v,g.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,a,_)}}addElevatedGeometry(e,i,o,a,h,u){const f={elevation:o,elevationSampler:i,bias:a,index:h,featureInfo:u},[_,g]=this.addGeometry(e,this.elevationBufferData,f);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:_,max:g}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,_),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,g))}addGeometry(e,i,o){let a=Number.POSITIVE_INFINITY,h=Number.NEGATIVE_INFINITY,u=null;o&&(u=o.elevationSampler.constantElevation(o.elevation,o.bias),u!=null&&(a=u,h=u));const f=(_,g,v)=>{if(o!=null)if(g.push(_),u!=null)i.elevatedLayoutVertexArray.emplaceBack(u),v.push(u);else{const b=o.elevationSampler.pointElevation(_,o.elevation,o.bias);i.elevatedLayoutVertexArray.emplaceBack(b),v.push(b),a=Math.min(a,b),h=Math.max(h,b)}};for(const _ of e){let g=0;for(const V of _)g+=V.length;const v=i.triangleSegments.prepareSegment(g,i.layoutVertexArray,i.indexArray),b=v.vertexLength,w=[],I=[],A=[],P=[],R=[],O=i.layoutVertexArray.length;for(const V of _){if(V.length===0)continue;V!==_[0]&&I.push(w.length/2);const G=i.lineSegments.prepareSegment(V.length,i.layoutVertexArray,i.lineIndexArray),ne=G.vertexLength;o&&R.push(i.layoutVertexArray.length-O),f(V[0],A,P),i.layoutVertexArray.emplaceBack(V[0].x,V[0].y),i.lineIndexArray.emplaceBack(ne+V.length-1,ne),w.push(V[0].x),w.push(V[0].y);for(let ee=1;ee<V.length;ee++)f(V[ee],A,P),i.layoutVertexArray.emplaceBack(V[ee].x,V[ee].y),i.lineIndexArray.emplaceBack(ne+ee-1,ne+ee),w.push(V[ee].x),w.push(V[ee].y);G.vertexLength+=V.length,G.primitiveLength+=V.length}const j=oh(w,I);for(let V=0;V<j.length;V+=3)i.indexArray.emplaceBack(b+j[V],b+j[V+1],b+j[V+2]);if(j.length>0&&o&&this.elevationMode==="hd-road-base"){const V=o.elevation.isTunnel(),G=o.elevation.safeArea,ne=this.elevatedStructures.addVertices(A,P);this.elevatedStructures.addTriangles(j,ne,V);const ee=R.length;if(ee>0){for(let ie=0;ie<ee-1;ie++)this.elevatedStructures.addRenderableRing(o.index,R[ie]+ne,R[ie+1]-R[ie],V,G,o.featureInfo);this.elevatedStructures.addRenderableRing(o.index,R[ee-1]+ne,A.length-R[ee-1],V,G,o.featureInfo)}}v.vertexLength+=g,v.primitiveLength+=j.length/3}return[a,h]}prepareElevatedPolygons(e,i,o){const a=1/J(o),h=[];for(const u of e){const f=ov(u,new mi(i,a));h.push(...f)}return h}clipPolygonsToTile(e,i){const o=-i,a=-i,h=Xe+i,u=Xe+i;let f=0;const _=[],g=[];for(;f<e.length;f++){const w=e[f],I=Dh(w);(I.min.x>=o&&I.max.x<=h&&I.min.y>=a&&I.max.y<=u?_:g).push(w)}if(_.length===e.length)return e;const v=[new Be(o,a),new Be(h,a),new Be(h,u),new Be(o,u),new Be(o,a)],b=_;for(const w of g)b.push(...nv(w,v));return b}}let hg,ug,dg,pg;
vendor: 35,116 bytes, line 19
19nt(bm,"FillBucket",{omit:["layers","patternFeatures"]}),nt(vm,"FillBufferData"),nt(Un,"ElevatedStructures");class kp{constructor(e,i,o,a){if(this.triangleCount=i.length/3,this.min=new Be(0,0),this.max=new Be(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||e.length===0)return;const[h,u]=[e[0].clone(),e[0].clone()];for(let b=1;b<e.length;++b){const w=e[b];h.x=Math.min(h.x,w.x),h.y=Math.min(h.y,w.y),u.x=Math.max(u.x,w.x),u.y=Math.max(u.y,w.y)}if(a){const b=Math.ceil(Math.max(u.x-h.x,u.y-h.y)/a);o=Math.max(o,b)}if(o===0)return;this.min=h,this.max=u;const f=this.max.sub(this.min);f.x=Math.max(f.x,1),f.y=Math.max(f.y,1);const _=Math.max(f.x,f.y)/o;this.cellsX=Math.max(1,Math.ceil(f.x/_)),this.cellsY=Math.max(1,Math.ceil(f.y/_)),this.xScale=1/_,this.yScale=1/_;const g=[];for(let b=0;b<this.triangleCount;b++){const w=e[i[3*b+0]].sub(this.min),I=e[i[3*b+1]].sub(this.min),A=e[i[3*b+2]].sub(this.min),P=bs(Math.floor(Math.min(w.x,I.x,A.x)),this.xScale,this.cellsX),R=bs(Math.floor(Math.max(w.x,I.x,A.x)),this.xScale,this.cellsX),O=bs(Math.floor(Math.min(w.y,I.y,A.y)),this.yScale,this.cellsY),j=bs(Math.floor(Math.max(w.y,I.y,A.y)),this.yScale,this.cellsY),V=new Be(0,0),G=new Be(0,0),ne=new Be(0,0),ee=new Be(0,0);for(let ie=O;ie<=j;++ie){V.y=G.y=ie*_,ne.y=ee.y=(ie+1)*_;for(let le=P;le<=R;++le)V.x=ne.x=le*_,G.x=ee.x=(le+1)*_,(Tr(w,I,A,V,G,ee)||Tr(w,I,A,V,ee,ne))&&g.push({cellIdx:ie*this.cellsX+le,triIdx:b})}}if(g.length===0)return;g.sort((b,w)=>b.cellIdx-w.cellIdx||b.triIdx-w.triIdx);let v=0;for(;v<g.length;){const b=g[v].cellIdx,w={start:this.payload.length,len:0};for(;v<g.length&&g[v].cellIdx===b;)++w.len,this.payload.push(g[v++].triIdx);this.cells[b]=w}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,i){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const o=bs(e.x-this.min.x,this.xScale,this.cellsX),a=bs(e.y-this.min.y,this.yScale,this.cellsY),h=this.cells[a*this.cellsX+o];if(h){this._lazyInitLookup();for(let u=0;u<h.len;u++){const f=this.payload[h.start+u],_=Math.floor(f/8),g=1<<f%8;if(!(this.lookup[_]&g)&&(this.lookup[_]|=g,i.push(f),i.length===this.triangleCount))return}}}query(e,i,o){if(this.triangleCount===0||this.cells.length===0||e.x>this.max.x||this.min.x>i.x||e.y>this.max.y||this.min.y>i.y)return;this._lazyInitLookup();const a=bs(e.x-this.min.x,this.xScale,this.cellsX),h=bs(i.x-this.min.x,this.xScale,this.cellsX),u=bs(e.y-this.min.y,this.yScale,this.cellsY),f=bs(i.y-this.min.y,this.yScale,this.cellsY);for(let _=u;_<=f;_++)for(let g=a;g<=h;g++){const v=this.cells[_*this.cellsX+g];if(v)for(let b=0;b<v.len;b++){const w=this.payload[v.start+b],I=Math.floor(w/8),A=1<<w%8;if(!(this.lookup[I]&A)&&(this.lookup[I]|=A,o.push(w),o.length===this.triangleCount))return}}}}function bs(r,e,i){return Math.max(0,Math.min(i-1,Math.floor(r*e)))}nt(kp,"TriangleGridIndex");class fg{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.footprints=[],this.worldview=e.worldview}updateFootprints(e,i){for(const o of this.footprints)i.push({footprint:o,id:e})}populate(e,i,o,a){const h=[];for(const{feature:u,id:f,index:_,sourceLayerIndex:g}of e){const v=this.layers[0]._featureFilter.needGeometry,b=Te(u,v);if(!this.layers[0]._featureFilter.filter(new yi(this.zoom,{worldview:this.worldview}),b,o))continue;const w={id:f,properties:u.properties,type:u.type,sourceLayerIndex:g,index:_,geometry:v?b.geometry:se(u,o,a),patterns:{}};h.push(w)}for(const u of h){const{geometry:f,index:_,sourceLayerIndex:g}=u;this.addFeature(u,f,_,o,{},i.availableImages,i.brightness),i.featureIndex.insert(e[_].feature,f,_,g,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,o,a,h,u,f){}destroy(){}addFeature(e,i,o,a,h,u=[],f){for(const _ of Hu(i,2)){const g=[],v=[],b=[],w=new Be(1/0,1/0),I=new Be(-1/0,-1/0);for(const R of _)if(R.length!==0){R!==_[0]&&b.push(v.length/2);for(let O=0;O<R.length;O++)v.push(R[O].x),v.push(R[O].y),g.push(R[O]),w.x=Math.min(w.x,R[O].x),w.y=Math.min(w.y,R[O].y),I.x=Math.max(I.x,R[O].x),I.y=Math.max(I.y,R[O].y)}const A=oh(v,b),P=new kp(g,A,8,256);this.footprints.push({vertices:g,indices:A,grid:P,min:w,max:I})}}}nt(fg,"ClipBucket",{omit:["layers"]});const sv=Wt([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),av=Wt([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),lv=Wt([{name:"a_centroid_pos",components:2,type:"Uint16"}]),cv=Wt([{name:"a_join_normal_inside",components:3,type:"Int16"}]),hv=Wt([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),uv=Wt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:dv}=sv,$u=Number.MAX_SAFE_INTEGER,mg=$u-1;function _g(r,e,i,o){return r.order<e||r.order===$u||!(r.clipMask&i)||function(a,h){return h.length!==0&&h.find(u=>u===a)===void 0}(o,r.clipScope)}function Bp(r,e){return r.x-e.x||r.y-e.y}function gg(r,e){return Bp(r.min,e.min)===0&&Bp(r.max,e.max)===0}function wm(r,e){return!(r.min.x>e.max.x||r.max.x<e.min.x||r.min.y>e.max.y||r.max.y<e.min.y)}function Np(r,e){if(r.length!==e.length)return!1;for(let i=0;i<r.length;i++)if(r[i].sourceId!==e[i].sourceId||!gg(r[i],e[i])||r[i].order!==e[i].order||r[i].clipMask!==e[i].clipMask||!zo(r[i].clipScope,e[i].clipScope))return!1;return!0}function yg(r,e,i){const o=1/Xe,a=1/(1<<i.canonical.z),h=(e.x*o+i.canonical.x)*a+i.wrap,u=(e.y*o+i.canonical.y)*a;return{min:new Be((r.x*o+i.canonical.x)*a+i.wrap,(r.y*o+i.canonical.y)*a),max:new Be(h,u)}}function pv(r,e,i){const o=1<<i.canonical.z,a=((e.x-i.wrap)*o-i.canonical.x)*Xe,h=(e.y*o-i.canonical.y)*Xe;return{min:new Be(((r.x-i.wrap)*o-i.canonical.x)*Xe,(r.y*o-i.canonical.y)*Xe),max:new Be(a,h)}}function Tm(r,e,i,o,a,h,u){const f=r.indices,_=r.vertices,g=[];for(let v=o;v<o+a;v+=3){const b=e[i[v+0]+h],w=e[i[v+1]+h],I=e[i[v+2]+h],A=Math.min(b.x,w.x,I.x),P=Math.max(b.x,w.x,I.x),R=Math.min(b.y,w.y,I.y),O=Math.max(b.y,w.y,I.y);g.length=0,r.grid.query(new Be(A,R),new Be(P,O),g);for(let j=0;j<g.length;j++){const V=g[j];if(Tr(_[f[3*V+0]],_[f[3*V+1]],_[f[3*V+2]],b,w,I,u))return!0}}return!1}function xg(r,e,i,o){if(!r||!i)return!1;let a=r.vertices;if(!e.canonical.equals(o.canonical)||e.wrap!==o.wrap){if(i.vertices.length<r.vertices.length)return xg(i,o,r,e);const h=e.canonical,u=o.canonical,f=Math.pow(2,u.z-h.z);a=r.vertices.map(_=>new Be((_.x+h.x*Xe)*f-u.x*Xe,(_.y+h.y*Xe)*f-u.y*Xe))}return Tm(i,a,r.indices,0,r.indices.length,0,0)}function vg(r,e,i,o){const a=Math.pow(2,o.z-i.z);return new Be((r+i.x*Xe)*a-o.x*Xe,(e+i.y*Xe)*a-o.y*Xe)}function Sm(r,e){const i=[];e.grid.queryPoint(r,i);const o=e.indices,a=e.vertices;for(let h=0;h<i.length;h++){const u=i[h];if(Gr([a[o[3*u+0]],a[o[3*u+1]],a[o[3*u+2]]],r))return!0}return!1}const Em=[new Be(0,0),new Be(Xe,0),new Be(Xe,Xe),new Be(0,Xe)];function bg(r,e){const i=[];let o=[];if(!e||r.length<2)return[r];if(r.length===2)return Ki(r[0],r[1],Em)?[r]:[];for(let a=0;a<r.length+2;a++){const h=r[a%r.length],u=r[(a+1)%r.length],f=Ki(a===0?r[r.length-1]:r[(a-1)%r.length],h,Em),_=Ki(h,u,Em),g=f||_;g&&o.push(h),g&&_||o.length>0&&(o.length>1&&i.push(o),o=[])}return o.length>1&&i.push(o),i}const Im=ge.types,fv=["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"],mv=["fill-extrusion-flood-light-ground-radius"],_v=Math.pow(2,13),gv=Math.pow(2,15)-1,wg=new Be(0,1),Ga=2147483648;function Zu(r,e,i,o,a,h,u,f){r.emplaceBack((e<<1)+u,(i<<1)+h,(Math.floor(o*_v)<<1)+a,Math.round(f))}function Wu(r,e,i){r.emplaceBack(e.x*Xe,e.y*Xe,i?1:0)}function Vp(r,e,i,o,a,h){r.emplaceBack(e.x,e.y,(i.x<<1)+o,(i.y<<1)+a,h)}function Xu(r,e,i){r.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Tg{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Sg{constructor(){this.centroidXY=new Be(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 Be(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Be(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new Be(this.max.x-this.min.x,this.max.y-this.min.y)}}class Eg{constructor(){this.acc=new Be(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,i){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=i.x,e.min.y=e.max.y=i.y)}appendEdge(e,i,o){this.accCount++,this.acc._add(i);let a=!!this.borders;i.x<e.min.x?(e.min.x=i.x,a=!0):i.x>e.max.x&&(e.max.x=i.x,a=!0),i.y<e.min.y?(e.min.y=i.y,a=!0):i.y>e.max.y&&(e.max.y=i.y,a=!0),((i.x===0||i.x===Xe)&&i.x===o.x)!=((i.y===0||i.y===Xe)&&i.y===o.y)&&this.processBorderOverlap(i,o),a&&this.checkBorderIntersection(i,o)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,mt(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>Xe!=e.x>Xe&&this.addBorderIntersection(1,mt(i.y,e.y,(Xe-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,mt(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>Xe!=e.y>Xe&&this.addBorderIntersection(3,mt(i.x,e.x,(Xe-i.y)/(e.y-i.y)))}addBorderIntersection(e,i){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const o=this.borders[e];i<o[0]&&(o[0]=i),i>o[1]&&(o[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const o=e.x===0?0:1;this.addBorderIntersection(o,i.y),this.addBorderIntersection(o,e.y)}else{const o=e.y===0?2:3;this.addBorderIntersection(o,i.x),this.addBorderIntersection(o,e.x)}}centroid(){return this.accCount===0?new Be(0,0):new Be(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,i)=>e+ +(i[0]!==Number.MAX_VALUE),0):0}}function Ig(r,e){const i=r.add(e)._unit(),o=W(r.x*i.x+r.y*i.y,-1,1);var a,h,u;return a=Math.acos(o),Math.min(4,Math.max(-4,Math.tan(a)))/4*gv*((h=r).x*(u=e).y-h.y*u.x<0?-1:1)}const yv=[r=>r.x<0,r=>r.x>Xe,r=>r.y<0,r=>r.y>Xe];function xv(r,e,i,o){const a=[4];if(o===0)return a;i._mult(o);const h=r.sub(i),u=e.sub(i),f=[r,e,h,u];for(let _=0;_<4;_++)for(const g of f)if(yv[_](g)){a.push(_);break}return a}class Am{constructor(e){this.vertexArray=new Wc,this.indexArray=new Ni,this.programConfigurations=new kn(e.layers,{zoom:e.zoom,lut:e.lut},i=>mv.includes(i)),this._segments=new qi,this.hiddenByLandmarkVertexArray=new eh,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new qi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,o,a=!1){const h=e.length;if(h>2){let u=Math.max(0,this._segments.get().length-1);const f=this._segments._prepareSegment(4*h,this.vertexArray.length,2*this._segmentToGroundQuads[u].length);let _;u!==this._segments.get().length-1&&(u++,this._segmentToGroundQuads[u]=[],this._segmentToRegionTriCounts[u]=[0,0,0,0,0]);{const g=e[0],v=e[1];_=Ig(g.sub(e[h-1])._perp()._unit(),v.sub(g)._perp()._unit())}for(let g=0;g<h;g++){const v=g===h-1?0:g+1,b=e[g],w=e[v],I=e[v===h-1?0:v+1],A=w.sub(b)._perp()._unit(),P=Ig(A,I.sub(w)._perp()._unit()),R=_,O=P;if(Cm(b,w,i)||a&&Mg(b,i)&&Mg(w,i)){_=P;continue}const j=f.vertexLength;Vp(this.vertexArray,b,w,1,1,R),Vp(this.vertexArray,b,w,1,0,R),Vp(this.vertexArray,b,w,0,1,O),Vp(this.vertexArray,b,w,0,0,O),f.vertexLength+=4;const V=xv(b,w,A,o);for(const G of V)this._segmentToGroundQuads[u].push({id:j,region:G}),this._segmentToRegionTriCounts[u][G]+=2,f.primitiveLength+=2;_=P}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let o=0;o<i;o++)this._segmentToGroundQuads[o].sort((a,h)=>a.region-h.region);for(let o=0;o<i;o++){const a=this._segmentToGroundQuads[o],h=e[o],u=this._segmentToRegionTriCounts[o];u.reduce((_,g)=>_+g,0);let f=0;for(let _=0;_<=4;_++){const g=u[_];if(g!==0){let v=this.regionSegments[_];v||(v=this.regionSegments[_]=new qi);const b={vertexOffset:h.vertexOffset,primitiveOffset:h.primitiveOffset+f,vertexLength:h.vertexLength,primitiveLength:g};v.get().push(b)}f+=g}for(let _=0;_<a.length;_++){const g=a[_].id;this.indexArray.emplaceBack(g,g+1,g+3),this.indexArray.emplaceBack(g,g+3,g+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,o,a,h,u,f){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,o,a,h,u,void 0,f)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,av.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,o,a,h,u,f,_){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,o,a,h,u,f,_)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&Ga))}updateHiddenByLandmarkRange(e,i,o){if(!this.hasData())return;const a=i+e;if(i!==0){for(let h=e;h<a;++h)this.hiddenByLandmarkVertexArray.emplace(h,o?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,hv.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const i=this.regionSegments[e];i&&i.destroy()}}}}class jp{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Ni,this.footprintVertices=new yn,this.footprintSegments=[],this.layoutVertexArray=new Pa,this.centroidVertexArray=new vp,this.wallVertexArray=new wp,this.indexArray=new Ni,this.programConfigurations=new kn(e.layers,{zoom:e.zoom,lut:e.lut},i=>fv.includes(i)),this.segments=new qi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new Am(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,o,a){this.features=[],this.hasPattern=gm("fill-extrusion",this.layers,this.pixelRatio,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=J(o),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:h,id:u,index:f,sourceLayerIndex:_}of e){const g=this.layers[0]._featureFilter.needGeometry,v=Te(h,g);if(!this.layers[0]._featureFilter.filter(new yi(this.zoom,{worldview:this.worldview}),v,o))continue;const b={id:u,sourceLayerIndex:_,index:f,geometry:g?v.geometry:se(h,o,a),properties:h.properties,type:h.type,patterns:{}},w=this.layoutVertexArray.length,I=Im[b.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:h.id,feature:ym("fill-extrusion",this.layers,b,this.zoom,this.pixelRatio,i)});else if(this.wallMode)for(const A of b.geometry)for(const P of bg(A,I))this.addFeature(h.id,b,[P],f,o,{},i.availableImages,a,i.brightness);else this.addFeature(h.id,b,b.geometry,f,o,{},i.availableImages,a,i.brightness);i.featureIndex.insert(h,b.geometry,f,_,this.index,w)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,o,a,h,u){for(const{featureId:f,feature:_}of this.features){const g=Im[_.type]==="Polygon",{geometry:v}=_;if(this.wallMode)for(const b of v)for(const w of bg(b,g))this.addFeature(f,_,[w],_.index,i,o,a,h,u);else this.addFeature(f,_,v,_.index,i,o,a,h,u)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,o,a,h,u,f){this.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f,this.worldview),this.groundEffect.update(e,i,h,o,a,u,f,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,dv),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,cv.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,uv.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,lv.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,i,o,a,h,u,f,_,g){const v=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(i,{})/this.tileToMeter,b=[new Be(0,0),new Be(Xe,Xe)],w=_.projection,I=w.name==="globe",A=this.wallMode||Im[i.type]==="Polygon",P=new Eg;P.centroidDataIndex=this.centroidData.length;const R=new Sg;R.buildingId=e,i.properties&&i.properties.hasOwnProperty("building_id")&&(R.buildingId=i.properties.building_id);const O=this.layers[0].paint.get("fill-extrusion-base").evaluate(i,{},h)<=0,j=this.layers[0].paint.get("fill-extrusion-height").evaluate(i,{},h);let V;if(R.height=j,R.vertexArrayOffset=this.layoutVertexArray.length,R.groundVertexArrayOffset=this.groundEffect.vertexArray.length,I&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Yc),this.wallMode){if(I)return void Ht("Non zero fill-extrusion-line-width is not yet supported on globe.");if(o.length!==1)return;V=function(pe){const Ce=pe[0].x===pe[pe.length-1].x&&pe[0].y===pe[pe.length-1].y;(function(Ve){let at=0;const tt=Ve.length;for(let Ye=0;Ye<tt;Ye++)at+=(Ve[(Ye+1)%tt].x-Ve[Ye].x)*(Ve[(Ye+1)%tt].y+Ve[Ye].y);return at>=0})(pe)||(pe=pe.reverse());const Pe={geometry:[],joinNormals:[],indices:[]},Oe=[],je=[],Se=[];let ke=pe.length;for(;ke>=2&&pe[ke-1].equals(pe[ke-2]);)ke--;if(ke<(Ce?3:2))return Pe;let fe,Ee,$e,Ne,ht,ot=0;for(;ot<ke-1&&pe[ot].equals(pe[ot+1]);)ot++;Ce&&(fe=pe[ke-2],ht=pe[ot].sub(fe)._unit()._perp());for(let Ve=ot;Ve<ke;Ve++){if($e=Ve===ke-1?Ce?pe[ot+1]:void 0:pe[Ve+1],$e&&pe[Ve].equals($e))continue;ht&&(Ne=ht),fe&&(Ee=fe),fe=pe[Ve],ht=$e?$e.sub(fe)._unit()._perp():Ne,Ne=Ne||ht;let at=Ne.add(ht);at.x===0&&at.y===0||at._unit();const tt=at.x*ht.x+at.y*ht.y,Ye=tt!==0?1/tt:1/0,it=Ne.x*ht.y-Ne.y*ht.x>0;let gt="miter";const St=2;gt==="miter"&&Ye>St&&(gt="bevel"),gt==="bevel"&&(Ye>100&&(gt="flipbevel"),Ye<St&&(gt="miter"));const Pt=(Ct,$t,Ot,Pi)=>{const H=new Be(Ct.x,Ct.y),$=new Be(Ct.x,Ct.y);H.x+=$t.x*Pi,H.y+=$t.y*Pi,$.x-=$t.x*Math.max(Ot,1),$.y-=$t.y*Math.max(Ot,1),Se.push($t),Oe.push(H),je.push($)};if(gt==="miter")at._mult(Ye),Pt(fe,at,0,0);else if(gt==="flipbevel")at=ht.mult(-1),Pt(fe,at,0,0),Pt(fe,at.mult(-1),0,0);else{const Ct=-Math.sqrt(Ye*Ye-1),$t=it?Ct:0,Ot=it?0:Ct;Ee&&Pt(fe,Ne,$t,Ot),$e&&Pt(fe,ht,$t,Ot)}}Pe.geometry=[...Oe,...je.reverse(),Oe[0]],Pe.joinNormals=[...Se,...Se.reverse(),Se[Se.length-1]];const Le=Pe.geometry.length-1;for(let Ve=0;Ve<Le/2;Ve++)if(Ve+1<Le/2){let at=Ve,tt=Ve+1,Ye=Le-1-Ve,it=Le-2-Ve;at=at===0?Le-1:at-1,tt=tt===0?Le-1:tt-1,Ye=Ye===0?Le-1:Ye-1,it=it===0?Le-1:it-1,Pe.indices.push(Ye),Pe.indices.push(tt),Pe.indices.push(at),Pe.indices.push(Ye),Pe.indices.push(it),Pe.indices.push(tt)}return Pe}(o[0]),o=[V.geometry]}const G=(pe,Ce)=>pe<(Ce.length-1)/2||pe===Ce.length-1,ne=this.wallMode?[o]:Hu(o,500);for(let pe=ne.length-1;pe>=0;pe--){const Ce=ne[pe];(Ce.length===0||(ee=Ce[0]).every(Ge=>Ge.x<=0)||ee.every(Ge=>Ge.x>=Xe)||ee.every(Ge=>Ge.y<=0)||ee.every(Ge=>Ge.y>=Xe))&&ne.splice(pe,1)}var ee;let ie;if(I)ie=Dg(ne,b,h);else{ie=[];for(const pe of ne)ie.push({polygon:pe,bounds:b})}const le=A?this.edgeRadius:0,he=le>0&&this.zoom<17,Ie=(pe,Ce)=>{if(pe.length===0)return!1;const Ge=pe[pe.length-1];return Ce.x===Ge.x&&Ce.y===Ge.y};for(const{polygon:pe,bounds:Ce}of ie){let Ge=0,Pe=0;for(const ke of pe)A&&!ke[0].equals(ke[ke.length-1])&&ke.push(ke[0]),Pe+=A?ke.length-1:ke.length;const Oe=this.segments.prepareSegment((A?5:4)*Pe,this.layoutVertexArray,this.indexArray);R.footprintSegIdx<0&&(R.footprintSegIdx=this.footprintSegments.length),R.polygonSegIdx<0&&(R.polygonSegIdx=this.polygonSegments.length);const je={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},Se=new Tg;if(Se.vertexOffset=this.footprintVertices.length,Se.indexOffset=3*this.footprintIndices.length,Se.ringIndices=[],A){const ke=[],fe=[];Ge=Oe.vertexLength;for(let $e=0;$e<pe.length;$e++){const Ne=pe[$e];Ne.length&&$e!==0&&fe.push(ke.length/2);const ht=[];let ot,Le;ot=Ne[1].sub(Ne[0])._perp()._unit(),Se.ringIndices.push(Ne.length-1);for(let Ve=1;Ve<Ne.length;Ve++){const at=Ne[Ve],tt=Ne[Ve===Ne.length-1?1:Ve+1],Ye=at.clone();if(le){Le=tt.sub(at)._perp()._unit();const it=ot.add(Le)._unit(),gt=le*Math.min(4,1/(ot.x*it.x+ot.y*it.y));Ye.x+=gt*it.x,Ye.y+=gt*it.y,Ye.x=Math.round(Ye.x),Ye.y=Math.round(Ye.y),ot=Le}if(!O||le!==0&&!he||Ie(ht,Ye)||ht.push(Ye),Zu(this.layoutVertexArray,Ye.x,Ye.y,0,0,1,1,0),this.wallMode){const it=G(Ve,Ne);Wu(this.wallVertexArray,V.joinNormals[Ve],!it)}Oe.vertexLength++,this.footprintVertices.emplaceBack(at.x,at.y),ke.push(at.x,at.y),I&&Xu(this.layoutVertexExtArray,w.projectTilePoint(Ye.x,Ye.y,h),w.upVector(h,Ye.x,Ye.y))}O&&(le===0||he)&&(ht.length!==0&&Ie(ht,ht[0])&&ht.pop(),this.groundEffect.addData(ht,Ce,v))}const Ee=this.wallMode?V.indices:oh(ke,fe);for(let $e=0;$e<Ee.length;$e+=3)this.footprintIndices.emplaceBack(Se.vertexOffset+Ee[$e+0],Se.vertexOffset+Ee[$e+1],Se.vertexOffset+Ee[$e+2]),this.indexArray.emplaceBack(Ge+Ee[$e],Ge+Ee[$e+2],Ge+Ee[$e+1]),Oe.primitiveLength++;Se.indexCount+=Ee.length,Se.vertexCount+=this.footprintVertices.length-Se.vertexOffset}for(let ke=0;ke<pe.length;ke++){const fe=pe[ke];P.startRing(R,fe[0]);let Ee=fe.length>4&&Pg(fe[fe.length-2],fe[0],fe[1]),$e=le?vv(fe[fe.length-2],fe[0],fe[1],le):0;const Ne=[];let ht,ot,Le;ot=fe[1].sub(fe[0])._perp()._unit();let Ve=!0;for(let at=1,tt=0;at<fe.length;at++){let Ye=fe[at-1],it=fe[at];const gt=fe[at===fe.length-1?1:at+1];if(P.appendEdge(R,it,Ye),Cm(it,Ye,Ce)){le&&(ot=gt.sub(it)._perp()._unit(),Ve=!Ve);continue}const St=it.sub(Ye)._perp(),Pt=St.x/(Math.abs(St.x)+Math.abs(St.y)),Ct=St.y>0?1:0,$t=Ye.dist(it);if(tt+$t>32768&&(tt=0),le){Le=gt.sub(it)._perp()._unit();let $=Cg(Ye,it,gt,Ag(ot,Le),le);isNaN($)&&($=0);const we=it.sub(Ye)._unit();Ye=Ye.add(we.mult($e))._round(),it=it.add(we.mult(-$))._round(),$e=$,ot=Le,O&&this.zoom>=17&&(Ie(Ne,Ye)||Ne.push(Ye),Ie(Ne,it)||Ne.push(it))}const Ot=Oe.vertexLength,Pi=fe.length>4&&Pg(Ye,it,gt);let H=zg(tt,Ee,Ve);if(Zu(this.layoutVertexArray,Ye.x,Ye.y,Pt,Ct,0,0,H),Zu(this.layoutVertexArray,Ye.x,Ye.y,Pt,Ct,0,1,H),this.wallMode){const $=G(at-1,fe),we=V.joinNormals[at-1];Wu(this.wallVertexArray,we,$),Wu(this.wallVertexArray,we,$)}if(tt+=$t,H=zg(tt,Pi,!Ve),Ee=Pi,Zu(this.layoutVertexArray,it.x,it.y,Pt,Ct,0,0,H),Zu(this.layoutVertexArray,it.x,it.y,Pt,Ct,0,1,H),this.wallMode){const $=G(at,fe),we=V.joinNormals[at];Wu(this.wallVertexArray,we,$),Wu(this.wallVertexArray,we,$)}if(Oe.vertexLength+=4,this.indexArray.emplaceBack(Ot+0,Ot+1,Ot+2),this.indexArray.emplaceBack(Ot+1,Ot+3,Ot+2),Oe.primitiveLength+=2,le){const $=Ge+(at===1?fe.length-2:at-2),we=at===1?Ge:$+1;if(this.indexArray.emplaceBack(Ot+1,$,Ot+3),this.indexArray.emplaceBack($,we,Ot+3),Oe.primitiveLength+=2,ht===void 0&&(ht=Ot),!Cm(gt,fe[at],Ce)){const Ze=at===fe.length-1?ht:Oe.vertexLength;this.indexArray.emplaceBack(Ot+2,Ot+3,Ze),this.indexArray.emplaceBack(Ot+3,Ze+1,Ze),this.indexArray.emplaceBack(Ot+3,we,Ze+1),Oe.primitiveLength+=3}Ve=!Ve}if(I){const $=this.layoutVertexExtArray,we=w.projectTilePoint(Ye.x,Ye.y,h),Ze=w.projectTilePoint(it.x,it.y,h),Je=w.upVector(h,Ye.x,Ye.y),Ke=w.upVector(h,it.x,it.y);Xu($,we,Je),Xu($,we,Je),Xu($,Ze,Ke),Xu($,Ze,Ke)}}A&&(Ge+=fe.length-1),O&&le&&this.zoom>=17&&(Ne.length!==0&&Ie(Ne,Ne[0])&&Ne.pop(),this.groundEffect.addData(Ne,Ce,v,le>0))}this.footprintSegments.push(Se),je.triangleCount=this.indexArray.length-je.triangleArrayOffset,this.polygonSegments.push(je),++R.footprintSegLen,++R.polygonSegLen}if(R.vertexCount=this.layoutVertexArray.length-R.vertexArrayOffset,R.groundVertexCount=this.groundEffect.vertexArray.length-R.groundVertexArrayOffset,R.vertexCount!==0){if(R.centroidXY=P.borders?wg:this.encodeCentroid(P,R),this.centroidData.push(R),P.borders){this.featuresOnBorder.push(P);const pe=this.featuresOnBorder.length-1;for(let Ce=0;Ce<P.borders.length;Ce++)P.borders[Ce][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[Ce].push(pe)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,i,a,u,f,h,g,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(i,a,u,f,h,g,this.worldview),this.maxHeight=Math.max(this.maxHeight,j)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,o)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[o].borders[e][0])}splitToSubtiles(){const e=[];for(let f=0;f<this.centroidData.length;f++){const _=this.centroidData[f],g=+(_.min.y+_.max.y>Xe),v=2*g+(+(_.min.x+_.max.x>Xe)^g);for(let b=0;b<_.polygonSegLen;b++){const w=_.polygonSegIdx+b;e.push({centroidIdx:f,subtile:v,polygonSegmentIdx:w,triangleSegmentIdx:this.polygonSegments[w].triangleSegIdx})}}const i=new Ni;e.sort((f,_)=>f.triangleSegmentIdx===_.triangleSegmentIdx?f.subtile-_.subtile:f.triangleSegmentIdx-_.triangleSegmentIdx);let o=0,a=0,h=0;for(const f of e){if(f.triangleSegmentIdx!==o)break;h++}const u=e.length;for(;a!==e.length;){o=e[a].triangleSegmentIdx;let f=0,_=a,g=a;for(let v=_;v<h&&e[v].subtile===f;v++)g++;for(;_!==h;){const v=e[_];f=v.subtile;const b=this.centroidData[v.centroidIdx].min.clone(),w=this.centroidData[v.centroidIdx].max.clone(),I={vertexOffset:this.segments.segments[o].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[o].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let A=_;A<g;A++){const P=e[A],R=this.polygonSegments[P.polygonSegmentIdx],O=this.centroidData[P.centroidIdx].min,j=this.centroidData[P.centroidIdx].max,V=this.indexArray.uint16;for(let G=R.triangleArrayOffset;G<R.triangleArrayOffset+R.triangleCount;G++)i.emplaceBack(V[3*G],V[3*G+1],V[3*G+2]);I.primitiveLength+=R.triangleCount,b.x=Math.min(b.x,O.x),b.y=Math.min(b.y,O.y),w.x=Math.max(w.x,j.x),w.y=Math.max(w.y,j.y)}I.primitiveLength>0&&this.triangleSubSegments.push({segment:I,min:b,max:w}),_=g;for(let A=_;A<h&&e[A].subtile===e[_].subtile;A++)g++}a=h;for(let v=a;v<u&&e[v].triangleSegmentIdx===e[a].triangleSegmentIdx;v++)h++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,o){const a=new qi;if(this.wallMode){for(const P of this.triangleSubSegments)a.segments.push(P.segment);return a}let h=0,u=0;const f=1<<e.canonical.z;if(i){const P=i.getMinMaxForTile(e);P&&(h=P.min,u=P.max)}u+=this.maxHeight;const _=e.toUnwrapped();let g;const v=[_.canonical.x/f+_.wrap,_.canonical.y/f],b=[(_.canonical.x+1)/f+_.wrap,(_.canonical.y+1)/f],w=(P,R,O)=>[P[0]*(1-O[0])+R[0]*O[0],P[1]*(1-O[1])+R[1]*O[1]],I=[],A=[];for(const P of this.triangleSubSegments){I[0]=P.min.x/Xe,I[1]=P.min.y/Xe,A[0]=P.max.x/Xe,A[1]=P.max.y/Xe;const R=w(v,b,I),O=w(v,b,A);if(new Nt([R[0],R[1],h],[O[0],O[1],u]).intersectsPrecise(o)===0){g&&(a.segments.push(g),g=void 0);continue}const j=P.segment;g&&g.vertexOffset!==j.vertexOffset&&(a.segments.push(g),g=void 0),g?(g.vertexLength+=j.vertexLength,g.primitiveLength+=j.primitiveLength):g={vertexOffset:j.vertexOffset,primitiveLength:j.primitiveLength,vertexLength:j.vertexLength,primitiveOffset:j.primitiveOffset,sortKey:void 0,vaos:{}}}return g&&a.segments.push(g),a}encodeCentroid(e,i){const o=e.centroid(),a=i.span(),h=Math.min(7,Math.round(a.x*this.tileToMeter/10)),u=Math.min(7,Math.round(a.y*this.tileToMeter/10));return new Be(W(o.x,1,Xe-1)<<3|h,W(o.y,1,Xe-1)<<3|u)}encodeBorderCentroid(e){if(!e.borders)return new Be(0,0);const i=e.borders,o=Number.MAX_VALUE;if(i[0][0]!==o||i[1][0]!==o){const a=i[0][0]!==o?0:1;return new Be(6|(i[0][0]!==o?0:65528),(i[a][0]+i[a][1])/2<<3|6)}{const a=i[2][0]!==o?2:3;return new Be((i[a][0]+i[a][1])/2<<3|6,6|(i[2][0]!==o?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=2147483647,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,o=e.vertexCount+e.vertexArrayOffset,a=e.flags&Ga?wg:e.centroidXY,h=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==a.y||h!==a.x){for(let u=i;u<o;++u)this.centroidVertexArray.emplace(u,a.x,a.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,i,o){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(Np(this.activeReplacements,a))return;if(this.activeReplacements=a,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const u of this.centroidData)u.flags&=2147483647;const h=[];for(const u of this.activeReplacements){if(u.order<o)continue;const f=Math.max(1,Math.pow(2,u.footprintTileId.canonical.z-e.canonical.z));if(u.footprint.buildingId){const _=u.footprint.buildingId;for(const g of this.centroidData)g.buildingId===_&&(g.flags|=Ga)}else for(const _ of this.centroidData)if(!(_.flags&Ga||u.min.x>_.max.x||_.min.x>u.max.x||u.min.y>_.max.y||_.min.y>u.max.y))for(let g=0;g<_.footprintSegLen;g++){const v=this.footprintSegments[_.footprintSegIdx+g];if(h.length=0,bv(this.footprintVertices,v.vertexOffset,v.vertexCount,u.footprintTileId.canonical,e.canonical,h),Tm(u.footprint,h,this.footprintIndices.uint16,v.indexOffset,v.indexCount,-v.vertexOffset,-f)){_.flags|=Ga;break}}}for(const u of this.centroidData)this.writeCentroidToBuffer(u);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,o){let a=!1;for(let h=0;h<o.footprintSegLen;h++){const u=this.footprintSegments[o.footprintSegIdx+h];let f=0;for(const _ of u.ringIndices){for(let g=f,v=_+f-1;g<_+f;v=g++){const b=this.footprintVertices.int16[2*(g+u.vertexOffset)+0],w=this.footprintVertices.int16[2*(g+u.vertexOffset)+1],I=this.footprintVertices.int16[2*(v+u.vertexOffset)+1];w>i!=I>i&&e<(this.footprintVertices.int16[2*(v+u.vertexOffset)+0]-b)*(i-w)/(I-w)+b&&(a=!a)}f=_}}return a}getHeightAtTileCoord(e,i){let o=Number.NEGATIVE_INFINITY,a=!0;const h=4*(e+Xe)*Xe+(i+Xe);if(this.partLookup.hasOwnProperty(h)){const u=this.partLookup[h];return u?{height:u.height,hidden:!!(u.flags&Ga)}:void 0}for(const u of this.centroidData)e>u.max.x||u.min.x>e||i>u.max.y||u.min.y>i||u.height<=o||this.footprintContainsPoint(e,i,u)&&(o=u.height,this.partLookup[h]=u,a=!!(u.flags&Ga));if(o!==Number.NEGATIVE_INFINITY)return{height:o,hidden:a};this.partLookup[h]=void 0}}function Ag(r,e){const i=r.add(e)._unit();return r.x*i.x+r.y*i.y}function vv(r,e,i,o){const a=e.sub(r)._perp()._unit(),h=i.sub(e)._perp()._unit();return Cg(r,e,i,Ag(a,h),o)}function Cg(r,e,i,o,a){const h=Math.sqrt(1-o*o);return Math.min(r.dist(e)/3,e.dist(i)/3,a*h/o)}function Cm(r,e,i){return r.x<i[0].x&&e.x<i[0].x||r.x>i[1].x&&e.x>i[1].x||r.y<i[0].y&&e.y<i[0].y||r.y>i[1].y&&e.y>i[1].y}function Mg(r,e){return r.x<e[0].x||r.x>e[1].x||r.y<e[0].y||r.y>e[1].y}function Pg(r,e,i){if(r.x<0||r.x>=Xe||e.x<0||e.x>=Xe||i.x<0||i.x>=Xe)return!1;const o=i.sub(e),a=o.perp(),h=r.sub(e);return(o.x*h.x+o.y*h.y)/Math.sqrt((o.x*o.x+o.y*o.y)*(h.x*h.x+h.y*h.y))>-.866&&a.x*h.x+a.y*h.y<0}function zg(r,e,i){const o=e?2|r:-3&r;return i?1|o:-2&o}function Rg(){const r=Math.PI/32,e=Math.tan(r),i=x;return i*Math.sqrt(1+2*e*e)-i}function Dg(r,e,i){const o=1<<i.z,a=N(i.x/o),h=N((i.x+1)/o),u=U(i.y/o),f=U((i.y+1)/o);return function(_,g,v,b,w=0,I){const A=[];if(!_.length||!v||!b)return A;const P=(ee,ie)=>{for(const le of ee)A.push({polygon:le,bounds:ie})},R=Math.ceil(Math.log2(v)),O=Math.ceil(Math.log2(b)),j=R-O,V=[];for(let ee=0;ee<Math.abs(j);ee++)V.push(j>0?0:1);for(let ee=0;ee<Math.min(R,O);ee++)V.push(0),V.push(1);let G=_;if(G=Op(G,g[0].y-w,g[1].y+w,1),G=Op(G,g[0].x-w,g[1].x+w,0),!G.length)return A;const ne=[];for(V.length?ne.push({polygons:G,bounds:g,depth:0}):P(G,g);ne.length;){const ee=ne.pop(),ie=ee.depth,le=V[ie],he=ee.bounds[0],Ie=ee.bounds[1],pe=le===0?he.x:he.y,Ce=le===0?Ie.x:Ie.y,Ge=I?I(le,pe,Ce):.5*(pe+Ce),Pe=Op(ee.polygons,pe-w,Ge+w,le),Oe=Op(ee.polygons,Ge-w,Ce+w,le);if(Pe.length){const je=[he,new Be(le===0?Ge:Ie.x,le===1?Ge:Ie.y)];V.length>ie+1?ne.push({polygons:Pe,bounds:je,depth:ie+1}):P(Pe,je)}if(Oe.length){const je=[new Be(le===0?Ge:he.x,le===1?Ge:he.y),Ie];V.length>ie+1?ne.push({polygons:Oe,bounds:je,depth:ie+1}):P(Oe,je)}}return A}(r,e,Math.ceil((h-a)/11.25),Math.ceil((u-f)/11.25),1,(_,g,v)=>{if(_===0)return .5*(g+v);{const b=U((i.y+g/Xe)/o);return(F(.5*(U((i.y+v/Xe)/o)+b))*o-i.y)*Xe}})}function bv(r,e,i,o,a,h){const u=Math.pow(2,o.z-a.z);for(let f=0;f<i;f++){let _=r.int16[2*(f+e)+0],g=r.int16[2*(f+e)+1];
19_=(_+a.x*Xe)*u-o.x*Xe,g=(g+a.y*Xe)*u-o.y*Xe,h.push(new Be(_,g))}}let Lg,Fg;nt(jp,"FillExtrusionBucket",{omit:["layers","features"]}),nt(Sg,"PartData"),nt(Tg,"FootprintSegment"),nt(Eg,"BorderCentroidData"),nt(Am,"GroundEffect");class Xl extends Be{constructor(e,i,o){super(e,i),this.z=o}}class Og extends Xl{constructor(e,i,o,a){super(e,i,o),this.w=a}}function kg(r,e,i,o){const a=i==="x"?"y":"x",h=(o-r[i])/(e[i]-r[i]);r[a]=Math.round(r[a]+(e[a]-r[a])*h),r[i]=o,r.hasOwnProperty("z")&&(r.z=mt(r.z,e.z,h)),r.hasOwnProperty("w")&&(r.w=mt(r.w,e.w,h))}function Bg(r,e,i,o){const a=i,h=o;for(const u of["x","y"]){let f=r,_=e;f[u]>=_[u]&&(f=e,_=r),f[u]<a&&_[u]>a&&kg(f,_,u,a),f[u]<h&&_[u]>h&&kg(_,f,u,h)}}function Up(r,e,i,o,a,h){const u=[];for(let f=0;f<r.length;f++){const _=r[f];let g;const v=u.length;let b=0;for(let w=0;w<_.length-1;w++){let I=_[w],A=_[w+1],P=0;const R=b;let O,j;h&&(P=Math.hypot(A.x-I.x,A.y-I.y),b+=P,O=I,j=A),I.x<e&&A.x<e||(I.x<e?I=new Be(e,I.y+(e-I.x)/(A.x-I.x)*(A.y-I.y))._round():A.x<e&&(A=new Be(e,I.y+(e-I.x)/(A.x-I.x)*(A.y-I.y))._round()),I.y<i&&A.y<i||(I.y<i?I=new Be(I.x+(i-I.y)/(A.y-I.y)*(A.x-I.x),i)._round():A.y<i&&(A=new Be(I.x+(i-I.y)/(A.y-I.y)*(A.x-I.x),i)._round()),I.x>=o&&A.x>=o||(I.x>=o?I=new Be(o,I.y+(o-I.x)/(A.x-I.x)*(A.y-I.y))._round():A.x>=o&&(A=new Be(o,I.y+(o-I.x)/(A.x-I.x)*(A.y-I.y))._round()),I.y>=a&&A.y>=a||(I.y>=a?I=new Be(I.x+(a-I.y)/(A.y-I.y)*(A.x-I.x),a)._round():A.y>=a&&(A=new Be(I.x+(a-I.y)/(A.y-I.y)*(A.x-I.x),a)._round()),g&&I.equals(g[g.length-1])||(g=[I],u.push(g),h&&h.push({progress:{min:R+Ng(O,j,I)*P,max:1},parentIndex:f,prevPoint:O,nextPoint:j})),g.push(A),h&&(h[h.length-1].progress.max=R+Ng(O,j,A)*P,h[h.length-1].nextPoint=j)))))}if(h&&b>0)for(let w=v;w<u.length;w++)h[w].progress.min/=b,h[w].progress.max/=b}return u}function wv(r,e,i,o,a){if(r.length<2)return void o.push(r);const h=[];for(;e.valid();){const[g,v]=e.get();for(let b=0;b<r.length-1;b++){const w=r[b],I=r[b+1],A=Sn(w,I,g,v);if(A){const[P]=A,R=new Be(mt(w.x,I.x,P),mt(w.y,I.y,P));h.push({t:b+P,distance:0,point:R})}}e.next()}if(h.length===0)return void o.push(r);h.sort((g,v)=>g.t-v.t);let u=0,f=0,_=[];for(o.push(_);u!==r.length;){if(f===h.length){for(;u!==r.length;)_.length!==0&&_[_.length-1].equals(r[u])||_.push(r[u]),u++;break}h[f].t<=u?(_.length!==0&&_[_.length-1].equals(h[f].point)||_.push(h[f].point),Math.trunc(h[f].t),f++):(_.length!==0&&_[_.length-1].equals(r[u])||_.push(r[u]),u++)}}function Ng(r,e,i){return r.x!==e.x?(i.x-r.x)/(e.x-r.x):r.y!==e.y?(i.y-r.y)/(e.y-r.y):0}function Yu(r,e){return r.x*e.x+r.y*e.y}function Vg(r,e){if(r.length===1){let i=0;const o=e[i++];let a;for(;!a||o.equals(a);)if(a=e[i++],!a)return 1/0;for(;i<e.length;i++){const h=e[i],u=r[0],f=a.sub(o),_=h.sub(o),g=u.sub(o),v=Yu(f,f),b=Yu(f,_),w=Yu(_,_),I=Yu(g,f),A=Yu(g,_),P=v*w-b*b,R=(w*I-b*A)/P,O=(v*A-b*I)/P,j=o.z*(1-R-O)+a.z*R+h.z*O;if(isFinite(j))return j}return 1/0}{let i=1/0;for(const o of e)i=Math.min(i,o.z);return i}}function jg(r,e,i,o,a,h,u,f){const _=u*a.getElevationAt(r,e,!0,!0),g=h[0]!==0,v=g?h[1]===0?u*(h[0]/7-450):u*function(b,w,I){const A=Math.floor(w[0]/8),P=Math.floor(w[1]/8),R=10*(w[0]-8*A),O=10*(w[1]-8*P),j=b.getElevationAt(A,P,!0,!0),V=b.getMeterToDEM(I),G=Math.floor(.5*(R*V-1)),ne=Math.floor(.5*(O*V-1)),ee=b.tileCoordToPixel(A,P),ie=2*G+1,le=2*ne+1,he=function(Oe,je,Se,ke,fe){return[Oe.getElevationAtPixel(je,Se,!0),Oe.getElevationAtPixel(je+fe,Se,!0),Oe.getElevationAtPixel(je,Se+fe,!0),Oe.getElevationAtPixel(je+ke,Se+fe,!0)]}(b,ee.x-G,ee.y-ne,ie,le),Ie=Math.abs(he[0]-he[1]),pe=Math.abs(he[2]-he[3]),Ce=Math.abs(he[0]-he[2])+Math.abs(he[1]-he[3]),Ge=Math.min(.25,.5*V*(Ie+pe)/ie),Pe=Math.min(.25,.5*V*Ce/le);return j+Math.max(Ge*R,Pe*O)}(a,h,f):_;return{base:_+(i===0?-1:i),top:g?Math.max(v+o,_+i+2):_+o}}class Tv{constructor(e){this._callback=e,this._triggered=!1,typeof MessageChannel<"u"&&(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 Sv{constructor(){this.tasks={},this.taskQueue=[],wt(["process"],this),this.invoker=new Tv(this.process),this.nextId=0}add(e,i){const o=this.nextId++,a=function({type:h,isSymbolTile:u,zoom:f}){return f=f||0,h==="message"?0:h!=="maybePrepare"||u?h!=="parseTile"||u?h==="parseTile"&&u?300-f:h==="maybePrepare"&&u?400-f:500:200-f:100-f}(i);if(a===0){try{e()}finally{}return null}return this.tasks[o]={fn:e,metadata:i,priority:a,id:o},this.taskQueue.push(o),this.invoker.trigger(),{cancel:()=>{delete this.tasks[o]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(o=>!!this.tasks[o]),!this.taskQueue.length)return;const e=this.pick();if(e===null)return;const i=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!i)return;i.fn()}finally{}}pick(){let e=null,i=1/0;for(let a=0;a<this.taskQueue.length;a++){const h=this.tasks[this.taskQueue[a]];h.priority<i&&(i=h.priority,e=a)}if(e===null)return null;const o=this.taskQueue[e];return this.taskQueue.splice(e,1),o}remove(){this.invoker.remove()}}class Ug{constructor(e,i,o){this.target=e,this.parent=i,this.mapId=o,this.callbacks={},this.cancelCallbacks={},wt(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler
19=new Sv}send(e,i,o,a,h=!1,u){const f=Math.round(1e18*Math.random()).toString(36).substring(0,10);o&&(o.metadata=u,this.callbacks[f]=o);const _=new Set;return this.target.postMessage({id:f,type:e,hasCallback:!!o,targetMapId:a,mustQueue:h,sourceMapId:this.mapId,data:ko(i,_)},_),{cancel:()=>{o&&delete this.callbacks[f],this.target.postMessage({id:f,type:"<cancel>",targetMapId:a,sourceMapId:this.mapId})}}}receive(e){const i=e.data;if(!i)return;const o=i.id;if(o&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const a=this.cancelCallbacks[o];delete this.cancelCallbacks[o],a&&a.cancel()}else if(i.mustQueue||bi(self)){const a=this.callbacks[o],h=this.scheduler.add(()=>this.processTask(o,i),a&&a.metadata||{type:"message"});h&&(this.cancelCallbacks[o]=h)}else this.processTask(o,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const o=this.callbacks[e];delete this.callbacks[e],o&&(i.error?o(gn(i.error)):o(null,gn(i.data)))}else{const o=new Set,a=i.hasCallback?(u,f)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:u?ko(u):null,data:ko(f,o)},o)}:()=>{},h=gn(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,h,a);else if(this.parent.getWorkerSource){const u=i.type.split("."),{source:f,scope:_}=h;this.parent.getWorkerSource(i.sourceMapId,u[0],f,_)[u[1]](h,a)}else a(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var Ku={workerUrl:"",workerClass:null,workerParams:void 0};const Mm="mapboxgl_preloaded_worker_pool";class Yl{constructor(){this.active={}}acquire(e,i=Yl.workerCount){if(!this.workers)for(this.workers=[];this.workers.length<i;)this.workers.push(Ku.workerClass!=null?new Ku.workerClass:new self.Worker(Ku.workerUrl,Ku.workerParams));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.workers&&this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Mm]}numActive(){return Object.keys(this.active).length}}Yl.workerCount=2;class ah{constructor(e,i,o="Worker",a=Yl.workerCount){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=ze();const h=this.workerPool.acquire(this.id,a);for(let u=0;u<h.length;u++){const f=new ah.Actor(h[u],i,this.id);f.name=`${o} ${u}`,this.actors.push(f)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,o){ue(this.actors,(a,h)=>{a.send(e,i,h)},o=o||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(e=>{e.remove()}),this.actors=[],this.workerPool.release(this.id)}}let Ju,Pm;function Gp(){return Ju||(Ju=new Yl),Ju}ah.Actor=Ug;class Ev{constructor(e){this.module=e}createIntArray(e){const i=new Int32Array(e),o=this.module.malloc(i.length*i.BYTES_PER_ELEMENT);return this.module.heap32.set(i,o/i.BYTES_PER_ELEMENT),o}createFloatArray(e){const i=new Float32Array(e),o=this.module.malloc(i.length*i.BYTES_PER_ELEMENT);return this.module.heapF32.set(i,o/i.BYTES_PER_ELEMENT),o}createStringBuffer(e){const i=this.module.malloc(e.length+1);for(let o=0;o<e.length;++o)this.module.heapU8[i+o]=e.charCodeAt(o);return this.module.heapU8[i+e.length]=0,i}readStringBuffer(e){let i="";for(;this.module.heapU8[e]!==0;)i+=String.fromCharCode(this.module.heapU8[e]),++e;return i}setStyle(e){const i=e.entranceColorRgb,o=e.facadeGlazingColorRgb,a=e.roofColorRgb,h=e.wallColorRgb,u=e.normalScale;this.module.setStyle(i[0],i[1],i[2],o[0],o[1],o[2],a[0],a[1],a[2],h[0],h[1],h[2],u[0],u[1],u[2],e.tileToMeters)}setAOOptions(e,i){this.module.setAOOptions(e?1:0,i)}setMetricOptions(e,i){this.module.setMetricOptions(e?1:0,i)}setStructuralOptions(e){this.module.setStructuralOptions(e?1:0)}setFacadeOptions(e,i){this.module.setFacadeOptions(e,i?1:0)}setFauxFacadeOptions(e,i,o){this.module.setFauxFacadeOptions(e?1:0,i?1:0,o)}setFacadeClassifierOptions(e){this.module.setFacadeClassifierOptions(e)}generateMesh(e,i){for(const f of e){const _=this.createStringBuffer(f.roofType),g=[0],v=[];for(const I of f.coordinates)if(Array.isArray(I)){for(const A of I)v.pu
19sh(A.x),v.push(A.y);g.push(v.length)}const b=this.createIntArray(g),w=this.createFloatArray(v);this.module.addFeature(f.id,f.sourceId,f.minHeight,f.height,_,f.roofType.length,w,b,g.length-1),this.module.free(_),this.module.free(b),this.module.free(w)}for(const f of i){let _;_=f.entrances?JSON.parse(f.entrances):[];const g=this.createFloatArray(_),v=[];for(const w of f.coordinates)v.push(w.x),v.push(w.y);const b=this.createFloatArray(v);this.module.addFacade(f.sourceId,f.crossPerc,f.distanceToRoad,g,_.length,b,v.length),this.module.free(g),this.module.free(b)}if(!this.module.generateMesh()){const f=this.module.getLastError();return this.readStringBuffer(f)}const o=this.module.getMeshCount(),a=new Array(o);for(let f=0;f<o;f++){const _=this.module.getPositionsPtr(f),g=this.module.getPositionsLength(f),v=new Float32Array(this.module.heapF32.buffer,_,g),b=this.module.getNormalsPtr(f),w=this.module.getNormalsLength(f),I=new Float32Array(this.module.heapF32.buffer,b,w),A=this.module.getColorsPtr(f),P=this.module.getColorsLength(f),R=new Uint8Array(this.module.heapU8.buffer,A,P),O=this.module.getAOPtr(f),j=this.module.getAOLength(f),V=new Float32Array(this.module.heapF32.buffer,O,j),G=this.module.getUVPtr(f),ne=this.module.getUVLength(f),ee=new Float32Array(this.module.heapF32.buffer,G,ne),ie=this.module.getFauxFacadePtr(f),le=this.module.getFauxFacadeLength(f),he=new 
19Uint8Array(this.module.heapU8.buffer,ie,le),Ie=this.module.getIndicesPtr(f),pe=this.module.getIndicesLength(f),Ce=new Int32Array(this.module.heap32.buffer,Ie,pe),Ge=this.module.getBuildingPart(f),Pe=this.readStringBuffer(Ge);a[f]={positions:v,normals:I,colors:R,ao:V,uv:ee,isFauxFacade:he,indices:Ce,buildingPart:Pe}}const h=this.module.getRingCount(),u=[];for(let f=0;f<h;f++){const _=this.module.getRingPtr(f),g=this.module.getRingLength(f),v=new Float32Array(this.module.heapF32.buffer,_,g);u.push(v)}return{meshes:a,modifiedPolygonRings:u}}}let Qu,zm,No,lh,Rm,ch=null,hh=null,Gg=null,qp=null;function qg(){return bi(self)&&self.worker.dracoUrl?self.worker.dracoUrl:zm||Br.DRACO_URL}function Hg(){if(bi(self)&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(lh)return lh;const r=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);if(typeof WebAssembly!="object")throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return lh=WebAssembly.validate(r)?Br.MESHOPT_SIMD_URL:Br.MESHOPT_URL,lh}function Iv(){return qp}const Hp={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},Av={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},ed={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function $g(r,e,i){const o=i.json.bufferViews.length,a=i.buffers.length;e.bufferView=o,i.json.bufferViews[o]={buffer:a,byteLength:r.byteLength},i.buffers[a]=r}const Dm="KHR_draco_mesh_compression";function Cv(r,e){const i=r.extensions&&r.extensions[Dm];if(!i)return;const o=new No.Decoder,a=Yg(e,i.bufferView),h=new No.Mesh;if(!o.DecodeArrayToMesh(a,a.byteLength,h))throw new Error("Failed to decode Draco mesh");const u=e.json.accessors[r.indices],f=Hp[u.componentType],_=u.count*f.BYTES_PER_ELEMENT,g=No._malloc(_);f===Uint16Array?o.GetTrianglesUInt16Array(h,_,g):o.GetTrianglesUInt32Array(h,_,g),$g(No.memory.buffer.slice(g,g+_),u,e),No._free(g);for(const v of Object.keys(i.attributes)){const b=o.GetAttributeByUniqueId(h,i.attributes[v]),w=e.json.accessors[r.attributes[v]],I=Av[w.componentType],A=w.count*ed[w.type]*Hp[w.componentType].BYTES_PER_ELEMENT,P=No._malloc(A);o.GetAttributeDataArrayForAllPoints(h,b,No[I],A,P),$g(No.memory.buffer.slice(P,P+A),w,e),No._free(P)}o.destroy(),h.destroy(),delete r.extensions[Dm]}const $p="EXT_meshopt_compression";function Mv(r,e){if(!r.extensions||!r.extensions[$p])return;const i=r.extensions[$p],o=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),a=new Uint8Array(i.count*i.byteStride);Rm.decodeGltfBuffer(a,i.count,i.byteStride,o,i.mode,i.filter),r.buffer=e.buffers.length,r.byteOffset=0,e.buffers[r.buffer]=a.buffer,delete r.extensions[$p]}const Zg=1179937895,Wg=new TextDecoder("utf8");function Xg(r,e){return new URL(r,e).href}function Pv(r,e,i,o){return fetch(Xg(r.uri,o)).then(a=>a.arrayBuffer()).then(a=>{e.buffers[i]=a})}function Yg(r,e){const i=r.json.bufferViews[e];return new Uint8Array(r.buffers[i.buffer],i.byteOffset||0,i.byteLength)}function zv(r,e,i,o){if(r.uri){const a=Xg(r.uri,o);return fetch(a).then(h=>h.blob()).then(h=>createImageBitmap(h)).then(h=>{e.images[i]=h})}if(r.bufferView!==void 0){const a=Yg(e,r.bufferView),h=new Blob([a],{type:r.mimeType});return createImageBitmap(h).then(u=>{e.images[i]=u})}}function Kg(r,e=0,i){const o={json:null,images:[],buffers:[]};if(new Uint32Array(r,e,1)[0]===Zg){const v=new Uint32Array(r,e);let b=2;const w=(v[b++]>>2)-3,I=v[b++]>>2;if(b++,o.json=JSON.parse(Wg.decode(v.subarray(b,b+I))),b+=I,b<w){const A=v[b++];b++;const P=e+(b<<2);o.buffers[0]=r.slice(P,P+A)}}else o.json=JSON.parse(Wg.decode(new Uint8Array(r,e)));const{buffers:a,images:h,meshes:u,extensionsUsed:f,bufferViews:_}=o.json;let g=Promise.resolve();if(a){const v=[];for(let b=0;b<a.length;b++){const w=a[b];w.uri?v.push(Pv(w,o,b,i)):o.buffers[b]||(o.buffers[b]=null)}g=Promise.all(v)}return g.then(()=>{const v=[],b=f&&f.includes(Dm),w=f&&f.includes($p);if(b&&v.push(function(){if(!No)return Qu??(Qu=function(I){let A,P=null;function R(){A=new Uint8Array(P.buffer)}function O(){throw new Error("Unexpected Draco error.")}const j={a:{a:O,d:function(V,G,ne){return A.copyWithin(V,G,G+ne)},c:function(V){const G=A.length,ne=Math.max(V>>>0,Math.ceil(1.2*G)),ee=Math.ceil((ne-G)/65536);try{return P.grow(ee),R(),!0}catch{return!1}},b:O}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(I,j):I.then(V=>V.arrayBuffer()).then(V=>WebAssembly.instantiate(V,j))).then(V=>{const{Rb:G,Qb:ne,P:ee,T:ie,X:le,Ja:he,La:Ie,Qa:pe,Va:Ce,Wa:Ge,eb:Pe,jb:Oe,f:je,e:Se,yb:ke,zb:fe,Ab:Ee,Bb:$e,Db:Ne,Gb
19:ht}=V.instance.exports;P=Se;const ot=(()=>{let Le=0,Ve=0,at=0,tt=0;return Ye=>{at&&(G(tt),G(Le),Ve+=at,at=Le=0),Le||(Ve+=128,Le=ne(Ve));const it=Ye.length+7&-8;let gt=Le;it>=Ve&&(at=it,gt=tt=ne(it));for(let St=0;St<Ye.length;St++)A[gt+St]=Ye[St];return gt}})();return R(),je(),{memory:Se,_free:G,_malloc:ne,Mesh:class{constructor(){this.ptr=ee()}destroy(){ie(this.ptr)}},Decoder:class{constructor(){this.ptr=he()}destroy(){Oe(this.ptr)}DecodeArrayToMesh(Le,Ve,at){const tt=ot(Le),Ye=Ie(this.ptr,tt,Ve,at.ptr);return!!le(Ye)}GetAttributeByUniqueId(Le,Ve){return{ptr:pe(this.ptr,Le.ptr,Ve)}}GetTrianglesUInt16Array(Le,Ve,at){Ce(this.ptr,Le.ptr,Ve,at)}GetTrianglesUInt32Array(Le,Ve,at){Ge(this.ptr,Le.ptr,Ve,at)}GetAttributeDataArrayForAllPoints(Le,Ve,at,tt,Ye){Pe(this.ptr,Le.ptr,Ve.ptr,at,tt,Ye)}},DT_INT8:ke(),DT_UINT8:fe(),DT_INT16:Ee(),DT_UINT16:$e(),DT_UINT32:Ne(),DT_FLOAT32:ht()}})}(fetch(qg())),Qu.then(I=>{No=I,Qu=void 0}))}()),w&&v.push(function(){if(Rm)return;const I=function(A){let P;const R=WebAssembly.instantiateStreaming(A,{}).then(V=>{P=V.instance,P.exports.__wasm_call_ctors()}),O={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},j={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:R,supported:!0,decodeGltfBuffer(V,G,ne,ee,ie,le){(function(he,Ie,pe,Ce,Ge,Pe,Oe){const je=he.exports.sbrk,Se=Ce+3&-4,ke=je(Se*Ge),fe=je(Pe.length),Ee=new Uint8Array(he.exports.memory.buffer);Ee.set(Pe,fe);const $e=Ie(ke,Ce,Ge,fe,Pe.length);if($e===0&&Oe&&Oe(ke,Se,Ge),pe.set(Ee.subarray(ke,ke+Ce*Ge)),je(ke-je(0)),$e!==0)throw new Error(`Malformed buffer data: ${$e}`)})(P,P.exports[j[ie]],V,G,ne,ee,P.exports[O[le]])}}}(fetch(Hg()));return I.ready.then(()=>{Rm=I})}()),h)for(let I=0;I<h.length;I++)v.push(zv(h[I],o,I,i));return(v.length?Promise.all(v):Promise.resolve()).then(()=>{if(b&&u)for(const{primitives:I}of u)for(const A of I)Cv(A,o);if(w&&u&&_)for(const I of _)Mv(I,o);return o}
vendor: 5,128 bytes, line 19
19)})}function Lm(r){switch(r){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 Fm(r){switch(r){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 Om{constructor(e,i,o,a){this.context=e,this.format=o,this.useMipmap=a&&a.useMipmap,this.texture=e.gl.createTexture(),this.update(i,{premultiply:a&&a.premultiply})}update(e,i){const o=e&&e instanceof HTMLVideoElement&&e.width===0?e.videoWidth:e.width,a=e&&e instanceof HTMLVideoElement&&e.height===0?e.videoHeight:e.height,{context:h}=this,{gl:u}=h,{x:f,y:_}=i&&i.position?i.position:{x:0,y:0},g=f+o,v=_+a;!this.size||this.size[0]===g&&this.size[1]===v||(u.bindTexture(u.TEXTURE_2D,null),u.deleteTexture(this.texture),this.texture=u.createTexture(),this.size=null),u.bindTexture(u.TEXTURE_2D,this.texture),h.pixelStoreUnpackFlipY.set(!1),h.pixelStoreUnpack.set(1),h.pixelStoreUnpackPremultiplyAlpha.set(this.format===u.RGBA8&&(!i||i.premultiply!==!1));const b=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&g>0&&v>0){const w=this.useMipmap?Math.floor(Math.log2(Math.max(g,v)))+1:1;u.texStorage2D(u.TEXTURE_2D,w,this.format,g,v),this.size=[g,v]}if(this.size)if(b)u.texSubImage2D(u.TEXTURE_2D,0,f,_,Lm(this.format),Fm(this.format),e);else{const w=e.data;w&&u.texSubImage2D(u.TEXTURE_2D,0,f,_,o,a,Lm(this.format),Fm(this.format),w)}this.useMipmap&&u.generateMipmap(u.TEXTURE_2D)}bind(e,i,o=!1){const{context:a}=this,{gl:h}=a;h.bindTexture(h.TEXTURE_2D,this.texture),e!==this.minFilter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,e),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,this.useMipmap&&!o?e===h.NEAREST?h.NEAREST_MIPMAP_NEAREST:h.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,i),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,o,a,h){const{context:u}=this,{gl:f}=u;f.bindTexture(f.TEXTURE_2D,this.texture),i!==this.magFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_MIN_FILTER,this.useMipmap?e===f.NEAREST?f.NEAREST_MIPMAP_NEAREST:f.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),o!==this.wrapS&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_S,o),this.wrapS=o),a!==this.wrapT&&(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_WRAP_T,a),this.wrapT=a),h!==this.compareMode&&(h?(f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.COMPARE_REF_TO_TEXTURE),f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_FUNC,h)):f.texParameteri(f.TEXTURE_2D,f.TEXTURE_COMPARE_MODE,f.NONE),this.compareMode=h)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class td{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:o}=this,{gl:a}=o;a.bindTexture(a.TEXTURE_2D,this.texture),e!==this.minFilter&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,e),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,i),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,i),this.wrapS=i)}}const Rv=Wt([{name:"a_pos_3f",components:3,type:"Float32"}]),Dv=Wt([{name:"a_color_3f",components:3,type:"Float32"}]),Lv=Wt([{name:"a_color_4f",components:4,type:"Float32"}]),Fv=Wt([{name:"a_uv_2f",components:2,type:"Float32"}]),Ov=Wt([{name:"a_normal_3f",components:3,type:"Float32"}]),kv=Wt([{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"}]),Bv=Wt([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function Jg(r,e){const i=Zp(r.projection,r.zoom,r.width,r.height),o=function(h,u,f,_,g){const v=new S(f.lng-180*qa,f.lat),b=new S(f.lng+180*qa,f.lat),w=h.project(v.lng,v.lat),I=h.project(b.lng,b.lat),A=-Math.atan2(I.y-w.y,I.x-w.x),P=Q.fromLngLat(f);P.y=W(P.y,-1+qa,1-qa);const R=P.toLngLat(),O=h.project(R.lng,R.lat),j=Q.fromLngLat(R);j.x+=qa;const V=j.toLngLat(),G=h.project(V.lng,V.lat),ne=ey(G.x-O.x,G.y-O.y,A),ee=Q.fromLngLat(R);ee.y+=qa;const ie=ee.toLngLat(),le=h.project(ie.lng,ie.lat),he=ey(le.x-O.x,le.y-O.y,A),Ie=Math.abs(ne.x)/Math.abs(he.y),pe=It([]);qo(pe,pe,-A*(1-(g?0:_)));const Ce=It([]);return Zr(Ce,Ce,[1,1-(1-Ie)*_,1]),Ce[4]=-he.x/he.y*_,qo(Ce,Ce,A),Wi(Ce,pe,Ce),Ce}
vendor: 5,478 bytes, line 19
19(r.projection,0,r.center,i,e),a=Qg(r);return Zr(o,o,[a,a,1]),o}function Qg(r){const e=r.projection,i=Zp(r.projection,r.zoom,r.width,r.height),o=km(e,r.center),a=km(e,S.convert(e.center));return Math.pow(2,o*i+(1-i)*a)}function Zp(r,e,i,o,a=1/0){const h=r.range;if(!h)return 0;const u=Math.min(a,Math.max(i,o)),f=Math.log(u/1024)/Math.LN2;return ce(h[0]+f,h[1]+f,e)}const qa=1/4e4;function km(r,e){const i=W(e.lat,-Y,Y),o=new S(e.lng-180*qa,i),a=new S(e.lng+180*qa,i),h=r.project(o.lng,i),u=r.project(a.lng,i),f=Q.fromLngLat(o),_=Q.fromLngLat(a),g=u.x-h.x,v=u.y-h.y,b=_.x-f.x,w=_.y-f.y,I=Math.sqrt((b*b+w*w)/(g*g+v*v));return Math.log(I)/Math.LN2}function ey(r,e,i){const o=Math.cos(i),a=Math.sin(i);return{x:r*o-e*a,y:r*a+e*o}}function ty(r,e,i){It(r),qo(r,r,ii(e[2])),Go(r,r,ii(e[0])),So(r,r,ii(e[1])),Zr(r,r,i),Wi(r,r,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function Wp(r,e,i,o,a,h,u,f){const _=[i[0]-e[0],i[1]-e[1],0],g=[o[0]-e[0],o[1]-e[1],0];if(jr(_)<1e-12||jr(g)<1e-12)return Co(r);const v=yr([],_,g);ki(v,v),xn(g,o,e),_[2]=(h-a)*f,g[2]=(u-a)*f;const b=_;return yr(b,_,g),ki(b,b),ta(r,v,b)}function Bm(r,e,i=!1){const o=ja(e.zoom),a=function(h,u,f){const _=u.worldSize,g=[h[12],h[13],h[14]],v=U(g[1]/_),b=N(g[0]/_),w=It([]),I=L(1,v)*_,A=L(1,0)*_*re(v,u.zoom),P=1/dm(_);let R=A*P;if(f){const G=Zp(u.projection,u.zoom,u.width,u.height,1024);R=P*u.projection.pixelSpaceConversion(u.center.lat,_,G)}const O=y(v,b);Ui(O,O,Vi([],ki([],O),I*R*g[2]));const j=function(G){const ne=[G[0],G[1],G[2]];let ee=[0,1,0];const ie=yr([],ee,ne);return yr(ee,ne,ie),ic(ee)===0&&(ee=[0,1,0],yr(ie,ne,ee)),ki(ie,ie),ki(ee,ee),ki(ne,ne),[ie[0],ie[1],ie[2],0,ee[0],ee[1],ee[2],0,ne[0],ne[1],ne[2],0,G[0],G[1],G[2],1]}(O);Zr(w,w,[R,R,R*I]),tn(w,w,[-g[0],-g[1],-g[2]]);const V=Wi([],u.globeMatrix,j);return Wi(V,V,w),Wi(V,V,h),V}(r,e,i);if(o>0){const h=function(u,f){const _=f.worldSize,g=L(1,0)*_*re(f.center.lat,f.zoom)/dm(_),v=L(1,f.center.lat)*_,b=It([]);return So(b,b,ii(f.center.lng)),Go(b,b,ii(f.center.lat)),tn(b,b,[0,0,Qr]),Zr(b,b,[g,g,g*v]),tn(b,b,[f.point.x-.5*_,f.point.y-.5*_,0]),Wi(b,b,u),Wi(b,f.globeMatrix,b)}(r,e);return function(u,f,_){const g=(A,P,R)=>{const O=jr(A),j=jr(P),V=$s(A,P,R);return Vi(V,V,1/jr(V)*mt(O,j,R))},v=g([u[0],u[1],u[2]],[f[0],f[1],f[2]],_),b=g([u[4],u[5],u[6]],[f[4],f[5],f[6]],_),w=g([u[8],u[9],u[10]],[f[8],f[9],f[10]],_),I=$s([u[12],u[13],u[14]],[f[12],f[13],f[14]],_);return[v[0],v[1],v[2],0,b[0],b[1],b[2],0,w[0],w[1],w[2],0,I[0],I[1],I[2],1]}(a,h,o)}return a}function iy(r,e,i,o){const a=Nt.projectAabbCorners(o,i);let h=Number.MAX_VALUE,u=-1;for(let g=0;g<a.length;++g){const v=a[g];v[0]=(.5*v[0]+.5)*e.width,v[1]=(.5-.5*v[1])*e.height,v[2]<h&&(u=g,h=v[2])}const f=g=>new Be(a[g][0],a[g][1]);let _;switch(u){case 0:case 6:_=[f(1),f(5),f(4),f(7),f(3),f(2),f(1)];break;case 1:case 7:_=[f(0),f(4),f(5),f(6),f(2),f(3),f(0)];break;case 3:case 5:_=[f(1),f(0),f(4),f(7),f(6),f(2),f(1)];break;default:_=[f(1),f(5),f(6),f(7),f(3),f(0),f(1)]}if(wi(r,_))return h}const Kl=64,uh={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function ry(r,e,i,o,a,h,u,f,_,g=!1){const v=i.zoom,b=i.project(o),w=re(o.lat,v),I=1/w;It(r),tn(r,r,[b.x+u[0]*I,b.y+u[1]*I,u[2]]);let A=1,P=1;const R=i.worldSize;if(g){if(i.projection.name==="mercator"){let G=0;i.elevation&&(G=i.elevation.getAtPointOrZero(new Q(b.x/R,b.y/R),0));const ne=vn([],[b.x,b.y,G,1],i.projMatrix)[3]/i.cameraToCenterDistance;A=ne,P=ne*re(i.center.lat,v)}else if(i.projection.name==="globe"){const G=Bm(r,i),ne=[0,0,0,1];vn(ne,ne,Wi([],i.projMatrix,G));const ee=ne[3]/i.cameraToCenterDistance,ie=ja(v),le=i.projection.pixelsPerMeter(o.lat,R)*re(o.lat,v),he=i.projection.pixelsPerMeter(i.center.lat,R)*re(i.center.lat,v);A=ee/mt(le,te(i.center.lat),ie),P=ee*w/le,A*=he,P*=he}}else A=I;Zr(r,r,[A,A,P]);const O=[...r],j=e.orientation,V=[];if(ty(V,[j[0]+a[0],j[1]+a[1],j[2]+a[2]],h),Wi(r,O,V),f&&i.elevation){let G=0;const ne=[];if(_&&i.elevation){G=function(ie,le,he,Ie,pe){const Ce=le.elevation;if(!Ce)return 0;const Ge=Nt.projectAabbCorners(he,Ie),Pe=L(1,pe.lat)*le.worldSize,Oe=function(Ve,at){const tt=[0,0,1],Ye=[{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 it of Ye){const gt=Ve[it.corners[0]],St=Ve[it.corners[1]],Pt=Ve[it.corners[2]],Ct=[St[0]-gt[0],St[1]-gt[1],at*(St[2]-gt[2])],$t=yr(Ct,Ct,[Pt[0]-gt[0],Pt[1]-gt[1],at*(Pt[2]-gt[2])]);ki($t,$t),it.dotProductWithUp=ar($t,tt)}return Ye.sort((it,gt)=>it.dotProductWithUp-gt.dotProductWithUp),Ye[0].corners}(Ge,Pe),je=Ge[Oe[0]],Se=Ge[Oe[1]],ke=Ge[Oe[2]],fe=Ge[Oe[3]],Ee=Ce.getAtPointOrZero(new Q(je[0]/le.worldSize,je[1]/le.worldSize),0),$e=Ce.getAtPointOrZero(new Q(Se[0]/le.worldSize,Se[1]/le.worldSize),0),Ne=Ce.getAtPointOrZero(new Q(ke[0]/le.worldSize,ke[1]/le.worldSize),0),ht=Ce.getAtPointOrZero(new Q(fe[0]/le.worldSize,fe[1]/le.worldSize),0),ot=(Ee+ht)/2,Le=($e+Ne)/2;return ot>Le?$e<Ne?Wp(ie,Se,fe,je,$e,ht,Ee,Pe):Wp(ie,ke,je,fe,Ne,Ee,ht,Pe):Ee<ht?Wp(ie,je,Se,ke,Ee,$e,Ne,Pe):Wp(ie,fe,ke,Se,ht,Ne,$e,Pe),Math.max(ot,Le)}(ne,i,e.aabb,r,o);const ee=Wi([],Ho([],ne),V);Wi(r,O,ee)}else G=i.elevation.getAtPointOrZero(new Q(b.x/R,b.y/R),0);G!==0&&(r[14]+=G)}}function id(r,e,i=!1){r.uploaded||(r.gfxTexture=new Om(e,r.image,i?e.gl.R8:e.gl.RGBA8,{useMipmap:r.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),r.uploaded=!0,r.image=null)}
19function Nv(r,e,i){r.indexBuffer=e.createIndexBuffer(r.indexArray,!1,!0),r.vertexBuffer=e.createVertexBuffer(r.vertexArray,Rv.members,!1,!0),r.normalArray&&(r.normalBuffer=e.createVertexBuffer(r.normalArray,Ov.members,!1,!0)),r.texcoordArray&&(r.texcoordBuffer=e.createVertexBuffer(r.texcoordArray,Fv.members,!1,!0)),r.colorArray&&(r.colorBuffer=e.createVertexBuffer(r.colorArray,(r.colorArray.bytesPerElement===12?Dv:Lv).members,!1,!0)),r.featureArray&&(r.pbrBuffer=e.createVertexBuffer(r.featureArray,Bv.members,!0)),r.segments=qi.simpleSegment(0,0,r.vertexArray.length,r.indexArray.length);const o=r.material;o.pbrMetallicRoughness.baseColorTexture&&id(o.pbrMetallicRoughness.baseColorTexture,e),o.pbrMetallicRoughness.metallicRoughnessTexture&&id(o.pbrMetallicRoughness.metallicRoughnessTexture,e),o.normalTexture&&id(o.normalTexture,e),o.occlusionTexture&&id(o.occlusionTexture,e,i),o.emissionTexture&&id(o.emissionTexture,e)}function Nm(r,e,i){if(r.meshes)for(const o of r.meshes)Nv(o,e,i);if(r.children)for(const o of r.children)Nm(o,e,i)}function Xp(r){if(r.meshes)for(const e of r.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(r.children)for(const e of r.children)Xp(e)}function Vm(r){if(r.meshes)for(const i of r.meshes)i.vertexBuffer&&(i.vertexBuffer.destroy(),i.indexBuffer.destroy(),i.normalBuffer&&i.normalBuffer.destroy(),i.texcoordBuffer&&i.texcoordBuffer.destroy(),i.colorBuffer&&i.colorBuffer.destroy(),i.pbrBuffer&&i.pbrBuffer.destroy(),i.segments.destroy(),i.material&&((e=i.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(r.children)for(const i of r.children)Vm(i)}function Jl(r,e){const i=r.json.bufferViews[e.bufferView],o=Hp[e.componentType];return new o(r.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==ed[e.type]*o.BYTES_PER_ELEMENT?i.byteStride/o.BYTES_PER_ELEMENT:ed[e.type]))}function jm(r,e,i,o){const a=Hp[e.componentType],h=function(v){switch(v){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(a),u=r.json.bufferViews[e.bufferView],f=u.byteStride?u.byteStride/a.BYTES_PER_ELEMENT:ed[e.type],_=i.float32,g=_.length/i.capacity;for(let v=0,b=0;v<e.count*f;v+=f,b+=g)for(let w=0;w<g;w++)_[b+w]=o[v+w]*h;i._trim()}function Vv(r,e,i){const o=r.indices,a=r.attributes,h={};h.indexArray=new Ni;const u=e.json.accessors[o],f=u.count/3;h.indexArray.reserve(f);const _=Jl(e,u);for(let w=0;w<f;w++)h.indexArray.emplaceBack(_[3*w],_[3*w+1],_[3*w+2]);h.indexArray._trim(),h.vertexArray=new Fn;const g=e.json.accessors[a.POSITION];h.vertexArray.reserve(g.count);const v=Jl(e,g);for(let w=0;w<g.count;w++)h.vertexArray.emplaceBack(v[3*w],v[3*w+1],v[3*w+2]);if(h.vertexArray._trim(),h.aabb=new Nt(g.min,g.max),h.centroid=function(w,I){const A=[0,0,0],P=w.length;if(P>0){for(let R=0;R<P;R++){const O=3*w[R];A[0]+=I[O],A[1]+=I[O+1],A[2]+=I[O+2]}A[0]/=P,A[1]/=P,A[2]/=P}return A}(_,v),a.COLOR_0!==void 0){const w=e.json.accessors[a.COLOR_0],I=ed[w.type],A=Jl(e,w);h.colorArray=I===3?new Fn:new gs,h.colorArray.resize(w.count),jm(e,w,h.colorArray,A)}if(a.NORMAL!==void 0){h.normalArray=new Fn;const w=e.json.accessors[a.NORMAL];h.normalArray.resize(w.count);const I=Jl(e,w);jm(e,w,h.normalArray,I)}if(a.TEXCOORD_0!==void 0&&i.length>0){h.texcoordArray=new ys;const w=e.json.accessors[a.TEXCOORD_0];h.texcoordArray.resize(w.count);const I=Jl(e,w);jm(e,w,h.texcoordArray,I)}if(a._FEATURE_ID_RGBA4444!==void 0){const w=e.json.accessors[a._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(h.featureData=Jl(e,w))}a._FEATURE_RGBA4444!==void 0&&(h.featureData=new Uint32Array(Jl(e,e.json.accessors[a._FEATURE_RGBA4444]).buffer));const b=r.material;return h.material=function(w,I){const{emissiveFactor:A=[0,0,0],alphaMode:P="OPAQUE",alphaCutoff:R=.5,normalTexture:O,occlusionTexture:j,emissiveTexture:V,doubleSided:G}=w,{baseColorFactor:ne=[1,1,1,1],metallicFactor:ee=1,roughnessFactor:ie=1,baseColorTexture:le,metallicRoughnessTexture:he}=w.pbrMetallicRoughness||{},Ie=j?I[j.index]:void 0;if(j&&j.extensions&&j.extensions.KHR_texture_transform&&Ie){const pe=j.extensions.KHR_texture_transform;Ie.offsetScale=[pe.offset[0],pe.offset[1],pe.scale[0],pe.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new ui(...ne),metallicFactor:ee,roughnessFactor:ie,baseColorTexture:le?I[le.index]:void 0,metallicRoughnessTexture:he?I[he.index]:void 0},doubleSided:G,emissiveFactor:new ui(...A),alphaMode:P,alphaCutoff:R,normalTexture:O?I[O.index]:void 0,occlusionTexture:Ie,emissionTexture:V?I[V.index]:void 0,defined:w.defined===void 0}}(b!==void 0?e.json.materials[b]:{defined:!1},i),h}function ny(r,e,i){const{matrix:o,rotation:a,translation:h,scale:u,mesh:f,extras:_,children:g}=r,v={};if(v.matrix=o||function(b,w,I,A){var P=w[0],R=w[1],O=w[2],j=w[3],V=P+P,G=R+R,ne=O+O,ee=P*V,ie=P*G,le=P*ne,he=R*G,Ie=R*ne,pe=O*ne,Ce=j*V,Ge=j*G,Pe=j*ne,Oe=A[0],je=A[1],Se=A[2];return b[0]=(1-(he+pe))*Oe,b[1]=(ie+Pe)*Oe,b[2]=(le-Ge)*Oe,b[3]=0,b[4]=(ie-Pe)*je,b[5]=(1-(ee+pe))*je,b[6]=(Ie+Ce)*je,b[7]=0,b[8]=(le+Ge)*Se,b[9]=(Ie-Ce)*Se,b[10]=(1-(ee+he))*Se,b[11]=0,b[12]=I[0],b[13]=I[1],b[14]=I[2],b[15]=1,b}([],a||[0,0,0,1],h||[0,0,0],u||[1,1,1]),f!==void 0){v.meshes=i[f];const b=v.anchor=[0,0];for(const w of v.meshes){const{min:I,max:A}=w.aabb;b[0]+=I[0]+A[0],b[1]+=I[1]+A[1]}b[0]=Math.floor(b[0]/v.meshes.length/2),b[1]=Math.floor(b[1]/v.meshes.length/2)}if(_&&(_.id&&(v.id=_.id),_.lights&&(v.lights=function(b){if(!b.length)return[];const w=function(O){const j=atob(O),V=new Uint8Array(j.length);for(let G=0;G<j.length;
vendor: 4,455 bytes, line 19
19G++)V[G]=j.codePointAt(G);return V}(b),I=[],A=w.length/24,P=new Uint16Array(w.buffer),R=new Float32Array(w.buffer);for(let O=0;O<A;O++){const j=P[2*O*6]/30,V=P[2*O*6+1]/30,G=P[2*O*6+10]/100,ne=R[6*O+1],ee=R[6*O+2],ie=R[6*O+3],le=R[6*O+4],he=ie-ne,Ie=le-ee,pe=Math.hypot(he,Ie);I.push({pos:[ne+.5*he,ee+.5*Ie,V],normal:[Ie/pe,-he/pe,0],width:pe,height:j,depth:G,points:[ne,ee,ie,le]})}return I}(_.lights))),g){const b=[];for(const w of g)b.push(ny(e.json.nodes[w],e,i));v.children=b}return v}function jv(r){if(r.vertices.length===0||r.indices.length===0)return null;const e=new kp(r.vertices,r.indices,8,256),[i,o]=[e.min.clone(),e.max.clone()];return{vertices:r.vertices,indices:r.indices,grid:e,min:i,max:o}}function Uv(r){if(!r.extras||!r.extras.ground)return null;const e=r.extras.ground;if(!e||!Array.isArray(e)||e.length===0)return null;const i=e[0];if(!i||!Array.isArray(i)||i.length===0)return null;const o=[];for(const u of i){if(!Array.isArray(u)||u.length!==2)continue;const f=u[0],_=u[1];typeof f=="number"&&typeof _=="number"&&o.push(new Be(f,_))}if(o.length<3)return null;o.length>1&&o[o.length-1].equals(o[0])&&o.pop();let a=0;for(let u=0;u<o.length;u++){const f=o[u],_=o[(u+1)%o.length],g=o[(u+2)%o.length];a+=(f.x-_.x)*(g.y-_.y)-(g.x-_.x)*(f.y-_.y)}a>0&&o.reverse();const h=oh(o.flatMap(u=>[u.x,u.y]),[]);return h.length===0?null:{vertices:o,indices:h}}function Gv(r,e){const i=[],o=[];let a=0;const h=[];for(const u of r){a=i.length;const f=u.vertexArray.float32,_=u.indexArray.uint16;for(let g=0;g<u.vertexArray.length;g++)h[0]=f[3*g+0],h[1]=f[3*g+1],h[2]=f[3*g+2],lr(h,h,e),i.push(new Be(h[0],h[1]));for(let g=0;g<3*u.indexArray.length;g++)o.push(_[g]+a)}if(o.length%3!=0)return null;for(let u=0;u<o.length;u+=3){const f=i[o[u+0]],_=i[o[u+1]],g=i[o[u+2]];(f.x-_.x)*(g.y-_.y)-(g.x-_.x)*(f.y-_.y)>0&&([o[u+1],o[u+2]]=[o[u+2],o[u+1]])}return{vertices:i,indices:o}}function oy(r){const e=function(_,g){const v=[],b=WebGL2RenderingContext;if(_.json.textures)for(const w of _.json.textures){const I={magFilter:b.LINEAR,minFilter:b.NEAREST,wrapS:b.REPEAT,wrapT:b.REPEAT};w.sampler!==void 0&&Object.assign(I,_.json.samplers[w.sampler]),v.push({image:g[w.source],sampler:I,uploaded:!1})}return v}(r,r.images),i=function(_,g){const v=[];for(const b of _.json.meshes){const w=[];for(const I of b.primitives)w.push(Vv(I,_,g));v.push(w)}return v}(r,e),{scenes:o,scene:a,nodes:h}=r.json,u=o?o[a||0].nodes:h,f=[];for(const _ of u)f.push(ny(h[_],r,i));return function(_,g,v){const b={},w=new Set;for(let I=0;I<_.length;I++){const A=v[g[I]];if(!A.extras)continue;const P=A.extras["mapbox:footprint:version"],R=A.extras["mapbox:footprint:id"];(P||R)&&w.add(I),P==="1.0.0"&&R&&(b[R]=I)}for(let I=0;I<_.length;I++){if(w.has(I))continue;const A=_[I],P=v[g[I]];if(!P.extras)continue;let R=null;A.id in b&&(R=Gv(_[b[A.id]].meshes,A.matrix)),R||(R=Uv(P)),R&&(A.footprint=jv(R))}if(w.size>0){const I=Array.from(w.values()).sort((A,P)=>A-P);for(let A=I.length-1;A>=0;A--)_.splice(I[A],1)}}(f,u,r.json.nodes),f}function qv(r){r.heightmap=new Float32Array(4096),r.heightmap.fill(-1);const e=r.vertexArray.float32,i=r.aabb.min[0]-1,o=r.aabb.min[1]-1,a=Kl/(r.aabb.max[0]-i+2),h=Kl/(r.aabb.max[1]-o+2);for(let u=0;u<e.length;u+=3){const f=e[u+2],_=(e[u+0]-i)*a|0,g=(e[u+1]-o)*h|0;f>r.heightmap[g*Kl+_]&&(r.heightmap[g*Kl+_]=f)}}function sy(r,e,i,o,a){i.reserve(i.length+4*r.length),o.reserve(o.length+10*r.length),a.reserve(a.length+10*r.length);let h=o.length;for(const u of r){const f=Math.min(10,Math.max(4,1.3*u.height))*e,_=[-u.normal[1],u.normal[0],0],g=Math.min(.29,.1*u.width/u.depth),v=u.width-2*u.depth*e*(g+.01),b=rn([],u.pos,_,v/2),w=rn([],u.pos,_,-v/2),I=[b[0],b[1],b[2]+u.height],A=[w[0],w[1],w[2]+u.height],P=rn([],u.normal,_,g);Vi(P,P,f);const R=rn([],u.normal,_,-g);Vi(R,R,f),Ui(P,b,P),Ui(R,w,R),b[2]+=.1,w[2]+=.1,o.emplaceBack(P[0],P[1],P[2]),o.emplaceBack(R[0],R[1],R[2]),o.emplaceBack(b[0],b[1],b[2]),o.emplaceBack(w[0],w[1],w[2]),o.emplaceBack(I[0],I[1],I[2]),o.emplaceBack(A[0],A[1],A[2]),o.emplaceBack(b[0],b[1],b[2]),o.emplaceBack(w[0],w[1],w[2]),o.emplaceBack(P[0],P[1],P[2]),o.emplaceBack(R[0],R[1],R[2]);const O=v/f/2;a.emplaceBack(-O-g,-1,O,.8),a.emplaceBack(O+g,-1,O,.8),a.emplaceBack(-O,0,O,1.3),a.emplaceBack(O,0,O,1.3),a.emplaceBack(O+g,-.8,O,.7),a.emplaceBack(O+g,-.8,O,.7),a.emplaceBack(0,0,O,1.3),a.emplaceBack(0,0,O,1.3),a.emplaceBack(O+g,-1.2,O,.8),a.emplaceBack(O+g,-1.2,O,.8),i.emplaceBack(6+h,4+h,8+h),i.emplaceBack(7+h,9+h,5+h
19),i.emplaceBack(0+h,1+h,2+h),i.emplaceBack(1+h,3+h,2+h),h+=10}}function Hv(r,e){const i={};i.indexArray=new Ni,i.vertexArray=new Fn,i.colorArray=new gs,sy(r,e,i.indexArray,i.vertexArray,i.colorArray);const o={defined:!0};o.emissiveFactor=ui.black;const a={};return a.baseColorFactor=ui.white,o.pbrMetallicRoughness=a,i.material=o,i.aabb=new Nt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const ay=Wt([{name:"a_pos_3f",components:3,type:"Float32"}]),$v=Wt([{name:"a_normal_3",components:3,type:"Int16"}]),ly=Wt([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),Zv=Wt([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),cy=ge.types,Um=32767;function Wv(r,e){const i=Xe+e;for(const o of r)for(const a of o)if(a.x<-e||a.x>i||a.y<-e||a.y>i)return!1;return!0}class hy{constructor(e){this.layoutAOArray=[],this.indexArrayForConflationUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.featuresOnBorder=[],this.buildingFeatures=[],this.footprintLookup={},this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.hasPattern=!1,this.worldview=e.worldview,this.layoutVertexArray=new Fn,this.layoutNormalArray=new Ma,this.layoutColorArray=new mo,this.indexArray=new Ni,this.indexArrayForConflation=new Ni,this.entranceBloom={layoutVertexArray:new Fn,layoutVertexBuffer:null,layoutAttenuationArray:new gs,layoutAttenuationBuffer:null,layoutColorArray:new mo,layoutColorBuffer:null,indexArray:new Ni,indexArrayForConflation:new Ni,indexBuffer:null,segmentsBucket:new qi},this.programConfigurations=new kn(e.layers,{zoom:e.zoom,lut:e.lut}),this.segmentsBucket=new qi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection,this.groundEffect=new Am(e)}get segments(){return this.segmentsBucket}get bloomGeometry(){return this.entranceBloom}updateFootprints(e,i){for(const o of this.footprints)i.push({footprint:o,id:e})}prepare(){return function(){if(qp!=null||Gg!=null)return null;if(hh!=null)return hh;const e=fetch(Br.BUILDING_GEN_URL);return hh=function(i){let o,a,h,u;function f(){o=new Uint8Array(u.buffer),a=new Int32Array(u.buffer),h=new Float32Array(u.buffer)}function _(){throw new Error("Unexpected BuildingGen error.")}const g=()=>{},v={a:{a:_,f:function(b){const w=o.length,I=Math.max(b>>>0,Math.ceil(1.2*w)),A=Math.ceil((I-w)/65536);try{return u.grow(A),f(),!0}catch{return!1}},g:_,b:g,c:g,d:g,e:g}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(i,v):i.then(b=>b.arrayBuffer()).then(b=>WebAssembly.instantiate(b,v))).then(b=>{const w=b.instance.exports;return(0,w.g)(),u=w.f,f(),new Ev({setStyle:w.h,setAOOptions:w.i,setMetricOptions:w.j,setStructuralOptions:w.k,setFacadeOptions:w.l,setFauxFacadeOptions:w.m,setFacadeClassifierOptions:w.n,addFeature:w.o,addFacade:w.p,generateMesh:w.q,getLastError:w.r,getMeshCount:w.s,getPositionsPtr:w.t,getPositionsLength:w.u,getNormalsPtr:w.v,getNormalsLength:w.w,getColorsPtr:w.x,getColorsLength:w.y,getAOPtr:w.z,getAOLength:w.A,getUVPtr:w.B,getUVLength:w.C,getFauxFacadePtr:w.D,getFauxFacadeLength:w.E,getIndicesPtr:w.F,getIndicesLength:w.G,getBuildingPart:w.H,getRingCount:w.I,getRingPtr:w.J,getRingLength:w.K,free:w.L,malloc:w.M,heapU8:o,heap32:a,heapF32:h})})}(e).then(i=>(hh=null,qp=i,qp)).catch(i=>{Ht("Could not load building-gen"),hh=null,Gg=i}),hh}()}populate(e,i,o,a){const h=Iv();if(!h)return;const u=J(o);this.tileToMeter=u,this.brightness=i.brightness,h.setStyle({convertToMeters:!1,entranceColorRgb:[1,1,1],facadeGlazingColorRgb:[.5607843137254902,.6745098039215687,.7215686274509804],normalScale:[1,-1,u],ridgeHeight:3,roofColorRgb:[.886274516,.784313738,.713725507],tileToMeters:u,tileZoom:16,wallColorRgb:[.988235294,.933333337,.811764717]}),h.setAOOptions(!1,.3),h.setMetricOptions(!1,16),h.setStructuralOptions(!0),h.setFacadeOptions(4,!0),h.setFauxFacadeOptions(!1,!1,1),h.setFacadeClassifierOptions(3);const f=new Map;for(const{feature:_}of e){if(cy[_.type]!=="LineString")continue;const g=this.layers[0]._featureFilter.needGeometry,v=Te(_,g);if(!this.layers[0]._featureFilter.filter(new yi(this.zoom),v,o))continue;const b=g?v.geometry:se(_,o,a),w=[];for(const R of b)for(const O of R)w.push({x:O.x,y:O.y});const I={coordinates:w,crossPerc:_.properties.cross_perc,distanceToRoad:_.properties.distance_to_road,entrances:_.properties.entrances,sourceId:0},A=_.properties.source_id;let P=f.get(A);P||(P=[],f.set(A,P)),P.push(I)}this.maxHeight=0;for(const{feature:_,index:g}of e){if(cy[_.type]==="LineString")continue;const v=this.layers[0]._featureFilter.needGeometry,b=Te(_,v);if(!this.layers[0]._featureFilter.filter(new yi(this.zoom),b,o))continue;const w=v?b.geometry:se(_,o,a),I=Hu(w,500);if(!Wv(w,163))continue;const A=this.layers[0],P=A.layout.get("building-base").evaluate(_,{},o),R=A.layout.get("building-height").evaluate(_,{},o),O=A.layout.get("building-roof-shape").evaluate(_,{},o),j=A.paint.get("building-ambient-occlusion-intensity"),V=A.paint.get("building-ambient-occlusion-ground-radius")/this.tileToMeter;if(O==="flat")continue;const G=_.properties.source_id;let ne;ne=f.has(G)?f.get(G):[];const ee=[],ie=new Be(1/0,1/0),le=new Be(-1/0,-1/0);for(const Le of I)if(Le.length>0){const Ve=[];for(const at of Le){const tt=[];for(let Ye=at.length-1;Ye>=0;Ye--){const it=at[Ye];tt.push({x:it.x,y:it.y}),ie.x=Math.min(ie.x,it.x),ie.y=Math.min(ie.y,it.y),le.x=Math.max(le.x,it.x),le.y=Math.max(le.y,it.y)}Ve.push(tt)}ee.push({id:_.id,height:R,minHeight:P,sourceId:0,roofType:O,coordinates:Ve})}const he=h.generateMesh(ee,ne);
19if(typeof he=="string"||he.meshes.length===0||he.modifiedPolygonRings.length===0)continue;let Ie=0;for(const Le of he.meshes)Ie+=Le.positions.length/3;const pe=this.segmentsBucket.prepareSegment(Ie,this.layoutVertexArray,this.indexArray),Ce=[];let Ge=null,Pe=0,Oe=-1;const je=this.indexArray.length;let Se=0;for(const Le of he.meshes){const Ve=this.layoutVertexArray.length;if(Le.buildingPart==="entrance"){const tt=new Array;for(let St=0;St<Le.indices.length;St+=12){const Pt=Le.positions[St+0],Ct=Le.positions[St+1],$t=Le.positions[St+3],Ot=Le.positions[St+4],Pi=Le.positions[St+2],H=Le.positions[St+8]-Pi,$=1,we=$t-Pt,Ze=Ot-Ct,Je=Math.hypot(we,Ze);tt.push({pos:[Pt+.5*we,Ct+.5*Ze,Pi],normal:[Ze/Je,-we/Je,0],width:Je,height:H,depth:$,points:[Pt,Ct,$t,Ot]})}const Ye=this.entranceBloom.segmentsBucket.prepareSegment(10*tt.length,this.entranceBloom.layoutVertexArray,this.entranceBloom.indexArray),it=this.entranceBloom.layoutVertexArray.length;Pe=this.entranceBloom.indexArray.length,sy(tt,.5/this.tileToMeter,this.entranceBloom.indexArray,this.entranceBloom.layoutVertexArray,this.entranceBloom.layoutAttenuationArray);const gt=this.entranceBloom.layoutVertexArray.length-it;Oe=this.entranceBloom.indexArray.length-Pe;for(let St=0;St<gt;St++)this.entranceBloom.layoutColorArray.emplaceBack(65535,65535);Ye.vertexLength+=gt,Ye.primitiveLength+=Oe,Ge={part:Le.buildingPart,vertexOffset:it,vertexLength:gt}}for(let tt=0;tt<Le.positions.length;tt+=3)Se=Math.max(Se,Le.positions[tt+2]),this.layoutVertexArray.emplaceBack(Le.positions[tt],Le.positions[tt+1],Le.positions[tt+2]);for(let tt=0;tt<Le.normals.length;tt+=3)this.layoutNormalArray.emplaceBack(Le.normals[tt+0]*Um,Le.normals[tt+1]*Um,Le.normals[tt+2]*Um);for(let tt=0;tt<Le.ao.length;tt++)this.layoutAOArray.push(Le.ao[tt]);for(let tt=0;tt<Le.colors.length;tt+=3){const Ye=1+(Le.ao[tt/3]-1)*j;this.layoutColorArray.emplaceBack(Le.colors[tt]*Ye<<8|Le.colors[tt+1]*Ye,Le.colors[tt+2]*Ye<<8)}const at=pe.vertexLength;for(let tt=0;tt<Le.indices.length;tt+=3)this.indexArray.emplaceBack(at+Le.indices[tt],at+Le.indices[tt+1],at+Le.indices[tt+2]);pe.vertexLength+=Le.positions.length/3,pe.primitiveLength+=Le.indices.length/3,(Le.buildingPart==="roof"||Le.buildingPart==="wall"||Le.buildingPart==="facade_glazing"||Le.buildingPart==="entrance")&&Ce.push({part:Le.buildingPart,vertexOffset:Ve,vertexLength:Le.positions.length/3})}this.maxHeight=Math.max(this.maxHeight,Se),this.buildingFeatures.push({feature:b,segment:pe,parts:Ce,buildingBloom:Ge});const ke=this.indexArray.length-je,fe=[],Ee=[],$e=new Be(1/0,1/0),Ne=new Be(-1/0,-1/0),ht=this.groundEffect.vertexArray.length;for(const Le of he.modifiedPolygonRings){const Ve=[],at=new Be(1/0,1/0),tt=new Be(-1/0,-1/0);for(let Ye=0;Ye<Le.length;Ye+=2){const it=Le.length-Ye-2;at.x=Math.min(at.x,Le[it]),at.y=Math.min(at.y,Le[it+1]),tt.x=Math.max(tt.x,Le[it]),tt.y=Math.max(tt.y,Le[it+1]);const gt=new Be(Le[it],Le[it+1]);
19Ve.push(gt),fe.push(gt.x,gt.y),Ee.push(gt.clone())}$e.x=Math.min($e.x,at.x),$e.y=Math.min($e.y,at.y),Ne.x=Math.max(Ne.x,tt.x),Ne.y=Math.max(Ne.y,tt.y),this.groundEffect.addData(Ve,[at,tt],V)}const ot=this.groundEffect.vertexArray.length-ht;(ie.x<0||le.x>Xe||ie.y<0||le.y>Xe)&&this.featuresOnBorder.push({featureId:_.id,footprintIndex:this.footprints.length});{const Le=oh(fe,null,2),Ve=new kp(Ee,Le,8,256);let at=_.id;_.properties&&_.properties.hasOwnProperty("building_id")&&(at=_.properties.building_id),this.footprints.push({vertices:Ee,indices:Le,grid:Ve,min:$e,max:Ne,buildingId:at,hiddenFlags:0,indicesOffset:je,indicesLength:ke,bloomIndicesOffset:Pe,bloomIndicesLength:Oe,groundEffectVertexOffset:ht,groundEffectVertexLength:ot,segment:pe,height:Se})}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,_,g,{},i.availableImages,o,i.brightness),this.groundEffect.addPaintPropertiesData(_,g,{},i.availableImages,o,i.brightness)}this.groundEffect.prepareBorderSegments(),this.evaluate(this.layers[0])}update(e,i,o,a,h,u,f){this.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f),this.groundEffect.update(e,i,h,o,a,u,f)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ay.members),this.layoutNormalBuffer=e.createVertexBuffer(this.layoutNormalArray,$v.members),this.entranceBloom.layoutVertexBuffer=e.createVertexBuffer(this.entranceBloom.layoutVertexArray,ay.members),this.entranceBloom.layoutAttenuationBuffer=e.createVertexBuffer(this.entranceBloom.layoutAttenuationArray,Zv.members),this.uploadUpdatedColorBuffer(e),this.uploadUpdatedIndexBuffer(e),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.layoutNormalBuffer.destroy(),this.layoutColorBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segmentsBucket.destroy(),this.entranceBloom.layoutVertexBuffer.destroy(),this.entranceBloom.layoutColorBuffer.destroy(),this.entranceBloom.layoutAttenuationBuffer.destroy(),this.entranceBloom.indexBuffer.destroy(),this.entranceBloom.segmentsBucket.destroy())}updateFootprintHiddenFlags(e,i,o=!0){let a=!1;const h=o?i:0,u=0|(o?-1:~i);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const f of e){const _=this.footprints[f],g=_.hiddenFlags&u|h;_.hiddenFlags!==g&&(_.hiddenFlags=g,a=!0,this.groundEffect.updateHiddenByLandmarkRange(_.groundEffectVertexOffset,_.groundEffectVertexLength,_.hiddenFlags!==0))}return a&&(this.indexArrayForConflationUploaded=!1),a}uploadUpdatedIndexBuffer(e){if(this.groundEffect.uploadHiddenByLandmark(e),!this.indexArrayForConflationUploaded&&this.indexArray.length!==0){this.indexArrayForConflation.resize(this.indexArray.length),this.indexArrayForConflation.uint16.set(this.indexArray.uint16),this.entranceBloom.indexArrayForConflation.resize(this.entranceBloom.indexArray.length),this.entranceBloom.indexArrayForConflation.uint16.set(this.entranceBloom.indexArray.uint16);for(const i of this.footprints){const o=i.indicesOffset+i.indicesLength;if(i.hiddenFlags!==0){for(let h=i.indicesOffset;h<o;h++)this.indexArrayForConflation.uint16[3*h+0]=0,this.indexArrayForConflation.uint16[3*h+1]=0,this.indexArrayForConflation.uint16[3*h+2]=0;const a=i.bloomIndicesOffset+i.bloomIndicesLength;for(let h=i.bloomIndicesOffset;h<a;h++)this.entranceBloom.indexArrayForConflation.uint16[3*h+0]=0,this.entranceBloom.indexArrayForConflation.uint16[3*h+1]=0,this.entranceBloom.indexArrayForConflation.uint16[3*h+2]=0}}this.indexBuffer?this.indexBuffer.updateData(this.indexArrayForConflation):this.indexBuffer=e.createIndexBuffer(this.indexArrayForConflation,!0),this.entranceBloom.indexBuffer?this.entranceBloom.indexBuffer.updateData(this.entranceBloom.indexArrayForConflation):this.entranceBloom.indexBuffer=e.createIndexBuffer(this.entranceBloom.indexArrayForConflation,!0),this.indexArrayForConflationUploaded=!0}}uploadUpdatedColorBuffer(e){this.layoutColorBuffer?this.layoutColorBuffer.updateData(this.layoutColorArray):this.layoutColorBuffer=e.createVertexBuffer(this.layoutColorArray,ly.members,!0),this.entranceBloom.layoutColorBuffer?this.entranceBloom.layoutColorBuffer.updateData(this.entranceBloom.layoutColorArray):this.entranceBloom.layoutColorBuffer=e.createVertexBuffer(this.entranceBloom.layoutColorArray,ly.members,!0)}evaluate(e){const i=e.paint.get("building-ambient-occlusion-intensity");for(const o of this.buildingFeatures){const a=o.feature;a.properties["building-part"]="roof";const h=e.paint.get("building-color").evaluate(a,{},this.canonical),u=e.paint.get("building-emissive-strength").evaluate(a,{},this.canonical);a.properties["building-part"]="wall";const f=e.paint.get("building-color").evaluate(a,{},this.canonical),_=e.paint.get("building-emissive-strength").evaluate(a,{},this.canonical);a.properties["building-part"]="window";const g=e.paint.get("building-color").evaluate(a,{},this.canonical),v=e.paint.get("building-emissive-strength").evaluate(a,{},this.canonical);a.properties["building-part"]="door";const b=e.paint.get("building-color").evaluate(a,{},this.canonical),w=e.paint.get("building-emissive-strength").evaluate(a,{},this.canonical);for(const A of o.parts){let P,R=h;A.part==="roof"?(R=h,P=u):A.part==="wall"?(R=f,P=_):A.part==="facade_glazing"?(R=g,P=v):A.part==="entrance"&&(R=b,P=w),P=W(P,0,1);for(let O=0;O<A.vertexLength;O++){const j=A.vertexOffset+O,V=1+(this.layoutAOArray[j]-1)*i;this.layoutColorArray.emplace(j,R.r*V*255<<8|R.g*V*255,R.b*V*255<<8|255*P)}}const I=o.buildingBloom;if(I)for(let A=0;A<I.vertexLength;A++)this.bloomGeometry.layoutColorArray.emplace(I.vertexOffset+A,255*b.r<<8|255*b.g,255*b.b<<8|51*w)}}needsEvaluation(e,i){const o=e.transform.projectionOptions,a=e.style.getBrightness();return!(this.uploaded&&o.name===this.projection.name&&this.brightness===a||(this.projection=o,this.brightness=a,0))}updateReplacement(e,i,o){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const a=i.getReplacementRegionsForTile(e.toUnwrapped());if(Np(this.activeReplacements,a))return;this.activeReplacements=a;for(const u of this.footprints)u.hiddenFlags&=-2;const h=[];for(const u of this.activeReplacements){if(u.order<=mg)continue;const f=Math.max(1,Math.pow(2,u.footprintTileId.canonical.z-e.canonical.z));for(const _ of this.footprints)_.min.x>u.max.x||_.max.x<u.min.x||_.min.y>u.max.y||_.max.y<u.min.y||(h.length=0,Xv(_.vertices,0,_.vertices.length,u.footprintTileId.canonical,e.canonical,h),Tm(u.footprint,h,_.indices,0,_.
vendor: 15,772 bytes, line 19
19indices.length,0,-f)&&(_.hiddenFlags|=1))}this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const u of this.footprints)this.groundEffect.updateHiddenByLandmarkRange(u.groundEffectVertexOffset,u.groundEffectVertexLength,u.hiddenFlags!==0);this.indexArrayForConflationUploaded=!1}getHeightAtTileCoord(e,i){let o=Number.NEGATIVE_INFINITY,a=!0;const h=4*(e+Xe)*Xe+(i+Xe);if(this.footprintLookup.hasOwnProperty(h)){const f=this.footprintLookup[h];return f?{height:f.height,hidden:f.hiddenFlags!==0}:void 0}const u=new Be(e,i);for(const f of this.footprints)e>f.max.x||f.min.x>e||i>f.max.y||f.min.y>i||f.height<=o||Sm(u,f)&&(o=f.height,this.footprintLookup[h]=f,a=f.hiddenFlags!==0);if(o!==Number.NEGATIVE_INFINITY)return{height:o,hidden:a};this.footprintLookup[h]=void 0}}function Xv(r,e,i,o,a,h){const u=Math.pow(2,o.z-a.z);for(let f=0;f<i;f++){let _=r[f+e].x,g=r[f+e].y;_=(_+a.x*Xe)*u-o.x*Xe,g=(g+a.y*Xe)*u-o.y*Xe,h.push(new Be(_,g))}}let uy,dy;nt(hy,"BuildingBucket",{omit:["layers"]});const Yv=Wt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),Kv=Wt([{name:"a_z_offset_width",components:3,type:"Float32"}],4),{members:Jv}=Yv,Qv=Wt([{name:"a_packed",components:3,type:"Float32"}]),{members:e1}=Qv,t1=Wt([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:i1}=t1;class py{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new Ua({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const o=this.getKey(e,i);return this.positions[o]}trim(){const e=this.width,i=this.height=ft(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,o){const a=[];let h=e.length%2==1?-e[e.length-1]*o:0,u=e[0]*o,f=!0;a.push({left:h,right:u,isDash:f,zeroLength:e[0]===0});let _=e[0];for(let g=1;g<e.length;g++){f=!f;const v=e[g];h=_*o,_+=v,u=_*o,a.push({left:h,right:u,isDash:f,zeroLength:v===0})}return a}addRoundDash(e,i,o){const a=i/2;for(let h=-o;h<=o;h++){const u=this.width*(this.nextRow+o+h);let f=0,_=e[f];for(let g=0;g<this.width;g++){g/_.right>1&&(_=e[++f]);const v=Math.abs(g-_.left),b=Math.abs(g-_.right),w=Math.min(v,b);let I;const A=h/o*(a+1);if(_.isDash){const P=a-Math.abs(A);I=Math.sqrt(w*w+P*P)}else I=a-Math.sqrt(w*w+A*A);this.image.data[u+g]=Math.max(0,Math.min(255,I+128))}}}addRegularDash(e,i){for(let _=e.length-1;_>=0;--_){const g=e[_],v=e[_+1];g.zeroLength?e.splice(_,1):v&&v.isDash===g.isDash&&(v.left=g.left,e.splice(_,1))}const o=e[0],a=e[e.length-1];o.isDash===a.isDash&&(o.left=a.left-this.width,a.right=o.right+this.width);const h=this.width*this.nextRow;let u=0,f=e[u];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++u]);const g=Math.abs(_-f.left),v=Math.abs(_-f.right),b=Math.min(g,v);this.image.data[h+_]=Math.max(0,Math.min(255,(f.isDash?b:-b)+i+128))}}addDash(e,i){const o=this.getKey(e,i);if(this.positions[o])return this.positions[o];const a=i==="round",h=a?7:0,u=2*h+1;if(this.nextRow+u>this.height)return Ht("LineAtlas out of space"),null;e.length===0&&e.push(1);let f=0;for(let v=0;v<e.length;v++)e[v]<0&&(Ht("Negative value is found in line dasharray, replacing values with 0"),e[v]=0),f+=e[v];if(f!==0){const v=this.width/f,b=this.getDashRanges(e,this.width,v);a?this.addRoundDash(b,v,h):this.addRegularDash(b,i==="square"?.5*v:0)}const _=this.nextRow+h;this.nextRow+=u;const g={tl:[_,h],br:[f,0]};return this.positions[o]=g,g}}nt(py,"LineAtlas");const r1=ge.types,n1=Math.cos(Math.PI/180*37.5),o1=Math.cos(Math.PI/180*5);class Gm{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new Xc,this.layoutVertexArray2=new Fn,this.patternVertexArray=new Fn,this.indexArray=new Ni,this.programConfigurations=new kn(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new qi,this.maxLineLength=0,this.zOffsetVertexArray=new Fn,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:Xe/64,this.worldview=e.worldview}updateFootprints(e,i){}populate(e,i,o,a){this.hasPattern=gm("line",this.layers,this.pixelRatio,i);const h=this.layers[0].layout.get("line-sort-key");this.tileToMeter=J(o);const u=this.layers[0].layout.get("line-elevation-reference");if(u==="hd-road-markup")this.elevationType="road";else{const w=this.layers[0].layout.get("line-z-offset"),I=w.isConstant()&&!w.constantOr(0);this.elevationType=u!=="sea"&&u!=="ground"&&I?"none":"offset",this.elevationType==="offset"&&u==="none"&&Ht(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const f=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&f!==void 0;const _=[];for(const{feature:w,id:I,index:A,sourceLayerIndex:P}of e){const R=this.layers[0]._featureFilter.needGeometry,O=Te(w,R);if(!this.layers[0]._featureFilter.filter(new yi(this.zoom,{worldview:this.worldview}),O,o))continue;const j=h?h.evaluate(O,{},o):void 0,V={id:I,properties:w.properties,type:w.type,sourceLayerIndex:P,index:A,geometry:R?O.geometry:se(w,o,a),patterns:{},sortKey:j};_.push(V)}h&&_.sort((w,I)=>w.sortKey-I.sortKey);const{lineAtlas:g,featureIndex:v}=i,b=this.addConstantDashes(g);for(const w of _){const{geometry:I,index:A,sourceLayerIndex:P}=w;if(b&&this.addFeatureDashes(w,g),this.hasPattern){const R=ym("line",this.layers,w,this.zoom,this.pixelRatio,i);this.patternFeatures.push(R)}else this.addFeature(w,I,A,o,g.positions,i.availableImages,i.brightness,i.elevationFeatures);v.insert(e[A].feature,I,A,P,this.index)}}addConstantDashes(e){let i=!1;for(const o of this.layers){const a=o.paint.get("line-dasharray").value,h=o.layout.get("line-cap").value;if(a.kind!=="constant"||h.kind!=="constant")i=!0;else{const u=h.value,f=a.value;if(!f)continue;e.addDash(f,u)}}return i}addFeatureDashes(e,i){const o=this.zoom;for(const a of this.layers){const h=a.paint.get("line-dasharray").value,u=a.layout.get("line-cap").value;if(h.kind==="constant"&&u.kind==="constant")continue;let f,_;if(h.kind==="constant"){if(f=h.value,!f)continue}else f=h.evaluate({zoom:o},e);_=u.kind==="constant"?u.value:u.evaluate({zoom:o},e),i.addDash(f,_),e.patterns[a.id]=[i.getKey(f,_)]}}update(e,i,o,a,h,u,f,_){this.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f,_)}addFeatures(e,i,o,a,h,u){for(const f of this.patternFeatures)this.addFeature(f,f.geometry,f.index,i,o,a,u)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,e1)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,i1)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Kv.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Jv),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&e.properties.hasOwnProperty("mapbox_clip_start")&&e.properties.hasOwnProperty("mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,i,o,a,h,u,f,_){const g=this.layers[0].layout,v=g.get("line-join").evaluate(e,{}),b=g.get("line-cap").evaluate(e,{}),w=g.get("line-miter-limit"),I=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e,this.zOffsetValue=g.get("line-z-offset").value;const A=this.layers[0].paint.get("line-width").value;if(A.kind!=="constant"&&A.isLineProgressConstant===!1&&(this.variableWidthValue=A),this.elevationType==="road"){const P=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,i,a,_,v,b,w,I)){const[R,O]=this.clipRuntimeLinesToTile(i,1);for(let j=0;j<R.length;j++){const V=R[j],G=O[j],ne={progress:{min:G.progress.min,max:G.progress.max},nextDir:this.computeSegNextDir(G,V),prevDir:this.computeSegPrevDir(G,V)};this.addLine(V,e,a,v,b,w,I,ne)}this.fillNonElevatedRoadSegment(P)}}else for(const P of i)this.addLine(P,e,a,v,b,w,I);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,o,h,u,a,f,void 0,this.worldview)}computeSegNextDir(e,i){return e.nextPoint.sub(i.at(-2)).unit()}computeSegPrevDir(e,i){return i[1].sub(e.prevPoint).unit()}clipLinesToTile(e,i){return Up(e,-i,-i,Xe+i,Xe+i)}clipRuntimeLinesToTile(e,i){const o=[];return[Up(e,-i,-i,Xe+i,Xe+i,o),o]}addElevatedRoadFeature(e,i,o,a,h,u,f,_){const g=[],v=Hi.getElevationFeature(e,a);if(v){const b=this.clipLinesToTile(i,1),w=this.prepareElevatedLines(b,v,o);for(const I of w)g.push({geometry:I,elevation:v,elevationTileID:o,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(g.length===0)return!1;for(const b of g){const w=this.layoutVertexArray.length;this.addLine(b.geometry,e,o,h,u,f,_);const I=new Yt(o,b.elevationTileID);if(b.elevation)for(let A=w;A<this.layoutVertexArray.length;A++){const P=new Be(this.layoutVertexArray.int16[6*A]>>1,this.layoutVertexArray.int16[6*A+1]>>1),R=I.pointElevation(P,b.elevation,.05);this.updateHeightRange(R),this.zOffsetVertexArray.emplaceBack(R,0,0)}else this.fillNonElevatedRoadSegment(w)}return!0}prepareElevatedLines(e,i,o){if(i.constantHeight!=null)return e;const a=[],h=1/J(o);for(const u of e)wv(u,new mi(i,h),0,a);return a}fillNonElevatedRoadSegment(e){for(let i=e;i<this.layoutVertexArray.length;i++)this.zOffsetVertexArray.emplaceBack(0,0,0)}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}addLine(e,i,o,a,h,u,f,_){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0;const g=a==="none";this.patternJoinNone=this.hasPattern&&g,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const v=_&&_.progress.min>0,b=_&&_.progress.max<1;if(this.lineClips){let le={min:this.lineClips.start,max:this.lineClips.end},he=1;if(_){const Ce=this.lineClips.end-this.lineClips.start;le=function(Ge,Pe,Oe){return{min:nl(Ge.min,Pe,Oe),max:nl(Ge.max,Pe,Oe)}}(_.progress,{min:0,max:1},le),Ce>0&&(he=(le.max-le.min)/Ce)}const Ie=+i.properties.mapbox_clip_feature_len,pe=+i.properties.mapbox_clip_seg_len;if(Number.isNaN(Ie)||Number.isNaN(pe)){for(let Ge=0;Ge<e.length-1;Ge++)this.totalDistance+=e[Ge].dist(e[Ge+1]);const Ce=this.totalDistance/(le.max-le.min);this.totalFeatureLength=Number.isFinite(Ce)?Ce:0,this.lineClips.start=le.min,this.lineClips.end=le.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=Ie,this.distance=pe*he,this.lineClips.start=le.min,this.lineClips.end=le.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}const w=r1[i.type]==="Polygon";let I=e.length;for(;I>=2&&e[I-1].equals(e[I-2]);)I--;let A=0;for(;A<I-1&&e[A].equals(e[A+1]);)A++;if(I<(w?3:2))return;a==="bevel"&&(u=1.05);const P=this.segments.prepareSegment(10*I,this.layoutVertexArray,this.indexArray);let R,O,j,V,G,ne,ee,ie;_&&_.prevDir&&(ne=_.prevDir.perp()),_&&_.nextDir&&(ee=_.nextDir.perp()),this.e1=this.e2=-1,w&&(R=e[I-2],G=e[A].sub(R)._unit()._perp());for(let le=A;le<I;le++){if(j=le===I-1?w?e[A+1]:void 0:e[le+1],j&&e[le].equals(j))continue;G&&(V=G),R&&(O=R),R=e[le],ie=this.evaluateLineProgressFeatures(O?O.dist(R):0),G=j?j.sub(R)._unit()._perp():V,V=V||G;const he=O&&j;let Ie=he?a:w||g?"butt":h;const pe=V.x*G.x+V.y*G.y;if(g){const fe=function(Ee){if(Ee.patternJoinNone){const $e=Ee.segmentPoints.length/2,Ne=Ee.lineSoFar-Ee.segmentStart;for(let ht=0;ht<$e;++ht){const ot=Ee.segmentPoints[2*ht+1],Le=Math.round(Ee.segmentPoints[2*ht])+.5+.25*ot;Ee.patternVertexArray.emplaceBack(Le,Ne,Ee.segmentStart),Ee.patternVertexArray.emplaceBack(Le,Ne,Ee.segmentStart)}Ee.segmentPoints.length=0}Ee.e1=Ee.e2=-1};if(he&&pe<o1){this.updateDistance(O,R),this.addCurrentVertex(R,V,1,1,P,ie),fe(this),this.addCurrentVertex(R,G,-1,-1,P,ie);continue}if(O){if(!j){this.updateDistance(O,R),this.addCurrentVertex(R,V,1,1,P,ie),fe(this);continue}Ie="miter"}}let Ce=V.add(G);Ce.x===0&&Ce.y===0||Ce._unit();const Ge=Ce.x*G.x+Ce.y*G.y,Pe=Ge!==0?1/Ge:1/0,Oe=2*Math.sqrt(2-2*Ge),je=Ge<n1&&O&&j,Se=V.x*G.y-V.y*G.x>0,ke=this.overscaling<=16?15*Xe/(512*this.overscaling):0;if(he&&Ie==="round"){if(Pe<f)Ie="miter";else if(Pe<=2){const fe=qm(R,-10,Xe+10);Ie=this.elevationType==="offset"&&(fe||this.hasCrossSlope)?"miter":"fakeround"}}if(Ie==="miter"&&Pe>u&&(Ie="bevel"),Ie==="bevel"&&(Pe>2&&(Ie="flipbevel"),Pe<u&&(Ie="miter")),O&&!(Ie==="miter"&&je)&&this.updateDistance(O,R),Ie==="miter")if(je){const fe=R.dist(O);if(fe>2*ke){const $e=R.sub(R.sub(O)._mult(ke/fe)._round());this.updateDistance(O,$e),this.addCurrentVertex($e,V,0,0,P,ie),O=$e}this.updateDistance(O,R),Ce._mult(Pe),this.addCurrentVertex(R,Ce,0,0,P,ie);const Ee=R.dist(j);if(Ee>2*ke){const $e=R.add(j.sub(R)._mult(ke/Ee)._round());this.updateDistance(R,$e),this.addCurrentVertex($e,G,0,0,P,ie),R=$e}}else Ce._mult(Pe),this.addCurrentVertex(R,Ce,0,0,P,ie);else if(Ie==="flipbevel"){if(Pe>100)Ce=G.mult(-1);else{const fe=Pe*V.add(G).mag()/V.sub(G).mag();Ce._perp()._mult(fe*(Se?-1:1))}this.addCurrentVertex(R,Ce,0,0,P,ie),this.addCurrentVertex(R,Ce.mult(-1),0,0,P,ie)}else if(Ie==="bevel"||Ie==="fakeround"){ie!=null&&O&&this.addCurrentVertex(R,ee||V,-1,-1,P,ie);const fe=R.dist(O)<=2*ke&&Ie!=="bevel",Ee=Ce.mult(Se?1:-1);Ee._mult(Pe);const $e=G.mult(Se?-1:1),Ne=V.mult(Se?-1:1),ht=this.evaluateLineProgressFeatures(this.distance);if(ie==null&&(this.addHalfVertex(R,Ee.x,Ee.y,!1,!Se,0,P,ht),fe||this.addHalfVertex(R,Ee.x+2*Ne.x,Ee.y+2*Ne.y,!1,Se,0,P,ht)),Ie==="fakeround"){const ot=Math.round(180*Oe/Math.PI/20);this.addHalfVertex(R,Ne.x,Ne.y,!1,Se,0,P,ht);for(let Le=0;Le<ot;Le++){let Ve=Le/ot;if(Ve!==.5){const tt=Ve-.5;Ve+=Ve*tt*(Ve-1)*((1.0904+pe*(pe*(3.55645-1.43519*pe)-3.2452))*tt*tt+(.848013+pe*(.215638*pe-1.06021)))}const at=$e.sub(Ne)._mult(Ve)._add(Ne)._unit();this.addHalfVertex(R,at.x,at.y,!1,Se,0,P,ht)}this.addHalfVertex(R,$e.x,$e.y,!1,Se,0,P,ht)}fe||ie!=null||this.addHalfVertex(R,Ee.x+2*$e.x,Ee.y+2*$e.y,!1,Se,0,P,ht),ie!=null&&j&&this.addCurrentVertex(R,ne||G,1,1,P,ie)}else if(Ie==="butt")this.addCurrentVertex(R,Ce,0,0,P,ie);else if(Ie==="square"){if(!O){const fe=v?0:-1;this.addCurrentVertex(R,Ce,fe,fe,P,ie)}if(this.addCurrentVertex(R,Ce,0,0,P,ie),O){const fe=b?0:1;this.addCurrentVertex(R,Ce,fe,fe,P,ie)}}else if(Ie==="round"){if(O){const fe=!he&&ee?ee:V;this.addCurrentVertex(R,fe,0,0,P,ie),!he&&b||this.addCurrentVertex(R,fe,1,1,P,ie,!0)}if(j){const fe=!he&&ne?ne:G;!he&&v||this.addCurrentVertex(R,fe,-1,-1,P,ie,!0),this.addCurrentVertex(R,fe,0,0,P,ie)}}}}addVerticesTo(e,i,o,a,h,u,f,_,g,v){const b=(i.w-e.w)/this.tessellationStep|0;let w=0;const I=this.scaledDistance;if(b>
191){this.lineSoFar=e.w;const P=(i.x-e.x)/b,R=(i.y-e.y)/b,O=(i.z-e.z)/b,j=(i.w-e.w)/b;for(let V=1;V<b;++V){e.x+=P,e.y+=R,e.z+=O,this.lineSoFar+=j,w+=j;const G=this.evaluateLineProgressFeatures(this.prevDistance+w);this.scaledDistance=(this.prevDistance+w)/this.totalDistance,this.addHalfVertex(e,o,a,v,!1,f,g,G),this.addHalfVertex(e,h,u,v,!0,-_,g,G)}}this.lineSoFar=i.w,this.scaledDistance=I;const A=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(i,o,a,v,!1,f,g,A),this.addHalfVertex(i,h,u,v,!0,-_,g,A)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&this.elevationType!=="offset")return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):Ht(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let i=0;return this.variableWidthValue&&this.variableWidthValue.kind!=="constant"&&(i=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0),this.elevationType!=="offset"?{zOffset:0,variableWidth:i}:this.zOffsetValue.kind==="constant"?{zOffset:this.zOffsetValue.value,variableWidth:i}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:i}}addCurrentVertex(e,i,o,a,h,u,f=!1){const _=i.x+i.y*o,g=i.y-i.x*o,v=i.y*a-i.x,b=-i.y-i.x*a;if(u!=null){const w=this.elevationType==="offset",I=-10,A=Xe+10,P=u.zOffset,R=new Og(e.x,e.y,P,this.lineSoFar),O=!!w&&qm(e,I,A),j=this.lineS
vendor: 4,594 bytes, line 19
19oFar,V=this.distance;if(this.currentVertex)if(O){const G=this.currentVertexIsOutside,ne=this.currentVertex,ee=new Og(e.x,e.y,P,this.lineSoFar);if(Bg(ne,ee,I,A),!qm(ee,I,A)){if(G){this.e1=this.e2=-1,this.distance-=ne.dist(R),this.lineSoFar=ne.w;const ie=this.evaluateLineProgressFeatures(ne.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(ne,_,g,f,!1,o,h,ie),this.addHalfVertex(ne,v,b,f,!0,-a,h,ie),this.prevDistance=this.distance}this.distance=this.prevDistance+ne.dist(ee),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(ne,ee,_,g,v,b,o,a,h,f),this.distance=V,this.scaledDistance=this.distance/this.totalDistance}}else{const G=this.currentVertex;if(this.currentVertexIsOutside){Bg(G,R,I,A),this.e1=this.e2=-1,this.distance-=G.dist(R),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=G.w;const ne=this.evaluateLineProgressFeatures(G.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(G,_,g,f,!1,o,h,ne),this.addHalfVertex(G,v,b,f,!0,-a,h,ne),this.prevDistance=this.distance,this.distance=V,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(G,R,_,g,v,b,o,a,h,f)}else O||(this.addHalfVertex(e,_,g,f,!1,o,h,u),this.addHalfVertex(e,v,b,f,!0,-a,h,u));this.currentVertex=R,this.currentVertexIsOutside=O,this.lineSoFar=j}else this.addHalfVertex(e,_,g,f,!1,o,h,u),this.addHalfVertex(e,v,b,f,!0,-a,h,u)}addHalfVertex({x:e,y:i},o,a,h,u,f,_,g){if(this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),u||this.segmentPoints.push(this.lineSoFar-this.segmentStart,f)),this.layoutVertexArray.emplaceBack((e<<1)+(h?1:0),(i<<1)+(u?1:0),Math.round(63*o)+128,Math.round(63*a)+128,1+(f===0?0:f<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const b=mt(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,b)}const v=_.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,v),_.primitiveLength++),u?this.e2=v:this.e1=v,g!=null&&this.zOffsetVertexArray.emplaceBack(g.zOffset,g.variableWidth,g.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,i){this.prevDistance=this.distance,this.distance+=e.dist(i),this.updateScaledDistance()}}function qm(r,e,i){return r.x<e||r.x>i||r.y<e||r.y>i}let fy,my;function _y(r,e,i){return e*(Xe/(r.tileSize*Math.pow(2,i-r.tileID.overscaledZ)))}nt(Gm,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const gy=(r,e,i)=>(1-i)*r+i*e;function yy(r,e){return 1/_y(r,1,e.tileZoom)}function xy(r,e,i,o){return r.translatePosMatrix(o||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const vy=r=>{const e=[];by(r)&&e.push("RENDER_LINE_DASH"),r.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=r.paint.get("line-trim-offset");i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),r.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const o=r.layout.get("line-join").constantOr("miter")==="none",a=!!r.paint.get("line-pattern").constantOr(1);return o&&a&&e.push("LINE_JOIN_NONE"),e};function by(r){const e=r.paint.get("line-dasharray").value;return e.value||e.kind!=="constant"}let Hm;const wy=()=>Hm||(Hm={layout:fy||(fy=new tr({"line-cap":new Qe(de.layout_line["line-cap"]),"line-join":new Qe(de.layout_line["line-join"]),"line-miter-limit":new qe(de.layout_line["line-miter-limit"]),"line-round-limit":new qe(de.layout_line["line-round-limit"]),"line-sort-key":new Qe(de.layout_line["line-sort-key"]),"line-z-offset":new Qe(de.layout_line["line-z-offset"]),"line-elevation-reference":new qe(de.layout_line["line-elevation-reference"]),"line-cross-slope":new qe(de.layout_line["line-cross-slope"]),visibility:new qe(de.layout_line.visibility),"line-width-unit":new qe(de.layout_line["line-width-unit"])})),paint:my||(my=new tr({"line-opacity":new Qe(de.paint_line["line-opacity"]),"line-color":new Qe(de.paint_line["line-color"]),"line-translate":new qe(de.paint_line["line-translate"]),"line-translate-anchor":new qe(de.paint_line["line-translate-anchor"]),"line-width":new Qe(de.paint_line["line-width"]),"line-gap-width":new Qe(de.paint_line["line-gap-width"]),"line-offset":new Qe(de.paint_line["line-offset"]),"line-blur"
vendor: 5,335 bytes, line 19
19:new Qe(de.paint_line["line-blur"]),"line-dasharray":new Qe(de.paint_line["line-dasharray"]),"line-pattern":new Qe(de.paint_line["line-pattern"]),"line-pattern-cross-fade":new qe(de.paint_line["line-pattern-cross-fade"]),"line-gradient":new Ea(de.paint_line["line-gradient"]),"line-trim-offset":new qe(de.paint_line["line-trim-offset"]),"line-trim-fade-range":new qe(de.paint_line["line-trim-fade-range"]),"line-trim-color":new qe(de.paint_line["line-trim-color"]),"line-emissive-strength":new qe(de.paint_line["line-emissive-strength"]),"line-border-width":new Qe(de.paint_line["line-border-width"]),"line-border-color":new Qe(de.paint_line["line-border-color"]),"line-occlusion-opacity":new qe(de.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"})}))},Hm);class s1 extends Qe{possiblyEvaluate(e,i){return i=new yi(Math.floor(i.zoom),{now:i.now,fadeDuration:i.fadeDuration,transition:i.transition,worldview:i.worldview}),super.possiblyEvaluate(e,i)}evaluate(e,i,o,a){return i=xe({},i,{zoom:Math.floor(i.zoom)}),super.evaluate(e,i,o,a)}}let rd;function Ty(r,e){return e>0?e+2*r:r}const a1=Wt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),l1=Wt([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),c1=Wt([{name:"a_projected_pos",components:4,type:"Float32"}],4);Wt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const h1=Wt([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),u1=Wt([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),d1=Wt([{name:"a_texb",components:2,type:"Uint16"}]),p1=Wt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),f1=Wt([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Wt([{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 Sy=Wt([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),m1=Wt([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Wt([{name:"triangle",components:3,type:"Uint16"}]),Wt([{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"}]),Wt([{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"}
vendor: 10,451 bytes, line 19
19]),Wt([{type:"Float32",name:"offsetX"}]),Wt([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var kr=24;function _1(r,e,i){return r.sections.forEach(o=>{o.text=function(a,h,u){const f=h.layout.get("text-transform").evaluate(u,{});return f==="uppercase"?a=a.toLocaleUpperCase():f==="lowercase"&&(a=a.toLocaleLowerCase()),po.applyArabicShaping&&(a=po.applyArabicShaping(a)),a}(o.text,e,i)}),r}const nd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function g1(r){return r==="︶"||r==="﹈"||r==="︸"||r==="﹄"||r==="﹂"||r==="︾"||r==="︼"||r==="︺"||r==="︘"||r==="﹀"||r==="︐"||r==="︓"||r==="︔"||r==="`"||r===" ̄"||r==="︑"||r==="︒"}function y1(r){return r==="︵"||r==="﹇"||r==="︷"||r==="﹃"||r==="﹁"||r==="︽"||r==="︻"||r==="︹"||r==="︗"||r==="︿"}const $m=4294967296,Ey=1/$m,Iy=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let Yp=class{constructor(r=new Uint8Array(16)){this.buf=ArrayBuffer.isView(r)?r:new Uint8Array(r),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(r,e,i=this.length){for(;this.pos<i;){const o=this.readVarint(),a=o>>3,h=this.pos;this.type=7&o,r(a,e,this),this.pos===h&&this.skip(o)}return e}readMessage(r,e){return this.readFields(r,e,this.readVarint()+this.pos)}readFixed32(){const r=this.dataView.getUint32(this.pos,!0);return this.pos+=4,r}readSFixed32(){const r=this.dataView.getInt32(this.pos,!0);return this.pos+=4,r}readFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*$m;return this.pos+=8,r}readSFixed64(){const r=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*$m;return this.pos+=8,r}readFloat(){const r=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,r}readDouble(){const r=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,r}readVarint(r){const e=this.buf;let i,o;return o=e[this.pos++],i=127&o,o<128?i:(o=e[this.pos++],i|=(127&o)<<7,o<128?i:(o=e[this.pos++],i|=(127&o)<<14,o<128?i:(o=e[this.pos++],i|=(127&o)<<21,o<128?i:(o=e[this.pos],i|=(15&o)<<28,function(a,h,u){const f=u.buf;let _,g;if(g=f[u.pos++],_=(112&g)>>4,g<128||(g=f[u.pos++],_|=(127&g)<<3,g<128)||(g=f[u.pos++],_|=(127&g)<<10,g<128)||(g=f[u.pos++],_|=(127&g)<<17,g<128)||(g=f[u.pos++],_|=(127&g)<<24,g<128)||(g=f[u.pos++],_|=(1&g)<<31,g<128))return dh(a,_,h);throw new Error("Expected varint not more than 10 bytes")}(i,r,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const r=this.readVarint();return r%2==1?(r+1)/-2:r/2}readBoolean(){return!!this.readVarint()}readString(){const r=this.readVarint()+this.pos,e=this.pos;return this.pos=r,r-e>=12&&Iy?Iy.decode(this.buf.subarray(e,r)):function(i,o,a){let h="",u=o;for(;u<a;){const f=i[u];let _,g,v,b=null,w=f>239?4:f>223?3:f>191?2:1;if(u+w>a)break;w===1?f<128&&(b=f):w===2?(_=i[u+1],(192&_)==128&&(b=(31&f)<<6|63&_,b<=127&&(b=null))):w===3?(_=i[u+1],g=i[u+2],(192&_)==128&&(192&g)==128&&(b=(15&f)<<12|(63&_)<<6|63&g,(b<=2047||b>=55296&&b<=57343)&&(b=null))):w===4&&(_=i[u+1],g=i[u+2],v=i[u+3],(192&_)==128&&(192&g)==128&&(192&v)==128&&(b=(15&f)<<18|(63&_)<<12|(63&g)<<6|63&v,(b<=65535||b>=1114112)&&(b=null))),b===null?(b=65533,w=1):b>65535&&(b-=65536,h+=String.fromCharCode(b>>>10&1023|55296),b=56320|1023&b),h+=String.fromCharCode(b),u+=w}return h}(this.buf,e,r)}readBytes(){const r=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,r);return this.pos=r,e}readPackedVarint(r=[],e){const i=this.readPackedEnd();for(;this.pos<i;)r.push(this.readVarint(e));return r}readPackedSVarint(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSVarint());return r}readPackedBoolean(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readBoolean());return r}readPackedFloat(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFloat());return r}readPackedDouble(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readDouble());return r}readPackedFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed32());return r}readPackedSFixed32(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed32());return r}readPackedFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readFixed64());return r}readPackedSFixed64(r=[]){const e=this.readPackedEnd();for(;this.pos<e;)r.push(this.readSFixed64());return r}readPackedEnd(){return this.type===2?this.readVarint()+this.pos:this.pos+1}skip(r){const e=7&r;if(e===0)for(;this.buf[this.pos++]>127;);else if(e===2)this.pos=this.readVarint()+this.pos;else if(e===5)this.pos+=4;else{if(e!==1)throw new Error(`Unimplemented type: ${e}`);this.pos+=8}}writeTag(r,e){this.writeVarint(r<<3|e)}realloc(r){let e=this.length||16;for(;e<this.pos+r;)e*=2;if(e!==this.length){const i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.dataView=new DataView(i.buffer),this.length=e}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(r){this.realloc(4),this.dataView.setInt32(this.pos,r,!0),this.pos+=4}writeSFixed32(r){this.realloc(4),this.dataView.setInt32(this.pos,r,!0),this.pos+=4}writeFixed64(r){this.realloc(8),this.dataView.setInt32(this.pos,-1&r,!0),this.dataView.setInt32(this.pos+4,Math.floor(r*Ey),!0),this.pos+=8}writeSFixed64(r){this.realloc(8),this.dataView.setInt32(this.pos,-1&r,!0),this.dataView.setInt32(this.pos+4,Math.floor(r*Ey),!0),this.pos+=8}writeVarint(r){(r=+r||0)>268435455||r<0?function(e,i){let o,a;if(e>=0?(o=e%4294967296|0,a=e/4294967296|0):(o=~(-e%4294967296),a=~(-e/4294967296),4294967295^o?o=o+1|0:(o=0,a=a+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(h,u,f){f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,h>>>=7,f.buf[f.pos++]=127&h|128,f.buf[f.pos]=127&(h>>>=7)}(o,0,i),function(h,u){const f=(7&h)<<4;u.buf[u.pos++]|=f|((h>>>=3)?128:0),h&&(u.buf[u.pos++]=127&h|((h>>>=7)?128:0),h&&(u.buf[u.pos++]=127&h|((h>>>=7)?128:0),h&&(u.buf[u.pos++]=127&h|((h>>>=7)?128:0),h&&(u.buf[u.pos++]=127&h|((h>>>=7)?128:0),h&&(u.buf[u.pos++]=127&h)))))}(a,i)}(r,this):(this.realloc(4),this.buf[this.pos++]=127&r|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=127&(r>>>=7)|(r>127?128:0),r<=127||(this.buf[this.pos++]=r>>>7&127))))}writeSVarint(r){this.writeVarint(r<0?2*-r-1:2*r)}writeBoolean(r){this.writeVarint(+r)}writeString(r){r=String(r),this.realloc(4*r.length),this.pos++;const e=this.pos;this.pos=function(o,a,h){for(let u,f,_=0;_<a.length;_++){if(u=a.charCodeAt(_),u>55295&&u<57344){if(!f){u>56319||_+1===a.length?(o[h++]=239,o[h++]=191,o[h++]=189):f=u;continue}if(u<56320){o[h++]=239,o[h++]=191,o[h++]=189,f=u;continue}u=f-55296<<10|u-56320|65536,f=null}else f&&(o[h++]=239,o[h++]=191,o[h++]=189,f=null);u<128?o[h++]=u:(u<2048?o[h++]=u>>6|192:(u<65536?o[h++]=u>>12|224:(o[h++]=u>>18|240,o[h++]=u>>12&63|128),o[h++]=u>>6&63|128),o[h++]=63&u|128)}return h}(this.buf,r,this.pos);const i=this.pos-e;i>=128&&Ay(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i}writeFloat(r){this.realloc(4),this.dataView.setFloat32(this.pos,r,!0),this.pos+=4}writeDouble(r){this.realloc(8),this.dataView.setFloat64(this.pos,r,!0),this.pos+=8}writeBytes(r){const e=r.length;this.writeVarint(e),this.realloc(e);for(let i=0;i<e;i++)this.buf[this.pos++]=r[i]}writeRawMessage(r,e){this.pos++;const i=this.pos;r(e,this);const o=this.pos-i;o>=128&&Ay(i,o,this),this.pos=i-1,this.writeVarint(o),this.pos+=o}writeMessage(r,e,i){this.writeTag(r,2),this.writeRawMessage(e,i)}writePackedVarint(r,e){e.length&&this.writeMessage(r,x1,e)}writePackedSVarint(r,e){e.length&&this.writeMessage(r,v1,e)}writePackedBoolean(r,e){e.length&&this.writeMessage(r,T1,e)}writePackedFloat(r,e){e.length&&this.writeMessage(r,b1,e)}writePackedDouble(r,e){e.length&&this.writeMessage(r,w1,e)}writePackedFixed32(r,e){e.length&&this.writeMessage(r,S1,e)}writePackedSFixed32(r,e){e.length&&this.writeMessage(r,E1,e)}writePackedFixed64(r,e){e.length&&this.writeMessage(r,I1,e)}writePackedSFixed64(r,e){e.length&&this.writeMessage(r,A1,e)}writeBytesField(r,e){this.writeTag(r,2),this.writeBytes(e)}writeFixed32Field(r,e){this.writeTag(r,5),this.writeFixed32(e)}writeSFixed32Field(r,e){this.writeTag(r,5),this.writeSFixed32(e)}writeFixed64Field(r,e){this.writeTag(r,1),this.writeFixed64(e)}writeSFixed64Field(r,e){this.writeTag(r,1),this.writeSFixed64(e)}writeVarintField(r,e){this.writeTag(r,0),this.writeVarint(e)}writeSVarintField(r,e){this.writeTag(r,0),this.writeSVarint(e)}writeStringField(r,e){this.writeTag(r,2),this.writeString(e)}writeFloatField(r,e){this.writeTag(r,5),this.writeFloat(e)}writeDoubleField(r,e){this.writeTag(r,1),this.writeDouble(e)}writeBooleanField(r,e){this.writeVarintField(r,+e)}};function dh(r,e,i){return i?4294967296*e+(r>>>0):4294967296*(e>>>0)+(r>>>0)}function Ay(r,e,i){const o=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(o);for(let a=i.pos-1;a>=r;a--)i.buf[a+o]=i.buf[a]}function x1(r,e){for(let i=0;i<r.length;i++)e.writeVarint(r[i])}function v1(r,e){for(let i=0;i<r.length;i++)e.writeSVarint(r[i])}function b1(r,e){for(let i=0;i<r.length;i++)e.writeFloat(r[i])}function w1(r,e){for(let i=0;i<r.length;i++)e.writeDouble(r[i])}function T1(r,e){for(let i=0;i<r.length;i++)e.writeBoolean(r[i])}function S1(r,e){for(let i=0;i<r.length;i++)e.writeFixed32(r[i])}function E1(r,e){for(let i=0;i<r.length;i++)e.writeSFixed32(r[i])}function I1(r,e){for(let i=0;i<r.length;
19i++)e.writeFixed64(r[i])}function A1(r,e){for(let i=0;i<r.length;i++)e.writeSFixed64(r[i])}const Zm=3;function C1(r,e,i){e.glyphs=[],r===1&&i.readMessage(M1,e)}function M1(r,e,i){if(r===3){const{id:o,bitmap:a,width:h,height:u,left:f,top:_,advance:g}=i.readMessage(P1,{});e.glyphs.push({id:o,bitmap:new Ua({width:h+2*Zm,height:u+2*Zm},a),metrics:{width:h,height:u,left:f,top:_,advance:g}})}else r===4?e.ascender=i.readSVarint():r===5&&(e.descender=i.readSVarint())}function P1(r,e,i){r===1?e.id=i.readVarint():r===2?e.bitmap=i.readBytes():r===3?e.width=i.readVarint():r===4?e.height=i.readVarint():r===5?e.left=i.readSVarint():r===6?e.top=i.readSVarint():r===7&&(e.advance=i.readVarint())}const Cy=Zm,Gn={horizontal:1,vertical:2,horizontalOnly:3};class od{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,i){const o=new od;return o.scale=e||1,o.fontStack=i,o}static forImage(e){const i=new od;return i.image=e,i}}class ph{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i,o){const a=new ph;for(let h=0;h<e.sections.length;h++){const u=e.sections[h];u.image?a.addImageSection(u,o):a.addTextSection(u,i)}return a}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(i,o){let a="";for(let h=0;h<i.length;h++){const u=i.charCodeAt(h+1)||null,f=i.charCodeAt(h-1)||null;a+=!o&&(u&&Uc(u)&&!nd[i[h+1]]||f&&Uc(f)&&!nd[i[h-1]])||!nd[i[h]]?i[h]:nd[i[h]]}return a}(this.text,e)}trim(){let e=0;for(let o=0;o<this.text.length&&Kp[this.text.charCodeAt(o)];o++)e++;let i=this.text.length;for(let o=this.text.length-1;o>=0&&o>=e&&Kp[this.text.charCodeAt(o)];o--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const o=new ph;return o.text=this.text.substring(e,i),o.sectionIndex=this.sectionIndex.slice(e,i),o.sections=this.sections,o}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,i)=>Math.max(e,this.sections[i].scale),0)}addTextSection(e,i){this.text+=e.text,this.sections.push(od.forText(e.scale,e.fontStack||i));const o=this.sections.length-1;for(let a=0;a<e.text.length;++a)this.sectionIndex.push(o)}addImageSection(e,i){const o=e.image?e.image.getPrimary():null;if(!o)return void Ht("Can't add FormattedSection with an empty image.");o.scaleSelf(i);const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCodePoint(a),this.sections.push(od.forImage(o)),this.sectionIndex.push(this.sections.length-1)):Ht("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Wm(r,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P=1){const R=ph.fromFeature(r,a,P);
19b===Gn.vertical&&R.verticalizePunctuation(w);let O=[];const j=function(ie,le,he,Ie,pe,Ce){if(!ie)return[];const Ge=[],Pe=function(ke,fe,Ee,$e,Ne,ht){let ot=0;for(let Le=0;Le<ke.length();Le++){const Ve=ke.getSection(Le);ot+=My(ke.getCodePoint(Le),Ve,$e,Ne,fe,ht)}return ot/Math.max(1,Math.ceil(ot/Ee))}(ie,le,he,Ie,pe,Ce),Oe=ie.text.indexOf("​")>=0;let je=0;for(let ke=0;ke<ie.length();ke++){const fe=ie.getSection(ke),Ee=ie.getCodePoint(ke);if(Kp[Ee]||(je+=My(Ee,fe,Ie,pe,le,Ce)),ke<ie.length()-1){const $e=!((Se=Ee)<11904||!(yt["Bopomofo Extended"](Se)||yt.Bopomofo(Se)||yt["CJK Compatibility Forms"](Se)||yt["CJK Compatibility Ideographs"](Se)||yt["CJK Compatibility"](Se)||yt["CJK Radicals Supplement"](Se)||yt["CJK Strokes"](Se)||yt["CJK Symbols and Punctuation"](Se)||yt["CJK Unified Ideographs Extension A"](Se)||yt["CJK Unified Ideographs"](Se)||yt["Enclosed CJK Letters and Months"](Se)||yt["Halfwidth and Fullwidth Forms"](Se)||yt.Hiragana(Se)||yt["Ideographic Description Characters"](Se)||yt["Kangxi Radicals"](Se)||yt["Katakana Phonetic Extensions"](Se)||yt.Katakana(Se)||yt["Vertical Forms"](Se)||yt["Yi Radicals"](Se)||yt["Yi Syllables"](Se)));(z1[Ee]||$e||fe.image)&&Ge.push(zy(ke+1,je,Pe,Ge,R1(Ee,ie.getCodePoint(ke+1),$e&&Oe),!1))}}var Se;return Ry(zy(ie.length(),je,Pe,Ge,0,!0))}(R,g,h,e,o,I),{processBidirectionalText:V,processStyledBidirectionalText:G}=po;if(V&&R.sections.length===1){const ie=V(R.toString(),j);for(const le of ie){const he=new ph;he.text=le,he.sections=R.sections;for(let Ie=0;Ie<le.length;Ie++)he.sectionIndex.push(0);O.push(he)}}else if(G){const ie=G(R.text,R.sectionIndex,j);for(const le of ie){const he=new ph;he.text=le[0],he.sectionIndex=le[1],he.sections=R.sections,O.push(he)}}else O=function(ie,le){const he=[],Ie=ie.text;let pe=0;for(const Ce of le)he.push(ie.substring(pe,Ce)),pe=Ce;return pe<Ie.length&&he.push(ie.substring(pe,Ie.length)),he}(R,j);const ne=[],ee={positionedLines:ne,text:R.toString(),top:v[1],bottom:v[1],left:v[0],right:v[0],writingMode:b,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(ie,le,he,Ie,pe,Ce,Ge,Pe,Oe,je,Se,ke){let fe=0,Ee=0,$e=0;const Ne=Pe==="right"?1:Pe==="left"?0:.5;let ht=!1;for(const Ye of pe){const it=Ye.getSections();for(const gt of it){if(gt.image)continue;const St=le[gt.fontStack];if(St&&(ht=St.ascender!==void 0&&St.descender!==void 0,!ht))break}if(!ht)break}let ot=0;for(const Ye of pe){Ye.trim();const it=Ye.getMaxScale(),gt=(it-1)*kr,St={positionedGlyphs:[],lineOffset:0};ie.positionedLines[ot]=St;const Pt=St.positionedGlyphs;let Ct=0;if(!Ye.length()){Ee+=Ce,++ot;continue}let $t=0,Ot=0;for(let H=0;H<Ye.length();H++){const $=Ye.getSection(H),we=Ye.getSectionIndex(H),Ze=Ye.getCodePoint(H);let Je=$.scale,Ke=null,st=null,bt=null,jt=kr,Ut=0,Dt=Oe;Dt===Gn.vertical&&((Le=Ze)===12312||Le===12313||Le===12316||Le===12540||Le===12448)&&(Dt=Gn.horizontal);const xi=!(Dt===Gn.horizontal||!Se&&!jc(Ze)||Se&&(Kp[Ze]||ap(Ze)));if($.image){const Yi=Ie.get($.image.toString());if(!Yi)continue;bt=$.image,ie.iconsInText=ie.iconsInText||!0,st=Yi.paddedRect;const zt=Yi.displaySize;Je=Je*kr/ke,Ke={width:zt[0],height:zt[1],left:0,top:-Cy,advance:xi?zt[1]:zt[0],localGlyph:!1},Ut=ht?-Ke.height*Je:it*kr-17-zt[1]*Je,jt=Ke.advance;const Fi=(xi?zt[0]:zt[1])*Je-kr*it;Fi>0&&Fi>Ct&&(Ct=Fi)}else{const Yi=he[$.fontStack];if(!Yi)continue;Yi[Ze]&&(st=Yi[Ze]);const zt=le[$.fontStack];if(!zt)continue;const Fi=zt.glyphs[Ze];if(!Fi)continue;if(Ke=Fi.metrics,jt=Ze!==8203?kr:0,ht){const Ai=zt.ascender!==void 0?Math.abs(zt.ascender):0,pi=zt.descender!==void 0?Math.abs(zt.descender):0,$i=(Ai+pi)*Je;$t<$i&&($t=$i,Ot=(Ai-pi)/2*Je),Ut=-Ai*Je}else Ut=(it-Je)*kr-17}xi?(ie.verticalizable=!0,Pt.push({glyph:Ze,image:bt,x:fe,y:Ee+Ut,vertical:xi,scale:Je,localGlyph:Ke.localGlyph,fontStack:$.fontStack,sectionIndex:we,metrics:Ke,rect:st}),fe+=jt*Je+je):(Pt.push({glyph:Ze,image:bt,x:fe,y:Ee+Ut,vertical:xi,scale:Je,localGlyph:Ke.localGlyph,fontStack:$.fontStack,sectionIndex:we,metrics:Ke,rect:st}),fe+=Ke.advance*Je+je)}Pt.length!==0&&($e=Math.max(fe-je,$e),ht?Dy(Pt,Ne,Ct,Ot,Ce*it/2):Dy(Pt,Ne,Ct,0,Ce/2)),fe=0;const Pi=Ce*it+Ct;St.lineOffset=Math.max(Ct,gt),Ee+=Pi,++ot}var Le;const Ve=Ee,{horizontalAlign:at,verticalAlign:tt}=Xm(Ge);(function(Ye,it,gt,St,Pt,Ct){const $t=(it-gt)*Pt,Ot=-Ct*St;for(const Pi of Ye)for(const H of Pi.positionedGlyphs)H.x+=$t,H.y+=Ot})(ie.positionedLines,Ne,at,tt,$e,Ve),ie.top+=-tt*Ve,ie.bottom=ie.top+Ve,ie.left+=-at*$e,ie.right=ie.left+$e,ie.hasBaseline=ht}(ee,e,i,o,O,u,f,_,b,g,w,A),!function(ie){for(const le of ie)if(le.positionedGlyphs.length!==0)return!1;return!0}(ne))return ee}const Kp={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},z1={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function My(r,e,i,o,a,h){if(e.image){const u=o.get(e.image.toString());return u?u.displaySize[0]*e.scale*kr/h+a:0}{const u=i[e.fontStack],f=u&&u.glyphs[r];return f?f.metrics.advance*e.scale+a:0}}function Py(r,e,i,o){const a=Math.pow(r-e,2);return o?r<e?a/2:2*a:a+Math.abs(i)*i}function R1(r,e,i){let o=0;return r===10&&(o-=1e4),i&&(o+=150),r!==40&&r!==65288||(o+=50),e!==41&&e!==65289||(o+=50),o}function zy(r,e,i,o,a,h){let u=null,f=Py(e,i,a,h);for(const _ of o){const g=Py(e-_.x,i,a,h)+_.badness;g<=f&&(u=_,f=g)}return{index:r,x:e,priorBreak:u,badness:f}}function Ry(r){return r?Ry(r.priorBreak).concat(r.index):[]}function Xm(r){let e=.5,i=.5;
vendor: 9,224 bytes, line 19
19switch(r){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":i=1;break;case"top":case"top-right":case"top-left":i=0}return{horizontalAlign:e,verticalAlign:i}}function Dy(r,e,i,o,a){if(!(e||i||o||a))return;const h=r.length-1,u=r[h],f=(u.x+u.metrics.advance*u.scale)*e;for(let _=0;_<=h;_++)r[_].x-=f,r[_].y+=i+o+a}function Ly(r){return r.imagePrimary!==void 0&&r.top!==void 0&&r.bottom!==void 0&&r.left!==void 0&&r.right!==void 0}function D1(r,e,i,o){const{horizontalAlign:a,verticalAlign:h}=Xm(o),u=i[0]-r.displaySize[0]*a,f=i[1]-r.displaySize[1]*h;return{imagePrimary:r,imageSecondary:e,top:f,bottom:f+r.displaySize[1],left:u,right:u+r.displaySize[0]}}function Fy(r,e,i,o,a,h){const u=r.imagePrimary;let f;if(u.content){const R=u.content,O=u.pixelRatio||1;f=[R[0]/O,R[1]/O,u.displaySize[0]-R[2]/O,u.displaySize[1]-R[3]/O]}const _=e.left*h,g=e.right*h;let v,b,w,I;i==="width"||i==="both"?(I=a[0]+_-o[3],b=a[0]+g+o[1]):(I=a[0]+(_+g-u.displaySize[0])/2,b=I+u.displaySize[0]);const A=e.top*h,P=e.bottom*h;return i==="height"||i==="both"?(v=a[1]+A-o[0],w=a[1]+P+o[2]):(v=a[1]+(A+P-u.displaySize[1])/2,w=v+u.displaySize[1]),{imagePrimary:u,imageSecondary:void 0,top:v,right:b,bottom:w,left:I,collisionPadding:f}}function Oy(r){return!r.imagePrimary.stretchX}function ky(r){return!r.imagePrimary.stretchY}function By(r){return{width:r.right-r.left,height:r.bottom-r.top}}const ws=128;function Ny(r,e,i){const{expression:o}=e;if(o.kind==="constant")return{kind:"constant",layoutSize:o.evaluate(new yi(r+1,{worldview:i}))};if(o.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:h}=o;let u=0;for(;u<a.length&&a[u]<=r;)u++;u=Math.max(0,u-1);let f=u;for(;f<a.length&&a[f]<r+1;)f++;f=Math.min(a.length-1,f);const _=a[u],g=a[f];return o.kind==="composite"?{kind:"composite",minZoom:_,maxZoom:g,interpolationType:h}:{kind:"camera",minZoom:_,maxZoom:g,minSize:o.evaluate(new yi(_,{worldview:i})),maxSize:o.evaluate(new yi(g,{worldview:i})),interpolationType:h}}}function Ym(r,{uSize:e,uSizeT:i},{lowerSize:o,upperSize:a}){return r.kind==="source"?o/ws:r.kind==="composite"?mt(o/ws,a/ws,i):e}function sd(r,e,i=1){let o=0,a=0;if(r.kind==="constant")a=r.layoutSize*i;else if(r.kind!=="source"){const{interpolationType:h,minZoom:u,maxZoom:f}=r,_=h?W(_n.interpolationFactor(h,e,u,f),0,1):0;r.kind==="camera"?a=mt(r.minSize,r.maxSize,_)*i:o=_*i}return{uSizeT:o,uSize:a}}class Zs extends Be{constructor(e,i,o,a,h){super(e,i),this.angle=a,this.z=o,h!==void 0&&(this.segment=h)}clone(){return new Zs(this.x,this.y,this.z,this.angle,this.segment)}}function Vy(r,e,i,o,a){if(e.segment===void 0)return!0;let h=e,u=e.segment+1,f=0;for(;f>-i/2;){if(u--,u<0)return!1;f-=r[u].dist(h),h=r[u]}f+=r[u].dist(r[u+1]),u++;const _=[];let g=0;for(;f<i/2;){const v=r[u],b=r[u+1];if(!b)return!1;let w=r[u-1].angleTo(v)-v.angleTo(b);for(w=Math.abs((w+3*Math.PI)%(2*Math.PI)-Math.PI),_.push({distance:f,angleDelta:w}),g+=w;f-_[0].distance>o;)g-=_.shift().angleDelta;if(g>a)return!1;u++,f+=v.dist(b)}return!0}function jy(r){let e=0;for(let i=0;i<r.length-1;i++)e+=r[i].dist(r[i+1]);return e}function Uy(r,e,i){return r?.6*e*i:0}function Gy(r,e){return Math.max(r?r.right-r.left:0,e?e.right-e.left:0)}function L1(r,e,i,o,a,h){const u=Uy(i,a,h),f=Gy(i,o)*h;let _=0;const g=jy(r)/2;for(let v=0;v<r.length-1;v++){const b=r[v],w=r[v+1],I=b.dist(w);if(_+I>g){const A=(g-_)/I,P=mt(b.x,w.x,A),R=mt(b.y,w.y,A),O=new Zs(P,R,0,w.angleTo(b),v);return!u||Vy(r,O,f,u,e)?O:void 0}_+=I}}function F1(r,e,i,o,a,h,u,f,_){const g=Uy(o,h,u),v=Gy(o,a),b=v*u,w=r[0].x===0||r[0].x===_||r[0].y===0||r[0].y===_;return e-b<e/4&&(e=b+e/4),qy(r,w?e/2*f%e:(v/2+2*h)*u*f%e,e,g,i,b,w,!1,_)}function qy(r,e,i,o,a,h,u,f,_){const g=h/2,v=jy(r);let b=0,w=e-i,I=[];for(let A=0;A<r.length-1;A++){const P=r[A],R=r[A+1],O=P.dist(R),j=R.angleTo(P);for(;w+i<b+O;){w+=i;const V=(w-b)/O,G=mt(P.x,R.x,V),ne=mt(P.y,R.y,V);if(G>=0&&G<_&&ne>=0&&ne<_&&w-g>=0&&w+g<=v){const ee=new Zs(G,ne,0,j,A);o&&!Vy(r,ee,h,o,a)||I.push(ee)}}b+=O}return f||I.length||u||(I=qy(r,b/2,i,o,a,h,u,!0,_)),I}function Hy(r){let e=0,i=0;for(const u of r)e+=u.w*u.h,i=Math.max(i,u.w);r.sort((u,f)=>f.h-u.h);const o=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let a=0,h=0;for(const u of r)for(let f=o.length-1;f>=0;f--){const _=o[f];if(!(u.w>_.w||u.h>_.h)){if(u.x=_.x,u.y=_.y,h=Math.max(h,u.y+u.h),a=Math.max(a,u.x+u.w),u.w===_.w&&u.h===_.h){const g=o.pop();g&&f<o.length&&(o[f]=g)}else u.h===_.h?(_.x+=u.w,_.w-=u.w):u.w===_.w?(_.y+=u.h,_.h-=u.h):(o.push({x:_.x+u.w,y:_.y,w:_.w-u.w,h:u.h}),_.y+=u.h,_.h-=u.h);break}}return{w:a,h,fill:e/(a*h)||0}}nt(Zs,"Anchor");const Ql=1;class ad{static getImagePositionScale(e,i,o){if(i&&e&&e.options&&e.options.transform){const a=e.options.transform;return{x:a.a,y:a.d}}return{x:o,y:o}}constructor(e,i,o,a){this.paddedRect=e;const{pixelRatio:h,version:u,stretchX:f,stretchY:_,content:g,sdf:v,usvg:b}=i;this.pixelRatio=h,this.stretchX=f,this.stretchY=_,this.content=g,this.version=u,this.padding=o,this.sdf=v,this.usvg=b,this.scale=ad.getImagePositionScale(a,b,h)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function Km(r,e,i){const o=Oo.parse(r),a=function(h,u,f=[1,1]){return{x:0,y:0,w:(h.data?h.data.width:h.width*f[0])+2*u,h:(h.data?h.data.height:h.height*f[1])+2*u}}(e,i,[o.options.transform.a,o.options.transform.d]);return{bin:a,imagePosition:new ad(a,e,i,o),imageVariant:o}}class $y{constructor(e,i,o){const a=new Map,h=new Map;this.haveRenderCallbacks=[];const u=[];this.addImages(e,a,Ql,u),this.addImages(i,h,2,u);const{w:f,h:_}=Hy(u),g=new qr({width:f||1,height:_||1});for(const[v,b]of e.entries()){const w=a.get(v).paddedRect;qr.copy(b.data,g,{x:0,y:0},{x:w.x+Ql,y:w.y+Ql},b.data,o,b.sdf)}for(const[v,b]of i.entries()){const w=h.get(v),I=w.paddedRect;let A=w.padding;const P=I.x+A,R=I.y+A,O=b.data.width,j=b.data.height;A=A>1?A-1:A,qr.copy(b.data,g,{x:0,y:0},{x:P,y:R},b.data,o),qr.copy(b.data,g,{x:0,y:j-A},{x:P,y:R-A},{width:O,height:A},o),qr.copy(b.data,g,{x:0,y:0},{x:P,y:R+j},{width:O,height:A},o),qr.copy(b.data,g,{x:O-A,y:0},{x:P-A,y:R},{width:A,height:j},o),qr.copy(b.data,g,{x:0,y:0},{x:P+O,y:R},{width:A,height:j},o),qr.copy(b.data,g,{x:O-A,y:j-A},{x:P-A,y:R-A},{width:A,height:A},o),qr.copy(b.data,g,{x:0,y:j-A},{x:P+O,y:R-A},{width:A,height:A},o),qr.copy(b.data,g,{x:0,y:0},{x:P+O,y:R+j},{width:A,height:A},o),qr.copy(b.data,g,{x:O-A,y:0},{x:P-A,y:R+j},{width:A,height:A},o)}this.lut=o,this.image=g,this.iconPositions=a,this.patternPositions=h}addImages(e,i,o,a){for(const[h,u]of e.entries()){const{bin:f,imagePosition:_,imageVariant:g}=Km(h,u,o);i.set(h,_),a.push(f),u.hasRenderCallback&&this.haveRenderCallbacks.push(g.id)}}patchUpdatedImages(e,i,o){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(a=>e.hasImage(a,o)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,o);for(const a of e.getUpdatedImages(o)){for(const h of this.iconPositions.keys()){const u=Oo.parse(h);if(bn.isEqual(u.id,a)){const f=e.getImage(a,o);this.patchUpdatedImage(this.iconPositions.get(h),f,i)}}for(const h of this.patternPositions.keys()){const u=Oo.parse(h);if(bn.isEqual(u.id,a)){const f=e.getImage(a,o);this.patchUpdatedImage(this.patternPositions.get(h),f,i)}}}}patchUpdatedImage(e,i,o){if(!e||!i||e.version===i.version)return;e.version=i.version;const[a,h]=e.tl,u=e.sdf;if(this.lut||u){const f={width:i.data.width,height:i.data.height},_=new qr(f);qr.copy(i.data,_,{x:0,y:0},{x:0,y:0},f,this.lut,u),o.update(_,{position:{x:a,y:h}})}else o.update(i.data,{position:{x:a,y:h}})}}nt(ad,"ImagePosition"),nt($y,"ImageAtlas");const ld=1e20;function Zy(r,e,i,o,a,h,u,f,_){for(let g=e;g<e+o;g++)Wy(r,i*h+g,h,a,u,f,_);for(let g=i;g<i+a;g++)Wy(r,g*h+e,1,o,u,f,_)}function Wy(r,e,i,o,a,h,u){h[0]=0,u[0]=-ld,u[1]=ld,a[0]=r[e];for(let f=1,_=0,g=0;f<o;f++){a[f]=r[e+f*i];const v=f*f;do{const b=h[_];g=(a[f]-a[b]+v-b*b)/(f-b)/2}while(g<=u[_]&&--_>-1);_++,h[_]=f,u[_]=g,u[_+1]=ld}for(let f=0,_=0;f<o;f++){for(;u[_+1]<f;)_++;const g=h[_],v=f-g;r[e+f*i]=a[g]+v*v}}const Vo=2,Jm={none:0,ideographs:1,all:2};class fh{constructor(e,i,o){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=o,this.url="",this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e){this.url=e}getGlyphs(e,i){const o=[],a=this.url||Br.GLYPHS_URL;for(const h in e)for(const u of e[h])o.push({stack:h,id:u});ue(o,({stack:h,id:u},f)=>{let _=this.entries[h];_||(_=this.entries[h]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let g=_.glyphs[u];if(g!==void 0)return void f(null,{stack:h,id:u,glyph:g});if(g=this._tinySDF(_,h,u),g)return _.glyphs[u]=g,void f(null,{stack:h,id:u,glyph:g});const v=Math.floor(u/256);if(256*v>65535)return Ht("glyphs > 65535 not supported"),void f(null,{stack:h,id:u,glyph:g});if(_.ranges[v])return void f(null,{stack:h,id:u,glyph:g});let b=_.requests[v];b||(b=_.requests[v]=[],fh.loadGlyphRange(h,v,a,this.requestManager,(w,I)=>
19{if(I){_.ascender=I.ascender,_.descender=I.descender;for(const A in I.glyphs)this._doesCharSupportLocalGlyph(+A)||(_.glyphs[+A]=I.glyphs[+A]);_.ranges[v]=!0}for(const A of b)A(w,I);delete _.requests[v]})),b.push((w,I)=>{w?f(w):I&&f(null,{stack:h,id:u,glyph:I.glyphs[u]||null})})},(h,u)=>{if(h)i(h);else if(u){const f={};for(const{stack:_,id:g,glyph:v}of u)f[_]===void 0&&(f[_]={}),f[_].glyphs===void 0&&(f[_].glyphs={}),f[_].glyphs[g]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics},f[_].ascender=this.entries[_].ascender,f[_].descender=this.entries[_].descender;i(null,f)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==Jm.none&&(this.localGlyphMode===Jm.all?!!this.localFontFamily:!!this.localFontFamily&&(yt["CJK Unified Ideographs"](e)||yt["Hangul Syllables"](e)||yt.Hiragana(e)||yt.Katakana(e)||yt["CJK Symbols and Punctuation"](e)||yt["CJK Unified Ideographs Extension A"](e)||yt["CJK Unified Ideographs Extension B"](e)||yt.Osage(e)))}_tinySDF(e,i,o){const a=this.localFontFamily;if(!a||!this._doesCharSupportLocalGlyph(o))return;let h=e.tinySDF;if(!h){let P="400";/bold/i.test(i)?P="900":/medium/i.test(i)?P="500":/light/i.test(i)&&(P="200"),h=e.tinySDF=new fh.TinySDF({fontFamily:a,fontWeight:P,fontSize:24*Vo,buffer:3*Vo,radius:8*Vo}),h.fontWeight=P}if(this.localGlyphs[h.fontWeight][o])return this.localGlyphs[h.fontWeight][o];const u=String.fromCodePoint(o),{data:f,width:_,height:g,glyphWidth:v,glyphHeight:b,glyphLeft:w,glyphTop:I,glyphAdvance:A}=h.draw(u);return this.localGlyphs[h.fontWeight][o]={id:o,bitmap:new Ua({width:_,height:g},f),metrics:{width:v/Vo,height:b/Vo,left:w/Vo,top:I/Vo-27,advance:A/Vo,localGlyph:!0}}}}fh.loadGlyphRange=function(r,e,i,o,a){const h=256*e,u=h+255,f=o.transformRequest(o.normalizeGlyphsURL(i).replace("{fontstack}",r).replace("{range}",`${h}-${u}`),ul.Glyphs);dl(f,(_,g)=>{if(_)a(_);else if(g){const v={},b=function(w){return new Yp(w).readFields(C1,{})}(g);for(const w of b.glyphs)v[w.id]=w;a(null,{glyphs:v,ascender:b.ascender,descender:b.descender})}})},fh.TinySDF=class{constructor({fontSize:r=24,buffer:e=3,radius:i=8,cutoff:o=.25,fontFamily:a="sans-serif",fontWeight:h="normal",fontStyle:u="normal"}={}){this.buffer=e,this.cutoff=o,this.radius=i;const f=this.size=r+4*e,_=this._createCanvas(f),g=this.ctx=_.getContext("2d",{willReadFrequently:!0});g.font=`${u} ${h} ${r}px ${a}`,g.textBaseline="alphabetic",g.textAlign="left",g.fillStyle="black",this.gridOuter=new Float64Array(f*f),this.gridInner=new Float64Array(f*f),this.f=new Float64Array(f),this.z=new Float64Array(f+1),this.v=new Uint16Array(f)}_createCanvas(r){const e=document.createElement("canvas");return e.width=e.height=r,e}draw(r){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:o,actualBoundingBoxLeft:a,actualBoundingBoxRight:h}=this.ctx.measureText(r),u=Math.ceil(i),f=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-a))),_=Math.min(this.size-this.buffer,u+Math.ceil(o)),g=f+2*this.buffer,v=_+2*this.buffer,b=Math.max(g*v,0),w=new Uint8ClampedArray(b),I={data:w,width:g,height:v,glyphWidth:f,glyphHeight:_,glyphTop:u,glyphLeft:0,glyphAdvance:e};if(f===0||_===0)return I;const{ctx:A,buffer:P,gridInner:R,gridOuter:O}=this;A.clearRect(P,P,f,_),A.fillText(r,P,P+u);const j=A.getImageData(P,P,f,_);O.fill(ld,0,b),R.fill(0,0,b);for(let V=0;V<_;V++)for(let G=0;G<f;G++){const ne=j.data[4*(V*f+G)+3]/255;if(ne===0)continue;const ee=(V+P)*g+G+P;if(ne===1)O[ee]=0,R[ee]=ld;else{const ie=.5-ne;O[ee]=ie>0?ie*ie:0,R[ee]=ie<0?ie*ie:0}}Zy(O,0,0,g,v,g,this.f,this.v,this.z),Zy(R,P,P,f,_,g,this.f,this.v,this.z);for(let V=0;V<b;V++){const G=Math.sqrt(O[V])-Math.sqrt(R[V]);w[V]=Math.round(255-255*(G/this.radius+this.cutoff))}return I}};const Ha=Ql;function Xy(r,e){return r+e[1]-e[0]}function Yy(r,e,i,o,a=1){const h=[],u=r.imagePrimary,f=u.pixelRatio,_=u.paddedRect.w-2*Ha,g=u.paddedRect.h-2*Ha,v=(r.right-r.left)*a,b=(r.bottom-r.top)*a,w=u.stretchX||[[0,_]],I=u.stretchY||[[0,g]],A=w.reduce(Xy,0),P=I.reduce(Xy,0),R=_-A,O=g-P;let j=0,V=A,G=0,ne=P,ee=0,ie=R,le=0,he=O;if(u.content&&o){const pe=u.content;j=Jp(w,0,pe[0]),G=Jp(I,0,pe[1]),V=Jp(w,pe[0],pe[2]),ne=Jp(I,pe[1],pe[3]),ee=pe[0]-j,le=pe[1]-G,ie=pe[2]-pe[0]-V,he=pe[3]-pe[1]-ne}const Ie=(pe,Ce,Ge,Pe)=>{const Oe=Qp(pe.stretch-j,V,v,r.left*a),je=ef(pe.fixed-ee,ie,pe.stretch,A),Se=Qp(Ce.stretch-G,ne,b,r.top*a),ke=ef(Ce.fixed-le,he,Ce.stretch,P),fe=Qp(Ge.stretch-j,V,v,r.left*a),Ee=ef(Ge.fixed-ee,ie,Ge.stretch,A),$e=Qp(Pe.stretch-G,ne,b,r.top*a),Ne=ef(Pe.fixed-le,he,Pe.stretch,P),ht=new Be(Oe,Se),ot=new Be(fe,Se),Le=new Be(fe,$e),Ve=new Be(Oe,$e),at=new Be(je/f,ke/f),tt=new Be(Ee/f,Ne/f),Ye=e*Math.PI/180;if(Ye){const $t=Math.sin(Ye),Ot=Math.cos(Ye),Pi=[Ot,-$t,$t,Ot];ht._matMult(Pi),ot._matMult(Pi),Ve._matMult(Pi),Le._matMult(Pi)}const it=pe.stretch+pe.fixed,gt=Ge.stretch+Ge.fixed,St=Ce.stretch+Ce.f
19ixed,Pt=Pe.stretch+Pe.fixed,Ct=r.imageSecondary;return{tl:ht,tr:ot,bl:Ve,br:Le,texPrimary:{x:u.paddedRect.x+Ha+it,y:u.paddedRect.y+Ha+St,w:gt-it,h:Pt-St},texSecondary:Ct?{x:Ct.paddedRect.x+Ha+it,y:Ct.paddedRect.y+Ha+St,w:gt-it,h:Pt-St}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:at,pixelOffsetBR:tt,minFontScaleX:ie/f/v,minFontScaleY:he/f/b,isSDF:i}};if(o&&(u.stretchX||u.stretchY)){const pe=Ky(w,R,A),Ce=Ky(I,O,P);for(let Ge=0;Ge<pe.length-1;Ge++){const Pe=pe[Ge],Oe=pe[Ge+1];for(let je=0;je<Ce.length-1;je++)h.push(Ie(Pe,Ce[je],Oe,Ce[je+1]))}}else h.push(Ie({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:_+1},{fixed:0,stretch:g+1}));return h}function Jp(r,e,i){let o=0;for(const a of r)o+=Math.max(e,Math.min(i,a[1]))-Math.max(e,Math.min(i,a[0]));return o}function Ky(r,e,i){const o=[{fixed:-Ha,stretch:0}];for(const[a,h]of r){const u=o[o.length-1];o.push({fixed:a-u.stretch,stretch:u.stretch}),o.push({fixed:a-u.stretch,stretch:u.stretch+(h-a)})}return o.push({fixed:e+Ha,stretch:i}),o}function Qp(r,e,i,o){return r/e*i+o}function ef(r,e,i,o){return r-e*i/o}function O1(r,e,i,o){const a=e+r.positionedLines[o].lineOffset;return o===0?i+a/2:i+(a+(e+r.positionedLines[o-1].lineOffset))/2}function k1(r,e=1,i=!1){let o=1/0,a=1/0,h=-1/0,u=-1/0;const f=r[0];for(let I=0;I<f.length;I++){const A=f[I];(!I||A.x<o)&&(o=A.x),(!I||A.y<a)&&(a=A.y),(!I||A.x>h)&&(h=A.x),(!I||A.y>u)&&(u=A.y)}const _=Math.min(h-o,u-a);let g=_/2;const v=new _c([],B1);if(_===0)return new Be(o,a);for(let I=o;I<h;I+=_)for(let A=a;A<u;A+=_)v.push(new mh(I+g,A+g,g,r));let b=function(I){let A=0,P=0,R=0;const O=I[0];for(let j=0,V=O.length,G=V-1;j<V;G=j++){const ne=O[j],ee=O[G],ie=ne.x*ee.y-ee.x*ne.y;P+=(ne.x+ee.x)*ie,R+=(ne.y+ee.y)*ie,A+=3*ie}return new mh(P/A,R/A,0,I)}(r),w=v.length;for(;v.length;){const I=v.pop();(I.d>b.d||!b.d)&&(b=I,i&&console.log("found best %d after %d probes",Math.round(1e4*I.d)/1e4,w)),I.max-b.d<=e||(g=I.h/2,v.push(new mh(I.p.x-g,I.p.y-g,g,r)),v.push(new mh(I.p.x+g,I.p.y-g,g,r)),v.push(new mh(I.p.x-g,I.p.y+g,g,r)),v.push(new mh(I.p.x+g,I.p.y+g,g,r)),w+=4)}return i&&(console.log(`num probes: ${w}`),console.log(`best distance: ${b.d}`)),b.p}function B1(r,e){return e.max-r.max}class mh{constructor(e,i,o,a){this.p=new Be(e,i),this.h=o,this.d=function(h,u){let f=!1,_=1/0;for(let g=0;g<u.length;g++){const v=u[g];for(let b=0,w=v.length,I=w-1;b<w;I=b++){const A=v[b],P=v[I];A.y>h.y!=P.y>h.y&&h.x<(P.x-A.x)*(h.y-A.y)/(P.y-A.y)+A.x&&(f=!f),_=Math.min(_,Bn(h,A,P))}}return(f?1:-1)*Math.sqrt(_)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}}const N1=Object.keys,Qm=Number.POSITIVE_INFINITY,V1=Math.sqrt(2);function Jy(r,[e,i]){let o=0,a=0;if(i===Qm){e<0&&(e=0);const h=e/V1;switch(r){case"top-right":case"top-left":a=h-7;break;case"bottom-right":case"bottom-left":a=7-h;break;case"bottom":a=7-e;break;case"top":a=e-7}switch(r){case"top-right":case"bottom-right":o=-h;break;case"top-left":case"bottom-left":o=h;break;case"left":o=e;break;case"right":o=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),r){case"top-right":case"top-left":case"top":a=i-7;break;case"bottom-right":case"bottom-left":case"bottom":a=7-i}switch(r){case"top-right":case"bottom-right":case"right":o=-e;break;case"top-left":case"bottom-left":case"left":o=e}}return[o,a]}function tf(r,e,i,o,a,h,u,f,_){if(!e||!e.usvg)return;const g=By(o),v=By(a),b=h!=="both"&&h!=="width"||!Oy(o)?1:v.width/g.width,w=h!=="both"&&h!=="height"||!ky(o)?1:v.height/g.height;i.scaleSelf(b,w);const I=i.toString();u.set(I,i),f.set(I,e);const{imagePosition:A}=Km(I,e,Ql);_.set(I,A)}function Qy(r,e,i,o,a,h,u,f,_){if(!r)return;const g=function(v,b,w,I,A,P){if(v.kind==="camera")return v.maxSize;if(v.kind==="composite"){const R=b.possiblyEvaluate(new yi(v.maxZoom,{worldview:P}),w).evaluate(A,{},w),O=b.possiblyEvaluate(new yi(v.minZoom,{worldview:P}),w).evaluate(A,{},w);return Math.max(R,O)}return b.possiblyEvaluate(new yi(I,{worldview:P})).evaluate(A,{},w)}(e,i,o,a,h,_);return r.scaleSelf(g*f*u)}function ex(r,e,i,o,a,h,u,f,_){return{iconPrimary:Qy(r.getPrimary(),e,i,o,a,h,u,f,_),iconSecondary:Qy(r.getSecondary(),e,i,o,a,h,u,f,_)}}function j1(r,e,i){if(!e)return;const o=i.get(r.toString()),a=i.get(e.toString());a&&(o.paddedRect.w===a.paddedRect.w&&o.paddedRect.h===a.paddedRect.h||Ht(`Mismatch in icon variant sizes: ${r.toString()} and ${e.toString()}`),o.usvg!==a.usvg&&Ht(`Mismatch in icon variant image types: ${r.id} and ${e.id}`))}function tx(r,e,i,o){if(!r)return;const a=e.get(i.toString());if(r.imagePrimary=a,o){const h=e.get(o.toString());r.imageSecondary=h}}function U1(r,e){for(const i in r.horizontal)ix(r.horizontal[i],e);ix(r.vertical,e)}function ix(r,e){if(r){for(const i of r.positionedLines)for(const o of i.positionedGlyphs)if(o.image!==null){const a=o.image.toString();o.rect=e.get(a).paddedRect}}}function e_(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function G1(r,e,i,o,a,h,u,f,_){const g=t_(h.horizontal)||h.vertical,v=i.get("icon-text-fit-padding").evaluate(o,{},a);let b,w=e;return e&&_!=="none"&&(r.allowVerticalPlacement&&h.vertical&&(b=Fy(e,h.vertical,_,v,f,u)),g&&(w=Fy(e,g,_,v,f,u))),{defaultShapedIcon:w,verticallyShapedIcon:b}}function q1(r,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O,j,V){let G=u.textMaxSize.evaluate(e,{},w);G===void 0?G=f*u.textScaleFactor:G*=u.textScaleFactor;const ne=r.layers[0].layout,ee=t_(i.horizontal)||i.vertical,ie=I.name==="globe",le=kr,he=r.tilePixelRatio*G/le,Ie=(je=r.overscaling,r.zoom>18&&je>2&&(je>>=1),Math.max(Xe/(512*je),1)*ne.get("symbol-spacing")),pe=ne.get("text-padding")*r.tilePixelRatio,Ce=ne.get("icon-padding")*r.tilePixelRatio,Ge=ii(ne.get("text-max-angle")),Pe=ne.get("icon-rotation-alignment")==="map"&&V!=="point",Oe=Ie/2;var je;r.hasAnyIconTextFit===!1&&R!=="none"&&(r.hasAnyIconTextFit=!0);const Se=e.properties?+e.properties[et]:null,ke=Se&&r.elevationFeatureIdToIndex?r.elevationFeatureIdToIndex.get(Se):65535,fe=(Ee,$e,Ne)=>{if($e.x<0||$e.x>=Xe||$e.y<0||$e.y>=Xe)return;let ht=null;if(ie){const{x:ot,y:Le,z:Ve}=I.projectTilePoint($e.x,$e.y,Ne);ht={anchor:new Zs(ot,Le,Ve,0,void 0),up:I.upVector(Ne,$e.x,$e.y)}}(function(ot,Le,Ve,at,tt,Ye,it,gt,St,Pt,Ct,$t,Ot,Pi,H,$,we,Ze,Je,Ke,st,bt,jt,Ut,Dt,xi,Yi,zt,Fi){const Ai=ot.addToLineVertexArray(Le,at);let pi,$i,zi,Ci,Mi,_i,Lt,vi=0,Zi=0,xt=0,Xt=0,Ri=-1,Ji=-1;const Oi={};let Er=la("");const Ti=Ve?Ve.anchor:Le,vr=zt!=="none";let En=0,Hr=0;if(St._unevaluatedLayout.getValue("text-radial-offset")===void 0){const Ir=St.layout.get("text-offset").evaluate(st,{},Dt);En=Ir[0]*kr,Hr=Ir[1]*kr}else En=St.layout.get("text-radial-offset").evaluate(st,{},Dt)*kr,Hr=Qm;if(ot.allowVerticalPlacement&&tt.vertical){const Ir=tt.vertical;if(H)_i=i_(Ir),gt&&(Lt=i_(gt));else{const zr=St.layout.get("text-rotate").evaluate(st,{},Dt)+90;zi=rf(Pt,Ti,Le,Ct,$t,Ot,Ir,Pi,zr,$),gt&&(Ci=rf(Pt,Ti,Le,Ct,$t,Ot,gt,Ze,zr))}}if(Ye){const Ir=ot.iconSizeData,zr=St.layout.get("icon-rotate").evaluate(st,{},Dt),$r=Yy(Ye,zr,jt,vr,bt.iconScaleFactor),cn=gt?Yy(gt,zr,jt,vr,bt.iconScaleFactor):void 0;$i=rf(Pt,Ti,Le,Ct,$t,Ot,Ye,Ze,zr,null),vi=4*$r.length;let en=null;Ir.kind==="source"?(en=[ws*St.layout.get("icon-size").evaluate(st,{},Dt)*bt.iconScaleFactor],en[0]>$a&&Ht(`${ot.layerIds[0]}: Value for "icon-size" is >= ${cd}. Reduce your "icon-size".`)):Ir.kind==="composite"&&(en=[ws*bt.compositeIconSizes[0].evaluate(st,{},Dt)*bt.iconScaleFactor,ws*bt.compositeIconSizes[1].evaluate(st,{}
19,Dt)*bt.iconScaleFactor],(en[0]>$a||en[1]>$a)&&Ht(`${ot.layerIds[0]}: Value for "icon-size" is >= ${cd}. Reduce your "icon-size".`)),ot.addSymbols(ot.icon,$r,en,Ke,Je,st,void 0,Ve,Le,Ai.lineStartIndex,Ai.lineLength,-1,Ut,Dt,xi,Yi),Ri=ot.icon.placedSymbolArray.length-1,cn&&(Zi=4*cn.length,ot.addSymbols(ot.icon,cn,en,Ke,Je,st,Gn.vertical,Ve,Le,Ai.lineStartIndex,Ai.lineLength,-1,Ut,Dt,xi,Yi),Ji=ot.icon.placedSymbolArray.length-1)}for(const Ir in tt.horizontal){const zr=Ir,$r=tt.horizontal[zr];pi||(Er=la($r.text),H?Mi=i_($r):pi=rf(Pt,Ti,Le,Ct,$t,Ot,$r,Pi,St.layout.get("text-rotate").evaluate(st,{},Dt),$));const cn=$r.positionedLines.length===1;if(xt+=rx(ot,Ve,Le,$r,it,St,H,st,$,Ai,tt.vertical?Gn.horizontal:Gn.horizontalOnly,cn?N1(tt.horizontal):[zr],Oi,Ri,bt,Ut,Dt,xi),cn)break}tt.vertical&&(Xt+=rx(ot,Ve,Le,tt.vertical,it,St,H,st,$,Ai,Gn.vertical,["vertical"],Oi,Ji,bt,Ut,Dt,xi));let Nr=-1;const In=(Ir,zr)=>Ir?Math.max(Ir,zr):zr;Nr=In(Mi,Nr),Nr=In(_i,Nr),Nr=In(Lt,Nr);const Ts=Nr>-1?1:0;ot.glyphOffsetArray.length>=65535&&Ht("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),st.sortKey!==void 0&&ot.addToSortKeyRanges(ot.symbolInstances.length,st.sortKey),ot.symbolInstances.emplaceBack(Le.x,Le.y,Ti.x,Ti.y,Ti.z,Oi.right>=0?Oi.right:-1,Oi.center>=0?Oi.center:-1,Oi.left>=0?Oi.left:-1,Oi.vertical>=0?Oi.vertical:-1,Ri,Ji,Er,pi!==void 0?pi:ot.collisionBoxArray.length,pi!==void 0?pi+1:ot.collisionBoxArray.length,zi!==void 0?zi:ot.collisionBoxArray.length,zi!==void 0?zi+1:ot.collisionBoxArray.length,$i!==void 0?$i:ot.collisionBoxArray.length,$i!==void 0?$i+1:ot.collisionBoxArray.length,Ci||ot.collisionBoxArray.length,Ci?Ci+1:ot.collisionBoxArray.length,Ct,xt,Xt,vi,Zi,Ts,0,En,Hr,Nr,0,vr?1:0,Fi)})(r,$e,ht,Ee,i,o,h,a,r.layers[0],r.collisionBoxArray,e.index,e.sourceLayerIndex,r.index,pe,j,g,0,Ce,Pe,O,e,u,v,b,w,A,P,R,ke)};if(V==="line")for(const Ee of Up(e.geometry,0,0,Xe,Xe)){const $e=F1(Ee,Ie,Ge,i.vertical||ee,o,le,he,r.overscaling,Xe);for(const Ne of $e)ee&&H1(r,ee.text,Oe,Ne)||fe(Ee,Ne,w)}else if(V==="line-center"){for(const Ee of e.geometry)if(Ee.length>1){const $e=L1(Ee,Ge,i.vertical||ee,o,le,he);$e&&fe(Ee,$e,w)}}else if(e.type==="Polygon")for(const Ee of Hu(e.geometry,0)){const $e=k1(Ee,16);fe(Ee[0],new Zs($e.x,$e.y,0,0,void 0),w)}else if(e.type==="LineString")for(const Ee of e.geometry)fe(Ee,new Zs(Ee[0].x,Ee[0].y,0,0,void 0),w);else if(e.type==="Point")for(const Ee of e.geometry)for(const $e of Ee)fe([$e],new Zs($e.x,$e.y,0,0,void 0),w)}const cd=255,$a=cd*ws;function rx(r,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R,O){const j=function(ne,ee,ie,le,he,Ie,pe,Ce){const Ge=[];if(ee.positionedLines.length===0)return Ge;const Pe=le.layout.get("text-rotate").evaluate(Ie,{})*Math.PI/180,Oe=function(Ee){const $e=Ee[0],Ne=Ee[1],ht=$e*Ne;return ht>0?[$e,-Ne]:ht<0?[-$e,Ne]:$e===0?[Ne,$e]:[Ne,-$e]}(ie);let je=Math.abs(ee.top-ee.bottom);for(const Ee of ee.positionedLines)je-=Ee.lineOffset;const Se=ee.positionedLines.length,ke=je/Se;let fe=ee.top-ie[1];for(let Ee=0;Ee<Se;++Ee){const $e=ee.positionedLines[Ee];fe=O1(ee,ke,fe,Ee);for(const Ne of $e.positionedGlyphs){if(!Ne.rect)continue;const ht=Ne.rect||{};let ot=Cy+1,Le=!0,Ve=1,at=0;if(Ne.image){const st=pe.get(Ne.image.toString());if(!st)continue;if(st.sdf){Ht("SDF images are not supported in formatted text and will be ignored.");continue}Le=!1,Ve=st.pixelRatio,ot=Ql/Ve}const tt=(he||Ce)&&Ne.vertical,Ye=Ne.metrics.advance*Ne.scale/2,it=Ne.metrics,gt=Ne.rect;if(gt===null)continue;Ce&&ee.verticalizable&&(at=Ne.image?Ye-Ne.metrics.width*Ne.scale/2:0);const St=he?[Ne.x+Ye,Ne.y]:[0,0];let Pt=[0,0],Ct=[0,0],$t=!1;he||(tt?(Ct=[Ne.x+Ye+Oe[0],Ne.y+Oe[1]-at],$t=!0):Pt=[Ne.x+Ye+ie[0],Ne.y+ie[1]-at]);const Ot=gt.w*Ne.scale/(Ve*(Ne.localGlyph?Vo:1)),Pi=gt.h*Ne.scale/(Ve*(Ne.localGlyph?Vo:1));let H,$,we,Ze;if(tt){const st=Ne.y-fe,bt=new Be(-Ye,Ye-st),jt=-Math.PI/2,Ut=new Be(...Ct);H=new Be(-Ye+Pt[0],Pt[1]),H._rotateAround(jt,bt)._add(Ut),H.x+=-st+Ye,H.y-=(it.left-ot)*Ne.scale;const Dt=Ne.image?it.advance*Ne.scale:kr*Ne.scale,xi=String.fromCodePoint(Ne.glyph);g1(xi)?H.x+=(1-ot)*Ne.scale:y1(xi)?H.x+=Dt-it.height*Ne.scale+(-ot-1)*Ne.scale:H.x+=Ne.image||it.width+2*ot===gt.w&&it.height+2*ot===gt.h?(Dt-Pi)/2:(Dt-(it.height+2*ot)*Ne.scale)/2,$=new Be(H.x,H.y-Ot),we=new Be(H.x+Pi,H.y),Ze=new Be(H.x+Pi,H.y-Ot)}else{const st=(it.left-ot)*Ne.scale-Ye+Pt[0],bt=(-it.top-ot)*Ne.scale+Pt[1],jt=st+Ot,Ut=bt+Pi;H=new Be(st,bt),$=new Be(jt,bt),we=new Be(st,Ut),Ze=new Be(jt,Ut)}
vendor: 34,039 bytes, line 19
19if(Pe){let st;st=he?new Be(0,0):$t?new Be(Oe[0],Oe[1]):new Be(ie[0],ie[1]),H._rotateAround(Pe,st),$._rotateAround(Pe,st),we._rotateAround(Pe,st),Ze._rotateAround(Pe,st)}const Je=new Be(0,0),Ke=new Be(0,0);Ge.push({tl:H,tr:$,bl:we,br:Ze,texPrimary:ht,texSecondary:void 0,writingMode:ee.writingMode,glyphOffset:St,sectionIndex:Ne.sectionIndex,isSDF:Le,pixelOffsetTL:Je,pixelOffsetBR:Ke,minFontScaleX:0,minFontScaleY:0})}}return Ge}(0,o,_,h,u,f,a,r.allowVerticalPlacement),V=r.textSizeData;let G=null;V.kind==="source"?(G=[ws*h.layout.get("text-size").evaluate(f,{},R)*A.textScaleFactor],G[0]>$a&&Ht(`${r.layerIds[0]}: Value for "text-size" is >= ${cd}. Reduce your "text-size".`)):V.kind==="composite"&&(G=[ws*A.compositeTextSizes[0].evaluate(f,{},R)*A.textScaleFactor,ws*A.compositeTextSizes[1].evaluate(f,{},R)*A.textScaleFactor],(G[0]>$a||G[1]>$a)&&Ht(`${r.layerIds[0]}: Value for "text-size" is >= ${cd}. Reduce your "text-size".`)),r.addSymbols(r.text,j,G,_,u,f,v,e,i,g.lineStartIndex,g.lineLength,I,P,R,O,!1);for(const ne of b)w[ne]=r.text.placedSymbolArray.length-1;return 4*j.length}function t_(r){for(const e in r)return r[e];return null}function rf(r,e,i,o,a,h,u,f,_,g){let v=u.top,b=u.bottom,w=u.left,I=u.right;if(Ly(u)&&u.collisionPadding){const A=u.collisionPadding;w-=A[0],v-=A[1],I+=A[2],b+=A[3]}if(_){const A=new Be(w,v),P=new Be(I,v),R=new Be(w,b),O=new Be(I,b),j=ii(_);let V=new Be(0,0);g&&(V=new Be(g[0],g[1])),A._rotateAround(j,V),P._rotateAround(j,V),R._rotateAround(j,V),O._rotateAround(j,V),w=Math.min(A.x,P.x,R.x,O.x),I=Math.max(A.x,P.x,R.x,O.x),v=Math.min(A.y,P.y,R.y,O.y),b=Math.max(A.y,P.y,R.y,O.y)}return r.emplaceBack(e.x,e.y,e.z,i.x,i.y,w,v,I,b,f,o,a,h),r.length-1}function i_(r){Ly(r)&&r.collisionPadding&&(r.top-=r.collisionPadding[1],r.bottom+=r.collisionPadding[3]);const e=r.bottom-r.top;return e>0?Math.max(10,e):null}function H1(r,e,i,o){const a=r.compareText;if(e in a){const h=a[e];for(let u=h.length-1;u>=0;u--)if(o.dist(h[u])<i)return!0}else a[e]=[];return a[e].push(o),!1}function nx(r,e){const i=r.fovAboveCenter,o=r.elevation?r.elevation.getMinElevationBelowMSL()*e:0,a=(r._camera.position[2]*r.worldSize-o)/Math.cos(r._pitch),h=Math.sin(i)*a/Math.sin(Math.max(Math.PI/2-r._pitch-i,.01));let u=Math.sin(r._pitch)*h+a;const f=a*(1/r._horizonShift);if(!r.elevation||r.elevation.exaggeration()===0){let _=Math.max(r.zoom-17,0);r.isOrthographic&&(_/=10),u*=1+_}return Math.min(1.01*u,f)}function hd(r,e){if(!e.isReprojectedInTileSpace)return{scale:1<<r.z,x:r.x,y:r.y,x2:r.x+1,y2:r.y+1,projection:e};const i=Math.pow(2,-r.z),o=r.x*i,a=(r.x+1)*i,h=r.y*i,u=(r.y+1)*i,f=N(o),_=N(a),g=U(h),v=U(u),b=e.project(f,g),w=e.project(_,g),I=e.project(_,v),A=e.project(f,v);let P=Math.min(b.x,w.x,I.x,A.x),R=Math.min(b.y,w.y,I.y,A.y),O=Math.max(b.x,w.x,I.x,A.x),j=Math.max(b.y,w.y,I.y,A.y);const V=i/16;function G(ee,ie,le,he,Ie,pe){const Ce=(le+Ie)/2,Ge=(he+pe)/2,Pe=e.project(N(Ce),U(Ge)),Oe=Math.max(0,P-Pe.x,R-Pe.y,Pe.x-O,Pe.y-j);P=Math.min(P,Pe.x),O=Math.max(O,Pe.x),R=Math.min(R,Pe.y),j=Math.max(j,Pe.y),Oe>V&&(G(ee,Pe,le,he,Ce,Ge),G(Pe,ie,Ce,Ge,Ie,pe))}G(b,w,o,h,a,h),G(w,I,a,h,a,u),G(I,A,a,u,o,u),G(A,b,o,u,o,h),P-=V,R-=V,O+=V,j+=V;const ne=1/Math.max(O-P,j-R);return{scale:ne,x:P*ne,y:R*ne,x2:O*ne,y2:j*ne,projection:e}}function ox(r,{x:e,y:i},o=0){return new Be(((e-o)*r.scale-r.x)*Xe,(i*r.scale-r.y)*Xe)}const $1=It(new Float32Array(16));class Za{constructor(e){this.spec=e,this.name=e.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(e,i){return{x:0,y:0,z:0}}unproject(e,i){return new S(0,0)}projectTilePoint(e,i,o){return{x:e,y:i,z:0}}locationPoint(e,i,o,a=!0){return e._coordinatePoint(e.locationCoordinate(i,o),a)}pixelsPerMeter(e,i){return L(1,e)*i}pixelSpaceConversion(e,i,o){return 1}farthestPixelDistance(e){return nx(e,e.pixelsPerMeter)}pointCoordinate(e,i,o,a){const h=e.horizonLineFromTop(!1),u=new Be(i,Math.max(h,o));return e.rayIntersectionCoordinate(e.pointRayIntersection(u,a))}pointCoordinate3D(e,i,o){const a=new Be(i,o);if(e.elevation)return e.elevation.pointCoordinate(a);{const h=this.pointCoordinate(e,a.x,a.y,0);return[h.x,h.y,h.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const o=e.horizonLineFromTop();return i.y<o}createInversionMatrix(e,i){return $1}createTileMatrix(e,i,o){let a,h,u;const f=o.canonical,_=It(new Float64Array(16));if(this.isReprojectedInTileSpace){const g=hd(f,this);a=1,h=g.x+o.wrap*g.scale,u=g.y,Zr(_,_,[a/g.scale,a/g.scale,e.pixelsPerMeter/i])}else a=i/e.zoomScale(f.z),h=(f.x+Math.pow(2,f.z)*o.wrap)*a,u=f.y*a;return tn(_,_,[h,u,0]),Zr(_,_,[a/Xe,a/Xe,1]),_}upVector(e,i,o){return[0,0,1]}upVectorScale(e,i,o){return{metersToTile:1}}}class Z1 extends Za{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,o]=this.parallels=e.parallels||[29.5,45.5],a=Math.sin(ii(i));this.n=(a+Math.sin(ii(o)))/2,this.c=1+a*(2*this.n-a),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n:o,c:a,r0:h}=this,u=ii(e-this.center[0]),f=ii(i),_=Math.sqrt(a-2*o*Math.sin(f))/o;return{x:_*Math.sin(u*o),y:_*Math.cos(u*o)-h,z:0}}unproject(e,i){const{n:o,c:a,r0:h}=this,u=h+i;let f=Math.atan2(e,Math.abs(u))*Math.sign(u);u*o<0&&(f-=Math.PI*Math.sign(e)*Math.sign(u));const _=ii(this.center[0])*o;f=be(f,-Math.PI-_,Math.PI-_);const g=W(ye(f/o)+this.center[0],-180,180),v=Math.asin(W((a-(e*e+u*u)*o*o)/(2*o),-1,1)),b=W(ye(v),-Y,Y);return new S(g,b)}}const ud=1.340264,dd=-.081106,pd=893e-6,fd=.003796,nf=Math.sqrt(3)/2;class W1 extends Za{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const o=Math.asin(nf*Math.sin(i)),a=o*o,h=a*a*a;return{x:.5*(e*Math.cos(o)/(nf*(ud+3*dd*a+h*(7*pd+9*fd*a)))/Math.PI+.5),y:1-.5*(o*(ud+dd*a+h*(pd+fd*a))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let o=i=(2*(1-i)-1)*Math.PI,a=o*o,h=a*a*a;for(let v,b,w,I=0;I<12&&(b=o*(ud+dd*a+h*(pd+fd*a))-i,w=ud+3*dd*a+h*(7*pd+9*fd*a),v=b/w,o=W(o-v,-Math.PI/3,Math.PI/3),a=o*o,h=a*a*a,!(Math.abs(v)<1e-12));++I);const u=nf*e*(ud+3*dd*a+h*(7*pd+9*fd*a))/Math.cos(o),f=Math.asin(Math.sin(o)/nf),_=W(180*u/Math.PI,-180,180),g=W(180*f/Math.PI,-Y,Y);return new S(_,g)}}class X1 extends Za{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){return{x:.5+e/360,y:.5-i/360,z:0}}unproject(e,i){const o=360*(e-.5),a=W(360*(.5-i),-Y,Y);return new S(o,a)}}const _h=Math.PI/2;function of(r){return Math.tan((_h+r)/2)}class Y1 extends Za{constructor(e){super(e),this.center=e.center||[0,30];const[i,o]=this.parallels=e.parallels||[30,30];let a=ii(i),h=ii(o);this.southernCenter=a+h<0,this.southernCenter&&(a=-a,h=-h);const u=Math.cos(a),f=of(a);this.n=a===h?Math.sin(a):Math.log(u/Math.cos(h))/Math.log(of(h)/f),this.f=u*Math.pow(of(a),this.n)/this.n}project(e,i){i=ii(i),this.southernCenter&&(i=-i),e=ii(e-this.center[0]);const o=1e-6,{n:a,f:h}=this;h>0?i<-_h+o&&(i=-_h+o):i>_h-o&&(i=_h-o);const u=h/Math.pow(of(i),a);let f=u*Math.sin(a*e),_=h-u*Math.cos(a*e);return f=.5*(f/Math.PI+.5),_=.5*(_/Math.PI+.5),{x:f,y:this.southernCenter?_:1-_,z:0}}unproject(e,i){e=(2*e-.5)*Math.PI,this.southernCenter&&(i=1-i),i=(2*(1-i)-.5)*Math.PI;const{n:o,f:a}=this,h=a-i,u=Math.sign(h),f=Math.sign(o)*Math.sqrt(e*e+h*h);let _=Math.atan2(e,Math.abs(h))*u;h*o<0&&(_-=Math.PI*Math.sign(e)*u);const g=W(ye(_/o)+this.center[0],-180,180),v=W(ye(2*Math.atan(Math.pow(a/f,1/o))-_h),-Y,Y);return new S(g,this.southernCenter?-v:v)}}class sx extends Za{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,i){return{x:z(e),y:F(i),z:0}}unproject(e,i){const o=N(e),a=U(i);return new S(o,a)}}const ax=ii(Y);class K1 extends Za{project(e,i){const o=(i=ii(i))*i,a=o*o;return{x:.5*((e=ii(e))*(.8707-.131979*o+a*(a*(.003971*o-.001529*a)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+o*(.015085+a*(.028874*o-.044475-.005916*a)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let o=i=(2*(1-i)-1)*Math.PI,a=25,h=0,u=o*o;do{u=o*o;const g=u*u;h=(o*(1.007226+u*(.015085+g*(.028874*u-.044475-.005916*g)))-i)/(1.007226+u*(.045255+g*(.259866*u-.311325-.005916*11*g))),o=W(o-h,-ax,ax)}while(Math.abs(h)>1e-6&&--a>0);u=o*o;const f=W(ye(e/(.8707+u*(u*(u*u*u*(.003971-.001529*u)-.013791)-.131979))),-180,180),_=ye(o);return new S(f,_)}}const lx=ii(Y);class J1 extends Za{project(e,i){i=ii(i),e=ii(e);const o=Math.cos(i),a=2/Math.PI,h=Math.acos(o*Math.cos(e/2)),u=Math.sin(h)/h,f=.5*(e*a+2*o*Math.sin(e/2)/u)||0,_=.5*(i+Math.sin(i)/u)||0;return{x:.5*(f/Math.PI+.5),y:1-.5*(_/Math.PI+1),z:0}}unproject(e,i){let o=e=(2*e-.5)*Math.PI,a=i=(2*(1-i)-1)*Math.PI,h=25;const u=1e-6;let f=0,_=0;do{const g=Math.cos(a),v=Math.sin(a),b=2*v*g,w=v*v,I=g*g,A=Math.cos(o/2),P=Math.sin(o/2),R=2*A*P,O=P*P,j=1-I*A*A,V=j?1/j:0,G=j?Math.acos(g*A)*Math.sqrt(1/j):0,ne=.5*(2*G*g*P+2*o/Math.PI)-e,ee=.5*(G*v+a)-i,ie=.5*V*(I*O+G*g*A*w)+1/Math.PI,le=V*(R*b/4-G*v*P),he=.125*V*(b*P-G*v*I*R),Ie=.5*V*(w*A+G*O*g)+.5,pe=le*he-Ie*ie;f=(ee*le-ne*Ie)/pe,_=(ne*he-ee*ie)/pe,o=W(o-f,-Math.PI,Math.PI),a=W(a-_,-lx,lx)}while((Math.abs(f)>u||Math.abs(_)>u)&&--h>0);return new S(ye(o),ye(a))}}class cx extends Za{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(ii(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,i){const{scale:o,cosPhi:a}=this;return{x:ii(e)*a*o+.5,y:-Math.sin(ii(i))/a*o+.5,z:0}}unproject(e,i){const{scale:o,cosPhi:a}=this,h=-(i-.5)/o,u=W(ye((e-.5)/o)/a,-180,180),f=Math.asin(W(h*a,-1,1)),_=W(ye(f),-Y,Y);return new S(u,_)}}class Q1 extends sx{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,i,o){const a=Nu(e,i,o);return lr(a,a,Dp(vs(o))),{x:a[0],y:a[1],z:a[2]}}locationPoint(e,i,o){const a=y(i.lat,i.lng),h=ki([],a),u=o?e._centerAltitude+o:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude;rn(a,a,h,L(1,0)*Xe*u);const f=It(new Float64Array(16));return Wi(f,e.pixelMatrix,e.globeMatrix),lr(a,a,f),new Be(a[0],a[1])}pixelsPerMeter(e,i){return L(1,0)*i}pixelSpaceConversion(e,i,o){const a=L(1,e)*i,h=mt(L(1,45)*i,a,o);return this.pixelsPerMeter(e,i)/h}createTileMatrix(e,i,o){const a=um(vs(o.canonical));return Wi(new Float64Array(16),e.globeMatrix,a)}createInversionMatrix(e,i){const{center:o}=e,a=Dp(vs(i));return So(a,a,ii(o.lng)),Go(a,a,ii(o.lat)),Zr(a,a,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(a)}pointCoordinate(e,i,o,a){return L_(e,i,o,!0)||new Q(0,0)}pointCoordinate3D(e,i,o){const a=this.pointCoordinate(e,i,o,0);return[a.x,a.y,a.z]}isPointAboveHorizon(e,i){return!L_(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(a,h){const u=a.cameraToCenterDistance,f=a._centerAltitude*h,_=a._camera,g=a._camera.forward(),v=Ui([],Vi([],g,-u),[0,0,f]),b=a.worldSize/(2*Math.PI),w=[0,0,-b],I=a.width/a.height,A=Math.tan(a.fovAboveCenter),P=Vi([],_.up(),A),R=Vi([],_.right(),A*I),O=ki([],Ui([],Ui([],g,P),R)),j=[];let V;if(new Qt(v,O).closestPointOnSphere(w,b,j)){const G=Ui([],j,w),ne=cr([],G,v);V=Math.cos(a.fovAboveCenter)*jr(ne)}else{const G=cr([],v,w),ne=cr([],w,v);ki(ne,ne);const ee=jr(G)-b;V=Math.sqrt(ee*(ee+2*b));const ie=Math.acos(V/(b+ee))-Math.acos(ar(g,ne));V*=Math.cos(ie)}return 1.01*V}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),o=ja(e.zoom);if(o>0){const a=nx(e,L(1,e.center.lat)*e.worldSize),h=e.worldSize/(2*Math.PI),u=Math.max(e.width,e.height)/e.worldSize*Math.PI;return mt(i,a+h*(1-Math.cos(u)),Math.pow(o,10))}return i}upVector(e,i,o){return Nu(i,o,e,1)}upVectorScale(e){return{metersToTile:Pp(Rp(vs(e)))}}}function hx(r){const e=r.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(r.name){case"mercator":return new sx(r);case"equirectangular":return new X1(r);case"naturalEarth":return new K1(r);case"equalEarth":return new W1(r);case"winkelTripel":return new J1(r);case"albers":return i?new cx(r):new Z1(r);case"lambertConformalConic":return i?new cx(r):new Y1(r);case"globe":return new Q1(r)}throw new Error(`Invalid projection name: ${r.name}`)}const eb=ge.types,tb=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function sf(r,e,i,o,a,h,u,f,_,g,v,b,w){const I=f?Math.min($a,Math.round(f[0])):0,A=f?Math.min($a,Math.round(f[1])):0;r.emplaceBack(e,i,Math.round(32*o),Math.round(32*a),h,u,(I<<1)+(_?1:0),A,16*g,16*v,256*b,256*w)}function af(r,e,i){r.emplaceBack(e,i)}function lf(r,e,i,o,a,h,u){r.emplaceBack(e,i,o,a,h,u)}const cf=(r,e,i,o)=>{for(let a=0;a<e;a++)r.emplaceBack(i[0],i[1],i[2],o[0],o[1],o[2])};function hf(r,e,i,o,a){r.emplaceBack(e,i,o,a),r.emplaceBack(e,i,o,a),r.emplaceBack(e,i,o,a),r.emplaceBack(e,i,o,a)}function ib(r){for(const e of r.sections)if(Yf(e.text))return!0;return!1}class r_{constructor(e){this.layoutVertexArray=new Kc,this.indexArray=new Ni,this.programConfigurations=e,this.segments=new qi,this.dynamicLayoutVertexArray=new gs,this.opacityVertexArray=new wu,this.placedSymbolArray=new jl,this.iconTransitioningVertexArray=new mo,this.globeExtVertexArray=new Ra,this.zOffsetVertexArray=new Us,this.orientationVertexArray=new Eu}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0&&this.iconTransitioningVertexArray.length===0}upload(e,i,o,a,h){this.isEmpty()||(o&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,a1.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,c1.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,tb,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,d1.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,l1.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||h)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,h1.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,u1.members,!0)),this.opacityVertexBuffer.itemSize=1),(o||a)&&this.programConfigurations.upload(e))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}nt(r_,"SymbolBuffers");class n_{constructor(e,i,o){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new o,this.segments=new qi,this.collisionVertexArray=new La,this.collisionVertexArrayExt=new gs}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,p1.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,f1.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}nt(n_,"CollisionBuffers");class uf{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.lut=e.lut,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=It([]),this.placementViewportMatrix=It([]);const i=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.textSizeData=Ny(this.zoom,i["text-size"],this.worldview),this.iconSizeData=Ny(this.zoom,i["icon-size"],this.worldview);const o=this.layers[0].layout,a=o.get("symbol-sort-key"),h=o.get("symbol-z-order");this.canOverlap=o.get("text-allow-overlap")||o.get("icon-allow-overlap")||o.get("text-ignore-placement")||o.get("icon-ignore-placement"),this.sortFeaturesByKey=h!=="viewport-y"&&a.constantOr(1)!==void 0,this.sortFeaturesByY=(h==="viewport-y"||h==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=o.get("text-writing-mode").map(u=>Gn[u]),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1}createArrays(){this.text=new r_(new kn(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new r_(new kn(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.glyphOffsetArray=new Du,this.lineVertexArray=new yp,this.symbolInstances=new gp}calculateGlyphDependencies(e,i,o,a,h){for(const u of e){const f=u.codePointAt(0);if(f===void 0)break;if(i[f]=!0,a&&h&&f<=65535){const _=nd[u];_&&(i[_.charCodeAt(0)]=!0)}}}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const o=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!Np(this.activeReplacements,o)&&(this.activeReplacements=o,!0)}populate(e,i,o,a){const h=this.layers[0],u=h.layout,f=this.projection.name==="globe",_=u.get("text-font"),g=u.get("text-field"),v=u.get("icon-image"),[b,w]=u.get("icon-size-scale-range"),I=W(i.scaleFactor||1,b,w),A=(g.value.kind!=="constant"||g.value.value instanceof nn&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(_.value.kind!=="constant"||_.value.value.length>0),P=v.value.kind!=="constant"||!!v.value.value||Object.keys(v.parameters).length>0,R=u.get("symbol-sort-key");if(this.features=[],!A&&!P)return;const O=i.iconDependencies,j=i.glyphDependencies,V=i.availableImages,G=new yi(this.zoom,{worldview:this.worldview});for(const{feature:ne,id:ee,index:ie,sourceLayerIndex:le}of e){const he=h._featureFilter.needGeometry,Ie=Te(ne,he);if(!h._featureFilter.filter(G,Ie,o))continue;if(he||(Ie.geometry=se(ne,o,a)),f&&ne.type!==1&&o.z<=5){const Oe=Ie.geometry,je=.98078528056,Se=(ke,fe)=>ar(Nu(ke.x,ke.y,o,1),Nu(fe.x,fe.y,o,1))<je;for(let ke=0;ke<Oe.length;ke++)Oe[ke]=ve(Oe[ke],Se)}let pe,Ce;if(A){const Oe=h.getValueAndResolveTokens("text-field",Ie,o,V),je=nn.factory(Oe);ib(je)&&(this.hasRTLText=!0),(!this.hasRTLText||mu()==="unavailable"||this.hasRTLText&&po.isParsed())&&(pe=_1(je,h,Ie))}if(P){const Oe=h.getValueAndResolveTokens("icon-image",Ie,o,V);Ce=typeof Oe=="string"?mn.build(Oe):Oe}if(!pe&&!Ce)continue;const Ge=this.sortFeaturesByKey?R.evaluate(Ie,{},o):void 0,Pe={id:ee,text:pe,icon:Ce,index:ie,sourceLayerIndex:le,geometry:Ie.geometry,properties:ne.properties,type:eb[ne.type],sortKey:Ge};if(this.features.push(Pe),Ce){const Oe=this.layers[0]._unevaluatedLayout._values,{iconPrimary:je,iconSecondary:Se}=ex(Ce,this.iconSizeData,Oe["icon-size"],o,this.zoom,Pe,this.pixelRatio,I,this.worldview),ke=je.id.toString();if(O.has(ke)?O.get(ke).push(je):O.set(ke,[je]),Se){this.hasAnySecondaryIcon=!0;const fe=Se.id.toString();O.has(fe)?O.get(fe).push(Se):O.set(fe,[Se])}}if(pe){const Oe=_.evaluate(Ie,{},o).join(","),je=u.get("text-rotation-alignment")==="map"&&u.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Gn.vertical)>=0;for(const Se of pe.sections)if(Se.image){const ke=Se.image.getPrimary().scaleSelf(this.pixelRatio),fe=ke.id.toString(),Ee=O.get(fe)||[];Ee.push(ke),O.set(fe,Ee)}else{const ke=uu(pe.toString()),fe=Se.fontStack||Oe,Ee=j[fe]=j[fe]||{};this.calculateGlyphDependencies(Se.text,Ee,je,this.allowVerticalPlacement,ke)}}}if(u.get("symbol-placement")==="line"&&(this.features=function(ne){const ee={},ie={},le=[];let he=0;function Ie(Pe){le.push(ne[Pe]),he++}function pe(Pe,Oe,je){const Se=ie[Pe];return delete ie[Pe],ie[Oe]=Se,le[Se].geometry[0].pop(),le[Se].geometry[0]=le[Se].geometry[0].concat(je[0]),Se}function Ce(Pe,Oe,je){const Se=ee[Oe];return delete ee[Oe],ee[Pe]=Se,le[Se].geometry[0].shift(),le[Se].geometry[0]=je[0].concat(le[Se].geometry[0]),Se}function Ge(Pe,Oe,je){const Se=je?Oe[0][Oe[0].length-1]:Oe[0][0];return`${Pe}:${Se.x}:${Se.y}`}for(let Pe=0;Pe<ne.length;Pe++){const Oe=ne[Pe],je=Oe.geometry,Se=Oe.text?Oe.text.toString():null;if(!Se){Ie(Pe);continue}const ke=Ge(Se,je),fe=Ge(Se,je,!0);if(ke in ie&&fe in ee&&ie[ke]!==ee[fe]){const Ee=Ce(ke,fe,je),$e=pe(ke,fe,le[Ee].geometry);delete ee[ke],delete ie[fe],ie[Ge(Se,le[$e].geometry,!0)]=$e,le[Ee].geometry=null}else ke in ie?pe(ke,fe,je):fe in ee?Ce(ke,fe,je):(Ie(Pe),ee[ke]=he-1,ie[fe]=he-1)}return le.filter(Pe=>Pe.geometry)}(this.features)),u.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",i.elevationFeatures){!this.elevationFeatures&&i.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const ne of i.elevationFeatures)this.elevationFeatureIdToIndex.set(ne.id,this.elevationFeatures.length),this.elevationFeatures.push(ne)}}else u.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((ne,ee)=>ne.sortKey-ee.sortKey)}update(e,i,o,a,h,u,f){this.text.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f,this.worldview),this.icon.programConfigurations.updatePaintArrays(e,i,h,o,a,u,f,this.worldview)}updateRoadElevation(e){if(this.elevationType!=="road"||!this.elevationFeatures||this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let i=!1;const o=J(e),a=1/o;let h=!1,u=!1;for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f),g=gr(1,0,0),v=gr(0,1,0),{numHorizontalGlyphVertices:b,numVerticalGlyphVertices:w,numIconVertices:I,numVerticalIconVertices:A}=_,P=b>0||w>0,R=I>0,O=this.elevationFeatures[_.elevationFeatureIndex];if(O){const j=new Be(_.tileAnchorX,_.tileAnchorY),V=.075+O.pointElevation(j);_.zOffset!==V&&(i=!0,_.zOffset=V);const G=O.computeSlopeNormal(j,a),ne=ta(Ao(),gr(0,0,1),G);Wo(g,g,ne),Wo(v,v,ne),g[2]*=o,v[2]*=o,g[0]===1&&g[1]===0&&g[2]===0&&v[0]===0&&v[1]===1&&v[2]===0||(h=h||P,u=u||R)}if(P&&(cf(this.text.orientationVertexArray,b,g,v),cf(this.text.orientationVertexArray,w,g,v)),R){const{placedIconSymbolIndex:j,verticalPlacedIconSymbolIndex:V}=_;j>=0&&cf(this.icon.orientationVertexArray,I,g,v),V>=0&&cf(this.icon.orientationVertexArray,A,g,v)}}h||(this.text.orientationVertexArray=void 0),u||(this.icon.orientationVertexArray=void 0),i&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(h,u,f)=>{o+=u,o>h.length&&h.resize(o);for(let _=-u;_<0;_++)h.emplace(_+o,f)},i=(h,u,f)=>{a+=u,a>h.length&&h.resize(a);for(let _=-u;_<0;_++)h.emplace(_+a,f)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let o=0,a=0;for(let h=0;h<this.symbolInstances.length;h++){const u=this.symbolInstances.get(h),{numHorizontalGlyphVertices:f,numVerticalGlyphVertices:_,numIconVertices:g}=u,v=u.zOffset,b=g>0;if((f>0||_>0)&&(e(this.text.zOffsetVertexArray,f,v),e(this.text.zOffsetVertexArray,_,v)),b){const{placedIconSymbolIndex:w,verticalPlacedIconSymbolIndex:I}=u;w>=0&&i(this.icon.zOffsetVertexArray,g,v),I>=0&&i(this.icon.zOffsetVertexArray,u.numVerticalIconVertices,v)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=hx(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,i){const o=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:a,y:h}of i)this.lineVertexArray.emplaceBack(a,h);return{lineStartIndex:o,lineLength:this.lineVertexArray.length-o}}addSymbols(e,i,o,a,h,u,f,_,g,v,b,w,I,A,P,R){const O=e.indexArray,j=e.layoutVertexArray,V=e.globeExtVertexArray,G=e.segments.prepareSegment(4*i.length,j,O,this.canOverlap?u.sortKey:void 0),ne=this.glyphOffsetArray.length,ee=G.vertexLength,ie=this.allowVerticalPlacement&&f===Gn.vertical?Math.PI/2:0,le=u.text&&u.text.sections;for(let Ie=0;Ie<i.length;Ie++){const{tl:pe,tr:Ce,bl:Ge,br:Pe,texPrimary:Oe,texSecondary:je,pixelOffsetTL:Se,pixelOffsetBR:ke,minFontScaleX:fe,minFontScaleY:Ee,glyphOffset:$e,isSDF:Ne,sectionIndex:ht}=i[Ie],ot=G.vertexLength,Le=$e[1];if(sf(j,g.x,g.y,pe.x,Le+pe.y,Oe.x,Oe.y,o,Ne,Se.x,Se.y,fe,Ee),sf(j,g.x,g.y,Ce.x,Le+Ce.y,Oe.x+Oe.w,Oe.y,o,Ne,ke.x,Se.y,fe,Ee),sf(j,g.x,g.y,Ge.x,Le+Ge.y,Oe.x,Oe.y+Oe.h,o,Ne,Se.x,ke.y,fe,Ee),sf(j,g.x,g.y,Pe.x,Le+Pe.y,Oe.x+Oe.w,Oe.y+Oe.h,o,Ne,ke.x,ke.y,fe,Ee),_){const{x:Ve,y:at,z:tt}=_.anchor,[Ye,it,gt]=_.up;lf(V,Ve,at,tt,Ye,it,gt),lf(V,Ve,at,tt,Ye,it,gt),lf(V,Ve,at,tt,Ye,it,gt),lf(V,Ve,at,tt,Ye,it,gt),hf(e.dynamicLayoutVertexArray,Ve,at,tt,ie)}else hf(e.dynamicLayoutVertexArray,g.x,g.y,g.z,ie);if(R){const Ve=je||Oe;af(e.iconTransitioningVertexArray,Ve.x,Ve.y),af(e.iconTransitioningVertexArray,Ve.x+Ve.w,Ve.y),af(e.iconTransitioningVertexArray,Ve.x,Ve.y+Ve.h),af(e.iconTransitioningVertexArray,Ve.x+Ve.w,Ve.y+Ve.h)}O.emplaceBack(ot,ot+1,ot+2),O.emplaceBack(ot+1,ot+2,ot+3),G.vertexLength+=4,G.primitiveLength+=2,this.glyphOffsetArray.emplaceBack($e[0]),Ie!==i.length-1&&ht===i[Ie+1].sectionIndex||e.programConfigurations.populatePaintArrays(j.length,u,u.index,{},I,A,P,le&&le[ht],this.worldview)}const he=_?_.anchor:g;e.placedSymbolArray.emplaceBack(he.x,he.y,he.z,g.x,g.y,ne,this.glyphOffsetArray.length-ne,ee,v,b,g.segment,o?o[0]:0,o?o[1]:0,a[0],a[1],f,0,0,0,w,0)}_commitLayoutVertex(e,i,o,a,h,u,f){e.emplaceBack(i,o,a,h,u,Math.round(f.x),Math.round(f.y))}_addCollisionDebugVertices(e,i,o,a,h,u,f){const _=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),g=_.vertexLength,v=f.tileAnchorX,b=f.tileAnchorY;for(let I=0;I<4;I++)o.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(o.collisionVertexArrayExt,i,e.padding,f.zOffset),this._commitLayoutVertex(o.layoutVertexArray,a,h,u,v,b,new Be(e.x1,e.y1)),this._commitLayoutVertex(o.layoutVertexArray,a,h,u,v,b,new Be(e.x2,e.y1)),this._commitLayoutVertex(o.layoutVertexArray,a,h,u,v,b,new Be(e.x2,e.y2)),this._commitLayoutVertex(o.layoutVertexArray,a,h,u,v,b,new Be(e.x1,e.y2)),_.vertexLength+=4;const w=o.indexArray;w.emplaceBack(g,g+1),w.emplaceBack(g+1,g+2),w.emplaceBack(g+2,g+3),w.emplaceBack(g+3,g),_.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,o,a,h,u){for(let f=a;f<h;f++){const _=o.get(f),g=this.getSymbolInstanceTextSize(e,u,i,f);this._addCollisionDebugVertices(_,g,this.textCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,u)}}_addIconDebugCollisionBoxes(e,i,o,a,h,u){for(let f=a;f<h;f++){const _=o.get(f),g=this.getSymbolInstanceIconSize(e,i,u.placedIconSymbolIndex);this._addCollisionDebugVertices(_,g,this.iconCollisionBox,_.projectedAnchorX,_.projectedAnchorY,_.projectedAnchorZ,u)}}generateCollisionDebugBuffers(e,i,o){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new n_(Jc,Sy.members,mo),this.iconCollisionBox=new n_(Jc,Sy.members,mo);const a=sd(this.iconSizeData,e),h=sd(this.textSizeData,e,o);for(let u=0;u<this.symbolInstances.length;u++){const f=this.symbolInstances.get(u);this._addTextDebugCollisionBoxes(h,e,i,f.textBoxStartIndex,f.textBoxEndIndex,f),this._addTextDebugCollisionBoxes(h,e,i,f.verticalTextBoxStartIndex,f.verticalTextBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.iconBoxStartIndex,f.iconBoxEndIndex,f),this._addIconDebugCollisionBoxes(a,e,i,f.verticalIconBoxStartIndex,f.verticalIconBoxEndIndex,f)}}getSymbolInstanceTextSize(e,i,o,a){const h=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:a),u=Ym(this.textSizeData,e,h)/kr;return this.tilePixelRatio*u}getSymbolInstanceIconSize(e,i,o){const a=this.icon.placedSymbolArray.get(o),h=Ym(this.iconSizeData,e,a);return this.tilePixelRatio*h}_commitDebugCollisionVertexUpdate(e,i,o,a){e.emplaceBack(i,-o,-o,a),e.emplaceBack(i,o,-o,a),e.emplaceBack(i,o,o,a),e.emplaceBack(i,-o,o,a)}_updateTextDebugCollisionBoxes(e,i,o,a,h,u,f){for(let _=a;_<h;_++){const g=o.get(_),v=this.getSymbolInstanceTextSize(e,u,i,_);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,v,g.padding,u.zOffset)}}_updateIconDebugCollisionBoxes(e,i,o,a,h,u,f){for(let _=a;_<h;_++){const g=o.get(_),v=this.getSymbolInstanceIconSize(e,i,u.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,v,g.padding,u.zOffset)}}updateCollisionDebugBuffers(e,i,o,a){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const h=sd(this.iconSizeData,e,a),u=sd(this.textSizeData,e,o);for(let f=0;f<this.symbolInstances.length;f++){const _=this.symbolInstances.get(f);this._updateTextDebugCollisionBoxes(u,e,i,_.textBoxStartIndex,_.textBoxEndIndex,_,o),this._updateTextDebugCollisionBoxes(u,e,i,_.verticalTextBoxStartIndex,_.verticalTextBoxEndIndex,_,o),this._updateIconDebugCollisionBoxes(h,e,i,_.iconBoxStartIndex,_.iconBoxEndIndex,_,a),this._updateIconDebugCollisionBoxes(h,e,i,_.verticalIconBoxStartIndex,_.verticalIconBoxEndIndex,_,a)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,i,o,a,h,u,f,_,g){const v={};if(i<o){const{x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:j,tileAnchorX:V,tileAnchorY:G,featureIndex:ne}=e.get(i);v.textBox={x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:j,tileAnchorX:V,tileAnchorY:G},v.textFeatureIndex=ne}if(a<h){const{x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:j,tileAnchorX:V,tileAnchorY:G,featureIndex:ne}=e.get(a);v.verticalTextBox={x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:j,tileAnchorX:V,tileAnchorY:G},v.verticalTextFeatureIndex=ne}if(u<f){const{x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:j,tileAnchorX:V,tileAnchorY:G,featureIndex:ne}=e.get(u);v.iconBox={x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:j,tileAnchorX:V,tileAnchorY:G},v.iconFeatureIndex=ne}if(_<g){const{x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:j,tileAnchorX:V,tileAnchorY:G,featureIndex:ne}=e.get(_);v.verticalIconBox={x1:b,y1:w,x2:I,y2:A,padding:P,projectedAnchorX:R,projectedAnchorY:O,projectedAnchorZ:j,tileAnchorX:V,tileAnchorY:G},v.verticalIconFeatureIndex=ne}return v}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const o=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,o.textBoxStartIndex,o.textBoxEndIndex,o.verticalTextBoxStartIndex,o.verticalTextBoxEndIndex,o.iconBoxStartIndex,o.iconBoxEndIndex,o.verticalIconBoxStartIndex,o.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,i){const o=e.placedSymbolArray.get(i),a=o.vertexStartIndex+4*o.numGlyphs;for(let h=o.vertexStartIndex;h<a;h+=4)e.indexArray.emplaceBack(h,h+1,h+2),e.indexArray.emplaceBack(h+1,h+2,h+3)}
vendor: 21,567 bytes, line 19
19getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),o=Math.cos(e),a=[],h=[],u=[];for(let f=0;f<this.symbolInstances.length;++f){u.push(f);const _=this.symbolInstances.get(f);a.push(0|Math.round(i*_.tileAnchorX+o*_.tileAnchorY)),h.push(_.featureIndex)}return u.sort((f,_)=>a[f]-a[_]||h[_]-h[f]),u}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,i)=>this.symbolInstances.get(i).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,i){const o=this.sortKeyRanges[this.sortKeyRanges.length-1];o&&o.sortKey===i?o.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:i,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const i of this.symbolInstanceIndexes){const o=this.symbolInstances.get(i);this.featureSortOrder.push(o.featureIndex);const{rightJustifiedTextSymbolIndex:a,centerJustifiedTextSymbolIndex:h,leftJustifiedTextSymbolIndex:u,verticalPlacedTextSymbolIndex:f,placedIconSymbolIndex:_,verticalPlacedIconSymbolIndex:g}=o;a>=0&&this.addIndicesForPlacedSymbol(this.text,a),h>=0&&h!==a&&this.addIndicesForPlacedSymbol(this.text,h),u>=0&&u!==h&&u!==a&&this.addIndicesForPlacedSymbol(this.text,u),f>=0&&this.addIndicesForPlacedSymbol(this.text,f),_>=0&&this.addIndicesForPlacedSymbol(this.icon,_),g>=0&&this.addIndicesForPlacedSymbol(this.icon,g)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let ux,dx,o_;nt(uf,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),uf.addDynamicAttributes=hf;class px{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:ha,this.defaultValue=e}evaluate(e){if(e.formattedSection){const i=this.defaultValue.property.overrides;if(i&&i.hasOverride(e.formattedSection))return i.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}nt(px,"FormatSectionOverride",{omit:["defaultValue"]});const s_=()=>o_||(o_={layout:ux||(ux=new tr({"symbol-placement":new qe(de.layout_symbol["symbol-placement"]),"symbol-spacing":new qe(de.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new qe(de.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Qe(de.layout_symbol["symbol-sort-key"]),"symbol-z-order":new qe(de.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new qe(de.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new qe(de.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new qe(de.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new qe(de.layout_symbol["icon-ignore-placement"]),"icon-optional":new qe(de.layout_symbol["icon-optional"]),"icon-rotation-alignment":new qe(de.layout_symbol["icon-rotation-alignment"]),"icon-size":new Qe(de.layout_symbol["icon-size"]),"icon-size-scale-range":new qe(de.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Qe(de.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Qe(de.layout_symbol["icon-text-fit-padding"]),"icon-image":new Qe(de.layout_symbol["icon-image"]),"icon-rotate":new Qe(de.layout_symbol["icon-rotate"]),"icon-padding":new qe(de.layout_symbol["icon-padding"]),"icon-keep-upright":new qe(de.layout_symbol["icon-keep-upright"]),"icon-offset":new Qe(de.layout_symbol["icon-offset"]),"icon-anchor":new Qe(de.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new qe(de.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new qe(de.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new qe(de.layout_symbol["text-rotation-alignment"]),"text-field":new Qe(de.layout_symbol["text-field"]),"text-font":new Qe(de.layout_symbol["text-font"]),"text-size":new Qe(de.layout_symbol["text-size"]),"text-size-scale-range":new qe(de.layout_symbol["text-size-scale-range"]),"text-max-width":new Qe(de.layout_symbol["text-max-width"]),"text-line-height":new Qe(de.layout_symbol["text-line-height"]),"text-letter-spacing":new Qe(de.layout_symbol["text-letter-spacing"]),"text-justify":new Qe(de.layout_symbol["text-justify"]),"text-radial-offset":new Qe(de.layout_symbol["text-radial-offset"]),"text-variable-anchor":new qe(de.layout_symbol["text-variable-anchor"]),"text-anchor":new Qe(de.layout_symbol["text-anchor"]),"text-max-angle":new qe(de.layout_symbol["text-max-angle"]),"text-writing-mode":new qe(de.layout_symbol["text-writing-mode"]),"text-rotate":new Qe(de.layout_symbol["text-rotate"]),"text-padding":new qe(de.layout_symbol["text-padding"]),"text-keep-upright":new qe(de.layout_symbol["text-keep-upright"]),"text-transform":new Qe(de.layout_symbol["text-transform"]),"text-offset":new Qe(de.layout_symbol["text-offset"]),"text-allow-overlap":new qe(de.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new qe(de.layout_symbol["text-ignore-placement"]),"text-optional":new qe(de.layout_symbol["text-optional"]),visibility:new qe(de.layout_symbol.visibility)})),paint:dx||(dx=new tr({"icon-opacity":new Qe(de.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Qe(de.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Qe(de.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Qe(de.paint_symbol["text-emissive-strength"]),"icon-color":new Qe(de.paint_symbol["icon-color"]),"icon-halo-color":new Qe(de.paint_symbol["icon-halo-color"]),"icon-halo-width":new Qe(de.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Qe(de.paint_symbol["icon-halo-blur"]),"icon-translate":new qe(de.paint_symbol["icon-translate"]),"icon-translate-anchor":new qe(de.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new qe(de.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Qe(de.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Qe(de.paint_symbol["text-occlusion-opacity"]),"text-color":new Qe(de.paint_symbol["text-color"],{runtimeType:wn,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new Qe(de.paint_symbol["text-halo-color"]),"text-halo-width":new Qe(de.paint_symbol["text-halo-width"]),"text-halo-blur":new Qe(de.paint_symbol["text-halo-blur"]),"text-translate":new qe(de.paint_symbol["text-translate"]),"text-translate-anchor":new qe(de.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new qe(de.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new qe(de.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new qe(de.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new qe(de.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Qe(de.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"})}))},o_);class df extends Jr{constructor(e,i,o,a){super(e,s_(),i,o,a),this._colorAdjustmentMatrix=It([]),this.hasInitialOcclusionOpacityProperties=e.paint!==void 0&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}recalculate(e,i){super.recalculate(e,i),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const o=this.layout.get("text-writing-mode");if(o){const a=[];for(const h of o)a.indexOf(h)<0&&a.push(h);this.layout._values["text-writing-mode"]=a}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,o,a){return this._saturation===e&&this._contrast===i&&this._brightnessMin===o&&this._brightnessMax===a||(this._colorAdjustmentMatrix=function(h,u,f,_){h=Xr(h),u=pn(u);const g=To(),v=h/3,b=1-2*v,w=[b,v,v,0,v,b,v,0,v,v,b,0,0,0,0,1],I=.5-.5*u,A=_-f;return Wi(g,[A,0,0,0,0,A,0,0,0,0,A,0,f,f,f,1],[u,0,0,0,0,u,0,0,0,0,u,0,I,I,I,1]),Wi(g,g,w),g}(e,i,o,a),this._saturation=e,this._contrast=i,this._brightnessMin=o,this._brightnessMax=a),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,o,a){const h=this.layout.get(e).evaluate(i,{},o,a),u=this._unevaluatedLayout._values[e];return u.isDataDriven()||au(u.value)||!h?h:function(f,_){return _.replace(/{([^{}]+)}/g,(g,v)=>v in f?String(f[v]):"")}(i.properties,h)}createBucket(e){return new uf(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of s_().paint.overridableProperties){if(!df.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),o=new px(i),a=new su(o,i.property.specification,this.scope,this.options);let h=null;h=i.value.kind==="constant"||i.value.kind==="source"?new Nc("source",a):new ds("composite",a,i.value.zoomStops,i.value.interpolationType),this.paint._values[e]=new js(i.property,h,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,o){return!(!this.layout||i.isDataDriven()||o.isDataDriven())&&df.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const o=e.get("text-field"),a=s_().paint.properties[i];let h=!1;const u=f=>{for(const _ of f)if(a.overrides&&a.overrides.hasOverride(_))return void(h=!0)};if(o.value.kind==="constant"&&o.value.value instanceof nn)u(o.value.value.sections);else if(o.value.kind==="source"){const f=g=>{h||(g instanceof vt&&rt(g.value)===yl?u(g.value.sections):g instanceof da?u(g.sections):g.eachChild(f))},_=o.value;_._styleExpression&&f(_._styleExpression.expression)}return h}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,i,o){return{config:new an(this,{zoom:i,lut:o}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let fx,mx,_x,gx;var a_=Wt([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function pf(r,e,i,o,a,h,u,f){const _=[r,e,1,i,o,1,a,h,1],g=[u,f,1],v=to([],_),[b,w,I]=Zo(g,g,v);return qn(_,_,[b,0,0,0,w,0,0,0,I])}function yx(r,e,i,o,a,h,u,f){const _=function(g,v,b,w,I,A,P,R){const O=pf(0,0,1,0,1,1,0,1),j=pf(g,v,b,w,I,A,P,R);return qn(j,j,to([],O))}(r,e,i,o,a,h,u,f);return[_[2]/_[8]/Xe,_[5]/_[8]/Xe]}function ff(r){return[r[0],Math.min(Math.max(r[1],-Y),Y)]}class xx extends Ps{constructor(e,i,o,a){super(),this.id=e,this.dispatcher=o,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(a),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new Lo("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=fl(this.map._requestManager.transformRequest(this.url,ul.Image),(o,a)=>{this._imageRequest=null,this._loaded=!0,o?this.fire(new Rn(o)):a&&(this.image=a instanceof HTMLImageElement?ro.getImageData(a):a,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new td(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Lo("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof td||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let i=e[0][1],o=e[0][1];for(const h of e)h[1]>o&&(o=h[1]),h[1]<i&&(i=h[1]);const a=(o+i)/2;if(a>Y?this.onNorthPole=!0:a<-Y&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const h=e.map(Q.fromLngLat);this.tileID=function(u){let f=1/0,_=1/0,g=-1/0,v=-1/0;for(const P of u)f=Math.min(f,P.x),_=Math.min(_,P.y),g=Math.max(g,P.x),v=Math.max(v,P.y);const b=Math.max(g-f,v-_),w=Math.max(0,Math.floor(-Math.log(b)/Math.LN2)),I=Math.pow(2,w);let A=Math.floor((f+g)/2*I);return A>1&&(A-=1),new Vn(w,A,Math.floor((_+v)/2*I))}(h),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Lo("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof td||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const O in this.tiles){const j=this.tiles[O];j.state!=="loaded"&&(j.state="loaded",j.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=hd(new Vn(0,0,0),this.map.transform.projection),o=[i.projection.project(this.coordinates[0][0],this.coordinates[0][1]),i.projection.project(this.coordinates[1][0],this.coordinates[1][1]),i.projection.project(this.coordinates[2][0],this.coordinates[2][1]),i.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(O){const j=O[1].x-O[0].x,V=O[1].y-O[0].y,G=O[2].x-O[1].x,ne=O[2].y-O[1].y,ee=O[3].x-O[2].x,ie=O[3].y-O[2].y,le=O[0].x-O[3].x,he=O[0].y-O[3].y,Ie=j*ne-G*V,pe=G*ie-ee*ne,Ce=ee*he-le*ie,Ge=le*V-j*he;return Ie>0&&pe>0&&Ce>0&&Ge>0||Ie<0&&pe<0&&Ce<0&&Ge<0}(o))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const a=hd(this.tileID,this.map.transform.projection),[h,u,f,_]=this.coordinates.map(O=>{const j=a.projection.project(O[0],O[1]);return ox(a,j)._round()});this.perspectiveTransform=yx(h.x,h.y,u.x,u.y,f.x,f.y,_.x,_.y);const g=this._boundsArray=new Pa;g.emplaceBack(h.x,h.y,0,0),g.emplaceBack(u.x,u.y,Xe,0),g.emplaceBack(_.x,_.y,0,Xe),g.emplaceBack(f.x,f.y,Xe,Xe),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(g,a_.members),this.boundsSegments=qi.simpleSegment(0,0,4,2);const v=[],b=[ff((w=this.coordinates)[0]),ff(w[1]),ff(w[2]),ff(w[3])];var w;const[I,A,P,R]=function(O){let j=O[0][0],V=j,G=O[0][1],ne=G;for(let ee=1;ee<O.length;ee++)O[ee][0]<j?j=O[ee][0]:O[ee][0]>V&&(V=O[ee][0]),O[ee][1]<G?G=O[ee][1]:O[ee][1]>ne&&(ne=O[ee][1]);return[j,G,V-j,ne-G]}(b);{const O=new Pa,[j,V,G,ne]=function(Se){let ke=Se[0].x,fe=ke,Ee=Se[0].y,$e=Ee;for(let Ne=1;Ne<Se.length;Ne++)Se[Ne].x<ke?ke=Se[Ne].x:Se[Ne].x>fe&&(fe=Se[Ne].x),Se[Ne].y<Ee?Ee=Se[Ne].y:Se[Ne].y>$e&&($e=Se[Ne].y);return[ke,Ee,fe-ke,$e-Ee]}(o),ee=Se=>[(Se.x-j)/G,(Se.y-V)/ne],[ie,le,he,Ie]=o.map(ee),pe=function(Se,ke,fe,Ee,$e,Ne,ht,ot){const Le=pf(0,0,1,0,1,1,0,1);return qn(Le,Le,to([],pf(Se,ke,fe,Ee,$e,Ne,ht,ot)))}(ie[0],ie[1],le[0],le[1],he[0],he[1],Ie[0],Ie[1]);this.elevatedGlobePerspectiveTransform=yx(ie[0],ie[1],le[0],le[1],he[0],he[1],Ie[0],Ie[1]);const Ce=(Se,ke)=>{v.push(Se.lng);const fe=Math.round((Se.lng-I)/P*Xe),Ee=Math.round((Se.lat-A)/R*Xe),$e=ee(ke),Ne=Zo([],[$e[0],$e[1],1],pe),ht=Math.round(Ne[0]/Ne[2]*Xe),ot=Math.round(Ne[1]/Ne[2]*Xe);O.emplaceBack(fe,Ee,ht,ot)},Ge=o[3].x-o[0].x,Pe=o[3].y-o[0].y,Oe=o[2].x-o[1].x,je=o[2].y-o[1].y;for(let Se=0;Se<65;Se++){const ke=Se/64,fe=[o[0].x+ke*Ge,o[0].y+ke*Pe],Ee=[o[1].x+ke*Oe,o[1].y+ke*je],$e=Ee[0]-fe[0],Ne=Ee[1]-fe[1];for(let ht=0;ht<65;ht++){const ot=ht/64,Le={x:fe[0]+$e*ot,y:fe[1]+Ne*ot};Ce(i.projection.unproject(Le.x,Le.y),Le)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(O,a_.members)}{this.maxLongitudeTriangleSize=0;let O=[],j=new Ni;const V=(G,ne,ee)=>{j.emplaceBack(G,ne,ee);const ie=v[G],le=v[ne],he=v[ee],Ie=Math.min(Math.min(ie,le),he),pe=Math.max(Math.max(ie,le),he)-Ie;pe>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=pe),O.push(Ie+pe/2)};for(let G=0;G<64;G++)for(let ne=0;ne<64;ne++){const ee=65*G+ne,ie=ee+1,le=ee+65,he=le+1;V(ee,le,ie),V(ie,le,he)}[O,j]=function(G,ne){const ee=Array.from({length:G.length},(he,Ie)=>Ie);ee.sort((he,Ie)=>G[he]-G[Ie]);const ie=[],le=new Ni;for(let he=0;he<ee.length;he++){const Ie=ee[he];ie.push(G[Ie]);const pe=3*Ie,Ce=pe+1;le.emplaceBack(ne.uint16[pe],ne.uint16[Ce],ne.uint16[Ce+1])}return[ie,le]}(O,j),this.elevatedGlobeTrianglesCenterLongitudes=O,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(j)}this.elevatedGlobeSegments=qi.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,P/Xe,0,R/Xe,0,0,A,I,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,o=i.gl;!this._dirty||this.texture instanceof td||(this.texture?this.texture.update(this.image):(this.texture=new Om(i,this.image,o.RGBA8),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(i)}loadTile(e,i){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},i(null)):(e.state="errored",i(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const i=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!i)return null;const o=this.elevatedGlobeTrianglesCenterLongitudes;let a=(h=e+180)+360*Math.round((o[0]-h)/360);var h;const u=new qi,f=(b,w)=>{u.segments.push({vertexOffset:0,primitiveOffset:b,vertexLength:i.segments[0].vertexLength,primitiveLength:w,sortKey:void 0,vaos:{}})},_=.51*this.maxLongitudeTriangleSize;if(Math.abs(o[0]-a)<=_){const b=Dr(o,0,o.length,a+_);return b===o.length||f(b,Gi(o,b+1,o.length,a+360-_)-b),u}a<o[0]&&(a+=360);const g=Gi(o,0,o.length,a-_);if(g===o.length)return f(0,o.length),u;f(0,g-0);const v=Dr(o,g+1,o.length,a+_);return v!==o.length&&f(v,o.length-v),u}}const rb=(Math.pow(256,2)-1)/16907520;class vx extends Jr{constructor(e,i,o,a){super(e,{layout:_x||(_x=new tr({visibility:new qe(de.layout_raster.visibility)})),paint:gx||(gx=new tr({"raster-opacity":new qe(de.paint_raster["raster-opacity"]),"raster-color":new Ea(de.paint_raster["raster-color"]),"raster-color-mix":new qe(de.paint_raster["raster-color-mix"]),"raster-color-range":new qe(de.paint_raster["raster-color-range"]),"raster-hue-rotate":new qe(de.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new qe(de.paint_raster["raster-brightness-min"]),"raster-brightness-max":new qe(de.paint_raster["raster-brightness-max"]),"raster-saturation":new qe(de.paint_raster["raster-saturation"]),"raster-contrast":new qe(de.paint_raster["raster-contrast"]),"raster-resampling":new qe(de.paint_raster["raster-resampling"]),"raster-fade-duration":new qe(de.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new qe(de.paint_raster["raster-emissive-strength"]),"raster-array-band":new qe(de.paint_raster["raster-array-band"]),"raster-elevation":new qe(de.paint_raster["raster-elevation"]),"raster-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"})}))},i,o,a),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof xx&&(e._source.onNorthPole||e._source.onSouthPole))&&this.paint.get("raster-elevation")===0}_handleSpecialPaintPropertyUpdate(e){e!=="raster-color"&&e!=="raster-color-range"||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}
vendor: 12,493 bytes, line 19
19updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[o,a]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(o)&&isNaN(a)||o===this._curRampRange[0]&&a===this._curRampRange[1]||(this.colorRamp=Vu({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:o,end:a}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[o,a])}}let bx,wx,Tx,Sx,Ex;class Ix extends Jr{constructor(e,i,o,a){super(e,{layout:bx||(bx=new tr({visibility:new qe(de["layout_raster-particle"].visibility)})),paint:wx||(wx=new tr({"raster-particle-array-band":new qe(de["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new qe(de["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new Ea(de["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new qe(de["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new qe(de["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new qe(de["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new qe(de["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new qe(de["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"})}))},i,o,a),this._updateColorRamp(),this.lastInvalidatedAt=ro.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return this.visibility!=="none"}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){e!=="raster-particle-color"&&e!=="raster-particle-max-speed"||(this._updateColorRamp(),this._invalidateAnimationState()),e==="raster-particle-count"&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,i=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Vu({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=ro.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}}class nb extends Jr{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}isDraped(e){return this.implementation.renderToTile!==void 0}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function l_(r,e,i){const o=[0,0,1],a=Co([]);return ea(a,a,i?-ii(r)+Math.PI:ii(r)),Ss(a,a,-ii(e)),Wo(o,o,a),ki(o,o)}const Ax={None:0,Model:1,Symbol:2,FillExtrusion:4};class mf{constructor(e,i,o,a){this.message=(e?`${e}: `:"")+o,a&&(this.identifier=a),i!=null&&i.__line__&&(this.line=i.__line__)}}function c_(r,e){const i=r.indexOf("://")===-1;try{return new URL(r,i&&e?"http://example.com":void 0),!0}catch{return!1}}class Cx{constructor(e,i){this.feature=e,this.instancedDataOffset=i,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class Mx{constructor(){this.instancedDataArray=new Qc,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class h_{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.layers=e.layers,this.layerIds=this.layers.map(i=>i.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=e.styleDefinedModelURLs}updateFootprints(e,i){}populate(e,i,o,a){this.tileToMeter=J(o);const h=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:u,id:f,index:_,sourceLayerIndex:g}of e){const v=f??(u.properties&&u.properties.hasOwnProperty("id")?u.properties.id:void 0),b=Te(u,h);if(!this.layers[0]._featureFilter.filter(new yi(this.zoom,{worldview:this.worldview}),b,o))continue;const w={id:v,sourceLayerIndex:g,index:_,geometry:h?b.geometry:se(u,o,a),properties:u.properties,type:u.type,patterns:{}},I=this.addFeature(w,w.geometry,b);I&&i.featureIndex.insert(u,w.geometry,_,g,this.index,this.instancesPerModel[I].instancedDataArray.length,Xe/32)}this.lookup=null}update(e,i,o,a){for(const h in this.instancesPerModel){const u=this.instancesPerModel[h];for(const f in e)u.idToFeaturesIndex.hasOwnProperty(f)&&(this.evaluate(u.features[u.idToFeaturesIndex[f]],e[f],u,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const o=this.instancesPerModel[i];for(const a of o.features){const h=this.layers[0],u=a.feature,f=this.canonical,_=h.paint.get("model-rotation").evaluate(u,{},f),g=h.paint.get("model-scale").evaluate(u,{},f),v=h.paint.get("model-translation").evaluate(u,{},f);$n(a.rotation,_)&&$n(a.scale,g)&&$n(a.translation,v)||(this.evaluate(a,a.featureStates,o,!0),e=!0)}}return e}updateReplacement(e,i,o,a){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const h=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(Np(this.activeReplacements,h))return!1;this.activeReplacements=h;let u=!1;for(const f in this.instancesPerModel){const _=this.instancesPerModel[f],g=_.instancedDataArray;for(const v of _.features){const b=v.instancedDataOffset,w=v.instancedDataCount;for(let I=0;I<w;I++){const A=16*(I+b);let P=g.float32[A+0];const R=P>Xe;P=R?P-Xe:P;const O=Math.floor(P),j=g.float32[A+1];let V=!1;for(const G of this.activeReplacements)if(!_g(G,o,Ax.Model,a)&&!(G.min.x>O||O>G.max.x||G.min.y>j||j>G.max.y)&&(V=Sm(vg(O,j,e.canonical,G.footprintTileId.canonical),G.footprint),V))break;g.float32[A]=V?P+Xe:P,u=u||V!==R}}}return u}isEmpty(){for(const e in this.instancesPerModel)if(this.instancesPerModel[e].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const i in this.instancesPerModel){const o=this.instancesPerModel[i];o.instancedDataArray.length<0||o.instancedDataArray.length===0||(o.instancedDataBuffer?o.instancedDataBuffer.updateData(o.instancedDataArray):o.instancedDataBuffer=e.createVertexBuffer(o.instancedDataArray,kv.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const i in this.instancesPerModel){const o=this.instancesPerModel[i];o.instancedDataArray.length!==0&&o.instancedDataBuffer&&o.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris&&this.modelsRequested)for(const i of this.modelUris)e.removeModel(i,"",!0)}addFeature(e,i,o){const a=this.layers[0],h=a.layout.get("model-id").evaluate(o,{},this.canonical);if(!h)return Ht(`modelId is not evaluated for layer ${a.id} and it is not going to get rendered.`),h;(c_(h,!1)||this.styleDefinedModelURLs[h]!==void 0)&&(this.modelUris.includes(h)||this.modelUris.push(h)),this.instancesPerModel[h]||(this.instancesPerModel[h]=new Mx);const u=this.instancesPerModel[h],f=u.instancedDataArray,_=new Cx(o,f.length);for(const g of i)for(const v of g){if(v.x<0||v.x>=Xe||v.y<0||v.y>=Xe)continue;const b=(this.lookupDim-1)/Xe,w=this.lookupDim*(v.y*b|0)+v.x*b|0;if(this.lookup){if(this.lookup[w]!==0)continue;this.lookup[w]=1}this.instanceCount++;const I=f.length;f.resize(I+1),u.instancesEvaluatedElevation.push(0),f.float32[16*I]=v.x,f.float32[16*I+1]=v.y}return _.instancedDataCount=u.instancedDataArray.length-_.instancedDataOffset,_.instancedDataCount>0&&(e.id&&(u.idToFeaturesIndex[e.id]=u.features.length),u.features.push(_),this.evaluate(_,{},u,!1)),h}getModelUris(){return this.modelUris}evaluate(e,i,o,a){const h=this.layers[0],u=e.feature,f=this.canonical,_=e.rotation=h.paint.get("model-rotation").evaluate(u,i,f),g=e.scale=h.paint.get("model-scale").evaluate(u,i,f),v=e.translation=h.paint.get("model-translation").evaluate(u,i,f),b=h.paint.get("model-color").evaluate(u,i,f);b.a=h.paint.get("model-color-mix-intensity").evaluate(u,i,f);const w=[];this.maxVerticalOffset<v[2]&&(this.maxVerticalOffset=v[2]),this.maxScale=Math.max(Math.max(this.maxScale,g[0]),Math.max(g[1],g[2])),ty(w,_,g);const I=Math.round(100*b.a)+b.b/1.05;for(let A=0;A<e.instancedDataCount;++A){const P=e.instancedDataOffset+A,R=16*P,O=o.instancedDataArray.float32;let j=0;a&&(j=O[R+6]-o.instancesEvaluatedElevation[P]);const V=0|O[R+1];O[R]=(0|O[R])+b.r/1.05,O[R+1]=V+b.g/1.05,O[R+2]=I,O[R+3]=1/(f.z>10?this.tileToMeter:J(f,V)),O[R+4]=v[0],O[R+5]=v[1],O[R+6]=v[2]+j,O[R+7]=w[0],O[R+8]=w[1],O[R+9]=w[2],O[R+10]=w[4],O[R+11]=w[5],O[R+12]=w[6],O[R+13]=w[8],O[R+14]=w[9],O[R+15]=w[10],o.instancesEvaluatedElevation[P]=v[2]}}}let Px,zx;nt(h_,"ModelBucket",{omit:["layers"]}),nt(Mx,"PerModelAttributes"),nt(Cx,"ModelFeature");class gh{constructor(e,i,o){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=o}static create(e,i,o){const a=o||e.findDEMTileFor(i);if(!a||!a.dem)return;const h=a.dem,u=a.tileID,f=1<<i.canonical.z-u.canonical.z;return new gh(a,h.dim/Xe/f,[(i.canonical.x/f-u.canonical.x)*h.dim,(i.canonical.y/f-u.canonical.y)*h.dim])}tileCoordToPixel(e,i){const o=i*this._scale+this._offset[1];return new Be(Math.floor(e*this._scale+this._offset[0]),Math.floor(o))}getElevationAt(e,i,o,a){const h=e*this._scale+this._offset[0],u=i*this._scale+this._offset[1],f=Math.floor(h),_=Math.floor(u),g=this._dem;return a=!!a,o?mt(mt(g.get(f,_,a),g.get(f,_+1,a),u-_),mt(g.get(f+1,_,a),g.get(f+1,_+1,a),u-_),h-f):g.get(f,_,a)}getElevationAtPixel(e,i,o){return this._dem.get(e,i,!!o)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*L(1,e)*this._dem.stride}}const u_=new Float32Array(262144),ec=new Uint8Array(262144);function Rx(r){let e=0;if(r.meshes)for(const i of r.meshes)e=Math.max(e,i.aabb.max[2]);if(r.children)for(const i of r.children)e=Math.max(e,Rx(i));return e}function Dx(r,e,i){if(r.meshes)for(const o of r.meshes){if(o.aabb.min[0]===1/0)continue;const a=Nt.applyTransform(o.aabb,r.matrix);i.insert(e,a.min[0],a.min[1],a.max[0],a.max[1])}if(r.children)for(const o of r.children)Dx(o,e,i)}const Lx=["","wall","door","roof","window","lamp","logo"];class Fx{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:Rx(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new Nt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new Nt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const o of this.node.meshes)this.node.lightMeshIndex!==e&&(o.transformedAabb=Nt.applyTransformFast(o.aabb,this.node.matrix),i.encapsulate(
19o.transformedAabb)),e++;this.aabb=i}return this.aabb}}class _f{constructor(e,i,o,a,h,u,f,_){this.id=o,this.layers=e,this.layerIds=this.layers.map(g=>g.fqid),this.stateDependentLayerIds=this.layers.filter(g=>g.isStateDependent()).map(g=>g.id),this.modelTraits|=uh.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,a&&(this.modelTraits|=uh.HasMapboxMeshFeatures),h&&(this.modelTraits|=uh.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=u,this.worldview=_,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const g of i)this.nodesInfo.push(new Fx(g)),Dx(g,f.featureIndexArray.length,f.grid),f.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,f.bucketLayerIDs.length-1,0);this.states={}}updateFootprints(e,i){for(const o of this.getNodesInfo()){const a=o.node;a.footprint&&i.push({footprint:a.footprint,id:e})}}update(e){const i=Object.keys(e).length!==0;if(i&&!this.stateDependentLayers.length)return;const o=i?this.stateDependentLayers:this.layers;if(!zo(e,this.states))for(const a of o)this.evaluate(a,e);this.states=structuredClone(e)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const i=this.getNodesInfo();for(const o of i){const a=o.node;this.uploaded?this.updatePbrBuffer(a):Nm(a,e,!0)}for(const o of i)Xp(o.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const o of e.meshes)o.pbrBuffer&&(o.pbrBuffer.updateData(o.featureArray),i=!0);return i}needsReEvaluation(e,i,o){const a=e.transform.projectionOptions,h=e.style.getBrightness(),u=this.brightness!==h;if(!this.uploaded||this.dirty||a.name!==this.projection.name||md(o.paint.get("model-color").value,u)||md(o.paint.get("model-color-mix-intensity").value,u)||md(o.paint.get("model-roughness").value,u)||md(o.paint.get("model-emissive-strength").value,u)||md(o.paint.get("model-height-based-emissive-strength-multiplier").value,u)){this.projection=a,this.brightness=h;const f=this.getNodesInfo();for(const _ of f)_.state=null;return!0}return!1}evaluateTransform(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const o=this.getNodesInfo(),a=this.id.canonical;for(const h of o){const u=h.feature;h.evaluatedTranslation=i.paint.get("model-translation").evaluate(u,{},a),h.evaluatedScale=i.paint.get("model-scale").evaluate(u,{},a)}}evaluate(e,i){const o=this.getNodesInfo();for(const a of o){if(!a.node.meshes)continue;const h=a.feature,u=i&&i[h.id];if(zo(u,a.state))continue;a.state=structuredClone(u);const f=a.node.meshes&&a.node.meshes[0].featureData,_=a.evaluatedColor[2],g=a.evaluatedRMEA[2],v=this.id.canonical;if(a.hasTranslucentParts=!1,f){for(let b=0;b<Lx.length;b++){const w=Lx[b];w.length&&(h.properties.part=w);const I=e.paint.get("model-color").evaluate(h,u,v).toPremultipliedRenderColor(null),A=e.paint.get("model-color-mix-intensity").evaluate(h,u,v);a.evaluatedColor[b]=[I.r,I.g,I.b,A],a.evaluatedRMEA[b][0]=e.paint.get("model-roughness").evaluate(h,u,v),a.evaluatedRMEA[b][2]=e.paint.get("model-emissive-strength").evaluate(h,u,v),a.evaluatedRMEA[b][3]=I.a,a.emissionHeightBasedParams[b]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(h,u,v),!a.hasTranslucentParts&&I.a<1&&(a.hasTranslucentParts=!0)}delete h.properties.part,sb(a,_!==a.evaluatedColor[2]||g!==a.evaluatedRMEA[2],this.modelTraits)}else a.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(h,u,v);a.evaluatedTranslation=e.paint.get("model-translation").evaluate(h,u,v),a.evaluatedScale=e.paint.get("model-scale").evaluate(h,u,v),this.updatePbrBuffer(a.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,o,a){const h=e.findDEMTileFor(o);if(h&&(h.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(h.dem&&h.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=h.tileID.overscaledZ;const u=gh.create(e,o,h);if(!u)return;
vendor: 4,230 bytes, line 19
19this.modelTraits&uh.HasMapboxMeshFeatures&&this.updateDEM(e,u,o,a);for(const f of this.getNodesInfo()){const _=f.node;if(!_.footprint||!_.footprint.vertices||!_.footprint.vertices.length)continue;const g=_.footprint.vertices;let v=u.getElevationAt(g[0].x,g[0].y,!0,!0);for(let b=1;b<g.length;b++)v=Math.min(v,u.getElevationAt(g[b].x,g[b].y,!0,!0));_.elevation=v}}this.terrainTile=h.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,o,a){let h=i._dem._modifiedForSources[a];if(h===void 0&&(i._dem._modifiedForSources[a]=[],h=i._dem._modifiedForSources[a]),h.includes(o.canonical))return;const u=i._dem.dim;h.push(o.canonical);let f=!1;for(const _ of this.getNodesInfo()){const g=_.node;if(!g.footprint||!g.footprint.grid)continue;const v=g.footprint.grid,b=i.tileCoordToPixel(v.min.x,v.min.y),w=i.tileCoordToPixel(v.max.x,v.max.y),I=Math.min(Math.min(u-w.y,b.x),Math.min(b.y,u-w.x));if(I<0)continue;const A=W(I,2,5);let P=Math.max(0,b.x-A),R=Math.max(0,b.y-A),O=Math.min(w.x+A,u-1),j=Math.min(w.y+A,u-1);for(let ee=R;ee<=j;++ee)for(let ie=P;ie<=O;++ie)ec[ee*u+ie]=255;let V=0,G=0;for(let ee=0;ee<v.cellsY;++ee)for(let ie=0;ie<v.cellsX;++ie){if(!v.cells[ee*v.cellsX+ie])continue;const le=i.tileCoordToPixel(v.min.x+ie/v.xScale,v.min.y+ee/v.yScale),he=i.tileCoordToPixel(v.min.x+(ie+1)/v.xScale,v.min.y+(ee+1)/v.yScale);for(let Ie=le.y;Ie<=Math.min(he.y+1,u-1);++Ie)for(let pe=le.x;pe<=Math.min(he.x+1,u-1);++pe)ec[Ie*u+pe]===255&&(ec[Ie*u+pe]=0,V+=i.getElevationAtPixel(pe,Ie),G++)}const ne=V/G;P=Math.max(1,b.x-A),R=Math.max(1,b.y-A),O=Math.min(w.x+A,u-2),j=Math.min(w.y+A,u-2),f=!0;for(let ee=R;ee<=j;++ee)for(let ie=P;ie<=O;++ie)ec[ee*u+ie]===0&&(u_[ee*u+ie]=i._dem.set(ie,ee,ne));for(let ee=1;ee<A;++ee){P=Math.max(1,b.x-ee),R=Math.max(1,b.y-ee),O=Math.min(w.x+ee,u-2),j=Math.min(w.y+ee,u-2);for(let ie=R;ie<=j;++ie)for(let le=P;le<=O;++le){const he=ie*u+le;if(ec[he]===255){let Ie=0,pe=0,Ce=-1,Ge=-1;for(let Pe=-1;Pe<=1;++Pe)for(let Oe=-1;Oe<=1;++Oe){const je=(ie+Pe)*u+le+Oe;if(ec[je]>=ee)continue;const Se=u_[je],ke=Math.abs(Se);ke>pe&&(Ie=Se,pe=ke,Ce=Oe,Ge=Pe)}if(pe>.1){const Pe=1-(ee+.5*Math.abs(Ce*Ge))/A;let Oe=i._dem.get(le,ie)+Ie*Pe;const je=i._dem.get(le+Ce,ie+Ge),Se=i._dem.get(le-Ce,ie-Ge,!0);(Oe-je)*(Oe-Se)>0&&(Oe=(je+Se)/2),u_[he]=i._dem.set(le,ie,Oe),ec[he]=ee}}}}}f&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=ro.now())}setFilter(e){this.filter=e?Ia(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new yi(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)Xp(i.node),Vm(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const o=i.getReplacementRegionsForTile(e.toUnwrapped());for(const a of this.getNodesInfo()){const h=a.node.footprint;a.hiddenByReplacement=!!h&&!o.find(u=>u.footprint===h)}}getHeightAtTileCoord(e,i){const o=[],a=[0,0,0],h=It([]);for(const u of this.getNodesInfo()){const f=u.node.meshes[0],_=f.transformedAabb;if(e<_.min[0]||i<_.min[1]||e>_.max[0]||i>_.max[1])continue;if(u.node.hidden===!0)return{height:1/0,maxHeight:u.feature.properties.height,hidden:!1,verticalScale:u.evaluatedScale[2]};fr(h,u.node.matrix),a[0]=e,a[1]=i,lr(a,a,h);const g=(a[0]-f.aabb.min[0])/(f.aabb.max[0]-f.aabb.min[0])*Kl|0,v=Math.min(63,(a[1]-f.aabb.min[1])/(f.aabb.max[1]-f.aabb.min[1])*Kl|0)*Kl+Math.min(63,g),b=f.heightmap[v];if(!(b<0&&u.node.footprint))return u.hiddenByReplacement?void 0:{height:b,maxHeight:u.feature.properties.height,hidden:!1,verticalScale:u.evaluatedScale[2]};if(u.node.footprint.grid.query(new Be(e,i),new Be(e,i),o),o.length>0)return{height:void 0,maxHeight:u.feature.properties.height,hidden:u.hiddenByReplacement,verticalScale:u.evaluatedScale[2]}}}}function md(r,e){return r instanceof Nc&&!r.isLightConstant&&e}function ob(r,e,i,o,a,h,u,f){let _=(61440&e|(61440&e)>>4)>>8,g=(3840&e|(3840&e)>>4)>>4,v=240&e|(240&e)>>4;i[3]>0&&(_=mt(_,255*i[0],i[3]),g=mt(g,255*i[1],i[3]),v=mt(v,255*i[2],i[3]));const b=_<<8|g,w=v<<8|Math.floor(255*o[3]),I=function(ee){const ie=W(ee,0,2);return Math.min(Math.round(.5*ie*255),255)}
19(o[2])<<8|15*o[0]<<4|15*o[1],A=W(a[0],0,1),P=W(a[1],0,1),R=W(a[2],0,1),O=W(a[3],0,1);let j,V,G,ne;if(A!==P&&u!==h&&P!==A){const ee=u-h;V=1/(ee*(P-A)),G=-(h+ee*A)/(ee*(P-A));const ie=W(a[4],-1,1);ne=Math.pow(10,ie),j=255*R<<8|255*O}else j=65535,V=0,G=1,ne=1;if(r.emplaceBack(b,w,I,j,V,G,ne),f){const ee=f.length;f.clear();for(let ie=0;ie<ee;ie++)f.emplaceBack(b,w,I,j,V,G,ne)}}function sb(r,e,i){const o=r.node;let a=0;const h=i&uh.HasMeshoptCompression;for(const u of o.meshes){if(o.lights&&o.lightMeshIndex===a||!u.featureData)continue;u.featureArray=new Oa,u.featureArray.reserve(u.featureData.length);let f=e;for(const _ of u.featureData){const g=h?65535&_:_>>16&65535,v=h?_>>16&65535:65535&_,b=(15&v)<8?15&v:0,w=r.evaluatedRMEA[b],I=r.evaluatedColor[b],A=r.emissionHeightBasedParams[b];let P;if(f&&b===2&&o.lights&&(P=new Oa,P.resize(10*o.lights.length)),ob(u.featureArray,g,I,w,A,u.aabb.min[2],u.aabb.max[2],P),P&&f){f=!1;const R=o.meshes[o.lightMeshIndex];R.featureArray=P,R.featureArray._trim()}}u.featureArray._trim(),a++}}function Ox(r,e,i,o){const a=1<<r.z;e.lat=U((o/Xe+r.y)/a),e.lng=N((i/Xe+r.x)/a)}function ab(r,e,i,o){const a=r.getNodesInfo()[e];
vendor: 14,837 bytes, line 19
19if(!a||a.hiddenByReplacement||!a.node.meshes)return;let h=Number.MAX_VALUE;const u=a.node,f=i.tile,_=o.calculatePosMatrix(f.tileID.toUnwrapped(),o.worldSize),g=a.evaluatedScale;let v=0;o.elevation&&u.elevation&&(v=u.elevation*o.elevation.exaggeration()),tn(_,_,[(u.anchor?u.anchor[0]:0)*(g[0]-1),(u.anchor?u.anchor[1]:0)*(g[1]-1),v]),Zr(_,_,g);const b=i.queryGeometry,w=b.isPointQuery()?b.screenBounds:b.screenGeometry,I=function(P){const R=Wi([],_,P.matrix);Wi(R,o.expandedFarZProjMatrix,R);for(let O=0;O<P.meshes.length;++O){const j=P.meshes[O];if(O===P.lightMeshIndex)continue;const V=iy(w,o,R,j.aabb);V!=null&&(h=Math.min(V,h))}if(P.children)for(const O of P.children)I(O)};if(I(u),h===Number.MAX_VALUE)return;const A=new S(0,0);return Ox(f.tileID.canonical,A,a.node.anchor[0],a.node.anchor[1]),{intersectionZ:h,position:A,feature:a.feature}}nt(_f,"Tiled3dModelBucket",{omit:["layers"]}),nt(Fx,"Tiled3dModelFeature");const lb={circle:class extends Jr{constructor(r,e,i,o){super(r,{layout:xs||(xs=new tr({"circle-sort-key":new Qe(de.layout_circle["circle-sort-key"]),"circle-elevation-reference":new qe(de.layout_circle["circle-elevation-reference"]),visibility:new qe(de.layout_circle.visibility)})),paint:Na||(Na=new tr({"circle-radius":new Qe(de.paint_circle["circle-radius"]),"circle-color":new Qe(de.paint_circle["circle-color"]),"circle-blur":new Qe(de.paint_circle["circle-blur"]),"circle-opacity":new Qe(de.paint_circle["circle-opacity"]),"circle-translate":new qe(de.paint_circle["circle-translate"]),"circle-translate-anchor":new qe(de.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new qe(de.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new qe(de.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Qe(de.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Qe(de.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Qe(de.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new qe(de.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}createBucket(r){return new ai(r)}queryRadius(r){const e=r;return Or("circle-radius",this,e)+Or("circle-stroke-width",this,e)+or(this.paint.get("circle-translate"))}queryIntersectsFeature(r,e,i,o,a,h,u,f){const _=qs(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),h.angle,r.pixelToTileUnitsFactor),g=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return G_(r,o,h,u,f,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",_,g)}getProgramIds(){return["circle"]}getDefaultProgramParams(r,e,i){const o=U_(this);return{config:new an(this,{zoom:e,lut:i}),defines:o,overrideFog:!1}}is3D(r){return!r&&!!this.layout&&this.layout.get("circle-elevation-reference")!=="none"}hasElevation(){return this.layout&&this.layout.get("circle-elevation-reference")!=="none"}},heatmap:class extends Jr{createBucket(r){return new H_(r)}constructor(r,e,i,o){super(r,{layout:$_||($_=new tr({visibility:new qe(de.layout_heatmap.visibility)})),paint:Z_||(Z_=new tr({"heatmap-radius":new Qe(de.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Qe(de.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new qe(de.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ea(de.paint_heatmap["heatmap-color"]),"heatmap-opacity":new qe(de.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Vu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}_clear(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}queryRadius(r){return Or("heatmap-radius",this,r)}queryIntersectsFeature(r,e,i,o,a,h,u,f){const _=this.paint.get("heatmap-radius").evaluate(e,i);return G_(r,o,h,u,f,!0,!0,new Be(0,0),_)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(r,e,i){return r==="heatmap"?{config:new an(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends Jr{constructor(r,e,i,o){super(r,{layout:W_||(W_=new tr({visibility:new qe(de.layout_hillshade.visibility)})),paint:X_||(X_=new tr({"hillshade-illumination-direction":new qe(de.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new qe(de.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new qe(de.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new qe(de.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new qe(de.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new qe(de.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new qe(de.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}shouldRedrape(){return this.hasOffscreenPass()&&this.paint.get("hillshade-illumination-anchor")==="viewport"}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}},fill:class extends Jr{constructor(r,e,i,o){super(r,{layout:hg||(hg=new tr({"fill-sort-key":new Qe(de.layout_fill["fill-sort-key"]),visibility:new qe(de.layout_fill.visibility),"fill-elevation-reference":new qe(de.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new Qe(de.layout_fill["fill-construct-bridge-guard-rail"])})),paint:ug||(ug=new tr({"fill-antialias":new qe(de.paint_fill["fill-antialias"]),"fill-opacity":new Qe(de.paint_fill["fill-opacity"]),"fill-color":new Qe(de.paint_fill["fill-color"]),"fill-outline-color":new Qe(de.paint_fill["fill-outline-color"]),"fill-translate":new qe(de.paint_fill["fill-translate"]),"fill-translate-anchor":new qe(de.paint_fill["fill-translate-anchor"]),"fill-pattern":new Qe(de.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new qe(de.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new qe(de.paint_fill["fill-emissive-strength"]),"fill-z-offset":new Qe(de.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new Qe(de.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new Qe(de.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}getProgramIds(){const r=this.paint.get("fill-pattern"),e=r&&r.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(r,e,i){return{config:new an(this,{zoom:e,lut:i}),overrideFog:!1}}recalculate(r,e){super.recalculate(r,e);const i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(r){return new bm(r)}queryRadius(){return or(this.paint.get("fill-translate"))}queryIntersectsFeature(r,e,i,o,a,h){return!r.queryGeometry.isAboveHorizon&&hr(Nn(r.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),h.angle,r.pixelToTileUnitsFactor),o)}isTileClipped(){return this.paint.get("fill-z-offset").constantOr(1)===0}is3D(r){if(this.paint.get("fill-z-offset").constantOr(1)!==0)return!0;const e=this.layout&&this.layout.get("fill-elevation-reference")!=="none";return r!=null?e&&!r:e}hasElevation(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}hasShadowPass(){return this.layout&&this.layout.get("fill-elevation-reference")!=="none"}},"fill-extrusion":class extends Jr{constructor(r,e,i,o){super(r,{layout:Lg||(Lg=new tr({visibility:new qe(de["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new qe(de["layout_fill-extrusion"]["fill-extrusion-edge-radius"])})),paint:Fg||(Fg=new tr({"fill-extrusion-opacity":new qe(de["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Qe(de["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new qe(de["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new qe(de["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Qe(de["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new qe(de["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new Qe(de["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Qe(de["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new qe(de["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new qe(de["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new qe(de["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new qe(de["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new qe(de["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new qe(de["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new qe(de["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new qe(de["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new qe(de["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new qe(de["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new Qe(de["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new Qe(de["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new qe(de["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new qe(de["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new qe(de["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new qe(de["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new Qe(de["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new Qe(de["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new qe(de["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new jp(r)}queryRadius(){return or(this.paint.get("fill-extrusion-translate"))}is3D(r){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(r,e,i,o,a,h,u,f,_){const g=qs(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),h.angle,r.pixelToTileUnitsFactor),v=this.paint.get("fill-extrusion-height").evaluate(e,i),b=this.paint.get("fill-extrusion-base").evaluate(e,i),w=[0,0],I=f&&h.elevation,A=h.elevation?h.elevation.exaggeration():1,P=r.tile.getBucket(this);if(I&&P instanceof jp){const G=P.centroidVertexArray,ne=_+1;ne<G.length&&(w[0]=G.geta_centroid_pos0(ne),w[1]=G.geta_centroid_pos1(ne))}if(w[0]===0&&w[1]===1)return!1;h.projection.name==="globe"&&(o=Dg([o],[new Be(0,0),new Be(Xe,Xe)],r.tileID.canonical).map(G=>G.polygon).flat());const R=I?f:null,[O,j]=function(G,ne,ee,ie,le,he,Ie,pe,Ce,Ge,Pe){return G.projection.name==="globe"?function(Oe,je,Se,ke,fe,Ee,$e,Ne,ht,ot,Le){const Ve=[],at=[],tt=Oe.projection.upVectorScale(Le,Oe.center.lat,Oe.worldSize).metersToTile,Ye=[0,0,0,1],it=[0,0,0,1],gt=(Pt,Ct,$t,Ot)=>{Pt[0]=Ct,Pt[1]=$t,Pt[2]=Ot,Pt[3]=1},St=Rg();Se>0&&(Se+=St),ke+=St;for(const Pt of je){const Ct=[],$t=[];for(const Ot of Pt){const Pi=Ot.x+fe.x,H=Ot.y+fe.y,$=Oe.projection.projectTilePoint(Pi,H,Le),we=Oe.projection.upVector(Le,Ot.x,Ot.y);let Ze=Se,Je=ke;if($e){const Ke=jg(Pi,H,Se,ke,$e,Ne,ht,ot);Ze+=Ke.base,Je+=Ke.top}Se!==0?gt(Ye,$.x+we[0]*tt*Ze,$.y+we[1]*tt*Ze,$.z+we[2]*tt*Ze):gt(Ye,$.x,$.y,$.z),gt(it,$.x+we[0]*tt*Je,$.y+we[1]*tt*Je,$.z+we[2]*tt*Je),lr(Ye,Ye,Ee),lr(it,it,Ee),Ct.push(new Xl(Ye[0],Ye[1],Ye[2])),$t.push(new Xl(it[0],it[1],it[2]))}Ve.push(Ct),at.push($t)}return[Ve,at]}(G,ne,ee,ie,le,he,Ie,pe,Ce,Ge,Pe):Ie?function(Oe,je,Se,ke,fe,Ee,$e,Ne,ht){const ot=[],Le=[],Ve=[0,0,0,1];for(const at of Oe){const tt=[],Ye=[];for(const it of at){const gt=it.x+ke.x,St=it.y+ke.y,Pt=jg(gt,St,je,Se,Ee,$e,Ne,ht);Ve[0]=gt,Ve[1]=St,Ve[2]=Pt.base,Ve[3]=1,vn(Ve,Ve,fe),Ve[3]=Math.max(Ve[3],1e-5);const Ct=new Xl(Ve[0]/Ve[3],Ve[1]/Ve[3],Ve[2]/Ve[3]);Ve[0]=gt,Ve[1]=St,Ve[2]=Pt.top,Ve[3]=1,vn(Ve,Ve,fe),Ve[3]=Math.max(Ve[3],1e-5);const $t=new Xl(Ve[0]/Ve[3],Ve[1]/Ve[3],Ve[2]/Ve[3]);tt.push(Ct),Ye.push($t)}
vendor: 3,724 bytes, line 19
19ot.push(tt),Le.push(Ye)}return[ot,Le]}(ne,ee,ie,le,he,Ie,pe,Ce,Ge):function(Oe,je,Se,ke,fe){const Ee=[],$e=[],Ne=fe[8]*je,ht=fe[9]*je,ot=fe[10]*je,Le=fe[11]*je,Ve=fe[8]*Se,at=fe[9]*Se,tt=fe[10]*Se,Ye=fe[11]*Se;for(const it of Oe){const gt=[],St=[];for(const Pt of it){const Ct=Pt.x+ke.x,$t=Pt.y+ke.y,Ot=fe[0]*Ct+fe[4]*$t+fe[12],Pi=fe[1]*Ct+fe[5]*$t+fe[13],H=fe[2]*Ct+fe[6]*$t+fe[14],$=fe[3]*Ct+fe[7]*$t+fe[15],we=Ot+Ne,Ze=Pi+ht,Je=H+ot,Ke=Math.max($+Le,1e-5),st=Ot+Ve,bt=Pi+at,jt=H+tt,Ut=Math.max($+Ye,1e-5);gt.push(new Xl(we/Ke,Ze/Ke,Je/Ke)),St.push(new Xl(st/Ut,bt/Ut,jt/Ut))}Ee.push(gt),$e.push(St)}return[Ee,$e]}(ne,ee,ie,le,he)}(h,o,b,v,g,u,R,w,A,h.center.lat,r.tileID.canonical),V=r.queryGeometry;return function(G,ne,ee){let ie=1/0;hr(ee,ne)&&(ie=Vg(ee,ne[0]));for(let le=0;le<ne.length;le++){const he=ne[le],Ie=G[le];for(let pe=0;pe<he.length-1;pe++){const Ce=he[pe],Ge=[Ce,he[pe+1],Ie[pe+1],Ie[pe],Ce];wi(ee,Ge)&&(ie=Math.min(ie,Vg(ee,Ge)))}}return ie!==1/0&&ie}(O,j,V.isPointQuery()?V.screenBounds:V.screenGeometry)}},building:class extends Jr{constructor(r,e,i,o){super(r,{layout:uy||(uy=new tr({visibility:new qe(de.layout_building.visibility),"building-facade":new Qe(de.layout_building["building-facade"]),"building-facade-floors":new Qe(de.layout_building["building-facade-floors"]),"building-facade-window":new Qe(de.layout_building["building-facade-window"]),"building-roof-shape":new Qe(de.layout_building["building-roof-shape"]),"building-height":new Qe(de.layout_building["building-height"]),"building-base":new Qe(de.layout_building["building-base"])})),paint:dy||(dy=new tr({"building-opacity":new qe(de.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new qe(de.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new qe(de.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new qe(de.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new qe(de.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new qe(de.paint_building["building-vertical-scale"]),"building-cast-shadows":new qe(de.paint_building["building-cast-shadows"]),"building-color":new Qe(de.paint_building["building-color"]),"building-emissive-strength":new Qe(de.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new qe(de.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new qe(de.paint_building["building-cutoff-fade-range"]),"building-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new hy(r)}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(r){return!0}},line:class extends Jr{constructor(r,e,i,o){const a=wy();super(r,a,e,i,o),a.layout&&(this.layout=new so(a.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof Cl,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}recalculate(r,e){super.recalculate(r,e),this.paint._values["line-floorwidth"]=(()=>
vendor: 8,840 bytes, line 19
19{if(rd)return rd;const i=wy();return rd=new s1(i.paint.properties["line-width"].specification),rd.useIntegerZoom=!0,rd})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new Gm(r)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(r,e,i){const o=vy(this);return{config:new an(this,{zoom:e,lut:i}),defines:o,overrideFog:!1}}queryRadius(r){const e=r,i=Ty(Or("line-width",this,e),Or("line-gap-width",this,e)),o=Or("line-offset",this,e);return i/2+Math.abs(o)+or(this.paint.get("line-translate"))}queryIntersectsFeature(r,e,i,o,a,h){if(r.queryGeometry.isAboveHorizon)return!1;const u=Nn(r.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),h.angle,r.pixelToTileUnitsFactor),f=r.pixelToTileUnitsFactor/2*Ty(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),_=this.paint.get("line-offset").evaluate(e,i);return _&&(o=function(g,v){const b=[],w=new Be(0,0);for(let I=0;I<g.length;I++){const A=g[I],P=[];for(let R=0;R<A.length;R++){const O=A[R],j=A[R+1],V=R===0?w:O.sub(A[R-1])._unit()._perp(),G=R===A.length-1?w:j.sub(O)._unit()._perp(),ne=V._add(G)._unit();ne._mult(1/(ne.x*G.x+ne.y*G.y)),P.push(ne._mult(v)._add(O))}b.push(P)}return b}(o,_*r.pixelToTileUnitsFactor)),function(g,v,b){for(let w=0;w<v.length;w++){const I=v[w];if(g.length>=3){for(let A=0;A<I.length;A++)if(Gr(g,I[A]))return!0}if(mr(g,I,b))return!0}return!1}(u,o,f)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(r){return!this.hasElevatedBuckets||this.layout&&this.layout.get("line-elevation-reference")==="hd-road-markup"}hasElevation(){return this.layout&&this.layout.get("line-elevation-reference")!=="none"}},symbol:df,background:class extends Jr{constructor(r,e,i,o){super(r,{layout:fx||(fx=new tr({visibility:new qe(de.layout_background.visibility)})),paint:mx||(mx=new tr({"background-pitch-alignment":new qe(de.paint_background["background-pitch-alignment"]),"background-color":new qe(de.paint_background["background-color"]),"background-pattern":new qe(de.paint_background["background-pattern"]),"background-opacity":new qe(de.paint_background["background-opacity"]),"background-emissive-strength":new qe(de.paint_background["background-emissive-strength"]),"background-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(r,e,i){return{overrideFog:!1}}is3D(r){return this.paint.get("background-pitch-alignment")==="viewport"}},raster:vx,"raster-particle":Ix,sky:class extends Jr{constructor(r,e,i,o){super(r,{layout:Tx||(Tx=new tr({visibility:new qe(de.layout_sky.visibility)})),paint:Sx||(Sx=new tr({"sky-type":new qe(de.paint_sky["sky-type"]),"sky-atmosphere-sun":new qe(de.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new qe(de.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new qe(de.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new qe(de.paint_sky["sky-gradient-radius"]),"sky-gradient":new Ea(de.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new qe(de.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new qe(de.paint_sky["sky-atmosphere-color"]),"sky-opacity":new qe(de.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(r){r==="sky-gradient"?this._updateColorRamp():r!=="sky-atmosphere-sun"&&r!=="sky-atmosphere-halo-color"&&r!=="sky-atmosphere-color"&&r!=="sky-atmosphere-sun-intensity"||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Vu({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(r){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=r.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(r,e){if(this.paint.get("sky-type")==="atmosphere"){const o=this.paint.get("sky-atmosphere-sun"),a=!o,h=r.style.light,u=h.properties.get("position");return a&&h.properties.get("anchor")==="viewport"&&Ht("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),a?l_(u.azimuthal,90-u.polar,e):l_(o[0],90-o[1],e)}const i=this.paint.get("sky-gradient-center");return l_(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(r){this._skyboxInvalidated=!1,this._lightPosition=r.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const r=this.paint.get("sky-type");return r==="atmosphere"?["skyboxCapture","skybox"]:r==="gradient"?["skyboxGradient"]:null}},slot:class extends Jr{constructor(r,e,i,o){super(r,{paint:Ex||(Ex=new tr({}))},e,null)}},model:class extends Jr{constructor(r,e,i,o){super(r,{layout:Px||(Px=new tr({visibility:new qe(de.layout_model.visibility),"model-id":new Qe(de.layout_model["model-id"])})),paint:zx||(zx=new tr({"model-opacity":new Qe(de.paint_model["model-opacity"]),"model-rotation":new Qe(de.paint_model["model-rotation"]),"model-scale":new Qe(de.paint_model["model-scale"]),"model-translation":new Qe(de.paint_model["model-translation"]),"model-color":new Qe(de.paint_model["model-color"]),"model-color-mix-intensity":new Qe(de.paint_model["model-color-mix-intensity"]),"model-type":new qe(de.paint_model["model-type"]),"model-cast-shadows":new qe(de.paint_model["model-cast-shadows"]),"model-receive-shadows":new qe(de.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new qe(de.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new Qe(de.paint_model["model-emissive-strength"]),"model-roughness":new Qe(de.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new Qe(de.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new qe(de.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new qe(de.paint_model["model-front-cutoff"]),"model-color-use-theme":new Qe({type:"string",default:"default","property-type":"data-driven"})}))},e,i,o),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(r){return new h_(r)}getProgramIds(){return["model"]}is3D(r){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(r){return r instanceof _f?Xe-1:0}queryIntersectsFeature(r,e,i,o,a,h){if(!this.modelManager)return!1;const u=this.modelManager,f=r.tile.getBucket(this);if(!(f&&f instanceof h_))return!1;for(const _ in f.instancesPerModel){const g=f.instancesPerModel[_],v=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(g.idToFeaturesIndex.hasOwnProperty(v)){const b=g.features[g.idToFeaturesIndex[v]],w=u.getModel(_,this.scope);if(!w)return!1;let I=To();const A=new S(0,0),P=f.canonical;let R=Number.MAX_VALUE;for(let O=0;O<b.instancedDataCount;++O){const j=16*(b.instancedDataOffset+O),V=g.instancedDataArray.float32,G=[V[j+4],V[j+5],V[j+6]];Ox(P,A,V[j],0|V[j+1]),ry(I,w,h,A,b.rotation,b.scale,G,!1,!1,!1),h.projection.name==="globe"&&(I=Bm(I,h));const ne=Wi([],h.projMatrix,I),ee=r.queryGeometry,ie=iy(ee.isPointQuery()?ee.screenBounds:ee.screenGeometry,h,ne,w.aabb);ie!=null&&(R=Math.min(ie,R))}return R!==Number.MAX_VALUE&&R}}return!1}_handleOverridablePaintPropertyUpdate(r,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||r!=="model-color"&&r!=="model-color-mix-intensity"&&r!=="model-rotation"&&r!=="model-scale"&&r!=="model-translation"&&r!=="model-emissive-strength")}_isPropertyZoomDependent(r){const e=this._transitionablePaint._values[r];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof ds}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends Jr{constructor(r,e,i,o){super(r,{layout:dg||(dg=new tr({"clip-layer-types":ne
19w qe(de.layout_clip["clip-layer-types"]),"clip-layer-scope":new qe(de.layout_clip["clip-layer-scope"])})),paint:pg||(pg=new tr({}))},e,i,o)}recalculate(r,e){super.recalculate(r,e)}createBucket(r){return new fg(r)}is3D(r){return!0}}},d_=new ui(0,0,0),p_={PATH_RULE_NON_ZERO:1,PATH_RULE_EVEN_ODD:2},f_={LINE_CAP_BUTT:1,LINE_CAP_ROUND:2,LINE_CAP_SQUARE:3},gf={LINE_JOIN_MITER:1,LINE_JOIN_MITER_CLIP:2,LINE_JOIN_ROUND:3,LINE_JOIN_BEVEL:4},cb={PAINT_ORDER_FILL_AND_STROKE:1},_d={PATH_COMMAND_MOVE:1,PATH_COMMAND_LINE:2,PATH_COMMAND_QUAD:3,PATH_COMMAND_CUBIC:4,PATH_COMMAND_CLOSE:5},kx={MASK_TYPE_LUMINANCE:1};function hb(r,e,i){r===1&&e.icons.push(function(o,a){return function(h){if(h.usvg_tree.height||(h.usvg_tree.height=h.usvg_tree.width),!h.metadata)return h;const{metadata:u}=h;if(u.content_area){const{content_area:f}=u;f.top==null&&(f.top=f.left),f.width==null&&(f.width=h.usvg_tree.width),f.height==null&&(f.height=f.width)}return u.stretch_x&&u.stretch_x.length&&Bx(u,"x"),u.stretch_y&&u.stretch_y.length&&Bx(u,"y"),h}(o.readFields(ub,{name:void 0},a))}(i,i.readVarint()+i.pos))}function Bx(r,e){const i=[],o=r[`stretch_${e}`];let a=null;for(let h=0;h<o.length;h++)a===null?a=i.length===0?o[0]:i[i.length-1][1]+o[h]:(i.push([a,a+o[h]]),a=null);r[`stretch_${e}_areas`]=i}function ub(r,e,i){r===1?e.name=i.readString():r===2?e.metadata=function(o,a){return o.readFields(db,{stretch_x:null,stretch_y:null,stretch_x_areas:null,stretch_y_areas:null,variables:[]},a)}(i,i.readVarint()+i.pos):r===3&&(e.usvg_tree=function(o,a){return o.readFields(mb,{width:20,children:[],linear_gradients:[],radial_gradients:[],clip_paths:[],masks:[]},a)}(i,i.readVarint()+i.pos),e.data="usvg_tree")}function db(r,e,i){r===1?e.stretch_x=i.readPackedVarint():r===2?e.stretch_y=i.readPackedVarint():r===3?e.content_area=function(o,a){return o.readFields(pb,{left:0},a)}(i,i.readVarint()+i.pos):r===4&&e.variables.push(function(o,a){return o.readFields(fb,{name:void 0},a)}(i,i.readVarint()+i.pos))}function pb(r,e,i){r===1?e.left=i.readVarint():r===2?e.width=i.readVarint():r===3?e.top=i.readVarint():r===4&&(e.height=i.readVarint())}function fb(r,e,i){r===1?e.name=i.readString():r===2&&(e.rgb_color=vf(i.readVarint()),e.value="rgb_color")}function mb(r,e,i){r===1?e.width=e.height=i.readVarint():r===2?e.height=i.readVarint():r===3?e.children.push(yf(i,i.readVarint()+i.pos)):r===4?e.linear_gradients.push(function(o,a){return o.readFields(wb,{spread_method:1,stops:[],x1:0,y1:0,x2:1,y2:0},a)}(i,i.readVarint()+i.pos)):r===5?e.radial_gradients.push(function(o,a){return o.readFields(Sb,{spread_method:1,stops:[],cx:.5,cy:.5,r:.5,fx:.5,fy:.5,fr:0},a)}(i,i.readVarint()+i.pos)):r===7?e.clip_paths.push(function(o,a){return o.readFields(Eb,{children:[]},a)}(i,i.readVarint()+i.pos)):r===8&&e.masks.push(function(o,a){const h=o.readFields(Ib,{left:0,width:20,mask_type:kx.MASK_TYPE_LUMINANCE,children:[]},a);return h.height==null&&(h.height=h.width),h.top==null&&(h.top=h.left),h}(i,i.readVarint()+i.pos))}function yf(r,e){return r.readFields(_b,{},e)}function _b(r,e,i){r===1?(e.group=function(o,a){return o.readFields(gb,{opacity:255,children:[]},a)}(i,i.readVarint()+i.pos),e.node="group"):r===2&&(e.path=function(o,a){return o.readFields(xb,{paint_order:1,commands:[],step:1,diffs:[],rule:p_.PATH_RULE_NON_ZERO},a)}(i,i.readVarint()+i.pos),e.node="path")}function gb(r,e,i){r===1?e.transform=xf(i,i.readVarint()+i.pos):r===2?e.opacity=i.readVarint():r===5?e.clip_path_idx=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(yf(i,i.readVarint()+i.pos))}function xf(r,e){return r.readFields(yb,{sx:1,ky:0,kx:0,sy:1,tx:0,ty:0},e)}function yb(r,e,i){r===1?e.sx=i.readFloat():r===2?e.ky=i.readFloat():r===3?e.kx=i.readFloat():r===4?e.sy=i.readFloat():r===5?e.tx=i.readFloat():r===6&&(e.ty=i.readFloat())}function xb(r,e,i){r===1?e.fill=function(o,a){return o.readFields(vb,{rgb_color:d_,paint:"rgb_color",opacity:255},a)}(i,i.readVarint()+i.pos):r===2?e.stroke=function(o,a){return o.readFields(bb,{rgb_color:d_,paint:"rgb_color",dasharray:[],dashoffset:0,miterlimit:4,opacity:255,width:1,linecap:1,linejoin:1},a)}(i,i.readVarint()+i.pos):r===3?e.paint_order=i.readVarint():r===5?i.readPackedVarint(e.commands):r===6?e.
19step=i.readFloat():r===7?i.readPackedSVarint(e.diffs):r===8&&(e.rule=i.readVarint())}function vb(r,e,i){r===1?(e.rgb_color=vf(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5&&(e.opacity=i.readVarint())}function vf(r){return new ui((r>>16&255)/255,(r>>8&255)/255,(255&r)/255,1)}function bb(r,e,i){r===1?(e.rgb_color=vf(i.readVarint()),e.paint="rgb_color"):r===2?(e.linear_gradient_idx=i.readVarint(),e.paint="linear_gradient_idx"):r===3?(e.radial_gradient_idx=i.readVarint(),e.paint="radial_gradient_idx"):r===5?i.readPackedFloat(e.dasharray):r===6?e.dashoffset=i.readFloat():r===7?e.miterlimit=i.readFloat():r===8?e.opacity=i.readVarint():r===9?e.width=i.readFloat():r===10?e.linecap=i.readVarint():r===11&&(e.linejoin=i.readVarint())}function wb(r,e,i){r===1?e.transform=xf(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(Nx(i,i.readVarint()+i.pos)):r===4?e.x1=i.readFloat():r===5?e.y1=i.readFloat():r===6?e.x2=i.readFloat():r===7&&(e.y2=i.readFloat())}function Nx(r,e){return r.readFields(Tb,{offset:0,opacity:255,rgb_color:d_},e)}function Tb(r,e,i){r===1?e.offset=i.readFloat():r===2?e.opacity=i.readVarint():r===3&&(e.rgb_color=vf(i.readVarint()))}function Sb(r,e,i){r===1?e.transform=xf(i,i.readVarint()+i.pos):r===2?e.spread_method=i.readVarint():r===3?e.stops.push(Nx(i,i.readVarint()+i.pos)):r===4?e.cx=i.readFloat():r===5?e.cy=i.readFloat():r===6?e.r=i.readFloat():r===7?e.fx=i.readFloat():r===8?e.fy=i.readFloat():r===9&&(e.fr=i.readFloat())}function Eb(r,e,i){r===1?e.transform=xf(i,i.readVarint()+i.pos):r===2?e.clip_path_idx=i.readVarint():r===3&&e.children.push(yf(i,i.readVarint()+i.pos))}function Ib(r,e,i){r===1?e.left=e.top=i.readFloat():r===2?e.width=e.height=i.readFloat():r===3?e.top=i.readFloat():r===4?e.height=i.readFloat():r===5?e.mask_type=i.readVarint():r===6?e.mask_idx=i.readVarint():r===7&&e.children.push(yf(i,i.readVarint()+i.pos))}class Ab{static calculate(e={},i=[]){const o=new Map,a=new Map;if(Object.keys(e).length===0)return o;i.forEach(h=>{a.set(h.name,h.rgb_color||new ui(0,0,0))});for(const[h,u]of Object.entries(e))a.has(h)?o.set(a.get(h).toString(),u):console.warn(`Ignoring unknown image variable "${h}"`);return o}}function yh(r,e=255,i){const o=e/255,a=r.toString(),h=i.has(a)?i.get(a).clone():r.clone();return h.a*=o,h.toString()}function gd(r,e){if(!sc()){const i=document.createElement("canvas");return i.width=r,i.height=e,i}return new OffscreenCanvas(r,e)}function Cb(r,e){const i=Ab.calculate(e.params,r.metadata?r.metadata.variables:[]),o=r.usvg_tree,a=o.width,h=o.height,u=e.transform?e.transform:new DOMMatrix,f=Math.max(1,Math.round(a*u.a)),_=Math.max(1,Math.round(h*u.d)),g=new DOMMatrix([f/a,0,0,_/h,0,0]),v=gd(f,_).getContext("2d");return m_(v,g,o,o,i),v.getImageData(0,0,f,_)}function m_(r,e,i,o,a){for(const h of o.children)Vx(r,e,i,h,a)}function Vx(r,e,i,o,a){o.group?(r.save(),function(h,u,f,_,g){const v=_.mask_idx!=null?f.masks[_.mask_idx]:null,b=_.clip_path_idx!=null?f.clip_paths[_.clip_path_idx]:null;if(_.transform&&(u=xh(_.transform).preMultiplySelf(u)),!function(A,P,R){return A.opacity!==255||P||R}(_,b!=null,v!=null))return void m_(h,u,f,_,g);const w=gd(h.canvas.width,h.canvas.height),I=w.getContext("2d");m_(I,u,f,_,g),b&&Zx(I,u,f,b),v&&Wx(I,u,f,v,g),h.globalAlpha=_.opacity/255,h.drawImage(w,0,0)}(r,e,i,o.group,a),r.restore()):o.path&&(r.save(),function(h,u,f,_,g){h.setTransform(u),_.paint_order===cb.PAINT_ORDER_FILL_AND_STROKE?(jx(h,f,_,g),Gx(h,f,_,g)):(Gx(h,f,_,g),jx(h,f,_,g))}(r,e,i,o.path,a),r.restore())}function jx(r,e,i,o){const a=i.fill;if(!a)return;const h=a.opacity/255;switch(r.save(),r.beginPath(),Xx(i,r),a.paint){case"rgb_color":r.fillStyle=yh(a.rgb_color,a.opacity,o);break;case"linear_gradient_idx":{const u=e.linear_gradients[a.linear_gradient_idx];u.transform&&r.setTransform(xh(u.transform).preMultiplySelf(r.getTransform())),r.fillStyle=qx(r,u,h,o);break}case"radial_gradient_idx":{const u=e.radial_gradients[a.radial_gradient_idx];u.transform&&r.setTransform(xh(u.transform).preMultiplySelf(r.getTransform())),r.fillStyle=Hx(r,u,h,o)}}
vendor: 6,526 bytes, line 19
19r.fill(Ux(i)),r.restore()}function Ux(r){return r.rule===p_.PATH_RULE_NON_ZERO?"nonzero":r.rule===p_.PATH_RULE_EVEN_ODD?"evenodd":void 0}function Gx(r,e,i,o){const a=i.stroke;if(!a)return;const h=Yx(i);r.lineWidth=a.width,r.miterLimit=a.miterlimit,r.setLineDash(a.dasharray),r.lineDashOffset=a.dashoffset;const u=a.opacity/255;switch(a.paint){case"rgb_color":r.strokeStyle=yh(a.rgb_color,a.opacity,o);break;case"linear_gradient_idx":r.strokeStyle=qx(r,e.linear_gradients[a.linear_gradient_idx],u,o,!0);break;case"radial_gradient_idx":r.strokeStyle=Hx(r,e.radial_gradients[a.radial_gradient_idx],u,o,!0)}switch(a.linejoin){case gf.LINE_JOIN_MITER_CLIP:case gf.LINE_JOIN_MITER:r.lineJoin="miter";break;case gf.LINE_JOIN_ROUND:r.lineJoin="round";break;case gf.LINE_JOIN_BEVEL:r.lineJoin="bevel"}switch(a.linecap){case f_.LINE_CAP_BUTT:r.lineCap="butt";break;case f_.LINE_CAP_ROUND:r.lineCap="round";break;case f_.LINE_CAP_SQUARE:r.lineCap="square"}r.stroke(h)}function qx(r,e,i,o,a=!1){if(e.stops.length===1){const w=e.stops[0];return yh(w.rgb_color,w.opacity*i,o)}const{x1:h,y1:u,x2:f,y2:_}=e;let g=new DOMPoint(h,u),v=new DOMPoint(f,_);if(a){const w=xh(e.transform);g=w.transformPoint(g),v=w.transformPoint(v)}const b=r.createLinearGradient(g.x,g.y,v.x,v.y);for(const w of e.stops)b.addColorStop(w.offset,yh(w.rgb_color,w.opacity*i,o));return b}function Hx(r,e,i,o,a=!1){if(e.stops.length===1){const O=e.stops[0];return yh(O.rgb_color,O.opacity*i,o)}const h=xh(e.transform),{fx:u,fy:f,fr:_,cx:g,cy:v,r:b}=e;let w=new DOMPoint(u,f),I=new DOMPoint(g,v),A=_,P=b;if(a){w=h.transformPoint(w),I=h.transformPoint(I);const O=(h.a+h.d)/2;A=_*O,P=e.r*O}const R=r.createRadialGradient(w.x,w.y,A,I.x,I.y,P);for(const O of e.stops)R.addColorStop(O.offset,yh(O.rgb_color,O.opacity*i,o));return R}function $x(r,e,i,o){const a=o.transform?xh(o.transform).preMultiplySelf(e):e,h=gd(r.canvas.width,r.canvas.height),u=h.getContext("2d");for(const _ of o.children)if(_.group)$x(u,a,i,_.group);else if(_.path){const g=_.path,v=new Path2D;v.addPath(Yx(g),a),u.fill(v,Ux(g))}const f=o.clip_path_idx!=null?i.clip_paths[o.clip_path_idx]:null;f&&Zx(u,a,i,f),r.globalCompositeOperation="source-over",r.drawImage(h,0,0)}function Zx(r,e,i,o){const a=gd(r.canvas.width,r.canvas.height);$x(a.getContext("2d"),e,i,o),r.globalCompositeOperation="destination-in",r.drawImage(a,0,0)}function Wx(r,e,i,o,a){if(o.children.length===0)return;const h=o.mask_idx!=null?i.masks[o.mask_idx]:null;h&&Wx(r,e,i,h,a);const u=r.canvas.width,f=r.canvas.height,_=gd(u,f),g=_.getContext("2d"),v=o.width,b=o.height,w=o.left,I=o.top,A=new Path2D,P=new Path2D;P.rect(w,I,v,b),A.addPath(P,e),g.clip(A);for(const j of o.children)Vx(g,e,i,j,a);const R=g.getImageData(0,0,u,f),O=R.data;if(o.mask_type===kx.MASK_TYPE_LUMINANCE)for(let j=0;j<O.length;j+=4)O[j+3]=O[j+3]/255*(.2126*O[j]+.7152*O[j+1]+.0722*O[j+2]);g.putImageData(R,0,0),r.globalCompositeOperation="destination-in",r.drawImage(_,0,0)}function xh(r){return r?new DOMMatrix([r.sx,r.ky,r.kx,r.sy,r.tx,r.ty]):new DOMMatrix}function Xx(r,e){const i=r.step;let o=r.diffs[0]*i,a=r.diffs[1]*i;e.moveTo(o,a);for(let h=0,u=2;h<r.commands.length;h++)switch(r.commands[h]){case _d.PATH_COMMAND_MOVE:o+=r.diffs[u++]*i,a+=r.diffs[u++]*i,e.moveTo(o,a);break;case _d.PATH_COMMAND_LINE:o+=r.diffs[u++]*i,a+=r.diffs[u++]*i,e.lineTo(o,a);break;case _d.PATH_COMMAND_QUAD:{const f=o+r.diffs[u++]*i,_=a+r.diffs[u++]*i;o=f+r.diffs[u++]*i,a=_+r.diffs[u++]*i,e.quadraticCurveTo(f,_,o,a);break}case _d.PATH_COMMAND_CUBIC:{const f=o+r.diffs[u++]*i,_=a+r.diffs[u++]*i,g=f+r.diffs[u++]*i,v=_+r.diffs[u++]*i;o=g+r.diffs[u++]*i,a=v+r.diffs[u++]*i,e.bezierCurveTo(f,_,g,v,o,a);break}case _d.PATH_COMMAND_CLOSE:e.closePath()}return e}function Yx(r){return Xx(r,new Path2D)}class bf{constructor(e){this.capacity=e,this.cache=new Map}get(e){if(!this.cache.has(e))return;const i=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,i),i}put(e,i){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,i)}delete(e){this.cache.delete(e)}}nt(bf,"LRUCache");class __{constructor(){this.cacheMap=new Map,this.cacheDependenciesMap=new Map}static _getImage(e){return new qr(e,e.data)}getFromCache(e,i,o){return this.cacheMap.has(o)||this.cacheMap.set(o,new bf(150)),this.cacheMap.get(o).get(Ca(e.toString(),i))}setInCache(e,i,o,a){this.cacheDependenciesMap.has(a)||this.cacheDependenciesMap.set(a,new Map),this.cacheMap.has(a)||this.cacheMap.set(a,new bf(150));const h=this.cacheDependenciesMap.get(a),u=Ca(e.id.toString(),o);h.get(u)||h.set(u,new Set);const f=this.cacheMap.get(a),_=e.toString();h.get(u).add(_),f.put(Ca(e.toString(),o),i)}removeImagesFromCacheByIds(e,i,o=0){if(!this.cacheMap.has(o)||!this.cacheDependenciesMap.has(o))return;const a=this.cacheMap.get(o),h=this.cacheDependenciesMap.get(o);for(const u of e){const f=Ca(u.toString(),i);if(h.has(f)){for(const _ of h.get(f))a.delete(_);h.delete(f)}}}rasterize(e,i,o,a,h=Cb){const u=this.getFromCache(e,o,a);if(u)return u.clone();const f=h(i.icon,e.options),_=__._getImage(f);return this.setInCache(e,_,o,a),_.clone()}}class Kx{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const o=this.toIdx(e,i);return{min:this.minimums[o],max:this.maximums[o]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function Jx(r,e,i,o){let a=0,h=Number.MAX_VALUE;for(let u=0;u<3;u++)if(Math.abs(o[u])<1e-15){if(i[u]<r[u]||i[u]>e[u])return null}else{const f=1/o[u];let _=(r[u]-i[u])*f,g=(e[u]-i[u])*f;if(_>g){const v=_;_=g,g=v}if(_>a&&(a=_),g<h&&(h=g),a>h)return null}return a}function Qx(r,e,i,o,a,h,u,f,_,g,v){const b=o-r,w=a-e,I=h-i,A=u-r,P=f-e,R=_-i,O=v[1]*R-v[2]*P,j=v[2]*A-v[0]*R,V=v[0]*P-v[1]*A,G=b*O+w*j+I*V;if(Math.abs(G)<1e-15)return null;const ne=1/G,ee=g[0]-r,ie=g[1]-e,le=g[2]-i,he=(ee*O+ie*j+le*V)*ne;if(he<0||he>1)return null;const Ie=ie*I-le*w,pe=le*b-ee*I,Ce=ee*w-ie*b,Ge=(v[0]*Ie+v[1]*pe+v[2]*Ce)*ne;return Ge<0||he+Ge>1?null:(A*Ie+P*pe+R*Ce)*ne}function e0(r,e,i){return(r-e)/(i-e)}function t0(r,e,i,o,a,h,u,f,_){const g=1<<i,v=h-o,b=u-a,w=(r+1)/g*v+o,I=(e+0)/g*b+a,A=(e+1)/g*b+a;f[0]=(r+0)/g*v+o,f[1]=I,_[0]=w,_[1]=A}class i0{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const i=function(h){const u=Math.ceil(Math.log2(h.dim/8)),f=[];let _=Math.ceil(Math.pow(2,u));const g=1/_,v=(I,A,P,R,O)=>
vendor: 25,645 bytes, line 19
19{const j=R?1:0,V=(I+1)*P-j,G=A*P,ne=(A+1)*P-j;O[0]=I*P,O[1]=G,O[2]=V,O[3]=ne};let b=new Kx(_);const w=[];for(let I=0;I<_*_;I++){v(I%_,Math.floor(I/_),g,!1,w);const A=Wa(w[0],w[1],h),P=Wa(w[2],w[1],h),R=Wa(w[2],w[3],h),O=Wa(w[0],w[3],h);b.minimums.push(Math.min(A,P,R,O)),b.maximums.push(Math.max(A,P,R,O)),b.leaves.push(1)}for(f.push(b),_/=2;_>=1;_/=2){const I=f[f.length-1];b=new Kx(_);for(let A=0;A<_*_;A++){v(A%_,Math.floor(A/_),2,!0,w);const P=I.getElevation(w[0],w[1]),R=I.getElevation(w[2],w[1]),O=I.getElevation(w[2],w[3]),j=I.getElevation(w[0],w[3]),V=I.isLeaf(w[0],w[1]),G=I.isLeaf(w[2],w[1]),ne=I.isLeaf(w[2],w[3]),ee=I.isLeaf(w[0],w[3]),ie=Math.min(P.min,R.min,O.min,j.min),le=Math.max(P.max,R.max,O.max,j.max),he=V&&G&&ne&&ee;b.maximums.push(le),b.minimums.push(ie),b.leaves.push(le-ie<=5&&he?1:0)}f.push(b)}return f}(this.dem),o=i.length-1,a=i[o];this._addNode(a.minimums[0],a.maximums[0],a.leaves[0]),this._construct(i,0,0,o,0)}raycastRoot(e,i,o,a,h,u,f=1){return Jx([e,i,-100],[o,a,this.maximums[0]*f],h,u)}raycast(e,i,o,a,h,u,f=1){if(!this.nodeCount)return null;const _=this.raycastRoot(e,i,o,a,h,u,f);if(_==null)return null;const g=[],v=[],b=[],w=[],I=[{idx:0,t:_,nodex:0,nodey:0,depth:0}];for(;I.length>0;){const{idx:A,t:P,nodex:R,nodey:O,depth:j}=I.pop();if(this.leaves[A]){t0(R,O,j,e,i,o,a,b,w);const G=1<<j,ne=(R+0)/G,ee=(R+1)/G,ie=(O+0)/G,le=(O+1)/G,he=Wa(ne,ie,this.dem)*f,Ie=Wa(ee,ie,this.dem)*f,pe=Wa(ee,le,this.dem)*f,Ce=Wa(ne,le,this.dem)*f,Ge=Qx(b[0],b[1],he,w[0],b[1],Ie,w[0],w[1],pe,h,u),Pe=Qx(w[0],w[1],pe,b[0],w[1],Ce,b[0],b[1],he,h,u),Oe=Math.min(Ge!==null?Ge:Number.MAX_VALUE,Pe!==null?Pe:Number.MAX_VALUE);if(Oe!==Number.MAX_VALUE)return Oe;{const je=rn([],h,u,P);if(r0(he,Ie,Ce,pe,e0(je[0],b[0],w[0]),e0(je[1],b[1],w[1]))>=je[2])return P}continue}let V=0;for(let G=0;G<this._siblingOffset.length;G++){t0((R<<1)+this._siblingOffset[G][0],(O<<1)+this._siblingOffset[G][1],j+1,e,i,o,a,b,w),b[2]=-100,w[2]=this.maximums[this.childOffsets[A]+G]*f;const ne=Jx(b,w,h,u);if(ne!=null){const ee=ne;g[G]=ee;let ie=!1;for(let le=0;le<V&&!ie;le++)ee>=g[v[le]]&&(v.splice(le,0,G),ie=!0);ie||(v[V]=G),V++}}for(let G=0;G<V;G++){const ne=v[G];I.push({idx:this.childOffsets[A]+ne,t:g[ne],nodex:(R<<1)+this._siblingOffset[ne][0],nodey:(O<<1)+this._siblingOffset[ne][1],depth:j+1})}}return null}_addNode(e,i,o){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(o),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,o,a,h){if(e[a].isLeaf(i,o)===1)return;this.childOffsets[h]||(this.childOffsets[h]=this.nodeCount);const u=a-1,f=e[u];let _=0,g=0;for(let v=0;v<this._siblingOffset.length;v++){const b=2*i+this._siblingOffset[v][0],w=2*o+this._siblingOffset[v][1],I=f.getElevation(b,w),A=f.isLeaf(b,w),P=this._addNode(I.min,I.max,A);A&&(_|=1<<v),g||(g=P)}for(let v=0;v<this._siblingOffset.length;v++)_&1<<v||this._construct(e,2*i+this._siblingOffset[v][0],2*o+this._siblingOffset[v][1],u,g+v)}}function r0(r,e,i,o,a,h){return mt(mt(r,i,h),mt(e,o,h),a)}function Wa(r,e,i){const o=i.dim,a=W(r*o-.5,0,o-1),h=W(e*o-.5,0,o-1),u=Math.floor(a),f=Math.floor(h),_=Math.min(u+1,o-1),g=Math.min(f+1,o-1);return r0(i.get(u,f),i.get(_,f),i.get(u,g),i.get(_,g),a-u,h-f)}const Mb={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function Pb(r,e,i){return(256*r*256+256*e+i)/10-1e4}function zb(r,e,i){return 256*r+e+i/256-32768}class wf{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,o,a=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(o&&o!=="mapbox"&&o!=="terrarium")return void Ht(`"${o}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const h=this.dim=i.height-2,u=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=a,this._modifiedForSources={},!a){for(let _=0;_<h;_++)u[this._idx(-1,_)]=u[this._idx(0,_)],u[this._idx(h,_)]=u[this._idx(h-1,_)],u[this._idx(_,-1)]=u[this._idx(_,0)],u[this._idx(_,h)]=u[this._idx(_,h-1)];u[this._idx(-1,-1)]=u[this._idx(0,0)],u[this._idx(h,-1)]=u[this._idx(h-1,0)],u[this._idx(-1,h)]=u[this._idx(0,h-1)],u[this._idx(h,h)]=u[this._idx(h-1,h-1)]}const f=o==="terrarium"?zb:Pb;for(let _=0;_<u.length;++_){const g=4*_;this.floatView[_]=f(this.pixels[g],this.pixels[g+1],this.pixels[g+2])}this._timestamp=ro.now()}_buildQuadTree(){this._tree=new i0(this)}get(e,i,o=!1){o&&(e=W(e,-1,this.dim),i=W(i,-1,this.dim));const a=this._idx(e,i);return this.floatView[a]}set(e,i,o){const a=this._idx(e,i),h=this.floatView[a];return this.floatView[a]=o,o-h}static getUnpackVector(e){return Mb[e]}_idx(e,i){if(e<-1||e>=this.dim+1||i<-1||i>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(i+1)*this.stride+(e+1)}static pack(e,i){const o=[0,0,0,0],a=wf.getUnpackVector(i);let h=Math.floor((e+a[3])/a[2]);return o[2]=h%256,h=Math.floor(h/256),o[1]=h%256,h=Math.floor(h/256),o[0]=h,o}getPixels(){return new J_({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,o){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let a=i*this.dim,h=i*this.dim+this.dim,u=o*this.dim,f=o*this.dim+this.dim;switch(i){case-1:a=h-1;break;case 1:h=a+1}switch(o){case-1:u=f-1;break;case 1:f=u+1}const _=-i*this.dim,g=-o*this.dim;for(let v=u;v<f;v++)for(let b=a;b<h;b++){const w=4*this._idx(b,v),I=4*this._idx(b+_,v+g);this.pixels[w+0]=e.pixels[I+0],this.pixels[w+1]=e.pixels[I+1],this.pixels[w+2]=e.pixels[I+2],this.pixels[w+3]=e.pixels[I+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function Rb(r,e,i){r===1?e.headerLength=i.readFixed32():r===2?e.x=i.readVarint():r===3?e.y=i.readVarint():r===4?e.z=i.readVarint():r===5&&e.layers.push(function(o,a){return o.readFields(kb,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},a)}(i,i.readVarint()+i.pos))}function Db(r,e,i){r===1?(e.delta_filter=function(o,a){return o.readFields(Lb,{blockSize:0},a)}(i,i.readVarint()+i.pos),e.filter="delta_filter"):r===2?(i.readVarint(),e.filter="zigzag_filter"):r===3?(i.readVarint(),e.filter="bitshuffle_filter"):r===4&&(i.readVarint(),e.filter="byteshuffle_filter")}function Lb(r,e,i){r===1&&(e.blockSize=i.readVarint())}function Fb(r,e,i){r===1?(i.readVarint(),e.codec="gzip_data"):r===2?(i.readVarint(),e.codec="jpeg_image"):r===3?(i.readVarint(),e.codec="webp_image"):r===4&&(i.readVarint(),e.codec="png_image")}function Ob(r,e,i){let o=0,a=0;r===1?e.firstByte=i.readFixed64():r===2?e.lastByte=i.readFixed64():r===3?e.filters.push(function(h,u){return h.readFields(Db,{},u)}(i,i.readVarint()+i.pos)):r===4?e.codec=function(h,u){return h.readFields(Fb,{},u)}(i,i.readVarint()+i.pos):r===5?a=i.readFloat():r===6?o=i.readFloat():r===7?e.bands.push(i.readString()):r===8?e.offset=i.readDouble():r===9&&(e.scale=i.readDouble()),e.offset===0&&(e.offset=a),e.scale===0&&(e.scale=o)}function kb(r,e,i){r===1?e.version=i.readVarint():r===2?e.name=i.readString():r===3?e.units=i.readString():r===4?e.tileSize=i.readVarint():r===5?e.buffer=i.readVarint():r===6?e.pixelFormat=i.readVarint():r===7&&e.dataIndex.push(function(o,a){return o.readFields(Ob,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},a)}(i,i.readVarint()+i.pos))}function Bb(r,e,i){if(r===2)(function(o,a,h){o.readFields(Nb,h,a)})(i,i.readVarint()+i.pos,e);else if(r===3)throw new Error("Not implemented")}function Nb(r,e,i){if(r===1){let o=0;const a=i.readVarint()+i.pos;for(;i.pos<a;)e[o++]=i.readVarint()}}function Vb(r,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let o=2;o>=1;o--){const a=o===1?1:0,h=o===2?1:0;for(let u=0;u<e[0];u++){const f=e[1]*u;for(let _=a;_<e[1];_++){const g=e[2]*(_+f);for(let v=h;v<e[2];v++){const b=e[3]*(v+g);for(let w=0;w<e[3];w++){const I=b+w;r[I]+=r[I-i]}}}}i*=e[o]}return r}function jb(r){for(let e=0,i=r.length;e<i;e++)r[e]=r[e]>>>1^-(1&r[e]);return r}function Ub(r,e){switch(e){case"uint32":return r;case"uint16":for(let i=0;i<r.length;i+=2){const o=r[i],a=r[i+1];r[i]=(240&o)>>4|(61440&o)>>8|(240&a)<<4|61440&a,r[i+1]=15&o|(3840&o)>>4|(15&a)<<8|(3840&a)<<4}return r;case"uint8":for(let i=0;i<r.length;i+=4){const o=r[i],a=r[i+1],h=r[i+2],u=r[i+3];r[i+0]=(192&o)>>6|(192&a)>>4|(192&h)>>2|192&u,r[i+1]=(48&o)>>4|(48&a)>>2|48&h|(48&u)<<2,r[i+2]=(12&o)>>2|12&a|(12&h)<<2|(12&u)<<4,r[i+3]=3&o|(3&a)<<2|(3&h)<<4|(3&u)<<6}return r;default:throw new Error(`Invalid pixel format, "${e}"`)}}nt(wf,"DEMData"),nt(i0,"DemMinMaxQuadTree",{omit:["dem"]});var lo=Uint8Array,yd=Uint16Array,Gb=Int32Array,n0=new lo([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]),o0=new lo([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]),qb=new lo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s0=function(r,e){for(var i=new yd(31),o=0;o<31;++o)i[o]=e+=1<<r[o-1];var a=new Gb(i[30]);for(o=1;o<30;++o)for(var h=i[o];h<i[o+1];++h)a[h]=h-i[o]<<5|o;return{b:i,r:a}},a0=s0(n0,2),l0=a0.b,Hb=a0.r;l0[28]=258,Hb[258]=28;for(var $b=s0(o0,0).b,c0=new yd(32768),Mr=0;Mr<32768;++Mr){var vh=(43690&Mr)>>1|(21845&Mr)<<1;c0[Mr]=((65280&(vh=(61680&(vh=(52428&vh)>>2|(13107&vh)<<2))>>4|(3855&vh)<<4))>>8|(255&vh)<<8)>>1}var xd=function(r,e,i){for(var o=r.length,a=0,h=new yd(e);a<o;++a)r[a]&&++h[r[a]-1];var u,f=new yd(e);for(a=1;a<e;++a)f[a]=f[a-1]+h[a-1]<<1;u=new yd(1<<e);var _=15-e;for(a=0;a<o;++a)if(r[a])for(var g=a<<4|r[a],v=e-r[a],b=f[r[a]-1]++<<v,w=b|(1<<v)-1;b<=w;++b)u[c0[b]>>_]=g;return u},vd=new lo(288);for(Mr=0;Mr<144;++Mr)vd[Mr]=8;for(Mr=144;Mr<256;++Mr)vd[Mr]=9;for(Mr=256;Mr<280;++Mr)vd[Mr]=7;for(Mr=280;Mr<288;++Mr)vd[Mr]=8;var h0=new lo(32);for(Mr=0;Mr<32;++Mr)h0[Mr]=5;var Zb=xd(vd,9),Wb=xd(h0,5),g_=function(r){for(var e=r[0],i=1;i<r.length;++i)r[i]>e&&(e=r[i]);return e},jo=function(r,e,i){var o=e/8|0;return(r[o]|r[o+1]<<8)>>(7&e)&i},y_=function(r,e){var i=e/8|0;return(r[i]|r[i+1]<<8|r[i+2]<<16)>>(7&e)},Xb=["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"],Uo=function(r,e,i){var o=new Error(e||Xb[r]);if(o.code=r,Error.captureStackTrace&&Error.captureStackTrace(o,Uo),!i)throw o;return o},Yb=new lo(0),Kb=typeof TextDecoder<"u"&&new TextDecoder;try{Kb.decode(Yb,{stream:!0})}catch{}const Jb={gzip_data:"gzip"};class yo extends Error{constructor(e){super(e),this.name="MRTError"}}const Qb={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},u0={uint32:1,uint16:2,uint8:4},ew={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let x_;class Tf{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const i=this.layers[e];if(!i)throw new yo(`Layer '${e}' not found`);return i}getHeaderLength(e){const i=new Uint8Array(e),o=new DataView(e);if(i[0]!==13)throw new yo("File is not a valid MRT.");return o.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),o=this.getHeaderLength(e);if(i.length<o)throw new yo(`Expected header with length >= ${o} but got buffer of length ${i.length}`);const a=new x_(i.subarray(0,o)).readFields(Rb,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==a.x||this.y!==a.y||this.z!==a.z))throw new yo(`Invalid attempt to parse header ${a.z}/${a.x}/${a.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=a.x,this.y=a.y,this.z=a.z;for(const h of a.layers)this.layers[h.name]=new d0(h,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],o=this.getLayer(e.layerName);for(let a of e.blockIndices){const h=o.dataIndex[a],u=h.firstByte-e.firstByte,f=h.lastByte-e.firstByte;if(o._blocksInProgress.has(a))continue;const _={layerName:o.name,firstByte:u,lastByte:f,pixelFormat:o.pixelFormat,blockIndex:a,blockShape:[h.bands.length].concat(o.bandShape),buffer:o.buffer,codec:h.codec.codec,filters:h.filters.map(g=>g.filter)};o._blocksInProgress.add(a),i.push(_)}return new p0(i,()=>{i.forEach(a=>o._blocksInProgress.delete(a.blockIndex))},(a,h)=>{if(i.forEach(u=>o._blocksInProgress.delete(u.blockIndex)),a)throw a;h.forEach(u=>{this.getLayer(u.layerName).processDecodedData(u)})})}}class d0{constructor({version:e,name:i,units:o,tileSize:a,pixelFormat:h,buffer:u,dataIndex:f},_){if(this.version=e,this.version!==1)throw new yo(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=o,this.tileSize=a,this.buffer=u,this.pixelFormat=Qb[h],this.dataIndex=f,this.bandShape=[a+2*u,a+2*u,u0[this.pixelFormat]],this._decodedBlocks=new bf(_?_.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return u0[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.put(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[o,a]of this.dataIndex.entries()){for(const[h,u]of a.bands.entries())if(u===e)return{bandIndex:i+h,blockIndex:o,blockBandIndex:h};i+=a.bands.length}break;case"number":for(const[o,a]of this.dataIndex.entries()){if(e>=i&&e<i+a.bands.length)return{bandIndex:e,blockIndex:o,blockBandIndex:e-i};i+=a.bands.length}break;default:throw new yo(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let i=1/0,o=-1/0;const a=[],h=new Set;for(const u of e){const{blockIndex:f}=this.getBlockForBand(u);if(f<0)throw new yo(`Invalid band: ${JSON.stringify(u)}`);const _=this.dataIndex[f];a.includes(f)||a.push(f),h.add(f),i=Math.min(i,_.firstByte),o=Math.max(o,_.lastByte)}if(h.size>this.cacheSize)throw new yo(`Number of blocks to decode (${h.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:i,lastByte:o,blockIndices:a}}hasBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0}hasDataForBand(e){const{blockIndex:i}=this.getBlockForBand(e);return i>=0&&!!this._decodedBlocks.get(i.toString())}getBandView(e){const{blockIndex:i,blockBandIndex:o}=this.getBlockForBand(e);if(i<0)throw new yo(`Band not found: ${JSON.stringify(e)}`);const a=this._decodedBlocks.get(i.toString());if(!a)throw new yo(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const h=this.dataIndex[i],u=this.bandShape.reduce((g,v)=>g*v,1),f=o*u,_=a.subarray(f,f+u);return{data:_,bytes:new Uint8Array(_.buffer).subarray(_.byteOffset,_.byteOffset+_.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:h.offset,scale:h.scale}}}Tf.setPbf=function(r){x_=r};class p0{constructor(e,i,o){this.tasks=e,this._onCancel=i,this._onComplete=o,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}Tf.performDecoding=function(r,e){const i=new Uint8Array(r);return Promise.all(e.tasks.map(o=>{const{layerName:a,firstByte:h,lastByte:u,pixelFormat:f,blockShape:_,blockIndex:g,filters:v,codec:b}=o,w=i.subarray(h,u+1),I=new Uint32Array(_[0]*_[1]*_[2]);let A;if(b!=="gzip_data")throw new yo(`Unhandled codec: ${b}`);return A=function(P,R){if(!globalThis.DecompressionStream&&R==="gzip_data")return Promise.resolve(((G=function(ie){ie[0]==31&&ie[1]==139&&ie[2]==8||Uo(6,"invalid gzip data");var le=ie[3],he=10;4&le&&(he+=2+(ie[10]|ie[11]<<8));for(var Ie=(le>>3&1)+(le>>4&1);Ie>0;Ie-=!ie[he++]);return he+(2&le)}(V=P))+8>V.length&&Uo(6,"invalid gzip data"),function(ie,le,he,Ie){var pe=ie.length;if(!pe||le.f&&!le.l)return he||new lo(0);var Ce=!he,Ge=Ce||le.i!=2,Pe=le.i;Ce&&(he=new lo(3*pe));var Oe,je,Se=function($i){var zi=he.length;if($i>zi){var Ci=new lo(Math.max(2*zi,$i));Ci.set(he),he=Ci}},ke=le.f||0,fe=le.p||0,Ee=le.b||0,$e=le.l,Ne=le.d,ht=le.m,ot=le.n,Le=8*pe;do{if(!$e){ke=jo(ie,fe,1);var Ve=jo(ie,fe+1,3);if(fe+=3,!Ve){var at=ie[(H=4+((fe+7)/8|0))-4]|ie[H-3]<<8,tt=H+at;if(tt>pe){Pe&&Uo(0);break}Ge&&Se(Ee+at),he.set(ie.subarray(H,tt),Ee),le.b=Ee+=at,le.p=fe=8*tt,le.f=ke;continue}if(Ve==1)$e=Zb,Ne=Wb,ht=9,ot=5;else if(Ve==2){var Ye=jo(ie,fe,31)+257,it=jo(ie,fe+10,15)+4,gt=Ye+jo(ie,fe+5,31)+1;fe+=14;for(var St=new lo(gt),Pt=new lo(19),Ct=0;Ct<it;++Ct)Pt[qb[Ct]]=jo(ie,fe+3*Ct,7);fe+=3*it;var $t=g_(Pt),Ot=(1<<$t)-1,Pi=xd(Pt,$t);for(Ct=0;Ct<gt;){var H,$=Pi[jo(ie,fe,Ot)];if(fe+=15&$,(H=$>>4)<16)St[Ct++]=H;else{var we=0,Ze=0;for(H==16?(Ze=3+jo(ie,fe,3),fe+=2,we=St[Ct-1]):H==17?(Ze=3+jo(ie,fe,7),fe+=3):H==18&&(Ze=11+jo(ie,fe,127),fe+=7);Ze--;)St[Ct++]=we}}var Je=St.subarray(0,Ye),Ke=St.subarray(Ye);ht=g_(Je),ot=g_(Ke),$e=xd(Je,ht),Ne=xd(Ke,ot)}else Uo(1);if(fe>Le){Pe&&Uo(0);break}}Ge&&Se(Ee+131072);for(var st=(1<<ht)-1,bt=(1<<ot)-1,jt=fe;;jt=fe){var Ut=(we=$e[y_(ie,fe)&st])>>4;if((fe+=15&we)>Le){Pe&&Uo(0);break}if(we||Uo(2),Ut<256)he[Ee++]=Ut;else{if(Ut==256){jt=fe,$e=null;break}var Dt=Ut-254;Ut>264&&(Dt=jo(ie,fe,(1<<(zt=n0[Ct=Ut-257]))-1)+l0[Ct],fe+=zt);var xi=Ne[y_(ie,fe)&bt],Yi=xi>>4;if(xi||Uo(3),fe+=15&xi,Ke=$b[Yi],Yi>3){var zt=o0[Yi];Ke+=y_(ie,fe)&(1<<zt)-1,fe+=zt}if(fe>Le){Pe&&Uo(0);break}Ge&&Se(Ee+131072);var Fi=Ee+Dt;if(Ee<Ke){var Ai=0-Ke,pi=Math.min(Ke,Fi);for(Ai+Ee<0&&Uo(3);Ee<pi;++Ee)he[Ee]=(void 0)[Ai+Ee]}for(;Ee<Fi;++Ee)he[Ee]=he[Ee-Ke]}}le.l=$e,le.p=jt,le.b=Ee,le.f=ke,$e&&(ke=1,le.m=ht,le.d=Ne,le.n=ot)}while(!ke);return Ee!=he.length&&Ce?(Oe=he,((je=Ee)==null||je>Oe.length)&&(je=Oe.length),new lo(Oe.subarray(0,je))):he.subarray(0,Ee)}(V.subarray(G,-8),{i:2},new lo(((O=V)[(j=O.length)-4]|O[j-3]<<8|O[j-2]<<16|O[j-1]<<24)>>>0))));var O,j,V,G;const ne=Jb[R];if(!ne)throw new Error(`Unhandled codec: ${R}`);const ee=new globalThis.DecompressionStream(ne);return new Response(new Blob([P]).stream().pipeThrough(ee)).arrayBuffer().then(ie=>new Uint8Array(ie))}(w,b).then(P=>(function(R,O){R.readFields(Bb,O)}(new x_(P),I),new ew[f](I.buffer))),A.then(P=>{for(let R=v.length-1;R>=0;R--)switch(v[R]){case"delta_filter":Vb(P,_);break;case"zigzag_filter":jb(P);break;case"bitshuffle_filter":Ub(P,f);break;default:throw new yo(`Unhandled filter "${v[R]}"`)}return{layerName:a,blockIndex:g,data:P}}).catch(P=>{throw P})}))},nt(p0,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),nt(Tf,"MapboxRasterTile"),nt(d0,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class f0{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const o=e[i];this._stringToNumber[o]=i,this._numberToString[i]=o}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}const tw=["id","tile","layer","source","sourceLayer","state"];class bh{constructor(e,i,o,a,h){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=o,this._y=a,this.properties=e.properties,this.id=h}clone(){const e=new bh(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const i of tw)this[i]!==void 0&&(e[i]=this[i]);return e}}class m0{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new ps(Xe,16,0),this.featureIndexArray=new xp,this.promoteId=i,this.is3DTile=!1,this.serializedLayersCache=new Map}insert(e,i,o,a,h,u=0,f=0){const _=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(o,a,h,u);const g=this.grid;for(let v=0;v<i.length;v++){const b=i[v],w=[1/0,1/0,-1/0,-1/0];for(let I=0;I<b.length;I++){const A=b[I];w[0]=Math.min(w[0],A.x),w[1]=Math.min(w[1],A.y),w[2]=Math.max(w[2],A.x),w[3]=Math.max(w[3],A.y)}f!==0&&(w[0]-=f,w[1]-=f,w[2]+=f,w[3]+=f),w[0]<Xe&&w[1]<Xe&&w[2]>=0&&w[3]>=0&&g.insert(_,w[0],w[1],w[2],w[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new lt(new Yp(this.rawTileData)).layers,this.sourceLayerCoder=new f0(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,i){const{tilespaceGeometry:o,transform:a,tileTransform:h,pixelPosMatrix:u,availableImages:f,worldview:_}=i;this.loadVTLayers(),this.serializedLayersCache.clear();const g=o.bufferedTilespaceBounds,v=this.grid.query(g.min.x,g.min.y,g.max.x,g.max.y,(A,P,R,O)=>nr(o.bufferedTilespaceGeometry,A,P,R,O));v.sort(iw);let b=null;a.elevation&&v.length>0&&(b=gh.create(a.elevation,this.tileID));const w={};let I;for(let A=0;A<v.length;A++){const P=v[A];if(P===I)continue;I=P;const R=this.featureIndexArray.get(P);let O=null;this.is3DTile?this.loadMatchingModelFeature(w,R,e,o,a,_):this.loadMatchingFeature(w,R,e,f,_,(j,V,G,ne=0)=>(O||(O=se(j,this.tileID.canonical,h)),V.queryIntersectsFeature(o,j,G,O,this.z,a,u,b,ne)))}return w}loadMatchingFeature(e,i,o,a,h,u){const{featureIndex:f,bucketIndex:_,sourceLayerIndex:g,layoutVertexArrayOffset:v}=i,b=this.bucketLayerIDs[_],w=o.layers,I=Object.keys(w);if(I.length&&!qt(I,b))return;const A=o.sourceCache,P=this.sourceLayerCoder.decode(g),R=this.vtLayers[P].feature(f),O=this.getId(R,P);for(let j=0;j<b.length;j++){const V=b[j];if(!w[V])continue;const{styleLayer:G,targets:ne}=w[V];let ee={};O!==void 0&&(ee=A.getFeatureState(G.sourceLayer,O));const ie=!u||u(R,G,ee,v);if(!ie)continue;const le=new bh(R,this.z,this.x,this.y,O);le.tile=this.tileID.canonical,le.state=ee;let he=this.serializedLayersCache.get(V);he||(he=G.serialize(),he.id=V,this.serializedLayersCache.set(V,he)),le.source=he.source,le.sourceLayer=he["source-layer"],le.layer=xe({},he),le.layer.paint=_0(he.paint,G.paint,R,ee,a),le.layer.layout=_0(he.layout,G.layout,R,ee,a);let Ie=!1;for(const pe of ne){this.updateFeatureProperties(le,pe);const{filter:Ce}=pe;if(Ce){if(R.properties=le.properties,Ce.needGeometry){const Ge=Te(R,!0);if(!Ce.filter(new yi(this.tileID.overscaledZ,{worldview:h}),Ge,this.tileID.canonical))continue}else if(!Ce.filter(new yi(this.tileID.overscaledZ,{worldview:h}),R))continue}Ie=!0,pe.targetId&&this.addFeatureVariant(le,pe)}Ie&&this.appendToResult(e,V,f,le,ie)}}loadMatchingModelFeature(e,i,o,a,h,u){const{featureIndex:f,bucketIndex:_}=i,g=this.bucketLayerIDs[_],v=o.layers,b=Object.keys(v);if(!b.length||qt(b,g))for(let w=0;w<g.length;w++){const I=g[w],{styleLayer:A,targets:P}=v[I];if(A.type!=="model")continue;const R=a.tile,O=R.getBucket(A);if(!(O&&O instanceof _f))continue;const j=ab(O,f,a,h);if(!j)continue;const{z:V,x:G,y:ne}=R.tileID.canonical,{feature:ee,intersectionZ:ie,position:le}=j;let he={};ee.id!==void 0&&(he=o.sourceCache.getFeatureState(A.sourceLayer,ee.id));const Ie=new bh({},V,G,ne,ee.id);Ie.tile=this.tileID.canonical,Ie.state=he,Ie.properties=ee.properties,Ie.geometry={type:"Point",coordinates:[le.lng,le.lat]};let pe=this.serializedLayersCache.get(I);pe||(pe=A.serialize(),pe.id=I,this.serializedLayersCache.set(I,pe)),Ie.source=pe.source,Ie.sourceLayer=pe["source-layer"],Ie.layer=xe({},pe);let Ce=!1;for(const Ge of P){this.updateFeatureProperties(Ie,Ge);const{filter:Pe}=Ge;if(Pe){if(ee.properties=Ie.properties,Pe.needGeometry){if(!Pe.filter(new yi(this.tileID.overscaledZ,{worldview:u}),ee,this.tileID.canonical))continue}else if(!Pe.filter(new yi(this.tileID.overscaledZ,{worldview:u}),ee))continue}Ce=!0,Ge.targetId&&this.addFeatureVariant(Ie,Ge)}Ce&&this.appendToResult(e,I,f,Ie,ie)}}updateFeatureProperties(e,i,o){if(i.properties){const a={};for(const h in i.properties){const u=i.properties[h].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,o);u!=null&&(a[h]=u)}e.properties=a}}addFeatureVariant(e,i,o){const a={target:i.target,namespace:i.namespace,uniqueFeatureID:i.uniqueFeatureID};i.properties&&(a.properties=e.properties),e.variants=e.variants||{},e.variants[i.targetId]=e.variants[i.targetId]||[],e.variants[i.targetId].push(a)}appendToResult(e,i,o,a,h){let u=e[i];u===void 0&&(u=e[i]=[]),u.push({featureIndex:o,feature:a,intersectionZ:h})}lookupSymbolFeatures(e,i,o,a,h,u){const f={};this.loadVTLayers();for(const _ of e)this.loadMatchingFeature(f,{bucketIndex:i,sourceLayerIndex:o,featureIndex:_,layoutVertexArrayOffset:0},a,h,u);return f}loadFeature(e){const{featureIndex:i,sourceLayerIndex:o}=e;this.loadVTLayers();const a=this.sourceLayerCoder.decode(o),h=this.vtFeatures[a];if(h[i])return h[i];const u=this.vtLayers[a].feature(i);return h[i]=u,u}hasLayer(e){for(const i of this.bucketLayerIDs)for(const o of i)if(e===o)return!0;return!1}getId(e,i){let o=e.id;if(this.promoteId){const a=Array.isArray(this.promoteId)||typeof this.promoteId!="object"?this.promoteId:this.promoteId[i];if(a!=null)if(Array.isArray(a)){if(!this.promoteIdExpression){const h=Ns(a);if(h.result!=="success"){const u=h.value.map(f=>`${f.key}: ${f.message}`).join(", ");return void Ht(`Failed to create expression for promoteId: ${u}`)}this.promoteIdExpression=h.value}this.promoteIdExpression._evaluator||(this.promoteIdExpression._evaluator=new Tl),o=this.promoteIdExpression.evaluate({zoom:0},e)}else o=e.properties[a];typeof o=="boolean"&&(o=Number(o))}return o}}function _0(r,e,i,o,a){return Et(r,(h,u)=>{const f=e instanceof so?e.get(u):null;return f&&f.evaluate?f.evaluate(i,o,void 0,a):f})}function iw(r,e){return e-r}nt(m0,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const g0=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
vendor: 4,392 bytes, line 19
19];class v_{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,o]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const a=o>>4;if(a!==1)throw new Error(`Got v${a} data when expected v1.`);const h=g0[15&o];if(!h)throw new Error("Unrecognized array type.");const[u]=new Uint16Array(e,2,1),[f]=new Uint32Array(e,4,1);return new v_(f,u,h,e)}constructor(e,i=64,o=Float64Array,a){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+i,2),65535),this.ArrayType=o,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const h=g0.indexOf(this.ArrayType),u=2*e*this.ArrayType.BYTES_PER_ELEMENT,f=e*this.IndexArrayType.BYTES_PER_ELEMENT,_=(8-f%8)%8;if(h<0)throw new Error(`Unexpected typed array class: ${o}.`);a&&a instanceof ArrayBuffer?(this.data=a,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+u+f+_),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+f+_,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+h]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const o=this._pos>>1;return this.ids[o]=o,this.coords[this._pos++]=e,this.coords[this._pos++]=i,o}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return b_(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,o,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:h,coords:u,nodeSize:f}=this,_=[0,h.length-1,0],g=[];for(;_.length;){const v=_.pop()||0,b=_.pop()||0,w=_.pop()||0;if(b-w<=f){for(let R=w;R<=b;R++){const O=u[2*R],j=u[2*R+1];O>=e&&O<=o&&j>=i&&j<=a&&g.push(h[R])}continue}const I=w+b>>1,A=u[2*I],P=u[2*I+1];A>=e&&A<=o&&P>=i&&P<=a&&g.push(h[I]),(v===0?e<=A:i<=P)&&(_.push(w),_.push(I-1),_.push(1-v)),(v===0?o>=A:a>=P)&&(_.push(I+1),_.push(b),_.push(1-v))}return g}within(e,i,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:a,coords:h,nodeSize:u}=this,f=[0,a.length-1,0],_=[],g=o*o;for(;f.length;){const v=f.pop()||0,b=f.pop()||0,w=f.pop()||0;if(b-w<=u){for(let R=w;R<=b;R++)x0(h[2*R],h[2*R+1],e,i)<=g&&_.push(a[R]);continue}const I=w+b>>1,A=h[2*I],P=h[2*I+1];x0(A,P,e,i)<=g&&_.push(a[I]),(v===0?e-o<=A:i-o<=P)&&(f.push(w),f.push(I-1),f.push(1-v)),(v===0?e+o>=A:i+o>=P)&&(f.push(I+1),f.push(b),f.push(1-v))}return _}}function b_(r,e,i,o,a,h){if(a-o<=i)return;const u=o+a>>1;y0(r,e,u,o,a,h),b_(r,e,i,o,u-1,1-h),b_(r,e,i,u+1,a,1-h)}function y0(r,e,i,o,a,h){for(;a>o;){if(a-o>600){const g=a-o+1,v=i-o+1,b=Math.log(g),w=.5*Math.exp(2*b/3),I=.5*Math.sqrt(b*w*(g-w)/g)*(v-g/2<0?-1:1);y0(r,e,i,Math.max(o,Math.floor(i-v*w/g+I)),Math.min(a,Math.floor(i+(g-v)*w/g+I)),h)}const u=e[2*i+h];let f=o,_=a;for(bd(r,e,o,i),e[2*a+h]>u&&bd(r,e,o,a);f<_;){for(bd(r,e,f,_),f++,_--;e[2*f+h]<u;)f++;for(;e[2*_+h]>u;)_--}e[2*o+h]===u?bd(r,e,o,_):(_++,bd(r,e,_,a)),_<=i&&(o=_+1),i<=_&&(a=_-1)}}function bd(r,e,i,o){w_(r,i,o),w_(e,2*i,2*o),w_(e,2*i+1,2*o+1)}function w_(r,e,i){const o=r[e];r[e]=r[i],r[i]=o}function x0(r,e,i,o){const a=r-i,h=e-o;return a*a+h*h}s.$=Lr,s.A=Lo,s.B=Oo,s.C=Ca,s.D=ah,s.E=Ps,s.F=2,s.G=ad,s.H=Hy,s.I=bn,s.J=is,s.K=class extends mf{},s.L=zs,s.M=dp,s.N=kc,s.O=Oc,s.P=Be,s.Q=ip,s.R=ul,s.S=au,s.T=Om,s.U=Ol,s.V=mf,s.W=lu,s.X=Ns,s.Y=wc,s.Z=xa,s._=ya,s.a=function(r){return Br.API_CDN_URL_REGEX.test(r)},s.a$=ze,s.a0=Ph,s.a1=kl,s.a2=Bc,s.a3=tp,s.a4=function(r){const e=r.value;let i=[];if(!e)return i;const o=is(e);return o!=="string"?(i=i.concat([new mf(r.key,e,`string expected, "${o}" found`)]),i):(c_(e,!0)||(i=i.concat([new mf(r.key,e,`invalid url "${e}"`)])),i)},s.a5=de,s.a6=Fl,s.a7=tr,s.a8=qe,s.a9=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return br(r.expression.evaluate(e))}interpolate(r,e,i){return{x:mt(r.x,e.x,i),y:mt(r.y,e.y,i),z:mt(r.z,e.z,i),azimuthal:mt(r.azimuthal,e.azimuthal,i),polar:mt(r.polar,e.polar,i)}}},s.aA=vn,s.aB=Qr,s.aC=Gr,s.aD=z,s.aE=ae,s.aF=function(r,e){const i={};for(let o=0;o<e.length;o++){const a=e[o];a in r&&(i[a]=r[a])}return i},s.aG=C,s.aH=F,s.aI=class{constructor(r){this.entries={}
19,this.scheduler=r}request(r,e,i,o){const a=this.entries[r]=this.entries[r]||{callbacks:[]};if(a.result){const[h,u]=a.result;return this.scheduler?this.scheduler.add(()=>{o(h,u)},e):o(h,u),()=>{}}return a.callbacks.push(o),a.cancel||(a.cancel=i((h,u)=>{a.result=[h,u];for(const f of a.callbacks)this.scheduler?this.scheduler.add(()=>{f(h,u)},e):f(h,u);setTimeout(()=>delete this.entries[r],3e3)})),()=>{a.result||(a.callbacks=a.callbacks.filter(h=>h!==o),a.callbacks.length||(a.cancel(),delete this.entries[r]))}}},s.aJ=function(r,e,i){const o=JSON.stringify(r.request);return r.data&&(this.deduped.entries[o]={result:[null,r.data]}),this.deduped.request(o,{type:"parseTile",isSymbolTile:r.isSymbolTile,zoom:r.tileZoom},a=>{const h=dl(r.request,(u,f,_,g)=>{u?a(u):f&&a(null,{vectorTile:i?void 0:new lt(new Yp(f)),rawData:f,cacheControl:_,expires:g})});return()=>{h.cancel(),a()}},e)},s.aK=function(r){Eh++,Eh>Do&&(r.getActor().send("enforceCacheSizeLimit",no),Eh=0)},s.aL=function(r){return r<=1?1:Math.pow(2,Math.floor(Math.log(r)/Math.LN2))},s.aM=Sr,s.aN=vx,s.aO=Ix,s.aP=xx,s.aQ=function(r,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let o=0;o<r.length;o++){const a=document.createElement("source");Mf(r[o])||(i.crossOrigin="Anonymous"),a.src=r[o],i.appendChild(a)}return{cancel:()=>{}}},s.aR=td,s.aS=function(r){return fetch(r).then(e=>e.arrayBuffer()).then(e=>Kg(e,0,r))},s.aT=oy,s.aU=class{constructor(r,e,i,o){this.id=r,this.position=e!=null?new S(e[0],e[1]):new S(0,0),this.orientation=i??[0,0,0],this.nodes=o,this.uploaded=!1,this.aabb=new Nt([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(r,e){if(Wi(r.matrix,e,r.matrix),r.meshes)for(const i of r.meshes){const o=Nt.applyTransformFast(i.aabb,r.matrix);this.aabb.encapsulate(o)}if(r.children)for(const i of r.children)this._applyTransformations(i,r.matrix)}computeBoundsAndApplyParent(){const r=It([]);for(const e of this.nodes)this._applyTransformations(e,r)}computeModelMatrix(r,e,i,o,a,h,u=!1){ry(this.matrix,this,r.transform,this.position,e,i,o,a,h,u)}upload(r){if(!this.uploaded){for(const e of this.nodes)Nm(e,r);for(const e of this.nodes)Xp(e);this.uploaded=!0}}destroy(){for(const r of this.nodes)Vm(r)}},s.aV=wt,s.aW=hd,s.aX=N,s.aY=U,s.aZ=Pa,s.a_=Ni,s.aa=yi,s.ab=ds,s.ac=Q,s.ad=lr,s.ae=jr,s.af=ce,s.ag=so,s.ah=ja,s.ai=mt,s.aj=Xe,s.ak=Pd,s.al=ii,s.am=ui,s.an=class{constructor(r){this.specification=r}possiblyEvaluate(r,e){return function([i,o]){const a=br([1,i,o]);return{x:a.x,y:a.y,z:a.z}}(r.expression.evaluate(e))}interpolate(r,e,i){return{x:mt(r.x,e.x,i),y:mt(r.y,e.y,i),z:mt(r.z,e.z,i)}}},s.ao=function(r,e,i=0,o=!0){const a=new Be(i,i),h=r.sub(a),u=e.add(a),f=[h,new Be(u.x,h.y),u,new Be(h.x,u.y)];return o&&f.push(h.clone()),f},s.ap=function(r,e){const i=[];for(let o=0;o<r.length;o++){const a=be(o-1,-1,r.length-1),h=be(o+1,-1,r.length-1),u=r[o],f=r[h],_=r[a].sub(u).unit(),g=f.sub(u).unit(),v=g.angleWithSep(_.x,_.y),b=_.add(g).unit().mult(-1*e/Math.sin(v/2));i.push(u.add(b))}return i},s.aq=ox,s.ar=nr,s.as=function(r,e,i=0){return gr(((e.x-i)*r.scale-r.x)*Xe,(e.y*r.scale-r.y)*Xe,q(e.z,e.y))},s.at=cr,s.au=ki,s.av=Qt,s.aw=_y,s.ax=function(r){let e=1/0,i=1/0,o=-1/0,a=-1/0;for(const h of r)e=Math.min(e,h.x),i=Math.min(i,h.y),o=Math.max(o,h.x),a=Math.max(a,h.y);return{min:new Be(e,i),max:new Be(o,a)}},s.ay=W,s.az=Wi,s.b=function(r){return Br.API_FONTS_REGEX.test(r)},s.b$=e_,s.b0=_p,s.b1=uf,s.b2=function(){po.isLoading()||po.isLoaded()||mu()!=="deferred"||cp()},s.b3=Ia,s.b4=Te,s.b5=bh,s.b6=oi,s.b7=Gm,s.b8=bm,s.b9=se,s.bA=function(r,e){const{x:i,y:o}=r.point,a=N_(i,o,r.worldSize/r._pixelsPerMercatorPixel,0,0);return Wi(a,a,um(vs(e)))},s.bB=Di,s.bC=Ka,s.bD=function(r,e){return Math.hypot(e[0]-r[0],e[1]-r[1],e[2]-r[2])},s.bE=rn,s.bF=yr,s.bG=ar,s.bH=sd,s.bI=Gn,s.bJ=Ym,s.bK=function(r,e,i,o,a){const h=5*e+2;r.float32[h+0]=i,r.float32[h+1]=o,r.float32[h+2]=a},s.bL=hf,s.bM=Mn,s.bN=Ko,s.bO=Yo,s.bP=Pn,s.bQ=be,s.bR=function(r,e,i,o){var a=new Vt(4);return a[0]=r,a[1]=e,a[2]=i,a[3]=o,a},s.bS=Up,s.bT=wi,s.bU=kr,s.bV=_g,s.bW=Ax,s.bX=vg,s.bY=Sm,s.bZ=Xm,s.b_=Jy,s.ba=yn,s.bb=Mu,s.bc=D_,s.bd=qi,s.be=oh,s.bf=a_,s.bg=function(r,e){const i=ja(e.zoom);if(i===0)return vs(r);const o=zp(r),a=hm(o),h=z(o.getWest())*e.worldSize,u=z(o.getEast())*e.worldSize,f=F(o.getNorth())*e.worldSize,_=F(o.getSouth())*e.worldSize,g=[h,f,0],v=[u,f,0],b=[h,_,0],w=[u,_,0],I=fr([],e.globeMatrix);return lr(g,g,I),lr(v,v,I),lr(b,b,I),lr(w,w,I),a[0]=$s(a[0],b,i),a[1]=$s(a[1],w,i),a[2]=$s(a[2],v,i),a[3]=$s(a[3],g,i),Nt.fromPoints(a)},s.bh=Dp,s.bi=fr,s.bj=Nu,s.bk=$s,s.bl=Ma,s.bm=L0,s.bn=Ks,s.bo=tn,s.bp=Tf,s.bq=Yp,s.br=dl,s.bs=function(r,e){const i=[];for(const o in r)o in e||i.push(o);return i},s.bt=ue,s.bu=["type","source","source-layer","minzoom","maxzoom","filter","layout"],s.bv=zo,s.bw=function(r){var e=new Vt(16);return e[0]=r[0],e[1]=r[1],e[2]=r[2],e[3]=r[3],e[4]=r[4],e[5]=r[5],e[6]=r[6],e[7]=r[7],e[8]=r[8],e[9]=r[9],e[10]=r[10],e[11]=r[11],e[12]=r[12],e[13]=r[13],e[14]=r[14],e[15]=r[15],e},s.bx=It,s.by=qo,s.bz=To,s.c=rc,s.c$=45,s.c0=v_,s.c1=Vi,s.c2=Xo,s.c3=Co,s.c4=function(r,e,i){i*=.5;var o=e[0],a=e[1],h=e[2],u=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_+a*f,r[1]=a*_-o*f,r[2]=h*_+u*f,r[3]=u*_-h*f,r},s.c5=Ss,s.c6=Xi,s.c7=function(r,e){return r[0]=-e[0],r[1]=-e[1],r[2]=-e[2],r[3]=e[3],r},s.c8=Ho,s.c9=function(r,e,i,o,a){var h,u=1/Math.tan(e/2);return r[0]=u/i,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=u,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,a!=null&&a!==1/0?(r[10]=(a+o)*(h=1/(o-a)),r[14]=2*a*o*h):(r[10]=-1,r[14]=-2*o),r},s.cA=Vn,s.cB=O_,s.cC=function(r,e,i,o,a,h,u,f,_){if(_.name==="globe")return O_(r,e,new Vn(i,o,a),!1);const g=hd({z:i,x:o,y:a},_);return new Nt([(h+g.x/g.scale)*e,e*(g.y/g.scale),u],[(h+g.x2/g.scale)*e,e*(g.y2/g.scale),f])},s.cD=function(r,e,i){return r[0]=Math.min(e[0],i[0]),r[1]=Math.min(e[1],i[1]),r[2]=Math.min(e[2],i[2]),r[3]=Math.min(e[3],i[3]),r},s.cE=function(r,e,i){return r[0]=Math.max(e[0],i[0]),r[1]=Math.max(e[1],i[1]),r[2]=Math.max(e[2],i[2]),r[3]=Math.max(e[3],i[3]),r},s.cF=function(r){const e=Math.round((r+45+360)%360/90)%4;return k[e]},s.cG=Y,s.cH=Io,s.cI=l,s.cJ=function(r){const e=It(new Float64Array(16));Wi(e,r.pixelMatrix,r.globeMatrix);const i=[0,d,0],o=[0,p,0];return lr(i,i,e),lr(o,o,e),[i[0]>0&&i[0]<=r.width&&i[1]>0&&i[1]<=r.height&&!pm(r,new S(r.center.lat,90)),o[0]>0&&o[0]<=r.width&&o[1]>0&&o[1]<=r.height&&!pm(r,new S(r.center.lat,-90))]},s.cK=function(r,e){const{scale:i}=r.tileTransform,o=i*Xe/(r.tileSize*Math.pow(2,e.zoom-r.tileID.overscaledZ+r.tileID.canonical.z));return function(a,h,u){var f=h[1],_=h[2],g=h[3],v=u[0],b=u[1];return a[0]=h[0]*v,a[1]=f*v,a[2]=_*b,a[3]=g*b,a}(new Float32Array(4),e.inverseAdjustmentMatrix,[o,o])},s.cL=Zp,s.cM=tc,s.cN=Jg,s.cO=function(r){const e=Jg(r,!0);return Di([],[e[0],e[1],e[4],e[5]])},s.cP=Zr,s.cQ=ri,s.cR=Go,s.cS=function(r){const{x:e,y:i}=r.point,{lng:o,lat:a}=r._center;return N_(e,i,r.worldSize,o,a)},s.cT=Ya,s.cU=ye,s.cV=jn,s.cW=Ki,s.cX=Cp,s.cY=function(r,e,i){let o=0;for(let a=0;a<2;++a)r[a]>0&&(o+=(r[a]-0)*(r[a]-0)),e[a]<0&&(o+=(0-e[a])*(0-e[a]));return o},s.cZ=function(r){return r*r*r*r*r},s.c_=D,s.ca=function(r,e,i,o,a,h,u){var f=1/(e-i),_=1/(o-a),g=1/(h-u);return r[0]=-2*f,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*_,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*g,r[11]=0,r[12]=(e+i)*f,r[13]=(a+o)*_,r[14]=(u+h)*g,r[15]=1,r},s.cb=L,s.cc=function(r,e,i){r[4*e+0]=i[0],r[4*e+1]=i[1],r[4*e+2]=i[2],r[4*e+3]=i[3]},s.cd=nh,s.ce=ka,s.cf=dr,s.cg=_o,s.ch=Hl,s.ci=S,s.cj=hx,s.ck=function(){var r=new Vt(4);return Vt!=Float32Array&&(r[1]=0,r[2]=0),r[0]=1,r[3]=1,r},s.cl=function(r,e,i){var o=e[0],a=e[1],h=e[2],u=e[3],f=Math.sin(i),_=Math.cos(i);return r[0]=o*_+h*f,r[1]=a*_+u*f,r[2]=o*-f+h*_,r[3]=a*-f+u*_,r},s.cm=function(r,e){return r[0]===e[0]&&r[1]===e[1]&&r[2]===e[2]&&r[3]===e[3]},s.cn=$n,s.co=function(r){return Math.hypot(r[0],r[1],r[2],r[3])},s.cp=Mo,s.cq=Wo,s.cr=go,s.cs=3,s.ct=2,s.cu=7,s.cv=6,s.cw=hn,s.cx=fi,s.cy=si,s.cz=Qg,s.d=function(r){return Br.API_TILEJSON_REGEX.test(r)},s.d$=(r,e,i,o,a,h,u,f,_,g)=>{const v=r.transform,b=v.calculatePixelsToTileUnitsMatrix(e),w=i.paint.get("line-trim-color-use-theme").
vendor: 18,510 bytes, line 19
19constantOr("default")==="none",I=v.pitch<15?gy(.07,.7,W((14-v.zoom)/5,0,1)):.07;return{u_matrix:xy(r,e,i,o),u_pixels_to_tile_units:b,u_device_pixel_ratio:h,u_width_scale:u,u_floor_width_scale:f,u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:a,u_texsize:by(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:yy(e,r.transform),u_alpha_discard_threshold:0,u_trim_offset:_,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:I,u_tile_to_meter:J(e.tileID.canonical,0),u_ground_shadow_factor:g}},s.d0=ql,s.d1=function(r,e,i){const o=Math.sqrt(r*r+e*e+i*i),a=o>0?Math.acos(i/o)*rl:0;let h=r!==0||e!==0?Math.atan2(-e,-r)*rl+90:0;return h<0&&(h+=360),[o,h,a]},s.d2=gr,s.d3=br,s.d4=J,s.d5=Ui,s.d6=Nt,s.d7=xn,s.d8=function(r){return[Math.pow(r[0],1/2.2),Math.pow(r[1],1/2.2),Math.pow(r[2],1/2.2)]},s.d9=c_,s.dA=zp,s.dB=function(r){const e=Y-5;r=W(r,-e,e)/e*90;const i=Math.pow(Math.abs(Math.sin(ii(r))),3);return Math.round(i*(c.length-1))},s.dC=function(r,e,i,o){const a=e.getNorth(),h=e.getSouth(),u=e.getWest(),f=e.getEast(),_=1<<r.z,g=f-u,v=a-h,b=g/n,w=-v/c[i],I=[0,b,0,w,0,0,a,u,0];if(r.z>0){const A=180/o;qn(I,I,[A/g+1,0,0,0,A/v+1,0,-.5*A/b,.5*A/w,1])}return I[2]=_,I[5]=r.x,I[8]=r.y,I},s.dD=vs,s.dE=function(r,e,i){const o=It(new Float64Array(16)),a=(e/(1<<r)-.5)*Math.PI*2;return So(o,i.globeMatrix,a),Float32Array.from(o)},s.dF=class{isDataAvailableAtPoint(r){const e=this._source();if(this.isUsingMockSource()||!e||r.y<0||r.y>1)return!1;const i=e.getSource().maxzoom,o=1<<i,a=Math.floor(r.x),h=Math.floor((r.x-a)*o),u=Math.floor(r.y*o),f=this.findDEMTileFor(new Sr(i,a,i,h,u));return!(!f||!f.dem)}getAtPointOrZero(r,e=0){return this.getAtPoint(r,e)||0}getAtPoint(r,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const o=this._source();if(!o||r.y<0||r.y>1)return e;const a=o.getSource().maxzoom,h=1<<a,u=Math.floor(r.x),f=r.x-u,_=new Sr(a,u,a,Math.floor(f*h),Math.floor(r.y*h)),g=this.findDEMTileFor(_);if(!g||!g.dem)return e;const v=g.dem,b=1<<g.tileID.canonical.z,w=(f*b-g.tileID.canonical.x)*v.dim,I=(r.y*b-g.tileID.canonical.y)*v.dim,A=Math.floor(w),P=Math.floor(I);return(i?this.exaggeration():1)*mt(mt(v.get(A,P),v.get(A,P+1),I-P),mt(v.get(A+1,P),v.get(A+1,P+1),I-P),w-A)}getAtTileOffset(r,e,i){const o=1<<r.canonical.z;return this.getAtPointOrZero(new Q(r.wrap+(r.canonical.x+e/Xe)/o,(r.canonical.y+i/Xe)/o))}getAtTileOffsetFunc(r,e,i,o){return a=>{const h=this.getAtTileOffset(r,a.x,a.y),u=o.upVector(r.canonical,a.x,a.y);return Vi(u,u,h*o.upVectorScale(r.canonical,e,i).metersToTile),u}}getForTilePoints(r,e,i,o){if(this.isUsingMockSource())return!1;const a=gh.create(this,r,o);return!!a&&(e.forEach(h=>{h[2]=this.exaggeration()*a.getElevationAt(h[0],h[1],i)}),!0)}getMinMaxForTile(r){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(r);if(!e||!e.dem)return null;const i=e.dem.tree,o=e.tileID,a=1<<r.canonical.z-o.canonical.z;let h=r.canonical.x/a-o.canonical.x,u=r.canonical.y/a-o.canonical.y,f=0;for(let _=0;_<r.canonical.z-o.canonical.z&&!i.leaves[f];_++){h*=2,u*=2;const g=2*Math.floor(u)+Math.floor(h);f=i.childOffsets[f]+g,h%=1,u%=1}return{min:this.exaggeration()*i.minimums[f],max:this.exaggeration()*i.maximums[f]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(r,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(r){throw new Error("Pure virtual method called.")}_source(){throw new Error("Pure virtual method called.")}isUsingMockSource(){throw new Error("Pure virtual method called.")}exaggeration(){throw new Error("Pure virtual method called.")}findDEMTileFor(r){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const r=this.visibleDemTiles;if(r.length===0)return null;let e=!1,i=Number.MAX_VALUE,o=Number.MIN_VALUE;for(const a of r){const h=this.getMinMaxForTile(a.tileID);h&&(i=Math.min(i,h.min),o=Math.max(o,h.max),e=!0)}return e?{min:i,max:o}:null}},s.dG=J_,s.dH=Pp,s.dI=function(r,e){return[Math.pow(r[0],2.2)*e,Math.pow(r[1],2.2)*e,Math.pow(r[2],2.2)*e]},s.dJ=sr,s.dK=function(r,e){var i=Math.sin(e),o=Math.cos(e);return r[0]=o,r[1]=i,r[2]=0,r[3]=-i,r[4]=o,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},s.dL=Zo,s.dM=B_,s.dN=pn,s.dO=Xr,s.dP=256,s.dQ=function(r,e){const i=[0,0,0];return lr(i,i,Dp(vs(e.canonical))),lr(i,i,r),i},s.dR=r=>({u_matrix:new Hl(r),u_texsize:new _o(r),u_pixels_to_tile_units:new ku(r),u_device_pixel_ratio:new dr(r),u_width_scale:new dr(r),u_floor_width_scale:new dr(r),u_image:new nh(r),u_units_to_pixels:new _o(r),u_tile_units_to_pixels:new dr(r),u_alpha_discard_threshold:new dr(r),u_trim_offset:new _o(r),u_trim_fade_range:new _o(r),u_trim_color:new ql(r),u_emissive_strength:new dr(r),u_zbias_factor:new dr(r),u_tile_to_meter:new dr(r),u_ground_shadow_factor:new ka(r),u_pattern_transition:new dr(r)}),s.dS=r=>({u_matrix:new Hl(r),u_pixels_to_tile_units:new ku(r),u_device_pixel_ratio:new dr(r),u_width_scale:new dr(r),u_floor_width_scale:new dr(r),u_units_to_pixels:new _o(r),u_dash_image:new nh(r),u_gradient_image:new nh(r),u_image_height:new dr(r),u_texsize:new _o(r),u_tile_units_to_pixels:new dr(r),u_alpha_discard_threshold:new dr(r),u_trim_offset:new _o(r),u_trim_fade_range:new _o(r),u_trim_color:new ql(r),u_emissive_strength:new dr(r),u_zbias_factor:new dr(r),u_tile_to_meter:new dr(r),u_ground_shadow_factor:new ka(r)}),s.dT=r=>({u_camera_to_center_distance:new dr(r),u_extrude_scale:new ku(r),u_device_pixel_ratio:new dr(r),u_matrix:new Hl(r),u_inv_rot_matrix:new Hl(r),u_merc_center:new _o(r),u_tile_id:new ka(r),u_zoom_transition:new dr(r),u_up_dir:new ka(r),u_emissive_strength:new dr(r)}),s.dU=Da,s.dV=m1,s.dW=U_,s.dX=(r,e,i,o,a,h)=>{const u=r.transform,f=u.projection.name==="globe";let _;if(h.paint.get("circle-pitch-alignment")==="map")if(f){const v=B_(u.zoom,e.canonical)*u._pixelsPerMercatorPixel;_=Float32Array.from([v,0,0,v])}else _=u.calculatePixelsToTileUnitsMatrix(i);else _=new Float32Array([u.pixelsToGLUnits[0],0,0,u.pixelsToGLUnits[1]]);const g={u_camera_to_center_distance:r.transform.getCameraToCenterDistance(u.projection),u_matrix:r.translatePosMatrix(e.projMatrix,i,h.paint.get("circle-translate"),h.paint.get("circle-translate-anchor")),u_device_pixel_ratio:ro.devicePixelRatio,u_extrude_scale:_,u_inv_rot_matrix:N0,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:h.paint.get("circle-emissive-strength")};if(f){g.u_inv_rot_matrix=o,g.u_merc_center=a,g.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],g.u_zoom_transition=ja(u.zoom);const v=a[0]*Xe,b=a[1]*Xe;g.u_up_dir=u.projection.upVector(new Vn(0,0,0),v,b)}return g},s.dY=vy,s.dZ=mn,s.d_=(r,e,i,o,a,h,u,f,_,g)=>{const v=r.transform,b=v.pitch<15?gy(.07,.7,W((14-v.zoom)/5,0,1)):.07,w=i.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:xy(r,e,i,o),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:v.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:a,u_width_scale:h,u_floor_width_scale:u,u_image:0,u_tile_units_to_pixels:yy(e,v),u_units_to_pixels:[1/v.pixelsToGLUnits[0],1/v.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:f,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toPremultipliedRenderColor(w?null:i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength"),u_zbias_factor:b,u_tile_to_meter:J(e.tileID.canonical,0),u_ground_shadow_factor:_,u_pattern_transition:g}},s.da=function(r,e){return r.readFields(hb,{icons:[]},e)},s.db=Gp,s.dc=fh,s.dd=Jm,s.de=ac,s.df=lp,s.dg=Zn,s.dh=la,s.di=kt,s.dj=function(r){const e=r.indexOf(Bl);return e>=0?r.slice(0,e):r},s.dk=function(r){return r.indexOf(Bl)>=0},s.dl=function(r){const e=r.lastIndexOf(Bl);return e>=0?r.slice(e+1):""},s.dm=function(r){const e=[],i=r.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),r.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},s.dn=function(r,e,i,o){return r.type==="custom"?new nb(r,e):new lb[r.type](r,e,i,o)},s.dp=Gt,s.dq=function(r){const e=r.indexOf(Bl);return e>=0?r.slice(e+1):""},s.dr=class extends bh{constructor(r,e){super(r._vectorTileFeature,r._z,r._x,r._y,r.id),r.state&&(this.state=Object.assign({},r.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=r.source,this.sourceLayer=r.sourceLayer,this.layer=r.layer)}toJSON(){const r=super.toJSON();return r.target=this.target,r.namespace=this.namespace,r}},s.ds=fu,s.dt=sa,s.du=function(r){return r({pluginStatus:sn,pluginURL:fs}),fu.on("pluginStateChange",r),r},s.dv=Ou,s.dw=class extends Jn{constructor(r){super(r),this.current=nm}set(r,e,i){if(this.fetchUniformLocation(r,e)){for(let o=0;o<9;o++)if(i[o]!==this.current[o]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},s.dx=B,s.dy=function(r,e,i){const o=ja(i.zoom),a=r.style.map._antialias,h=r.terrain&&r.terrain.exaggeration()>0;return o===0&&!a&&!h},s.dz=function(r){const e=r.pixelsPerMeter,i=e/L(1,r.center.lat),o=It(new Float64Array(16));return tn(o,o,[r.point.x,r.point.y,0]),Zr(o,o,[i,i,e]),Float32Array.from(o)},s.e=Br,s.e$=mu,s.e0=ft,s.e1=Vu,s.e2=q,s.e3=Hs,s.e4=jp,s.e5=Rg,s.e6=Ga,s.e7=450,s.e8=7,s.e9=re,s.eA=function(r,e,i,o,a,h,u,f,_,g,v,b,w,I,A,P){var R=new Vt(16);return R[0]=r,R[1]=e,R[2]=i,R[3]=o,R[4]=a,R[5]=h,R[6]=u,R[7]=f,R[8]=_,R[9]=g,R[10]=v,R[11]=b,R[12]=w,R[13]=I,R[14]=A,R[15]=P,R},s.eB=x,s.eC=Au,s.eD=Vl,s.eE=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Be(1/0,1/0),max:new Be(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(r,e=!1){const i=yg(new Be(0,0),new Be(Xe,Xe),r),o=[];if(e&&!wm(i,this._globalClipBounds))return o;for(const a of this._activeRegions){if(a.hiddenByOverlap||!wm(i,a))continue;const h=pv(a.min,a.max,r);o.push({min:h.min,max:h.max,sourceId:this._sourceIds[a.priority],footprint:a.footprint,footprintTileId:a.tileId,order:a.order,clipMask:a.clipMask,clipScope:a.clipScope})}return o}setSources(r){this._setSources(r.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const o of e.cache.getVisibleCoordinates()){const a=e.cache.getTile(o).buckets[e.layer];a&&a.updateFootprints(o.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask,getClipScope:()=>e.clipScope})))}_addSource(r){const e=r.getFootprints();if(e.length===0)return;const i=r.getOrder(),o=r.getClipMask(),a=r.getClipScope();for(const h of e){if(!h.footprint)continue;const u=yg(h.footprint.min,h.footprint.max,h.id);this._activeRegions.push({min:u.min,max:u.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:h.id,footprint:h.footprint,order:i,clipMask:o,clipScope:a})}this._sourceIds.push(r.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||Bp(e.min,i.min)||Bp(e.max,i.max)||e.order-i.order||e.clipMask-i.clipMask||function(o,a){const h=(u,f)=>u+f;return o.length-a.length||o.reduce(h,"").localeCompare(a.reduce(h,""))}(e.clipScope,i.clipScope));let r=this._activeRegions.length!==this._prevRegions.length;if(!r){let e=0;for(;!r&&e!==this._activeRegions.length;){const i=this._activeRegions[e],o=this._prevRegions[e];r=i.priority!==o.priority||!gg(i,o)||i.order!==o.order||i.clipMask!==o.clipMask||!zo(i.clipScope,o.clipScope),++e}}if(r){++this._updateTime;for(const i of this._activeRegions)i.order!==$u&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,i.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,i.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,i.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,i.max.y));const e=i=>{const o=this._activeRegions;if(i>=o.length)return i;const a=o[i].priority;for(;i<o.length&&o[i].priority===a;)++i;return i};if(this._sourceIds.length>1){let i=0,o=e(i);for(;i!==o;){let a=i;const h=i;for(;a!==o;){const u=this._activeRegions[a];u.hiddenByOverlap=!1;for(let f=0;f<h;f++){const _=this._activeRegions[f];if(!_.hiddenByOverlap&&u.order===$u&&wm(u,_)&&(u.hiddenByOverlap=xg(u.footprint,u.tileId,_.footprint,_.tileId),u.hiddenByOverlap))break}++a}i=o,o=e(i)}}}}_setSources(r){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=r.length-1;e>=0;e--)this._addSource(r[e]);this._computeReplacement()}},s.eF=$u,s.eG=class{constructor(r){this._createGrid(r),this._createPoles(r)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const r of this._poleSegments)r.destroy();for(const r of this._gridSegments)r.withSkirts.destroy(),r.withoutSkirts.destroy()}_fillGridMeshWithLods(r,e){const i=new yn,o=new Ni,a=[],h=r+1+2,u=e[0]+1,f=e[0]+1+(1+e.length),_=(g,v,b)=>{let w=g===h-1?g-2:g===0?g:g-1;return w+=b?24575:0,[w,v]};for(let g=0;g<h;++g)i.emplaceBack(..._(g,0,!0));for(let g=0;g<u;++g)for(let v=0;v<h;++v)i.emplaceBack(..._(v,g,(v===0||v===h-1)&&!0));for(let g=0;g<e.length;++g){const v=e[g];for(let b=0;b<h;++b)i.emplaceBack(..._(b,v,!0))}for(let g=0;g<e.length;++g){const v=o.length,b=e[g]+1+2,w=new Ni;for(let P=0;P<b-1;P++){const R=P===b-2,O=R?h*(f-e.length+g-P):h;for(let j=0;j<h-1;j++){const V=P*h+j;P===0||R||j===0||j===h-2?(w.emplaceBack(V+1,V,V+O),w.emplaceBack(V+O,V+O+1,V+1)):(o.emplaceBack(V+1,V,V+O),o.emplaceBack(V+O,V+O+1,V+1))}}const I=qi.simpleSegment(0,v,i.length,o.length-v);for(let P=0;P<w.uint16.length;P+=3)o.emplaceBack(w.uint16[P],w.uint16[P+1],w.uint16[P+2]);const A=qi.simpleSegment(0,v,i.length,o.length-v);a.push({withoutSkirts:I,withSkirts:A})}return{vertices:i,indices:o,segments:a}}_createGrid(r){const e=this._fillGridMeshWithLods(n,c);this._gridSegments=e.segments,this._gridBuffer=r.createVertexBuffer(e.vertices,D_.members),this._gridIndexBuffer=r.createIndexBuffer(e.indices,!0)}_createPoles(r){const e=new Ni;for(let u=0;u<=n;u++)e.emplaceBack(0,u+1,u+2);this._poleIndexBuffer=r.createIndexBuffer(e,!0);const i=new Gs,o=new Gs,a=new Gs,h=new Gs;this._poleSegments=[];for(let u=0,f=0;u<Cp;u++){const _=360/(1<<u);i.emplaceBack(0,-Qr,0,.5,0),o.emplaceBack(0,-Qr,0,.5,1),a.emplaceBack(0,-Qr,0,.5,.5),h.emplaceBack(0,-Qr,0,.5,.5);for(let g=0;g<=n;g++){let v=g/n,b=0;const w=mt(0,_,v),[I,A,P]=m(k0,B0,w,Qr);i.emplaceBack(I,A,P,v,b),o.emplaceBack(I,A,P,v,1-b);const R=ii(w);v=.5+.5*Math.sin(R),b=.5+.5*Math.cos(R),a.emplaceBack(I,A,P,v,b),h.emplaceBack(I,A,P,v,1-b)}this._poleSegments.push(qi.simpleSegment(f,0,66,64)),f+=66}this._poleNorthVertexBuffer=r.createVertexBuffer(i,Mp,!1),this._poleSouthVertexBuffer=r.createVertexBuffer(o,Mp,!1),this._texturedPoleNorthVertexBuffer=r.createVertexBuffer(a,Mp,!1),this._texturedPoleSouthVertexBuffer=r.createVertexBuffer(h,Mp,!1)}getGridBuffers(r,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[r].withSkirts:this._gridSegments[r].withoutSkirts]}getPoleBuffers(r,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[r]]}},s.eH=mg,s.eI=Z,s.eJ=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},s.eK=oe,s.eL=K,s.eM=function(r,e,i){return r[0]=e[0]/i[0],r[1]=e[1]/i[1],r[2]=e[2]/i[2],r},s.eN=un,s.eO=y,s.eP=ic,s.eQ=ur,s.eR=function([r,e,i]){const o=Math.hypot(r,e,i),a=Math.atan2(r,i),h=.5*Math.PI-Math.acos(-e/o);return new S(ye(a),ye(h))},s.eS=An,s.eT=km,s.eU=function(r){const e=r.navigator?r.navigator.userAgent:null;return!!function(i){if(er==null){const o=i.navigator?i.navigator.userAgent:null;er=!!i.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return er}(r)&&!(!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/)))},s.eV=function(r,e){no=r,Do=e},s.eW=pm,s.eX=V_,s.eY=function(r){const e=[0,0,0],i=It(new Float64Array(16));return Wi(i,r.pixelMatrix,r.globeMatrix),lr(e,e,i),new Be(e[0],e[1])},s.eZ=function(){const r=Ju;r&&(r.isPreloaded()&&r.numActive()===1?(r.release(Mm),Ju=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()"))},s.e_=function(){Gp().acquire(Mm)},s.ea=function(r,e){if(r===e){var i=e[1],o=e[2],a=e[3],h=e[6],u=e[7],f=e[11];r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=i,r[6]=e[9],r[7]=e[13],r[8]=o,r[9]=h,r[11]=e[14],r[12]=a,r[13]=u,r[14]=f}else r[0]=e[0],r[1]=e[4],r[2]=e[8],r[3]=e[12],r[4]=e[1],r[5]=e[5],r[6]=e[9],r[7]=e[13],r[8]=e[2],r[9]=e[6],r[10]=e[10],r[11]=e[14],r[12]=e[3],r[13]=e[7],r[14]=e[11],r[15]=e[15];return r},s.eb=rb,s.ec=Wt,s.ed=Pu,s.ee=256,s.ef=um,s.eg=Fn,s.eh=So,s.ei=function(r,e){return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[4],r[4]=e[5],r[5]=e[6],r[6]=e[8],r[7]=e[9],r[8]=e[10],r},s.ej=Gs,s.ek=Iu,s.el=Jd,s.em=function(r,e,i,o,a){return W((r-e)/(i-e)*(a-o)+o,o,a)},s.en=ea,s.eo=function(r,e){var i=e[0],o=e[1],a=e[2],h=e[3],u=e[4],f=e[5],_=e[6],g=e[7],v=e[8],b=v*u-f*g,w=-v*h+f*_,I=g*h-u*_,A=i*b+o*w+a*I;return A?(r[0]=b*(A=1/A),r[1]=(-v*o+a*g)*A,r[2]=(f*o-a*u)*A,r[3]=w*A,r[4]=(v*i-a*_)*A,r[5]=(-f*i+a*h)*A,r[6]=I*A,r[7]=(-g*i+o*_)*A,r[8]=(u*i-o*h)*A,r):null},s.ep=2,s.eq=$o,s.er=Bm,s.es=[1,1,1],s.et=class{constructor(r,e,i,o){this.context=r,this.format=o,this.size=i,this.texture=r.gl.createTexture();const[a,h,u]=this.size,{gl:f}=r;f.bindTexture(f.TEXTURE_3D,this.texture),r.pixelStoreUnpackFlipY.set(!1),r.pixelStoreUnpack.set(1),r.pixelStoreUnpackPremultiplyAlpha.set(!1),f.texImage3D(f.TEXTURE_3D,0,this.format,a,h,u,0,Lm(this.format),Fm(this.format),e.data)}bind(r,e){const{context:i}=this,{gl:o}=i;
19o.bindTexture(o.TEXTURE_3D,this.texture),r!==this.minFilter&&(o.texParameteri(o.TEXTURE_3D,o.TEXTURE_MAG_FILTER,r),o.texParameteri(o.TEXTURE_3D,o.TEXTURE_MIN_FILTER,r),this.minFilter=r),e!==this.wrapS&&(o.texParameteri(o.TEXTURE_3D,o.TEXTURE_WRAP_S,e),o.texParameteri(o.TEXTURE_3D,o.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:r}=this.context;r.deleteTexture(this.texture),this.texture=null}},s.eu=gh,s.ev=Ja,s.ew=function(r,e,i,o){var a=e[0],h=e[1],u=e[2],f=e[3];return r[0]=a+o*(i[0]-a),r[1]=h+o*(i[1]-h),r[2]=u+o*(i[2]-u),r[3]=f+o*(i[3]-f),r},s.ex=uh,s.ey=mo,s.ez=ys,s.f=function(r){return btoa(encodeURIComponent(r).replace(/%([0-9A-F]{2})/g,(e,i)=>String.fromCharCode(+("0x"+i))))},s.f0=function(r,e,i=!1){if(sn===Tn.deferred||sn===Tn.loading||sn===Tn.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");fs=ro.resolveURL(r),sn=Tn.deferred,du=e,pu(),i||cp()},s.f1=function(r){lh=ro.resolveURL(r),ch||(ch=new ah(Gp(),new Ps)),ch.broadcast("setMeshoptUrl",lh)},s.f2=Hg,s.f3=function(r){zm=ro.resolveURL(r),ch||(ch=new ah(Gp(),new Ps)),ch.broadcast("setDracoUrl",zm)},s.f4=qg,s.f5=Ku,s.f6=function(r){const e=Is();if(!e)return;const i=e.delete(Ro);r&&i.then(()=>r()).catch(r)},s.f7=Yl,s.f8=nt,s.f9=Ua,s.fa=Vo,s.fb=f0,s.fc=m0,s.fd=py,s.fe=et,s.ff="hd_road_elevation",s.fg=Hi,s.fh=Et,s.fi=Wl,s.fj=Km,s.fk=Ql,s.fl=function(r,e,i,o,a,h,u,f=1,_,g,v){r.createArrays(),r.tilePixelRatio=Xe/(512*r.overscaling),r.compareText={},r.iconsNeedLinear=!1;const b=r.layers[0].layout,w=r.layers[0]._unevaluatedLayout._values,I={};I.scaleFactor=f,I.textSizeScaleRange=b.get("text-size-scale-range"),I.iconSizeScaleRange=b.get("icon-size-scale-range");const[A,P]=I.textSizeScaleRange,[R,O]=I.iconSizeScaleRange;I.textScaleFactor=W(I.scaleFactor,A,P),I.iconScaleFactor=W(I.scaleFactor,R,O);const j=w["text-size"],V=w["icon-size"];if(r.textSizeData.kind==="composite"){const{minZoom:he,maxZoom:Ie}=r.textSizeData;I.compositeTextSizes=[j.possiblyEvaluate(new yi(he,{worldview:v}),h),j.possiblyEvaluate(new yi(Ie,{worldview:v}),h)]}if(r.iconSizeData.kind==="composite"){const{minZoom:he,maxZoom:Ie}=r.iconSizeData;I.compositeIconSizes=[V.possiblyEvaluate(new yi(he,{worldview:v}),h),V.possiblyEvaluate(new yi(Ie,{worldview:v}),h)]}I.layoutTextSize=j.possiblyEvaluate(new yi(u+1,{worldview:v}),h),I.layoutIconSize=V.possiblyEvaluate(new yi(u+1,{worldview:v}),h),I.textMaxSize=j.possiblyEvaluate(new yi(18,{worldview:v}),h);const G=b.get("symbol-placement"),ne=b.get("text-rotation-alignment")==="map"&&G!=="point",ee=b.get("text-size");let ie=!1;const le=[];for(const he of r.features){const Ie=b.get("text-font").evaluate(he,{},h).join(","),pe=ee.evaluate(he,{},h)*I.textScaleFactor,Ce=I.layoutTextSize.evaluate(he,{},h)*I.textScaleFactor,Ge=I.layoutIconSize.evaluate(he,{},h)*I.iconScaleFactor,Pe={horizontal:{},vertical:void 0},Oe=he.text;let je,Se=[0,0];if(Oe){const it=Oe.toString(),gt=b.get("text-letter-spacing").evaluate(he,{},h)*kr,St=b.get("text-line-height").evaluate(he,{},h)*kr,Pt=Zf(it)?gt:0,Ct=b.get("text-anchor").evaluate(he,{},h),$t=b.get("text-variable-anchor");if(!$t){const we=b.get("text-radial-offset").evaluate(he,{},h);if(we)Se=Jy(Ct,[we*kr,Qm]);else{const Ze=b.get("text-offset").evaluate(he,{},h);Se=[Ze[0]*kr,Ze[1]*kr]}}let Ot=ne?"center":b.get("text-justify").evaluate(he,{},h);const Pi=G==="point",H=Pi?b.get("text-max-width").evaluate(he,{},h)*kr:1/0,$=we=>{r.allowVerticalPlacement&&uu(it)&&(Pe.vertical=Wm(Oe,e,i,a,Ie,H,St,Ct,we,Pt,Se,Gn.vertical,!0,Ce,pe,_))};if(!ne&&$t){const we=Ot==="auto"?$t.map(Je=>e_(Je)):[Ot];let Ze=!1;for(let Je=0;Je<we.length;Je++){const Ke=we[Je];if(!Pe.horizontal[Ke])if(Ze)Pe.horizontal[Ke]=Pe.horizontal[0];else{const st=Wm(Oe,e,i,a,Ie,H,St,"center",Ke,Pt,Se,Gn.horizontal,!1,Ce,pe,_);st&&(Pe.horizontal[Ke]=st,Ze=st.positionedLines.length===1)}}$("left")}else{if(Ot==="auto"&&(Ot=e_(Ct)),Pi||b.get("text-writing-mode").indexOf("horizontal")>=0||!uu(it)){const we=Wm(Oe,e,i,a,Ie,H,St,Ct,Ot,Pt,Se,Gn.horizontal,!1,Ce,pe,_);we&&(Pe.horizontal[Ot]=we)}$(Pi?"left":Ot)}}let ke,fe,Ee,$e,Ne,ht,ot=!1;const Le=b.get("icon-text-fit").evaluate(he,{},h);if(he.icon&&he.icon.hasPrimary()){const it=ex(he.icon,r.iconSizeData,w["icon-size"],h,r.zoom,he,_,I.iconScaleFactor,v);
19ke=it.iconPrimary,Ee=it.iconSecondary;const gt=ke.toString();if(fe=o.get(gt),fe&&(Ne=b.get("icon-offset").evaluate(he,{},h),ht=b.get("icon-anchor").evaluate(he,{},h),je=D1(a.get(gt),Ee?a.get(Ee.toString()):void 0,Ne,ht),ot=fe.sdf,r.sdfIcons===void 0?r.sdfIcons=fe.sdf:r.sdfIcons!==fe.sdf&&Ht("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(fe.pixelRatio!==r.pixelRatio||b.get("icon-rotate").constantOr(1)!==0)&&(r.iconsNeedLinear=!0)),Ee){const St=Ee.toString();$e=o.get(St)}}ie=ie||!(!he.icon||!he.icon.hasSecondary());const Ve=t_(Pe.horizontal)||Pe.vertical;r.iconsInText||(r.iconsInText=!!Ve&&Ve.iconsInText);const at=Ce*I.textScaleFactor/kr,{defaultShapedIcon:tt,verticallyShapedIcon:Ye}=G1(r,je,b,he,h,Pe,at,Ne,Le);Le!=="none"&&je&&(Oy(je)||ky(je))&&(tf(0,fe,ke,je,tt,Le,g,o,a),tf(0,$e,Ee,je,tt,Le,g,o,a),Ye&&(tf(0,fe,ke,je,Ye,Le,g,o,a),tf(0,$e,Ee,je,Ye,Le,g,o,a))),je=tt,le.push({feature:he,shapedTextOrientations:Pe,shapedText:Ve,shapedIcon:je,iconPrimary:ke,iconSecondary:Ee,iconOffset:Ne,iconAnchor:ht,verticallyShapedIcon:Ye,layoutTextSize:Ce,layoutIconSize:Ge,textOffset:Se,isSDFIcon:ot,iconTextFit:Le})}return{featureData:le,sizes:I,hasAnySecondaryIcon:ie,textAlongLine:ne,symbolPlacement:G}},s.fm=$y,s.fn=function(r,e,i,o,a,h,u,f,_,g){const{featureData:v,hasAnySecondaryIcon:b,sizes:w,textAlongLine:I,symbolPlacement:A}=e;for(const P of v){const{shapedIcon:R,verticallyShapedIcon:O,feature:j,shapedTextOrientations:V,shapedText:G,layoutTextSize:ne,textOffset:ee,isSDFIcon:ie,iconPrimary:le,iconSecondary:he,iconTextFit:Ie,iconOffset:pe}=P;tx(R,g.iconPositions,le,he),tx(O,g.iconPositions,le,he),U1(V,g.iconPositions),j1(le,he,g.iconPositions),(G||R)&&q1(r,j,V,R,O,_,w,ne,0,ee,ie,o,a,u,f,b,Ie,pe,I,A)}i&&r.generateCollisionDebugBuffers(h,r.collisionBoxArray,w.textScaleFactor)},s.fo=lt,s.fp=wf,s.fq=ge,s.fr=function(r){let e=0;if(new Uint32Array(r,0,1)[0]!==Zg){const i=new Uint32Array(r,0,7),[,,o,a,h,u]=i;e=i.byteLength+a+h+u+h,(o!==r.byteLength||e>=r.byteLength)&&Ht("Invalid b3dm header information.")}return Kg(r,e)},s.fs=function(r,e){const i=oy(r);for(const o of i){for(const a of o.meshes)qv(a);o.lights&&(o.lightMeshIndex=o.meshes.length,o.meshes.push(Hv(o.lights,e)))}return i},s.ft=_f,s.fu=bi,s.fv=Ug,s.fw=po,s.fx=Tn,s.fy=function(r){na(),ho!=null&&ho.then(e=>{e.keys().then(i=>{for(let o=0;o<i.length-r;o++)e.delete(i[o]).catch(a=>Ht(a.message))}).catch(i=>Ht(i.message))}).catch(e=>Ht(e.message))},s.g=function(r,e){return sa(xe(r,{method:"GET"}),e)},s.h=xe,s.i=function(r){return Br.API_STYLE_REGEX.test(r)&&!rc(r)},s.j=function(r){return r.indexOf("mapbox:")===0},s.k=Qo,s.l=Ih,s.m=function(r){return decodeURIComponent(atob(r).split("").map(e=>"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)).join(""))},s.n=function(r,e){return sa(xe(r,{type:"json"}),e)},s.o=fl,s.p=function(r,e){return sa(xe(r,{method:"POST"}),e)},s.q=ro,s.r=qr,s.s=function(r){try{const e=self[r];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}},s.t=sc,s.u=function(){return function r(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,r)}()},s.v=function(r){return!!r&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(r)},s.w=Ht,s.x=function(){return Pm||(Pm=new Yl),Pm},s.y=__,s.z=Rn}),Pr(["./shared"],function(s){function li(ye){const k=ye?ye.url.toString():void 0;return k?performance.getEntriesByName(k):[]}function Vt(ye){if(typeof ye=="number"||typeof ye=="boolean"||typeof ye=="string"||ye==null)return JSON.stringify(ye);if(Array.isArray(ye)){let B="[";for(const Z of ye)B+=`${Vt(Z)},`;return`${B}]`}let k="{";for(const B of Object.keys(ye).sort())k+=`${B}:${Vt(ye[B])},`;return`${k}}`}function Di(ye){let k="";for(const B of s.bu)k+=`/${Vt(ye[B])}`;return k}class sr{constructor(k){this.keyCache={},this._layers={},this._layerConfigs={},k&&this.replace(k)}replace(k,B){this._layerConfigs={},this._layers={},this.update(k,[],B)}update(k,B,Z){this._options=Z;for(const W of k)this._layerConfigs[W.id]=W,(this._layers[W.id]=s.dn(W,this.scope,null,this._options)).compileFilter(Z),this.keyCache[W.id]&&delete this.keyCache[W.id];for(const W of B)delete this.keyCache[W],delete this._layerConfigs[W],delete this._layers[W];this.familiesBySource={};const oe=function(W,ce){const be={};for(let xe=0;xe<W.length;xe++){const He=W[xe];let ze=ce&&ce[He.id];ze||(He.type==="symbol"?ze=He.id:(ze=Di(He),He.type==="line"&&He.paint&&function wt(Et){return typeof Et=="string"&&Et==="line-progress"||(Array.isArray(Et)?Et.some(wt):!(!Et||typeof Et!="object")&&Object.values(Et).some(wt))}(He.paint["line-width"])&&(ze+=`/${Vt(He.paint["line-width"])}`))),ce&&(ce[He.id]=ze);let ft=be[ze];ft||(ft=be[ze]=[]),ft.push(He)}const ue=[];for(const xe in be)ue.push(be[xe]);return ue}(Object.values(this._layerConfigs),this.keyCache);for(const W of oe){const ce=W.map(ft=>this._layers[ft.id]),be=ce[0];if(be.visibility==="none")continue;const ue=be.source||"";let xe=this.familiesBySource[ue];xe||(xe=this.familiesBySource[ue]={});const He=be.sourceLayer||"_geojsonTileLayer";let ze=xe[He];ze||(ze=xe[He]=[]),ze.push(ce)}}}const to=1*s.fa;class qn{constructor(k){const B={},Z=[];for(const be in k){const ue=k[be],xe=B[be]={};for(const He in ue.glyphs){const ze=ue.glyphs[+He];if(!ze||ze.bitmap.width===0||ze.bitmap.height===0)continue;
19const ft=ze.metrics.localGlyph?to:1,wt={x:0,y:0,w:ze.bitmap.width+2*ft,h:ze.bitmap.height+2*ft};Z.push(wt),xe[He]=wt}}const{w:oe,h:W}=s.H(Z),ce=new s.f9({width:oe||1,height:W||1});for(const be in k){const ue=k[be];for(const xe in ue.glyphs){const He=ue.glyphs[+xe];if(!He||He.bitmap.width===0||He.bitmap.height===0)continue;const ze=B[be][xe],ft=He.metrics.localGlyph?to:1;s.f9.copy(He.bitmap,ce,{x:0,y:0},{x:ze.x+ft,y:ze.y+ft},He.bitmap)}}this.image=ce,this.positions=B}}s.f8(qn,"GlyphAtlas");class To{constructor(k){this.tileID=new s.aM(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.tileZoom=k.tileZoom,this.uid=k.uid,this.zoom=k.zoom,this.lut=k.lut,this.canonical=k.tileID.canonical,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.scope=k.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=k.showCollisionBoxes,this.collectResourceTiming=!!k.request&&k.request.collectResourceTiming,this.promoteId=k.promoteId,this.isSymbolTile=k.isSymbolTile,this.tileTransform=s.aW(k.tileID.canonical,k.projection),this.projection=k.projection,this.worldview=k.worldview,this.localizableLayerIds=k.localizableLayerIds,this.brightness=k.brightness,this.extraShadowCaster=!!k.extraShadowCaster,this.tessellationStep=k.tessellationStep,this.scaleFactor=k.scaleFactor,this.worldview=k.worldview}parse(k,B,Z,oe,W,ce){this.status="parsing",this.data=k,this.collisionBoxArray=new s.b0;const be=new s.fb(Object.keys(k.layers).sort()),ue=new s.fc(this.tileID,this.promoteId);ue.bucketLayerIDs=[];const xe={},He=new s.fd(256,256),ze={featureIndex:ue,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:He,availableImages:Z,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0},ft=[],wt=B.familiesBySource[this.source];for(const Gt in wt){const kt=k.layers[Gt];if(!kt)continue;let qt=!1,Ei=!1,Ht=!1;for(const bi of wt[Gt])bi[0].type==="symbol"?qt=!0:Ei=!0,bi[0].is3D()&&bi[0].type!=="model"&&(Ht=!0);if(this.extraShadowCaster&&!Ht||this.isSymbolTile===!0&&!qt||this.isSymbolTile===!1&&!Ei)continue;kt.version===1&&s.w(`Vector tile source "${this.source}" layer "${Gt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const rr=be.encode(Gt),Cr=[];let br=!1;for(let bi=0,oi=0;bi<kt.length;bi++){const er=kt.feature(bi),Xi=ue.getId(er,Gt);if(this.localizableLayerIds&&this.localizableLayerIds.has(Gt)){const Gi=er.properties?er.properties.worldview:null;if(this.worldview&&typeof Gi=="string")if(Gi==="all")er.properties.$localized=!0;else{if(!Gi.split(",").includes(this.worldview))continue;er.properties.$localized=!0,er.properties.worldview=this.worldview}}!br&&er.properties&&er.properties.hasOwnProperty(s.fe)&&(br=!0),Cr.push({feature:er,id:Xi,index:oi,sourceLayerIndex:rr}),oi++}br&&!ze.elevationFeatures&&k.layers.hasOwnProperty(s.ff)&&(ze.elevationFeatures=s.fg.parseFrom(k.layers[s.ff],this.canonical));for(const bi of wt[Gt]){const oi=bi[0];if(this.extraShadowCaster&&(!oi.is3D()||oi.type==="model")||this.isSymbolTile!==void 0&&oi.type==="symbol"!==this.isSymbolTile||oi.minzoom&&this.zoom<Math.floor(oi.minzoom)||oi.maxzoom&&this.zoom>=oi.maxzoom||oi.visibility==="none")continue;It(bi,this.zoom,ze.brightness,Z,this.worldview);const er=xe[oi.id]=oi.createBucket({index:ue.bucketLayerIDs.length,layers:bi,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:rr,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:oe,worldview:this.worldview});ue.bucketLayerIDs.push(bi.map(Gi=>s.C(Gi.id,Gi.scope)));let Xi=er.prepare?er.prepare():null;Xi!=null?(Xi=Xi.then(()=>er.populate(Cr,ze,this.tileID.canonical,this.tileTransform)),ft.push(Xi)):er.populate(Cr,ze,this.tileID.canonical,this.tileTransform)}}const Et=()=>{let Gt,kt,qt,Ei,Ht,rr;He.trim();const Cr={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},br=()=>{if(Gt)return this.status="done",ce(Gt);if(this.extraShadowCaster)this.status="done",ce(null,{buckets:Object.values(xe).filter(oi=>!oi.isEmpty()),featureIndex:ue,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:ze.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(kt&&qt&&Ei){const oi=new qn(kt),er=new Map;for(const[Dr,pn]of qt.entries()){const{imagePosition:Xr}=s.fj(Dr,pn,s.fk);er.set(Dr,Xr)}const Xi={};for(const Dr in xe){const pn=xe[Dr];pn instanceof s.b1&&(It(pn.layers,this.zoom,ze.brightness,Z,this.worldview),Xi[Dr]=s.fl(pn,kt,oi.positions,qt,er,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Ht,this.worldview))}const Gi={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(W,qt,Ht,()=>{Gi.iconsPending=!1,bi(Xi,oi,Gi)}),this.rasterizeIfNeeded(W,Ei,rr,()=>{Gi.patternsPending=!1,bi(Xi,oi,Gi)})}},bi=(oi,er,Xi,Gi)=>{if(Xi.iconsPending||Xi.patternsPending)return;const Dr=new s.fm(qt,Ei,this.lut);for(const pn in xe){const Xr=xe[pn];if(pn in oi)s.fn(Xr,oi[pn],this.showCollisionBoxes,Z,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,qt,Dr);else if(Xr.hasPattern&&(Xr instanceof s.b7||Xr instanceof s.b8||Xr instanceof s.e4)){It(Xr.layers,this.zoom,ze.brightness,Z,this.worldview);const nl=Object.fromEntries(Dr.patternPositions);Xr.addFeatures(ze,this.tileID.canonical,nl,Z,this.tileTransform,this.brightness)}}this.status="done",ce(null,{buckets:Object.values(xe).filter(pn=>
19!pn.isEmpty()),featureIndex:ue,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:er.image,lineAtlas:He,imageAtlas:Dr,brightness:ze.brightness})};if(!this.extraShadowCaster){const oi=s.fh(ze.glyphDependencies,Gi=>Object.keys(Gi).map(Number));Object.keys(oi).length?W.send("getGlyphs",{uid:this.uid,stacks:oi},(Gi,Dr)=>{Gt||(Gt=Gi,kt=Dr,br())},void 0,!1,Cr):kt={};const er=Array.from(ze.iconDependencies.keys()).map(Gi=>s.I.parse(Gi));er.length?W.send("getImages",{images:er,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Gi,Dr)=>{Gt||(Gt=Gi,qt=new Map,Ht=this.updateImageMapAndGetImageTaskQueue(qt,Dr,ze.iconDependencies),br())},void 0,!1,Cr):(qt=new Map,Ht=new Map);const Xi=Array.from(ze.patternDependencies.keys()).map(Gi=>s.I.parse(Gi));Xi.length?W.send("getImages",{images:Xi,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Gi,Dr)=>{Gt||(Gt=Gi,Ei=new Map,rr=this.updateImageMapAndGetImageTaskQueue(Ei,Dr,ze.patternDependencies),br())},void 0,!1,Cr):(Ei=new Map,rr=new Map)}if(ze.elevationFeatures&&ze.elevationFeatures.length>0){const oi=[];for(const Xi of Object.values(xe))if(Xi instanceof s.b8){const Gi=Xi.getUnevaluatedPortalGraph();Gi&&oi.push(Gi)}const er=s.fi.evaluate(oi);for(const Xi of Object.values(xe))if(Xi instanceof s.b8){const Gi=k.layers[be.decode(Xi.sourceLayerIndex)];Xi.setEvaluatedPortalGraph(er,Gi,this.tileID.canonical,ze.availableImages,ze.brightness)}}br()};ft.length>0?Promise.allSettled(ft).then(Et).catch(ce):Et()}rasterizeIfNeeded(k,B,Z,oe){Array.from(B.values()).some(W=>W.usvg)?this.rasterize(k,B,Z,oe):oe()}updateImageMapAndGetImageTaskQueue(k,B,Z){const oe=new Map;for(const W of B.keys()){const ce=Z.get(W)||[];for(const be of ce){const ue=be.toString(),xe=B.get(be.id.toString());xe.usvg?oe.has(ue)||(oe.set(ue,be),k.set(ue,Object.assign({},xe))):k.set(ue,xe)}}return oe}rasterize(k,B,Z,oe){this.rasterizeTask=k.send("rasterizeImages",{scope:this.scope,tasks:Z},(W,ce)=>{if(!W)for(const[be,ue]of ce.entries()){const xe=Object.assign(B.get(be),{data:ue});B.set(be,xe)}oe()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function It(ye,k,B,Z,oe){const W=new s.aa(k,{brightness:B,worldview:oe});for(const ce of ye)ce.recalculate(W,Z)}class fr extends s.E{constructor(k,B,Z,oe,W,ce,be){super(),this.actor=k,this.layerIndex=B,this.availableImages=Z,this.availableModels=oe,this.loadVectorData=ce||s.aJ,this.loading={},this.loaded={},this.deduped=new s.aI(k.scheduler),this.isSpriteLoaded=W,this.scheduler=k.scheduler,this.brightness=be}loadTile(k,B){const Z=k.uid,oe=k&&k.request,W=oe&&oe.collectResourceTiming,ce=this.loading[Z]=new To(k);ce.abort=this.loadVectorData(k,(be,ue)=>{const xe=!this.loading[Z];if(delete this.loading[Z],ce.cancelRasterize(),xe||be||!ue)return ce.status="done",xe||(this.loaded[Z]=ce),B(be);const He=ue.rawData,ze={};ue.expires&&(ze.expires=ue.expires),ue.cacheControl&&(ze.cacheControl=ue.cacheControl),ce.vectorTile=ue.vectorTile||new s.fo(new s.bq(He));
19const ft=()=>{ce.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(wt,Et)=>{if(wt||!Et)return B(wt);const Gt={};if(W){const kt=li(oe);kt.length>0&&(Gt.resourceTiming=JSON.parse(JSON.stringify(kt)))}B(null,s.h({rawTileData:He.slice(0)},Et,ze,Gt))})};this.isSpriteLoaded?ft():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(ft,{type:"parseTile",isSymbolTile:k.isSymbolTile,zoom:k.tileZoom}):ft()}),this.loaded=this.loaded||{},this.loaded[Z]=ce})}reloadTile(k,B){const Z=this.loaded,oe=k.uid;if(Z&&Z[oe]){const W=Z[oe];W.scaleFactor=k.scaleFactor,W.showCollisionBoxes=k.showCollisionBoxes,W.projection=k.projection,W.brightness=k.brightness,W.tileTransform=s.aW(k.tileID.canonical,k.projection),W.extraShadowCaster=k.extraShadowCaster,W.lut=k.lut,W.worldview=k.worldview;const ce=(be,ue)=>{const xe=W.reloadCallback;xe&&(delete W.reloadCallback,W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,xe)),B(be,ue)};W.status==="parsing"?W.reloadCallback=ce:W.status==="done"&&(W.vectorTile?W.parse(W.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,ce):ce())}else B(null,void 0)}abortTile(k,B){const Z=k.uid,oe=this.loading[Z];oe&&(oe.abort&&oe.abort(),delete this.loading[Z]),B()}removeTile(k,B){const Z=this.loaded,oe=k.uid;Z&&Z[oe]&&delete Z[oe],B()}}class Wi{loadTile(k,B){const{uid:Z,encoding:oe,rawImageData:W,padding:ce}=k,be=ImageBitmap&&W instanceof ImageBitmap?this.getImageData(W,ce):W;B(null,new s.fp(Z,be,oe,ce<1))}reloadTile(k,B){B(null,null)}abortTile(k,B){B()}removeTile(k,B){B()}getImageData(k,B){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(k.width,k.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=k.width,this.offscreenCanvas.height=k.height,this.offscreenCanvasContext.drawImage(k,0,0,k.width,k.height);const Z=this.offscreenCanvasContext.getImageData(-B,-B,k.width+2*B,k.height+2*B);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Z}}s.bp.setPbf(s.bq);class tn{constructor(k){this._mrt=new s.bp(k.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=k.uid,this.tileID=k.tileID,this.source=k.source}parse(k,B){const Z=this._mrt;this.status="parsing",this._entireBuffer=k;try{Z.parseHeader(k),this._isHeaderLoaded=!0;const oe=[];for(const W in Z.layers){const ce=Z.getLayer(W),be=ce.getDataRange(ce.getBandList()),ue=Z.createDecodingTask(be),xe=k.slice(be.firstByte,be.lastByte+1),He=s.bp.performDecoding(xe,ue).then(ze=>ue.complete(null,ze)).catch(ze=>ue.complete(ze,null));oe.push(He)}Promise.allSettled(oe).then(()=>B(null,Z)).catch(W=>B(W))}catch(oe){B(oe)}}}class Zr{constructor(k){this.actor=k,this.loading={},this.loaded={}}loadTile(k,B){const Z=k.uid,oe=k.request,W=this.loading[Z]=new tn(k),{cancel:ce}=s.br(oe,(be,ue,xe,He)=>{const ze=!this.loading[Z];if(delete this.loading[Z],ze||be||!ue)return W.status="done",ze||(this.loaded[Z]=W),B(be);W.parse(ue,(ft,wt)=>{if(ft||!wt)return B(ft);B(null,wt,xe,He)}),this.loaded[Z]=W});W.abort=ce}reloadTile(k,B){B(null,void 0)}abortTile(k,B){const Z=k.uid,oe=this.loading[Z];oe&&(oe.abort&&oe.abort(),delete this.loading[Z]),B()}removeTile(k,B){const Z=k.uid;this.loaded[Z]&&delete this.loaded[Z],B()}decodeRasterArray(k,B){s.bp.performDecoding(k.buffer,k.task).then(Z=>B(null,Z)).catch(Z=>B(Z))}}const Go=s.fq.prototype.toGeoJSON;class So{constructor(k){this._feature=k,this.extent=s.aj,this.type=k.type,this.properties=k.tags,"id"in k&&!isNaN(k.id)&&(this.id=parseInt(k.id,10))}loadGeometry(){if(this._feature.type===1){const k=[];for(const B of this._feature.geometry)k.push([new s.P(B[0],B[1])]);return k}{const k=[];for(const B of this._feature.geometry){const Z=[];for(const oe of B)Z.push(new s.P(oe[0],oe[1]));k.push(Z)}return k}}toGeoJSON(k,B,Z){return Go.call(this,k,B,Z)}}class qo{constructor(k,B){this.name=k,this.extent=s.aj,this.length=B.length,this._jsonFeatures=B}feature(k){return new So(this._jsonFeatures[k])}}class Ks{constructor(k){this.layers={},this.extent=s.aj;for(const B of Object.keys(k))this.layers[B]=new qo(B,k[B])}}const io=64/4096,Ho=128;class tc{constructor(){this.features=new Map}clear(){this.features.clear()}load(k=[],B){for(const Z of k){const oe=Z.id;if(oe==null)continue;let W=this.features.get(oe);W&&this.updateCache(W,B),Z.geometry?(W=Js(Z),this.updateCache(W,B),this.features.set(oe,W)):this.features.delete(oe),this.updateCache(W,B)}}updateCache(k,B){for(const{canonical:Z,uid:oe}of Object.values(B)){const{z:W,x:ce,y:be}=Z;fi(k,Math.pow(2,W),ce,be)&&delete B[oe]}}getTile(k,B,Z){const oe=Math.pow(2,k),W=[];for(const ce of this.features.values())fi(ce,oe,B,Z)&&W.push(Ui(ce,oe,B,Z));return{features:W}}getFeatures(){return[...this.features.values()]}}function fi({minX:ye,minY:k,maxX:B,maxY:Z},oe,W,ce){return ye<(W+1+io)/oe&&k<(ce+1+io)/oe&&B>(W-io)/oe&&Z>(ce-io)/oe}function Js(ye){const{id:k,geometry:B,properties:Z}=ye;if(!B)return;if(B.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:oe,coordinates:W}=B,ce={id:k,type:1,geometry:[],tags:Z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},be=ce.geometry;if(oe==="Point")jr(W,be,ce);else if(oe==="MultiPoint")for(const ue of W)jr(ue,be,ce);else if(oe==="LineString")ce.type=2,gr(W,be,ce);else if(oe==="MultiLineString")ce.type=2,ur(W,be,ce);else if(oe==="Polygon")ce.type=3,ur(W,be,ce,!0);else{if(oe!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");ce.type=3;for(const ue of W)ur(ue,be,ce,!0)}return ce}function jr([ye,k],B,Z){const oe=s.aD(ye);let W=s.aH(k);W=W<0?0:W>1?1:W,B.push(oe,W),Z.minX=Math.min(Z.minX,oe),Z.minY=Math.min(Z.minY,W),Z.maxX=Math.max(Z.maxX,oe),Z.maxY=Math.max(Z.maxY,W)}function gr(ye,k,B,Z=!1,oe=!1){const W=[];for(const ce of ye)jr(ce,W,B);k.push(W),Z&&function(ce,be){let ue=0;for(let xe=0,He=ce.length,ze=He-2;xe<He;ze=xe,xe+=2)ue+=(ce[xe]-ce[ze])*(ce[xe+1]+ce[ze+1]);if(ue>0===be)for(let xe=0,He=ce.length;xe<He/2;xe+=2){const ze=ce[xe],ft=ce[xe+1];
19ce[xe]=ce[He-2-xe],ce[xe+1]=ce[He-1-xe],ce[He-2-xe]=ze,ce[He-1-xe]=ft}}(W,oe)}function ur(ye,k,B,Z=!1){for(let oe=0;oe<ye.length;oe++)gr(ye[oe],k,B,Z,oe===0)}function Ui(ye,k,B,Z){const{id:oe,type:W,geometry:ce,tags:be}=ye,ue=[];if(W===1)(function(xe,He,ze,ft,wt){for(let Et=0;Et<xe.length;Et+=2){const Gt=Math.round(s.aj*(xe[Et+0]*He-ze)),kt=Math.round(s.aj*(xe[Et+1]*He-ft));wt.push([Gt,kt])}})(ce,k,B,Z,ue);else for(const xe of ce)xn(xe,k,B,Z,ue);return{id:oe,type:W,geometry:ue,tags:be}}function xn(ye,k,B,Z,oe){const W=-Ho,ce=s.aj+Ho;let be;for(let ue=0;ue<ye.length-2;ue+=2){let xe=Math.round(s.aj*(ye[ue+0]*k-B)),He=Math.round(s.aj*(ye[ue+1]*k-Z)),ze=Math.round(s.aj*(ye[ue+2]*k-B)),ft=Math.round(s.aj*(ye[ue+3]*k-Z));const wt=ze-xe,Et=ft-He;xe<W&&ze<W||(xe<W?(He+=Math.round(Et*((W-xe)/wt)),xe=W):ze<W&&(ft=He+Math.round(Et*((W-xe)/wt)),ze=W),He<W&&ft<W||(He<W?(xe+=Math.round(wt*((W-He)/Et)),He=W):ft<W&&(ze=xe+Math.round(wt*((W-He)/Et)),ft=W),xe>=ce&&ze>=ce||(xe>=ce?(He+=Math.round(Et*((ce-xe)/wt)),xe=ce):ze>=ce&&(ft=He+Math.round(Et*((ce-xe)/wt)),ze=ce),He>=ce&&ft>=ce||(He>=ce?(xe+=Math.round(wt*((ce-He)/Et)),He=ce):ft>=ce&&(ze=xe+Math.round(wt*((ce-He)/Et)),ft=ce),be&&xe===be[be.length-1][0]&&He===be[be.length-1][1]||(be=[[xe,He]],oe.push(be)),be.push([ze,ft])))))}}function Ya({name:ye,features:k},B){B.writeStringField(1,ye),B.writeVarintField(5,s.aj);const Z=new Map,oe=new Map,W={keys:Z,values:oe,feature:null};for(const ce of k)W.feature=ce,B.writeMessage(2,Eo,W);for(const ce of Z.keys())B.writeStringField(3,ce);for(const ce of oe.keys())B.writeMessage(4,ic,ce)}function Eo(ye,k){const B=ye.feature;B.id===void 0||isNaN(+B.id)||k.writeVarintField(1,+B.id),B.tags&&k.writeMessage(2,Hn,ye),k.writeVarintField(3,B.type),k.writeMessage(4,Qs,B)}function Hn({keys:ye,values:k,feature:B},Z){for(const oe of Object.keys(B.tags)){let W=B.tags[oe];if(W===null)continue;let ce=ye.get(oe);ce===void 0&&(ce=ye.size,ye.set(oe,ce)),Z.writeVarint(ce);const be=typeof W;be!=="string"&&be!=="boolean"&&be!=="number"&&(W=JSON.stringify(W));let ue=k.get(W);ue===void 0&&(ue=k.size,k.set(W,ue)),Z.writeVarint(ue)}}function Vi(ye,k){return(k<<3)+(7&ye)}function rn(ye){return ye<<1^ye>>31}function Qs(ye,k){const{geometry:B,type:Z}=ye;let oe=0,W=0;if(Z===1){k.writeVarint(Vi(1,B.length));for(const ce of B){const be=ce[0]-oe,ue=ce[1]-W;k.writeVarint(rn(be)),k.writeVarint(rn(ue)),oe+=be,W+=ue}}else for(const ce of B){k.writeVarint(Vi(1,1));const be=ce.length-(Z===3?1:0);for(let ue=0;ue<be;ue++){ue===1&&k.writeVarint(Vi(2,be-1));const xe=ce[ue][0]-oe,He=ce[ue][1]-W;k.writeVarint(rn(xe)),k.writeVarint(rn(He)),oe+=xe,W+=He}Z===3&&k.writeVarint(Vi(7,1))}}function ic(ye,k){const B=typeof ye;B==="string"?k.writeStringField(1,ye):B==="boolean"?k.writeBooleanField(7,ye):B==="number"&&(ye%1!=0?k.writeDoubleField(3,ye):ye<0?k.writeSVarintField(6,ye):k.writeVarintField(5,ye))}const $o={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ye=>ye},ki=Math.fround||(ar=new Float32Array(1),ye=>(ar[0]=+ye,ar[0]));var ar;const yr=3,hn=5,lr=6;class Zo{constructor(k){this.options=Object.assign(Object.create($o),k),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(k){const{log:B,minZoom:Z,maxZoom:oe}=this.options;B&&console.time("total time");const W=`prepare ${k.length} points`;B&&console.time(W),this.points=k;const ce=[];for(let ue=0;ue<k.length;ue++){const xe=k[ue];if(!xe.geometry)continue;const[He,ze]=xe.geometry.coordinates,ft=ki($n(He)),wt=ki(cr(ze));ce.push(ft,wt,1/0,ue,-1,1),this.options.reduce&&ce.push(0)}let be=this.trees[oe+1]=this._createTree(ce);B&&console.timeEnd(W);for(let ue=oe;ue>=Z;ue--){const xe=+Date.now();be=this.trees[ue]=this._createTree(this._cluster(be,ue)),B&&console.log("z%d: %d clusters in %dms",ue,be.numItems,+Date.now()-xe)}return B&&console.timeEnd("total time"),this}getClusters(k,B){let Z=((k[0]+180)%360+360)%360-180;const oe=Math.max(-90,Math.min(90,k[1]));let W=k[2]===180?180:((k[2]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,k[3]));if(k[2]-k[0]>=360)Z=-180,W=180;else if(Z>W){const ze=this.getClusters([Z,oe,180,ce],B),ft=this.getClusters([-180,oe,W,ce],B);return ze.concat(ft)}const be=this.trees[this._limitZoom(B)],ue=be.range($n(Z),cr(ce),$n(W),cr(oe)),xe=be.data,He=[];
vendor: 4,449 bytes, line 19
19for(const ze of ue){const ft=this.stride*ze;He.push(xe[ft+hn]>1?Wo(xe,ft,this.clusterProps):this.points[xe[ft+yr]])}return He}getChildren(k){const B=this._getOriginId(k),Z=this._getOriginZoom(k),oe="No cluster with the specified id.",W=this.trees[Z];if(!W)throw new Error(oe);const ce=W.data;if(B*this.stride>=ce.length)throw new Error(oe);const be=this.options.radius/(this.options.extent*Math.pow(2,Z-1)),ue=W.within(ce[B*this.stride],ce[B*this.stride+1],be),xe=[];for(const He of ue){const ze=He*this.stride;ce[ze+4]===k&&xe.push(ce[ze+hn]>1?Wo(ce,ze,this.clusterProps):this.points[ce[ze+yr]])}if(xe.length===0)throw new Error(oe);return xe}getLeaves(k,B,Z){const oe=[];return this._appendLeaves(oe,k,B=B||10,Z=Z||0,0),oe}getTile(k,B,Z){const oe=this.trees[this._limitZoom(k)],W=Math.pow(2,k),{extent:ce,radius:be}=this.options,ue=be/ce,xe=(Z-ue)/W,He=(Z+1+ue)/W,ze={features:[]};return this._addTileFeatures(oe.range((B-ue)/W,xe,(B+1+ue)/W,He),oe.data,B,Z,W,ze),B===0&&this._addTileFeatures(oe.range(1-ue/W,xe,1,He),oe.data,W,Z,W,ze),B===W-1&&this._addTileFeatures(oe.range(0,xe,ue/W,He),oe.data,-1,Z,W,ze),ze.features.length?ze:null}getClusterExpansionZoom(k){let B=this._getOriginZoom(k)-1;for(;B<=this.options.maxZoom;){const Z=this.getChildren(k);if(B++,Z.length!==1)break;k=Z[0].properties.cluster_id}return B}_appendLeaves(k,B,Z,oe,W){const ce=this.getChildren(B);for(const be of ce){const ue=be.properties;if(ue&&ue.cluster?W+ue.point_count<=oe?W+=ue.point_count:W=this._appendLeaves(k,ue.cluster_id,Z,oe,W):W<oe?W++:k.push(be),k.length===Z)break}return W}_createTree(k){const B=new s.c0(k.length/this.stride|0,this.options.nodeSize,Float32Array);for(let Z=0;Z<k.length;Z+=this.stride)B.add(k[Z],k[Z+1]);return B.finish(),B.data=k,B}_addTileFeatures(k,B,Z,oe,W,ce){for(const be of k){const ue=be*this.stride,xe=B[ue+hn]>1;let He,ze,ft;if(xe)He=Ka(B,ue,this.clusterProps),ze=B[ue],ft=B[ue+1];else{const Gt=this.points[B[ue+yr]];He=Gt.properties;const[kt,qt]=Gt.geometry.coordinates;ze=$n(kt),ft=cr(qt)}const wt={type:1,geometry:[[Math.round(this.options.extent*(ze*W-Z)),Math.round(this.options.extent*(ft*W-oe))]],tags:He};let Et;Et=xe||this.options.generateId?B[ue+yr]:this.points[B[ue+yr]].id,Et!==void 0&&(wt.id=Et),ce.features.push(wt)}}_limitZoom(k){return Math.max(this.options.minZoom,Math.min(Math.floor(+k),this.options.maxZoom+1))}_cluster(k,B){const{radius:Z,extent:oe,reduce:W,minPoints:ce}=this.options,be=Z/(oe*Math.pow(2,B)),ue=k.data,xe=[],He=this.stride;for(let ze=0;ze<ue.length;ze+=He){if(ue[ze+2]<=B)continue;ue[ze+2]=B;const ft=ue[ze],wt=ue[ze+1],Et=k.within(ue[ze],ue[ze+1],be),Gt=ue[ze+hn];let kt=Gt;for(const qt of Et){const Ei=qt*He;ue[Ei+2]>B&&(kt+=ue[Ei+hn])}if(kt>Gt&&kt>=ce){let qt,Ei=ft*Gt,Ht=wt*Gt,rr=-1;const Cr=(ze/He<<5)+(B+1)+this.points.length;for(const br of Et){const bi=br*He;if(ue[bi+2]<=B)continue;ue[bi+2]=B;const oi=ue[bi+hn];Ei+=ue[bi]*oi,Ht+=ue[bi+1]*oi,ue[bi+4]=Cr,W&&(qt||(qt=this._map(ue,ze,!0),rr=this.clusterProps.length,this.clusterProps.push(qt)),W(qt,this._map(ue,bi)))}ue[ze+4]=Cr,xe.push(Ei/kt,Ht/kt,1/0,Cr,-1,kt),W&&xe.push(rr)}else{for(let qt=0;qt<He;qt++)xe.push(ue[ze+qt]);if(kt>1)for(const qt of Et){const Ei=qt*He;if(!(ue[Ei+2]<=B)){ue[Ei+2]=B;for(let Ht=0;Ht<He;Ht++)xe.push(ue[Ei+Ht])}}}}return xe}_getOriginId(k){return k-this.points.length>>5}_getOriginZoom(k){return(k-this.points.length)%32}_map(k,B,Z){if(k[B+hn]>1){const ce=this.clusterProps[k[B+lr]];return Z?Object.assign({},ce):ce}const oe=this.points[k[B+yr]].properties,W=this.options.map(oe);return Z&&W===oe?Object.assign({},W):W}}function Wo(ye,k,B){return{type:"Feature",id:ye[k+yr],properties:Ka(ye,k,B),geometry:{type:"Point",coordinates:[(Z=ye[k],360*(Z-.5)),un(ye[k+1])]}};var Z}function Ka(ye,k,B){const Z=ye[k+hn],oe=Z>=1e4?`${Math.round(Z/1e3)}k`:Z>=1e3?Math.round(Z/100)/10+"k":Z,W=ye[k+lr],ce=W===-1?{}:Object.assign({},B[W]);return Object.assign(ce,{cluster:!0,cluster_id:ye[k+yr],point_count:Z,point_count_abbreviated:oe})}function $n(ye){return ye/360+.5}function cr(ye){const k=Math.sin(ye*Math.PI/180),B=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return B<0?0:B>1?1:B}function un(ye){const k=(180-360*ye)*Math.PI/180;return 360*Math.atan(Math.exp(k))/Math.PI-90}function Xo(ye,k,B,Z){let oe=Z;const W=k+(B-k>>1);let ce,be=B-k;const ue=ye[k],xe=ye[k+1],He=ye[B],ze=ye[B+1];for(let ft=k+3;ft<B;ft+=3){const wt=Ja(ye[ft],ye[ft+1],ue,xe,He,ze);if(wt>oe)ce=ft,oe=wt;else if(wt===oe){const Et=Math.abs(ft-W);
vendor: 11,116 bytes, line 19
19Et<be&&(ce=ft,be=Et)}}oe>Z&&(ce-k>3&&Xo(ye,k,ce,Z),ye[ce+2]=oe,B-ce>3&&Xo(ye,ce,B,Z))}function Ja(ye,k,B,Z,oe,W){let ce=oe-B,be=W-Z;if(ce!==0||be!==0){const ue=((ye-B)*ce+(k-Z)*be)/(ce*ce+be*be);ue>1?(B=oe,Z=W):ue>0&&(B+=ce*ue,Z+=be*ue)}return ce=ye-B,be=k-Z,ce*ce+be*be}function Io(ye,k,B,Z){const oe={id:ye??null,type:k,geometry:B,tags:Z,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(k==="Point"||k==="MultiPoint"||k==="LineString")An(oe,B);else if(k==="Polygon")An(oe,B[0]);else if(k==="MultiLineString")for(const W of B)An(oe,W);else if(k==="MultiPolygon")for(const W of B)An(oe,W[0]);return oe}function An(ye,k){for(let B=0;B<k.length;B+=3)ye.minX=Math.min(ye.minX,k[B]),ye.minY=Math.min(ye.minY,k[B+1]),ye.maxX=Math.max(ye.maxX,k[B]),ye.maxY=Math.max(ye.maxY,k[B+1])}function vn(ye,k,B,Z){if(!k.geometry)return;const oe=k.geometry.coordinates;if(oe&&oe.length===0)return;const W=k.geometry.type,ce=Math.pow(B.tolerance/((1<<B.maxZoom)*B.extent),2);let be=[],ue=k.id;if(B.promoteId?ue=k.properties[B.promoteId]:B.generateId&&(ue=Z||0),W==="Point")Ao(oe,be);else if(W==="MultiPoint")for(const xe of oe)Ao(xe,be);else if(W==="LineString")Co(oe,be,ce,!1);else if(W==="MultiLineString"){if(B.lineMetrics){for(const xe of oe)be=[],Co(xe,be,ce,!1),ye.push(Io(ue,"LineString",be,k.properties));return}Ss(oe,be,ce,!1)}else if(W==="Polygon")Ss(oe,be,ce,!0);else{if(W!=="MultiPolygon"){if(W==="GeometryCollection"){for(const xe of k.geometry.geometries)vn(ye,{id:ue,geometry:xe,properties:k.properties},B,Z);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const xe of oe){const He=[];Ss(xe,He,ce,!0),be.push(He)}}ye.push(Io(ue,W,be,k.properties))}function Ao(ye,k){k.push(ea(ye[0]),dn(ye[1]),0)}function Co(ye,k,B,Z){let oe,W,ce=0;for(let ue=0;ue<ye.length;ue++){const xe=ea(ye[ue][0]),He=dn(ye[ue][1]);k.push(xe,He,0),ue>0&&(ce+=Z?(oe*He-xe*W)/2:Math.sqrt(Math.pow(xe-oe,2)+Math.pow(He-W,2))),oe=xe,W=He}const be=k.length-3;k[2]=1,Xo(k,0,be,B),k[be+2]=1,k.size=Math.abs(ce),k.start=0,k.end=k.size}function Ss(ye,k,B,Z){for(let oe=0;oe<ye.length;oe++){const W=[];Co(ye[oe],W,B,Z),k.push(W)}}function ea(ye){return ye/360+.5}function dn(ye){const k=Math.sin(ye*Math.PI/180),B=.5-.25*Math.log((1+k)/(1-k))/Math.PI;return B<0?0:B>1?1:B}function Cn(ye,k,B,Z,oe,W,ce,be){if(Z/=k,W>=(B/=k)&&ce<Z)return ye;if(ce<B||W>=Z)return null;const ue=[];for(const xe of ye){const He=xe.geometry;let ze=xe.type;const ft=oe===0?xe.minX:xe.minY,wt=oe===0?xe.maxX:xe.maxY;if(ft>=B&&wt<Z){ue.push(xe);continue}if(wt<B||ft>=Z)continue;let Et=[];if(ze==="Point"||ze==="MultiPoint")Qa(He,Et,B,Z,oe);else if(ze==="LineString")Mo(He,Et,B,Z,oe,!1,be.lineMetrics);else if(ze==="MultiLineString")Wr(He,Et,B,Z,oe,!1);else if(ze==="Polygon")Wr(He,Et,B,Z,oe,!0);else if(ze==="MultiPolygon")for(const Gt of He){const kt=[];Wr(Gt,kt,B,Z,oe,!0),kt.length&&Et.push(kt)}if(Et.length){if(be.lineMetrics&&ze==="LineString"){for(const Gt of Et)ue.push(Io(xe.id,ze,Gt,xe.tags));continue}ze!=="LineString"&&ze!=="MultiLineString"||(Et.length===1?(ze="LineString",Et=Et[0]):ze="MultiLineString"),ze!=="Point"&&ze!=="MultiPoint"||(ze=Et.length===3?"Point":"MultiPoint"),ue.push(Io(xe.id,ze,Et,xe.tags))}}return ue.length?ue:null}function Qa(ye,k,B,Z,oe){for(let W=0;W<ye.length;W+=3){const ce=ye[W+oe];ce>=B&&ce<=Z&&Mn(k,ye[W],ye[W+1],ye[W+2])}}function Mo(ye,k,B,Z,oe,W,ce){let be=ta(ye);const ue=oe===0?Yo:Po;let xe,He,ze=ye.start;for(let kt=0;kt<ye.length-3;kt+=3){const qt=ye[kt],Ei=ye[kt+1],Ht=ye[kt+2],rr=ye[kt+3],Cr=ye[kt+4],br=oe===0?qt:Ei,bi=oe===0?rr:Cr;let oi=!1;ce&&(xe=Math.sqrt(Math.pow(qt-rr,2)+Math.pow(Ei-Cr,2))),br<B?bi>B&&(He=ue(be,qt,Ei,rr,Cr,B),ce&&(be.start=ze+xe*He)):br>Z?bi<Z&&(He=ue(be,qt,Ei,rr,Cr,Z),ce&&(be.start=ze+xe*He)):Mn(be,qt,Ei,Ht),bi<B&&br>=B&&(He=ue(be,qt,Ei,rr,Cr,B),oi=!0),bi>Z&&br<=Z&&(He=ue(be,qt,Ei,rr,Cr,Z),oi=!0),!W&&oi&&(ce&&(be.end=ze+xe*He),k.push(be),be=ta(ye)),ce&&(ze+=xe)}let ft=ye.length-3;const wt=ye[ft],Et=ye[ft+1],Gt=oe===0?wt:Et;Gt>=B&&Gt<=Z&&Mn(be,wt,Et,ye[ft+2]),ft=be.length-3,W&&ft>=3&&(be[ft]!==be[0]||be[ft+1]!==be[1])&&Mn(be,be[0],be[1],be[2]),be.length&&k.push(be)}function ta(ye){const k=[];return k.size=ye.size,k.start=ye.start,k.end=ye.end,k}function Wr(ye,k,B,Z,oe,W){for(const ce of ye)Mo(ce,k,B,Z,oe,W,!1)}function Mn(ye,k,B,Z){ye.push(k,B,Z)}function Yo(ye,k,B,Z,oe,W){const ce=(W-k)/(Z-k);return Mn(ye,W,B+(oe-B)*ce,1),ce}function Po(ye,k,B,Z,oe,W){const ce=(W-B)/(oe-B);return Mn(ye,k+(Z-k)*ce,W,1),ce}function Ko(ye,k){const B=[];for(let Z=0;Z<ye.length;Z++){const oe=ye[Z],W=oe.type;let ce;if(W==="Point"||W==="MultiPoint"||W==="LineString")ce=Jo(oe.geometry,k);else if(W==="MultiLineString"||W==="Polygon"){ce=[];for(const be of oe.geometry)ce.push(Jo(be,k))}else if(W==="MultiPolygon"){ce=[];for(const be of oe.geometry){const ue=[];for(const xe of be)ue.push(Jo(xe,k));ce.push(ue)}}B.push(Io(oe.id,W,ce,oe.tags))}return B}function Jo(ye,k){const B=[];B.size=ye.size,ye.start!==void 0&&(B.start=ye.start,B.end=ye.end);for(let Z=0;Z<ye.length;Z+=3)B.push(ye[Z]+k,ye[Z+1],ye[Z+2]);return B}function ia(ye,k){if(ye.transformed)return ye;const B=1<<ye.z,Z=ye.x,oe=ye.y;for(const W of ye.features){const ce=W.geometry,be=W.type;if(W.geometry=[],be===1)for(let ue=0;ue<ce.length;ue+=2)W.geometry.push(Bi(ce[ue],ce[ue+1],k,B,Z,oe));else for(let ue=0;ue<ce.length;ue++){const xe=[];for(let He=0;He<ce[ue].length;He+=2)xe.push(Bi(ce[ue][He],ce[ue][He+1],k,B,Z,oe));W.geometry.push(xe)}}return ye.transformed=!0,ye}function Bi(ye,k,B,Z,oe,W){return[Math.round(B*(ye*Z-oe)),Math.round(B*(k*Z-W))]}function el(ye,k,B,Z,oe){const W=k===oe.maxZoom?0:oe.tolerance/((1<<k)*oe.extent),ce={features:[],numPoints:0,numSimplified:0,numFeatures:ye.length,source:null,x:B,y:Z,z:k,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const be of ye)tl(ce,be,W,oe);return ce}function tl(ye,k,B,Z){const oe=k.geometry,W=k.type,ce=[];if(ye.minX=Math.min(ye.minX,k.minX),ye.minY=Math.min(ye.minY,k.minY),ye.maxX=Math.max(ye.maxX,k.maxX),ye.maxY=Math.max(ye.maxY,k.maxY),W==="Point"||W==="MultiPoint")for(let be=0;be<oe.length;be+=3)ce.push(oe[be],oe[be+1]),ye.numPoints++,ye.numSimplified++;else if(W==="LineString")Pn(ce,oe,ye,B,!1,!1);else if(W==="MultiLineString"||W==="Polygon")for(let be=0;be<oe.length;be++)Pn(ce,oe[be],ye,B,W==="Polygon",be===0);else if(W==="MultiPolygon")for(let be=0;be<oe.length;be++){const ue=oe[be];for(let xe=0;xe<ue.length;xe++)Pn(ce,ue[xe],ye,B,!0,xe===0)}if(ce.length){let be=k.tags||null;if(W==="LineString"&&Z.lineMetrics){be={};for(const xe in k.tags)be[xe]=k.tags[xe];be.mapbox_clip_start=oe.start/oe.size,be.mapbox_clip_end=oe.end/oe.size}const ue={geometry:ce,type:W==="Polygon"||W==="MultiPolygon"?3:W==="LineString"||W==="MultiLineString"?2:1,tags:be};k.id!==null&&(ue.id=k.id),ye.features.push(ue)}}function Pn(ye,k,B,Z,oe,W){const ce=Z*Z;if(Z>0&&k.size<(oe?ce:Z))return void(B.numPoints+=k.length/3);const be=[];for(let ue=0;ue<k.length;ue+=3)(Z===0||k[ue+2]>ce)&&(B.numSimplified++,be.push(k[ue],k[ue+1])),B.numPoints++;oe&&function(ue,xe){let He=0;for(let ze=0,ft=ue.length,wt=ft-2;ze<ft;wt=ze,ze+=2)He+=(ue[ze]-ue[wt])*(ue[ze+1]+ue[wt+1]);if(He>0===xe)for(let ze=0,ft=ue.length;ze<ft/2;ze+=2){const wt=ue[ze],Et=ue[ze+1];ue[ze]=ue[ft-2-ze],ue[ze+1]=ue[ft-1-ze],ue[ft-2-ze]=wt,ue[ft-1-ze]=Et}}(be,W),ye.push(be)}const il={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Th{constructor(k,B){const Z=(B=this.options=function(W,ce){for(const be in ce)W[be]=ce[be];return W}(Object.create(il),B)).debug;if(Z&&console.time("preprocess data"),B.maxZoom<0||B.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(B.promoteId&&B.generateId)throw new Error("promoteId and generateId cannot be used together.");let oe=function(W,ce){const be=[];if(W.type==="FeatureCollection")for(let ue=0;ue<W.features.length;ue++)vn(be,W.features[ue],ce,ue);else vn(be,W.type==="Feature"?W:{geometry:W},ce);return be}(k,B);this.tiles={},this.tileCoords=[],Z&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",B.indexMaxZoom,B.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),oe=function(W,ce){const be=ce.buffer/ce.extent;let ue=W;const xe=Cn(W,1,-1-be,be,0,-1,2,ce),He=Cn(W,1,1-be,2+be,0,-1,2,ce);return(xe||He)&&(ue=Cn(W,1,-be,1+be,0,-1,2,ce)||[],xe&&(ue=Ko(xe,1).concat(ue)),He&&(ue=ue.concat(Ko(He,-1)))),ue}(oe,B),oe.length&&this.splitTile(oe,0,0,0),Z&&(oe.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(k,B,Z,oe,W,ce,be){const ue=[k,B,Z,oe],xe=this.options,He=xe.debug;for(;ue.length;){oe=ue.pop(),Z=ue.pop(),B=ue.pop(),k=ue.pop();const ze=1<<B,ft=ra(B,Z,oe);let wt=this.tiles[ft];if(!wt&&(He>1&&console.time("creation"),wt=this.tiles[ft]=el(k,B,Z,oe,xe),this.tileCoords.push({z:B,x:Z,y:oe}),He)){He>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",B,Z,oe,wt.numFeatures,wt.numPoints,wt.numSimplified),console.timeEnd("creation"));const oi=`z${B}`;this.stats[oi]=(this.stats[oi]||0)+1,this.total++}if(wt.source=k,W==null){if(B===xe.indexMaxZoom||wt.numPoints<=xe.indexMaxPoints)continue}else{if(B===xe.maxZoom||B===W)continue;if(W!=null){const oi=W-B;if(Z!==ce>>oi||oe!==be>>oi)continue}}if(wt.source=null,k.length===0)continue;He>1&&console.time("clipping");const Et=.5*xe.buffer/xe.extent,Gt=.5-Et,kt=.5+Et,qt=1+Et;let Ei=null,Ht=null,rr=null,Cr=null,br=Cn(k,ze,Z-Et,Z+kt,0,wt.minX,wt.maxX,xe),bi=Cn(k,ze,Z+Gt,Z+qt,0,wt.minX,wt.maxX,xe);k=null,br&&(Ei=Cn(br,ze,oe-Et,oe+kt,1,wt.minY,wt.maxY,xe),Ht=Cn(br,ze,oe+Gt,oe+qt,1,wt.minY,wt.maxY,xe),br=null),bi&&(rr=Cn(bi,ze,oe-Et,oe+kt,1,wt.minY,wt.maxY,xe),Cr=Cn(bi,ze,oe+Gt,oe+qt,1,wt.minY,wt.maxY,xe),bi=null),He>1&&console.timeEnd("clipping"),ue.push(Ei||[],B+1,2*Z,2*oe),ue.push(Ht||[],B+1,2*Z,2*oe+1),ue.push(rr||[],B+1,2*Z+1,2*oe),ue.push(Cr||[],B+1,2*Z+1,2*oe+1)}}getTile(k,B,Z){k=+k,B=+B,Z=+Z;const oe=this.options,{extent:W,debug:ce}=oe;if(k<0||k>24)return null;const be=1<<k,ue=ra(k,B=B+be&be-1,Z);if(this.tiles[ue])return ia(this.tiles[ue],W);ce>1&&console.log("drilling down to z%d-%d-%d",k,B,Z);let xe,He=k,ze=B,ft=Z;for(;!xe&&He>0;)He--,ze>>=1,ft>>=1,xe=this.tiles[ra(He,ze,ft)];return xe&&xe.source?(ce>1&&(console.log("found parent tile z%d-%d-%d",He,ze,ft),console.time("drilling down")),this.splitTile(xe.source,He,ze,ft,k,B,Z),ce>1&&console.timeEnd("drilling down"),this.tiles[ue]?ia(this.tiles[ue],W):null):null}}function ra(ye,k,B){return 32*((1<<ye)*B+k)+ye}function Be(ye,k){const B=ye.tileID.canonical;if(!this._geoJSONIndex)return void k(null,null);const Z=this._geoJSONIndex.getTile(B.z,B.x,B.y);if(!Z)return void k(null,null);const oe=xe=>xe.tags&&"3d_elevation_id"in xe.tags&&"source"in xe.tags&&xe.tags.source==="elevation",W=Z.features.filter(xe=>oe(xe));let ce={_geojsonTileLayer:Z.features};W.length>0&&(ce={_geojsonTileLayer:Z.features.filter(xe=>!oe(xe)),hd_road_elevation:W});const be=new Ks(ce),ue=function(xe){const He=new s.bq;
19for(const ze of Object.keys(xe))He.writeMessage(3,Ya,{name:ze,features:xe[ze]});return He.finish()}(ce).buffer;k(null,{vectorTile:be,rawData:ue})}class zo extends fr{constructor(k,B,Z,oe,W,ce,be){super(k,B,Z,oe,W,Be,be),ce&&(this.loadGeoJSON=ce),this._dynamicIndex=new tc}loadData(k,B){const Z=k&&k.request,oe=Z&&Z.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(k,(W,ce)=>{if(W||!ce)return B(W);if(typeof ce!="object")return B(new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`));{try{if(k.filter){const ue=s.X(k.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ue.result==="error")throw new Error(ue.value.map(xe=>`${xe.key}: ${xe.message}`).join(", "));ce.features=ce.features.filter(xe=>ue.value.evaluate({zoom:0},xe))}k.dynamic?(ce.type==="Feature"&&(ce={type:"FeatureCollection",features:[ce]}),k.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(ce.features,this.loaded),k.cluster&&(ce.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=k.cluster?new Zo(function({superclusterOptions:ue,clusterProperties:xe}){if(!xe||!ue)return ue;const He={},ze={},ft={accumulated:null,zoom:0},wt={properties:null},Et=Object.keys(xe);for(const Gt of Et){const[kt,qt]=xe[Gt],Ei=s.X(qt),Ht=s.X(typeof kt=="string"?[kt,["accumulated"],["get",Gt]]:kt);He[Gt]=Ei.value,ze[Gt]=Ht.value}return ue.map=Gt=>{wt.properties=Gt;const kt={};for(const qt of Et)kt[qt]=He[qt].evaluate(ft,wt);return kt},ue.reduce=(Gt,kt)=>{wt.properties=kt;for(const qt of Et)ft.accumulated=Gt[qt],Gt[qt]=ze[qt].evaluate(ft,wt)},ue}(k)).load(ce.features):k.dynamic?this._dynamicIndex:function(ue,xe){return new Th(ue,xe)}(ce,k.geojsonVtOptions)}catch(ue){return B(ue)}const be={};if(oe){const ue=li(Z);ue&&(be.resourceTiming={},be.resourceTiming[k.source]=JSON.parse(JSON.stringify(ue)))}B(null,be)}})}reloadTile(k,B){const Z=this.loaded;return Z&&Z[k.uid]?k.partial?B(null,void 0):super.reloadTile(k,B):this.loadTile(k,B)}loadGeoJSON(k,B){if(k.request)s.n(k.request,B);else{if(typeof k.data!="string")return B(new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return B(null,JSON.parse(k.data))}catch{return B(new Error(`Input data given to '${k.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(k,B){try{B(null,this._geoJSONIndex.getClusterExpansionZoom(k.clusterId))}catch(Z){B(Z)}}getClusterChildren(k,B){try{B(null,this._geoJSONIndex.getChildren(k.clusterId))}catch(Z){B(Z)}}getClusterLeaves(k,B){try{B(null,this._geoJSONIndex.getLeaves(k.clusterId,k.limit,k.offset))}catch(Z){B(Z)}}}class Sh{constructor(k,B,Z){this.tileID=new s.aM(k.tileID.overscaledZ,k.tileID.wrap,k.tileID.canonical.z,k.tileID.canonical.x,k.tileID.canonical.y),this.tileZoom=k.tileZoom,this.uid=k.uid,this.zoom=k.zoom,this.canonical=k.tileID.canonical,this.pixelRatio=k.pixelRatio,this.tileSize=k.tileSize,this.source=k.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=k.projection,this.brightness=B,this.worldview=Z}parse(k,B,Z,oe){this.status="parsing";const W=new s.aM(Z.tileID.overscaledZ,Z.tileID.wrap,Z.tileID.canonical.z,Z.tileID.canonical.x,Z.tileID.canonical.y),ce=[],be=B.familiesBySource[Z.source],ue=new s.fc(W,Z.promoteId);ue.bucketLayerIDs=[],ue.is3DTile=!0,s.fr(k).then(xe=>{if(!xe)return oe(new Error("Could not parse tile"));const He=xe.json.extensionsUsed&&xe.json.extensionsUsed.includes("MAPBOX_mesh_features")||xe.json.asset.extras&&xe.json.asset.extras.MAPBOX_mesh_features,ze=xe.json.extensionsUsed&&xe.json.extensionsUsed.includes("EXT_meshopt_compression"),ft=new s.aa(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const wt in be)for(const Et of be[wt]){const Gt=Et[0];ue.bucketLayerIDs.push(Et.map(Ei=>s.C(Ei.id,Ei.scope))),Gt.recalculate(ft,[]);const kt=s.fs(xe,1/s.d4(Z.tileID.canonical)),qt=new s.ft(Et,kt,W,He,ze,this.brightness,ue,this.worldview);He||(qt.needsUpload=!0),ce.push(qt),qt.evaluate(Gt)}this.status="done",oe(null,{buckets:ce,featureIndex:ue,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(xe=>
19oe(new Error(xe.message)))}}class rl{constructor(k,B,Z,oe,W,ce,be,ue){this.actor=k,this.layerIndex=B,this.availableImages=Z,this.availableModels=oe,this.brightness=be,this.loading={},this.loaded={},this.worldview=ue}loadTile(k,B){const Z=k.uid,oe=this.loading[Z]=new Sh(k,this.brightness,this.worldview);s.br(k.request,(W,ce)=>{const be=!this.loading[Z];return delete this.loading[Z],be||W?(oe.status="done",be||(this.loaded[Z]=oe),B(W)):ce&&ce.byteLength!==0?void oe.parse(ce,this.layerIndex,k,(ue,xe)=>{oe.status="done",this.loaded=this.loaded||{},this.loaded[Z]=oe,ue||!xe?B(ue):B(null,xe)}):(oe.status="done",this.loaded[Z]=oe,B())})}reloadTile(k,B){const Z=this.loaded,oe=k.uid;if(Z&&Z[oe]){const W=Z[oe];W.projection=k.projection,W.brightness=k.brightness;const ce=(be,ue)=>{W.reloadCallback&&(delete W.reloadCallback,this.loadTile(k,B)),B(be,ue)};W.status==="parsing"?W.reloadCallback=ce:W.status==="done"&&this.loadTile(k,B)}}abortTile(k,B){const Z=k.uid;this.loading[Z]&&delete this.loading[Z],B()}removeTile(k,B){const Z=this.loaded,oe=k.uid;Z&&Z[oe]&&delete Z[oe],B()}}class ii{constructor(k){this.self=k,this.actor=new s.fv(k,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new s.y,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=s.cj({name:"mercator"}),this.workerSourceTypes={vector:fr,geojson:zo,"raster-dem":Wi,"raster-array":Zr,"batched-model":rl},this.workerSources={},this.self.registerWorkerSource=(B,Z)=>{if(this.workerSourceTypes[B])throw new Error(`Worker source with name "${B}" already registered.`);this.workerSourceTypes[B]=Z},this.self.registerRTLTextPlugin=B=>{if(s.fw.isParsed())throw new Error("RTL text plugin already registered.");s.fw.setState({pluginStatus:s.fx.parsed,pluginURL:s.fw.getPluginURL()}),s.fw.applyArabicShaping=B.applyArabicShaping,s.fw.processBidirectionalText=B.processBidirectionalText,s.fw.processStyledBidirectionalText=B.processStyledBidirectionalText;for(const Z of this.rtlPluginParsingListeners)Z(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(k,B,Z){delete this.layerIndexes[k],delete this.availableImages[k],delete this.availableModels[k],delete this.workerSources[k],Z()}checkIfReady(k,B,Z){Z()}setReferrer(k,B){this.referrer=B}spriteLoaded(k,B){this.isSpriteLoaded[k]||(this.isSpriteLoaded[k]={});const{scope:Z,isLoaded:oe}=B;if(this.isSpriteLoaded[k][Z]=oe,this.workerSources[k]&&this.workerSources[k][Z])for(const W in this.workerSources[k][Z]){const ce=this.workerSources[k][Z][W];for(const be in ce){const ue=ce[be];ue instanceof fr&&(ue.isSpriteLoaded=oe,ue.fire(new s.A("isSpriteLoaded")))}}}setImages(k,B,Z){this.availableImages[k]||(this.availableImages[k]={});const{scope:oe,images:W}=B;if(this.availableImages[k][oe]=W,this.workerSources[k]&&this.workerSources[k][oe]){for(const ce in this.workerSources[k][oe]){const be=this.workerSources[k][oe][ce];for(const ue in be)be[ue].availableImages=W}Z()}else Z()}setModels(k,{scope:B,models:Z},oe){if(this.availableModels[k]||(this.availableModels[k]={}),this.availableModels[k][B]=Z,this.workerSources[k]&&this.workerSources[k][B]){for(const W in this.workerSources[k][B]){const ce=this.workerSources[k][B][W];for(const be in ce)ce[be].availableModels=Z}oe()}else oe()}setProjection(k,B){this.projections[k]=s.cj(B)}setBrightness(k,B,Z){this.brightness=B,Z()}setWorldview(k,B,Z){this.worldview=B,Z()}setLayers(k,B,Z){this.getLayerIndex(k,B.scope).replace(B.layers,B.options),Z()}updateLayers(k,B,Z){this.getLayerIndex(k,B.scope).update(B.layers,B.removedIds,B.options),Z()}loadTile(k,B,Z){B.projection=this.projections[k]||this.defaultProjection,this.getWorkerSource(k,B.type,B.source,B.scope).loadTile(B,Z)}decodeRasterArray(k,B,Z){this.getWorkerSource(k,B.type,B.source,B.scope).decodeRasterArray(B,Z)}reloadTile(k,B,Z){B.projection=this.projections[k]||this.defaultProjection,this.getWorkerSource(k,B.type,B.source,B.scope).reloadTile(B,Z)}abortTile(k,B,Z){this.getWorkerSource(k,B.type,B.source,B.scope).abortTile(B,Z)}removeTile(k,B,Z){this.getWorkerSource(k,B.type,B.source,B.scope).removeTile(B,Z)}removeSource(k,B,Z){if(!(this.workerSources[k]&&this.workerSources[k][B.scope]&&this.workerSources[k][B.scope][B.type]&&this.workerSources[k][B.scope][B.type][B.source]))return;const oe=this.workerSources[k][B.scope][B.type][B.source];delete this.workerSources[k][B.scope][B.type][B.source],oe.removeSource!==void 0?oe.removeSource(B,Z):Z()}loadWorkerSource(k,B,Z){try{this.self.importScripts(B.url),Z()}catch(oe){Z(oe.toString())}}syncRTLPluginState(k,B,Z){if(s.fw.isParsed())Z(null,!0);else if(s.fw.isParsing())this.rtlPluginParsingListeners.push(Z);else try{s.fw.setState(B);const oe=s.fw.getPluginURL();!s.fw.isLoaded()||s.fw.isParsed()||s.fw.isParsing()||oe==null||(s.fw.setState({pluginStatus:s.fx.parsing,pluginURL:s.fw.getPluginURL()}),this.self.importScripts(oe),s.fw.isParsed()?Z(null,!0):this.rtlPluginParsingListeners.push(Z))}catch(oe){Z(oe.toString())}}setDracoUrl(k,B){this.dracoUrl=B}getAvailableImages(k,B){this.availableImages[k]||(this.availableImages[k]={});let Z=this.availableImages[k][B];return Z||(Z=[]),Z}getAvailableModels(k,B){this.availableModels[k]||(this.availableModels[k]={});let Z=this.availableModels[k][B];return Z||(Z={}),Z}getLayerIndex(k,B){this.layerIndexes[k]||(this.layerIndexes[k]={});let Z=this.layerIndexes[k][B];return Z||(Z=this.layerIndexes[k][B]=new sr,Z.scope=B),Z}getWorkerSource(k,B,Z,oe){const W=this.workerSources;return W[k]||(W[k]={}),W[k][oe]||(W[k][oe]={}),W[k][oe][B]||(W[k][oe][B]={}),this.isSpriteLoaded[k]||(this.isSpriteLoaded[k]={}),W[k][oe][B][Z]||(W[k][oe][B][Z]=new this.workerSourceTypes[B]({send:(ce,be,ue,xe,He,ze)=>this.actor.send(ce,be,ue,k,He,ze),scheduler:this.actor.scheduler},this.getLayerIndex(k,oe),this.getAvailableImages(k,oe),this.getAvailableModels(k,oe),this.isSpriteLoaded[k][oe],void 0,this.brightness,this.worldview)),W[k][oe][B][Z]}rasterizeImagesWorker(k,B,Z){const oe=new Map;for(const[W,{image:ce,imageVariant:be}]of B.tasks.entries()){const ue=this.imageRasterizer.rasterize(be,ce,B.scope,k);oe.set(W,ue)}Z(void 0,oe)}removeRasterizedImages(k,B,Z){this.imageRasterizer.removeImagesFromCacheByIds(B.imageIds,B.scope,k),Z()}enforceCacheSizeLimit(k,B){s.fy(B)}getWorkerPerformanceMetrics(k,B,Z){Z(void 0,void 0)}}return s.fu(self)&&(self.worker=new ii(self)),ii}),Pr(["./shared"],function(s){var li="3.14.0";const Vt={create:"create",load:"load",fullLoad:"fullLoad"},Di={mark(l){performance.mark(l)},measure(l,t,n){performance.measure(l,t,n)}};function sr(l){const t=l.name.split("?")[0];return s.a(t)&&t.includes("mapbox-gl.js")?"javascript":s.a(t)&&t.includes("mapbox-gl.css")?"css":s.b(t)?"fontRange":s.c(t)?"sprite":s.i(t)?"style":s.d(t)?"tilejson":"other"}var to,qn={},To=function(){if(to)return qn;function l(c){return!t(c)}function t(c){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var p,m,y=new Blob([""],{type:"text/javascript"}),x=URL.createObjectURL(y);try{m=new Worker(x),p=!0}catch{p=!1}return m&&m.terminate(),URL.revokeObjectURL(x),p}()?function(){var p=document.createElement("canvas");p.width=p.height=1;var m=p.getContext("2d");if(!m)return!1;var y=m.getImageData(0,0,1,1);return y&&y.width===p.width}()?(n[d=c&&c.failIfMajorPerformanceCaveat]===void 0&&(n[d]=function(p){var m,y=function(x){var T=document.createElement("canvas"),S=Object.create(l.webGLContextAttributes);return S.failIfMajorPerformanceCaveat=x,T.getContext("webgl2",S)}(p);if(!y)return!1;try{m=y.createShader(y.VERTEX_SHADER)}catch{return!1}return!(!m||y.isContextLost())&&(y.shaderSource(m,"void main() {}"),y.compileShader(m),y.getShaderParameter(m,y.COMPILE_STATUS)===!0)}(d)),n[d]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var d}to=1,qn.supported=l,qn.notSupportedReason=t;var n={};return l.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},qn}();function It(l,t,n){const c=document.createElement(l);return t!=null&&(c.className=t),n&&n.appendChild(c),c}function fr(l,t,n){const c=document.createElementNS("http://www.w3.org/2000/svg",l);for(const d of Object.keys(t))c.setAttributeNS(null,d,String(t[d]));return n&&n.appendChild(c),c}const Wi=typeof document<"u"?document.documentElement&&document.documentElement.style:null,tn=Wi&&Wi.userSelect!==void 0?"userSelect":"WebkitUserSelect";let Zr;function Go(){Wi&&tn&&(Zr=Wi[tn],Wi[tn]="none")}function So(){Wi&&tn&&(Wi[tn]=Zr)}function qo(l){l.preventDefault(),l.stopPropagation(),window.removeEventListener("click",qo,!0)}function Ks(){window.addEventListener("click",qo,!0),window.setTimeout(()=>{window.removeEventListener("click",qo,!0)},0)}function io(l,t){const n=l.getBoundingClientRect();return fi(l,n,t)}function Ho(l,t){const n=l.getBoundingClientRect(),c=[];for(let d=0;d<t.length;d++)c.push(fi(l,n,t[d]));return c}function tc(l){return/firefox/i.test(navigator.userAgent)&&/macintosh/i.test(navigator.userAgent)&&l.button===2&&l.ctrlKey?0:l.button}function fi(l,t,n){const c=l.offsetWidth===t.width?1:l.offsetWidth/t.width;return new s.P((n.clientX-t.left)*c,(n.clientY-t.top)*c)}const Js="01",jr="NO_ACCESS_TOKEN";class gr{constructor(t,n,c){this._transformRequestFn=t,this._customAccessToken=n,this._silenceAuthErrors=!!c,this._createSkuToken()}_createSkuToken(){const t=function(){let n="";for(let c=0;c<10;c++)n+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Js,n].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,n){return this._transformRequestFn&&this._transformRequestFn(t,n)||{url:t}}normalizeStyleURL(t,n){if(!s.j(t))return t;const c=Ui(t);return c.params.push(`sdk=js-${li}`),c.path=`/styles/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeGlyphsURL(t,n){if(!s.j(t))return t;const c=Ui(t);return c.path=`/fonts/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeModelURL(t,n){if(!s.j(t))return t;const c=Ui(t);return c.path=`/models/v1${c.path}`,this._makeAPIURL(c,this._customAccessToken||n)}normalizeSourceURL(t,n,c,d){if(!s.j(t))return t;const p=Ui(t);return p.path=`/v4/${p.authority}.json`,p.params.push("secure"),c&&p.params.push(`language=${c}`),d&&p.params.push(`worldview=${d}`),this._makeAPIURL(p,this._customAccessToken||n)}normalizeIconsetURL(t,n){const c=Ui(t);return s.j(t)?(c.path=`/styles/v1${c.path}/iconset.pbf`,this._makeAPIURL(c,this._customAccessToken||n)):xn(c)}normalizeSpriteURL(t,n,c,d){const p=Ui(t);return s.j(t)?(p.path=`/styles/v1${p.path}/sprite${n}${c}`,this._makeAPIURL(p,this._customAccessToken||d)):(p.path+=`${n}${c}`,xn(p))}normalizeTileURL(t,n,c){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!s.j(t))return t;const d=Ui(t);d.path=d.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${n||c&&d.authority!=="raster"&&c===512?"@2x":""}${s.l.supported?".webp":"$1"}`),d.authority==="raster"?d.path=`/${s.e.RASTER_URL_PREFIX}${d.path}`:d.authority==="rasterarrays"?d.path=`/${s.e.RASTERARRAYS_URL_PREFIX}${d.path}`:d.authority==="3dtiles"?d.path=`/${s.e.TILES3D_URL_PREFIX}${d.path}`:(d.path=d.path.replace(/^.+\/v4\//,"/"),d.path=`/${s.e.TILE_URL_VERSION}${d.path}`);const p=this._customAccessToken||function(m){for(const y of m){const x=y.match(/^access_token=(.*)$/);if(x)return x[1]}return null}(d.params)||s.e.ACCESS_TOKEN;return s.e.REQUIRE_ACCESS_TOKEN&&p&&this._skuToken&&d.params.push(`sku=${this._skuToken}`),this._makeAPIURL(d,p)}canonicalizeTileURL(t,n){const c=Ui(t);if(!c.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!c.path.match(/\.[\w]+$/))return t;let d="mapbox://";c.path.match(/^\/raster\/v1\//)?d+=`raster/${c.path.replace(`/${s.e.RASTER_URL_PREFIX}/`,"")}`:c.path.match(/^\/rasterarrays\/v1\//)?d+=`rasterarrays/${c.path.replace(`/${s.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:d+=`tiles/${c.path.replace(`/${s.e.TILE_URL_VERSION}/`,"")}`;let p=c.params;return n&&(p=p.filter(m=>!m.match(/^access_token=/))),p.length&&(d+=`?${p.join("&")}`),d}canonicalizeTileset(t,n){const c=!!n&&s.j(n),d=[];for(const p of t.tiles||[])s.k(p)?d.push(this.canonicalizeTileURL(p,c)):d.push(p);return d}_makeAPIURL(t,n){const c="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",d=Ui(s.e.API_URL);if(t.protocol=d.protocol,t.authority=d.authority,t.protocol==="http"){const p=t.params.indexOf("secure");p>=0&&t.params.splice(p,1)}if(d.path!=="/"&&(t.path=`${d.path}${t.path}`),!s.e.REQUIRE_ACCESS_TOKEN)return xn(t);if(n=n||s.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!n)throw new Error(`An API access token is required to use Mapbox GL. ${c}`);if(n[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${c}`)}return t.params=t.params.filter(p=>p.indexOf("access_token")===-1),t.params.push(`access_token=${n||""}`),xn(t)}}const ur=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Ui(l){const t=l.match(ur);
19if(!t)throw new Error("Unable to parse URL object");return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}function xn(l){const t=l.params.length?`?${l.params.join("&")}`:"";return`${l.protocol}://${l.authority}${l.path}${t}`}const Ya="mapbox.eventData";function Eo(l){if(!l)return null;const t=l.split(".");if(!t||t.length!==3)return null;try{return JSON.parse(s.m(t[1]))}catch{return null}}class Hn{constructor(t){this.type=t,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(t){const n=Eo(s.e.ACCESS_TOKEN);let c="";return c=n&&n.u?s.f(n.u):s.e.ACCESS_TOKEN||"",t?`${Ya}.${t}:${c}`:`${Ya}:${c}`}fetchEventData(){const t=s.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid");if(t)try{const d=localStorage.getItem(n);d&&(this.eventData=JSON.parse(d));const p=localStorage.getItem(c);p&&(this.anonId=p)}catch{s.w("Unable to read from LocalStorage")}}saveEventData(){const t=s.s("localStorage"),n=this.getStorageKey(),c=this.getStorageKey("uuid"),d=this.anonId;if(t&&d)try{localStorage.setItem(c,d),Object.keys(this.eventData).length>=1&&localStorage.setItem(n,JSON.stringify(this.eventData))}catch{s.w("Unable to write to LocalStorage")}}processRequests(t){}postEvent(t,n,c,d){if(!s.e.EVENTS_URL)return;const p=Ui(s.e.EVENTS_URL);p.params.push(`access_token=${d||s.e.ACCESS_TOKEN||""}`);const m={event:this.type,created:new Date(t).toISOString()},y=n?s.h(m,n):m,x={url:xn(p),headers:{"Content-Type":"text/plain"},body:JSON.stringify([y])};this.pendingRequest=s.p(x,T=>{this.pendingRequest=null,c(T),this.saveEventData(),this.processRequests(d)})}queueRequest(t,n){this.queue.push(t),this.processRequests(n)}}const Vi=new class extends Hn{constructor(l){super("appUserTurnstile"),this._customAccessToken=l}postTurnstileEvent(l,t){s.e.EVENTS_URL&&s.e.ACCESS_TOKEN&&Array.isArray(l)&&l.some(n=>s.j(n)||s.k(n))&&this.queueRequest(Date.now(),t)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const t=Eo(s.e.ACCESS_TOKEN),n=t?t.u:s.e.ACCESS_TOKEN;let c=n!==this.eventData.tokenU;s.v(this.anonId)||(this.anonId=s.u(),c=!0);const d=this.queue.shift();if(this.eventData.lastSuccess){const p=new Date(this.eventData.lastSuccess),m=new Date(d),y=(d-this.eventData.lastSuccess)/864e5;c=c||y>=1||y<-1||p.getDate()!==m.getDate()}else c=!0;c?this.postEvent(d,{sdkIdentifier:"mapbox-gl-js",sdkVersion:li,skuId:Js,"enabled.telemetry":!1,userId:this.anonId},p=>{p||(this.eventData.lastSuccess=d,this.eventData.tokenU=n)},l):this.processRequests()}},rn=Vi.postTurnstileEvent.bind(Vi),Qs=new class extends Hn{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(l,t,n,c){this.skuToken=t,this.errorCb=c,s.e.EVENTS_URL&&(n||s.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(jr)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||(this.anonId||this.fetchEventData(),s.v(this.anonId)||(this.anonId=s.u()),this.postEvent(n,{sdkIdentifier:"mapbox-gl-js",sdkVersion:li,skuId:Js,skuToken:this.skuToken,userId:this.anonId},c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l))}remove(){this.errorCb=null}},ic=Qs.postMapLoadEvent.bind(Qs),$o=new class extends Hn{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(l){let t=this.mapInstanceIdMap.get(l);return t||(t=s.u(),this.mapInstanceIdMap.set(l,t)),t}getEventId(l){const t=this.eventIdPerMapInstanceMap.get(l)||0;return this.eventIdPerMapInstanceMap.set(l,t+1),t}postStyleLoadEvent(l,t){const{map:n,style:c,importedStyles:d}=t;if(!s.e.EVENTS_URL||!l&&!s.e.ACCESS_TOKEN)return;const p=this.getMapInstanceId(n),m={mapInstanceId:p,eventId:this.getEventId(p),style:c};d.length&&(m.importedStyles=d),this.queueRequest({timestamp:Date.now(),payload:m},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,payload:n}=this.queue.shift();this.postEvent(t,n,()=>{},l)}},ki=$o.postStyleLoadEvent.bind($o),ar=new class extends Hn{constructor(){super("gljs.performance")}postPerformanceEvent(l,t){s.e.EVENTS_URL&&(l||s.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:t},l)}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:t,performanceData:n}=this.queue.shift(),c=function(d){const p=performance.getEntriesByType("resource"),m=performance.getEntriesByType("mark"),y=function(M){const D={};if(M){for(const z in M)if(z!=="other")for(const F of M[z]){const L=`${z}ResolveRangeMin`,N=`${z}ResolveRangeMax`,U=`${z}RequestCount`,q=`${z}RequestCachedCount`;D[L]=Math.min(D[L]||1/0,F.startTime),D[N]=Math.max(D[N]||-1/0,F.responseEnd);const Y=te=>{D[te]===void 0&&(D[te]=0),++D[te]};F.transferSize!==void 0&&F.transferSize===0&&Y(q),Y(U)}}return D}(function(M,D){const z={};
vendor: 12,329 bytes, line 19
19if(M)for(const F of M){const L=D(F);z[L]===void 0&&(z[L]=[]),z[L].push(F)}return z}(p,sr)),x=window.devicePixelRatio,T=navigator.connection||navigator.mozConnection||navigator.webkitConnection,S=T?T.effectiveType:void 0,C={counters:[],metadata:[],attributes:[]},E=(M,D,z)=>{z!=null&&M.push({name:D,value:z.toString()})};for(const M in y)E(C.counters,M,y[M]);if(d.interactionRange[0]!==1/0&&d.interactionRange[1]!==-1/0&&(E(C.counters,"interactionRangeMin",d.interactionRange[0]),E(C.counters,"interactionRangeMax",d.interactionRange[1])),m)for(const M of Object.keys(Vt)){const D=Vt[M],z=m.find(F=>F.name===D);z&&E(C.counters,D,z.startTime)}return E(C.counters,"visibilityHidden",d.visibilityHidden),E(C.attributes,"style",function(M){if(M)for(const D of M){const z=D.name.split("?")[0];if(s.i(z)){const F=z.split("/").slice(-2);if(F.length===2)return`mapbox://styles/${F[0]}/${F[1]}`}}}(p)),E(C.attributes,"terrainEnabled",d.terrainEnabled?"true":"false"),E(C.attributes,"fogEnabled",d.fogEnabled?"true":"false"),E(C.attributes,"projection",d.projection),E(C.attributes,"zoom",d.zoom),E(C.metadata,"devicePixelRatio",x),E(C.metadata,"connectionEffectiveType",S),E(C.metadata,"navigatorUserAgent",navigator.userAgent),E(C.metadata,"screenWidth",window.screen.width),E(C.metadata,"screenHeight",window.screen.height),E(C.metadata,"windowWidth",window.innerWidth),E(C.metadata,"windowHeight",window.innerHeight),E(C.metadata,"mapWidth",d.width/x),E(C.metadata,"mapHeight",d.height/x),E(C.metadata,"webglRenderer",d.renderer),E(C.metadata,"webglVendor",d.vendor),E(C.metadata,"sdkVersion",li),E(C.metadata,"sdkIdentifier","mapbox-gl-js"),C}(n);for(const d of c.metadata);for(const d of c.counters);for(const d of c.attributes);this.postEvent(t,c,()=>{},l)}},yr=ar.postPerformanceEvent.bind(ar),hn=new class extends Hn{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(l,t,n,c){if(!s.e.API_URL||!s.e.SESSION_PATH)return;const d=Ui(s.e.API_URL+s.e.SESSION_PATH);d.params.push(`sku=${t||""}`),d.params.push(`access_token=${c||s.e.ACCESS_TOKEN||""}`);const p={url:xn(d),headers:{"Content-Type":"text/plain"}};this.pendingRequest=s.g(p,m=>{this.pendingRequest=null,n(m),this.saveEventData(),this.processRequests(c)})}getSessionAPI(l,t,n,c){this.skuToken=t,this.errorCb=c,s.e.SESSION_PATH&&s.e.API_URL&&(n||s.e.ACCESS_TOKEN?this.queueRequest({id:l,timestamp:Date.now()},n):this.errorCb(new Error(jr)))}processRequests(l){if(this.pendingRequest||this.queue.length===0)return;const{id:t,timestamp:n}=this.queue.shift();t&&this.success[t]||this.getSession(n,this.skuToken,c=>{c?this.errorCb(c):t&&(this.success[t]=!0)},l)}remove(){this.errorCb=null}},lr=hn.getSessionAPI.bind(hn),Zo=new Set;function Wo(l,t){t?Zo.add(l):Zo.delete(l)}class Ka{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(t,n){this._updatedSourceCaches[t]=n,this.setDirty()}discardSourceCacheUpdate(t){delete this._updatedSourceCaches[t]}updateLayer(t){const n=t.scope;this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._updatedLayers[n].add(t.id),this.setDirty()}removeLayer(t){const n=t.scope;this._removedLayers[n]=this._removedLayers[n]||{},this._updatedLayers[n]=this._updatedLayers[n]||new Set,this._removedLayers[n][t.id]=t,this._updatedLayers[n].delete(t.id),this._updatedPaintProps.delete(t.fqid),this.setDirty()}getRemovedLayer(t){return this._removedLayers[t.scope]?this._removedLayers[t.scope][t.id]:null}discardLayerRemoval(t){this._removedLayers[t.scope]&&delete this._removedLayers[t.scope][t.id]}getLayerUpdatesByScope(){const t={};for(const n in this._updatedLayers)t[n]=t[n]||{},t[n].updatedIds=Array.from(this._updatedLayers[n].values());for(const n in this._removedLayers)t[n]=t[n]||{},t[n].removedIds=Object.keys(this._removedLayers[n]);return t}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(t){this._updatedPaintProps.add(t.fqid),this.setDirty()}getUpdatedImages(t){return this._updatedImages[t]?Array.from(this._updatedImages[t].values()):[]}updateImage(t,n){this._updatedImages[n]=this._updatedImages[n]||new Set,this._updatedImages[n].add(s.I.toString(t)),this.setDirty()}resetUpdatedImages(t){this._updatedImages[t]&&this._updatedImages[t].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function $n(l){const{userImage:t}=l;return!!(t&&t.render&&t.render())&&(l.data.replace(new Uint8Array(t.data.buffer)),!0)}class cr extends s.E{constructor(t){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=t,t!=="raster"&&s.t()&&(this.imageRasterizerDispatcher=new s.D(s.x(),this,"Image Rasterizer Worker",1))}addScope(t){this.loaded.set(t,!1),this.imageProviders.set(t,new Map),this.images.set(t,new Map),this.updatedImages.set(t,new Set),this.callbackDispatchedThisFrame.set(t,new Set),this.patterns.set(t,new Map),this.atlasImage.set(t,new s.r({width:1,height:1}))}removeScope(t){this.loaded.delete(t),this.imageProviders.delete(t),this.images.delete(t),this.updatedImages.delete(t),this.callbackDispatchedThisFrame.delete(t),this.patterns.delete(t),this.atlasImage.delete(t);const n=this.atlasTexture.get(t);n&&(n.destroy(),this.atlasTexture.delete(t))}addImageProvider(t,n){this.imageProviders.has(n)||this.imageProviders.set(n,new Map),this.imageProviders.get(n).set(t.id,t)}removeImageProvider(t,n){this.imageProviders.has(n)&&this.imageProviders.get(n).delete(t)}getPendingImageProviders(){const t=[];for(const n of this.imageProviders.values())for(const c of n.values())c.hasPendingRequests()&&t.push(c);return t}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new s.y),this._imageRasterizer}isLoaded(){for(const t of this.loaded.keys())if(!this.loaded.get(t))return!1;return!0}setLoaded(t,n){if(this.loaded.get(n)!==t&&(this.loaded.set(n,t),t)){for(const{ids:c,callback:d}of this.requestors)this._notify(c,n,d);this.requestors=[]}}hasImage(t,n){return!!this.getImage(t,n)}getImage(t,n){return this.images.get(n).get(t.toString())}addImage(t,n,c){this._validate(t,c)&&this.images.get(n).set(t.toString(),c)}_validate(t,n){let c=!0;return this._validateStretch(n.stretchX,n.data&&n.data.width)||(this.fire(new s.z(new Error(`Image "${t.name}" has invalid "stretchX" value`))),c=!1),this._validateStretch(n.stretchY,n.data&&n.data.height)||(this.fire(new s.z(new Error(`Image "${t.name}" has invalid "stretchY" value`))),c=!1),this._validateContent(n.content,n)||(this.fire(new s.z(new Error(`Image "${t.name}" has invalid "content" value`))),c=!1),c}_validateStretch(t,n){if(!t)return!0;let c=0;for(const d of t){if(d[0]<c||d[1]<d[0]||n<d[1])return!1;c=d[1]}return!0}_validateContent(t,n){return t?t.length!==4||!n.usvg&&(t[0]<0||n.data.width<t[0]||t[1]<0||n.data.height<t[1]||t[2]<0||n.data.width<t[2]||t[3]<0||n.data.height<t[3])?!1:!(t[2]<t[0]||t[3]<t[1]):!0}updateImage(t,n,c){const d=this.images.get(n).get(t.toString());c.version=d.version+1,this.images.get(n).set(t.toString(),c),this.updatedImages.get(n).add(t),this.removeFromImageRasterizerCache(t,n)}clearUpdatedImages(t){this.updatedImages.get(t).clear()}removeFromImageRasterizerCache(t,n){this.spriteFormat!=="raster"&&(s.t()?this.imageRasterizerDispatcher.getActor().send("removeRasterizedImages",{imageIds:[t],scope:n}):this.imageRasterizer.removeImagesFromCacheByIds([t],n))}removeImage(t,n){const c=this.images.get(n),d=c.get(t.toString());c.delete(t.toString()),this.patterns.get(n).delete(t.toString()),this.removeFromImageRasterizerCache(t,n),d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(t){return Array.from(this.images.get(t).keys()).map(n=>s.I.from(n))}getImages(t,n,c){const d=[],p=[],m=this.imageProviders.get(n);for(const S of t){if(!S.iconsetId){d.push(S);continue}const C=m.get(S.iconsetId);C&&(this.getImage(S,n)?p.push(S):C.addPendingRequest(S))}if(d.length===0)return void this._notify(p,n,c);let y=!0;const x=!!this.loaded.get(n),T=this.images.get(n);if(!x)for(const S of d)T.has(S.toString())||(y=!1);x||y?this._notify(d,n,c):this.requestors.push({ids:d,scope:n,callback:c})}rasterizeImages(t,n){const c=new Map,{tasks:d,scope:p}=t;for(const[m,y]of d.entries()){const x=this.getImage(y.id,p);x&&c.set(m,{image:x,imageVariant:y})}this._rasterizeImages(p,c,n)}_rasterizeImages(t,n,c){if(s.t())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:n,scope:t},c);else{const d=new Map;for(const[p,{image:m,imageVariant:y}]of n.entries())d.set(p,this.imageRasterizer.rasterize(y,m,t,0));c(void 0,d)}}getUpdatedImages(t){return this.updatedImages.get(t)||new Set}_notify(t,n,c){const d=this.images.get(n),p=new Map;for(const m of t){if(!d.get(m.toString())){if(m.iconsetId)continue;this.fire(new s.A("styleimagemissing",{id:m.name}))}const y=d.get(m.toString());if(!y){s.w(`Image "${m.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const x={data:y.usvg?null:y.data.clone(),pixelRatio:y.pixelRatio,sdf:y.sdf,usvg:y.usvg,version:y.version,stretchX:y.stretchX,stretchY:y.stretchY,content:y.content,hasRenderCallback:!!(y.userImage&&y.userImage.render)};y.usvg&&Object.assign(x,{width:y.icon.usvg_tree.width,height:y.icon.usvg_tree.height}),p.set(s.I.toString(m),x)}c(null,p)}getPixelSize(t){const{width:n,height:c}=this.atlasImage.get(t);return{width:n,height:c}}getPattern(t,n,c){const d=t.toString(),p=this.patterns.get(n),m=p.get(d),y=this.getImage(t,n);if(!y)return null;if(m){if(m.position.version===y.version)return m.position;m.position.version=y.version}else{if(y.usvg&&!y.data){const x=this.getPatternInFlightId(d,n);if(this.patternsInFlight.has(x))return null;this.patternsInFlight.add(x);const T=new s.B(t).scaleSelf(s.q.devicePixelRatio),S=new Map([[T.toString(),{image:y,imageVariant:T}]]);return this._rasterizeImages(n,S,(C,E)=>this.storePatternImage(T,n,y,c,E)),null}this.storePattern(t,n,y)}return this._updatePatternAtlas(n,c),p.get(d).position}getPatternInFlightId(t,n){return s.C(t,n)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(t,n,c,d,p){const m=t.toString(),y=p?p.get(m):void 0;y&&(c.data=y,this.storePattern(t.id,n,c),this._updatePatternAtlas(n,d),this.patternsInFlight.delete(this.getPatternInFlightId(t.id.toString(),n)))}storePattern(t,n,c){const d={w:c.data.width+2*s.F,h:c.data.height+2*s.F,x:0,y:0},p=new s.G(d,c,s.F);this.patterns.get(n).set(t.toString(),{bin:d,position:p})}destroyAtlasTextures(){for(const t of this.atlasTexture.values())t&&t.destroy();this.atlasTexture.clear()}bind(t,n){const c=t.gl;let d=this.atlasTexture.get(n);d?this.dirty&&(d.update(this.atlasImage.get(n)),this.dirty=!1):(d=new s.T(t,this.atlasImage.get(n),c.RGBA8),this.atlasTexture.set(n,d)),d.bind(c.LINEAR,c.CLAMP_TO_EDGE)}_updatePatternAtlas(t,n){const c=this.patterns.get(t),d=Array.from(c.values()).map(({bin:T})=>T),{w:p,h:m}=s.H(d),y=this.atlasImage.get(t);y.resize({width:p||1,height:m||1});const x=this.images.get(t);for(const[T,{bin:S,position:C}]of c.entries()){let E=C.padding;const M=S.x+E,D=S.y+E,z=x.get(T).data,F=z.width,L=z.height;E=E>1?E-1:E,s.r.copy(z,y,{x:0,y:0},{x:M,y:D},{width:F,height:L},n),s.r.copy(z,y,{x:0,y:L-E},{x:M,y:D-E},{width:F,height:E},n),s.r.copy(z,y,{x:0,y:0},{x:M,y:D+L},{width:F,height:E},n),s.r.copy(z,y,{x:F-E,y:0},{x:M-E,y:D},{width:E,height:L},n),s.r.copy(z,y,{x:0,y:0},{x:M+F,y:D},{width:E,height:L},n),s.r.copy(z,y,{x:F-E,y:L-E},{x:M-E,y:D-E},{width:E,height:E},n),s.r.copy(z,y,{x:0,y:L-E},{x:M+F,y:D-E},{width:E,height:E},n),s.r.copy(z,y,{x:0,y:0},{x:M+F,y:D+L},{width:E,height:E},n),s.r.copy(z,y,{x:F-E,y:0},{x:M-E,y:D+L},{width:E,height:E},n)}this.dirty=!0}beginFrame(){for(const t of this.images.keys())this.callbackDispatchedThisFrame.set(t,new Set)}
19dispatchRenderCallbacks(t,n){const c=this.images.get(n);for(const d of t){if(this.callbackDispatchedThisFrame.get(n).has(d.toString()))continue;this.callbackDispatchedThisFrame.get(n).add(d.toString());const p=c.get(d.toString());$n(p)&&this.updateImage(d,n,p)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function un(l){const t=l.key,n=l.value,c=l.valueSpec||{},d=l.objectElementValidators||{},p=l.style,m=l.styleSpec;let y=[];const x=s.J(n);if(x!=="object")return[new s.V(t,n,`object expected, ${x} found`)];for(const T in n){const S=T.split(".")[0];let C;d[S]?C=d[S]:c[S]?C=Bi:d["*"]?C=d["*"]:c["*"]&&(C=Bi),C?y=y.concat(C({key:(t&&`${t}.`)+T,value:n[T],valueSpec:c[S]||c["*"],style:p,styleSpec:m,object:n,objectKey:T},n)):y.push(new s.K(t,n[T],`unknown property "${T}"`))}for(const T in c)d[T]||c[T].required&&c[T].default===void 0&&n[T]===void 0&&y.push(new s.V(t,n,`missing required property "${T}"`));return y}function Xo(l){const t=l.value,n=l.valueSpec,c=l.style,d=l.styleSpec,p=l.key,m=l.arrayElementValidator||Bi;if(s.J(t)!=="array")return[new s.V(p,t,`array expected, ${s.J(t)} found`)];if(n.length&&t.length!==n.length)return[new s.V(p,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new s.V(p,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let y={type:n.value,values:n.values,minimum:n.minimum,maximum:n.maximum,function:void 0};d.$version<7&&(y.function=n.function),s.J(n.value)==="object"&&(y=n.value);let x=[];for(let T=0;T<t.length;T++)x=x.concat(m({array:t,arrayIndex:T,value:t[T],valueSpec:y,style:c,styleSpec:d,key:`${p}[${T}]`},!0));return x}function Ja(l){const t=l.key,n=l.value,c=l.valueSpec;let d=s.J(n);if(d==="number"&&n!=n&&(d="NaN"),d!=="number")return[new s.V(t,n,`number expected, ${d} found`)];if("minimum"in c){let p=c.minimum;if(s.J(c.minimum)==="array"&&(p=c.minimum[l.arrayIndex]),n<p)return[new s.V(t,n,`${n} is less than the minimum value ${p}`)]}if("maximum"in c){let p=c.maximum;if(s.J(c.maximum)==="array"&&(p=c.maximum[l.arrayIndex]),n>p)return[new s.V(t,n,`${n} is greater than the maximum value ${p}`)]}return[]}function Io(l){const t=l.valueSpec,n=s.M(l.value.type);let c,d,p,m={};const y=n!=="categorical"&&l.value.property===void 0,x=!y,T=s.J(l.value.stops)==="array"&&s.J(l.value.stops[0])==="array"&&s.J(l.value.stops[0][0])==="object",S=un({key:l.key,value:l.value,valueSpec:l.styleSpec.function,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{stops:function(M){if(n==="identity")return[new s.V(M.key,M.value,'identity function may not have a "stops" property')];let D=[];const z=M.value;return D=D.concat(Xo({key:M.key,value:z,valueSpec:M.valueSpec,style:M.style,styleSpec:M.styleSpec,arrayElementValidator:C})),s.J(z)==="array"&&z.length===0&&D.push(new s.V(M.key,z,"array must have at least one stop")),D},default:function(M){return Bi({key:M.key,value:M.value,valueSpec:t,style:M.style,styleSpec:M.styleSpec})}}});return n==="identity"&&y&&S.push(new s.V(l.key,l.value,'missing required property "property"')),n==="identity"||l.value.stops||S.push(new s.V(l.key,l.value,'missing required property "stops"')),n==="exponential"&&l.valueSpec.expression&&!s.N(l.valueSpec)&&S.push(new s.V(l.key,l.value,"exponential functions not supported")),l.styleSpec.$version>=8&&(x&&!s.O(l.valueSpec)?S.push(new s.V(l.key,l.value,"property functions not supported")):y&&!s.Q(l.valueSpec)&&S.push(new s.V(l.key,l.value,"zoom functions not supported"))),n!=="categorical"&&!T||l.value.property!==void 0||S.push(new s.V(l.key,l.value,'"property" property is required')),S;function C(M){let D=[];const z=M.value,F=M.key;if(s.J(z)!=="array")return[new s.V(F,z,`array expected, ${s.J(z)} found`)];if(z.length!==2)return[new s.V(F,z,`array length 2 expected, length ${z.length} found`)];if(T){if(s.J(z[0])!=="object")return[new s.V(F,z,`object expected, ${s.J(z[0])} found`)];if(z[0].zoom===void 0)return[new s.V(F,z,"object stop key must have zoom")];if(z[0].value===void 0)return[new s.V(F,z,"object stop key must have value")];const L=s.M(z[0].zoom);if(typeof L!="number")return[new s.V(F,z[0].zoom,"stop zoom values must be numbers")];if(p&&p>L)return[new s.V(F,z[0].zoom,"stop zoom values must appear in ascending order")];L!==p&&(p=L,d=void 0,m={}),D=D.concat(un({key:`${F}[0]`,value:z[0],valueSpec:{zoom:{}},style:M.style,styleSpec:M.styleSpec,objectElementValidators:{zoom:Ja,value:E}}))}else D=D.concat(E({key:`${F}[0]`,value:z[0],style:M.style,styleSpec:M.styleSpec},z));return s.S(s.U(z[1]))?D.concat([new s.V(`${F}
19[1]`,z[1],"expressions are not allowed in function stops.")]):D.concat(Bi({key:`${F}[1]`,value:z[1],valueSpec:t,style:M.style,styleSpec:M.styleSpec}))}function E(M,D){const z=s.J(M.value),F=s.M(M.value),L=M.value!==null?M.value:D;if(c){if(z!==c)return[new s.V(M.key,L,`${z} stop domain type must match previous stop domain type ${c}`)]}else c=z;if(z!=="number"&&z!=="string"&&z!=="boolean"&&typeof F!="number"&&typeof F!="string"&&typeof F!="boolean")return[new s.V(M.key,L,"stop domain value must be a number, string, or boolean")];if(z!=="number"&&n!=="categorical"){let N=`number expected, ${z} found`;return s.O(t)&&n===void 0&&(N+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new s.V(M.key,L,N)]}return n!=="categorical"||z!=="number"||typeof F=="number"&&isFinite(F)&&Math.floor(F)===F?n!=="categorical"&&z==="number"&&typeof F=="number"&&typeof d=="number"&&d!==void 0&&F<d?[new s.V(M.key,L,"stop domain values must appear in ascending order")]:(d=F,n==="categorical"&&F in m?[new s.V(M.key,L,"stop domain values must be unique")]:(m[F]=!0,[])):[new s.V(M.key,L,`integer expected, found ${String(F)}`)]}}function An(l){const t=(l.expressionContext==="property"?s.W:s.X)(s.U(l.value),l.valueSpec);if(t.result==="error")return t.value.map(c=>new s.V(`${l.key}${c.key}`,l.value,c.message));const n=t.value.expression||t.value._styleExpression.expression;if(l.expressionContext==="property"&&l.propertyKey==="text-font"&&!n.outputDefined())return[new s.V(l.key,l.value,`Invalid data expression for "${l.propertyKey}". Output values must be contained as literals within the expression.`)];if(l.expressionContext==="property"&&l.propertyType==="layout"&&!s.Y(n))return[new s.V(l.key,l.value,'"feature-state" data expressions are not supported with layout properties.')];if(l.expressionContext==="filter")return vn(n,l);if(l.expressionContext&&l.expressionContext.indexOf("cluster")===0){if(!s.Z(n,["zoom","feature-state"]))return[new s.V(l.key,l.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(l.expressionContext==="cluster-initial"&&!s._(n))return[new s.V(l.key,l.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function vn(l,t){const n=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(t.valueSpec&&t.valueSpec.expression)for(const d of t.valueSpec.expression.parameters)n.delete(
19d);if(n.size===0)return[];const c=[];return l instanceof s.$&&n.has(l.name)?[new s.V(t.key,t.value,`["${l.name}"] expression is not supported in a filter for a ${t.object.type} layer with id: ${t.object.id}`)]:(l.eachChild(d=>{c.push(...vn(d,t))}),c)}function Ao(l){const t=l.key,n=l.value,c=l.valueSpec,d=[];return Array.isArray(c.values)?c.values.indexOf(s.M(n))===-1&&d.push(new s.V(t,n,`expected one of [${c.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(c.values).indexOf(s.M(n))===-1&&d.push(new s.V(t,n,`expected one of [${Object.keys(c.values).join(", ")}], ${JSON.stringify(n)} found`)),d}function Co(l){return s.a1(s.U(l.value))?An(s.L({},l,{expressionContext:"filter",valueSpec:l.styleSpec[`filter_${l.layerType||"fill"}`]})):Ss(l)}function Ss(l){const t=l.value,n=l.key;if(s.J(t)!=="array")return[new s.V(n,t,`array expected, ${s.J(t)} found`)];const c=l.styleSpec;let d,p=[];if(t.length<1)return[new s.V(n,t,"filter array must have at least 1 element")];switch(p=p.concat(Ao({key:`${n}[0]`,value:t[0],valueSpec:c.filter_operator,style:l.style,styleSpec:l.styleSpec})),s.M(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&s.M(t[1])==="$type"&&p.push(new s.V(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&p.push(new s.V(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(d=s.J(t[1]),d!=="string"&&p.push(new s.V(`${n}[1]`,t[1],`string expected, ${d} found`)));for(let m=2;m<t.length;m++)d=s.J(t[m]),s.M(t[1])==="$type"?p=p.concat(Ao({key:`${n}[${m}]`,value:t[m],valueSpec:c.geometry_type,style:l.style,styleSpec:l.styleSpec})):d!=="string"&&d!=="number"&&d!=="boolean"&&p.push(new s.V(`${n}[${m}]`,t[m],`string, number, or boolean expected, ${d} found`));break;case"any":case"all":case"none":for(let m=1;m<t.length;m++)p=p.concat(Ss({key:`${n}[${m}]`,value:t[m],style:l.style,styleSpec:l.styleSpec}));break;case"has":case"!has":d=s.J(t[1]),t.length!==2?p.push(new s.V(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):d!=="string"&&p.push(new s.V(`${n}[1]`,t[1],`string expected, ${d} found`))}return p}function ea(l,t){const n=l.key,c=l.style,d=l.layer,p=l.styleSpec,m=l.value,y=l.objectKey,x=p[`${t}_${l.layerType}`];if(!x)return[];const T=y.match(/^(.*)-use-theme$/);if(t==="paint"&&T&&x[T[1]])return s.S(m)?[].concat(Bi({key:l.key,value:m,valueSpec:{type:"string",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:y})):Bi({key:n,value:m,valueSpec:{type:"string"},style:c,styleSpec:p});const S=y.match(/^(.*)-transition$/);if(t==="paint"&&S&&x[S[1]]&&x[S[1]].transition)return Bi({key:n,value:m,valueSpec:p.transition,style:c,styleSpec:p});const C=l.valueSpec||x[y];if(!C)return[new s.K(n,m,`unknown property "${y}"`)];let E;if(s.J(m)==="string"&&s.O(C)&&!C.tokens&&(E=/^{([^}]+)}$/.exec(m))){const D=`\`{ "type": "identity", "property": ${E?JSON.stringify(E[1]):'"_"'} }\``;return[new s.V(n,m,`"${y}" does not support interpolation syntax
20Use an identity property function instead: ${D}.`)]}const M=[];if(l.layerType==="symbol")y!=="text-field"||!c||c.glyphs||c.imports||M.push(new s.V(n,m,'use of "text-field" requires a style "glyphs" property')),y==="text-font"&&s.a2(s.U(m))&&s.M(m.type)==="identity"&&M.push(new s.V(n,m,'"text-font" does not support identity functions'));else if(l.layerType==="model"&&t==="paint"&&d&&d.layout&&d.layout.hasOwnProperty("model-id")&&s.O(C)&&(s.a3(C)||s.Q(C))){const D=s.W(s.U(m),C),z=D.value.expression||D.value._styleExpression.expression;z&&!s.Z(z,["measure-light"])&&(y==="model-emissive-strength"&&s._(z)&&s.Y(z)||M.push(new s.V(n,m,`${y} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return M.concat(Bi({key:l.key,value:m,valueSpec:C,style:c,styleSpec:p,expressionContext:"property",propertyType:t,propertyKey:y}))}function dn(l){return ea(l,"paint")}function Cn(l){return ea(l,"layout")}function Qa(l){let t=[];const n=l.value,c=l.key,d=l.style,p=l.styleSpec;n.type||n.ref||t.push(new s.V(c,n,'either "type" or "ref" is required'));let m=s.M(n.type);const y=s.M(n.ref);
20if(n.id){const x=s.M(n.id);for(let T=0;T<l.arrayIndex;T++){const S=d.layers[T];s.M(S.id)===x&&t.push(new s.V(c,n.id,`duplicate layer id "${n.id}", previously used at line ${S.id.__line__}`))}}if("ref"in n){let x;["type","source","source-layer","filter","layout"].forEach(T=>{T in n&&t.push(new s.V(c,n[T],`"${T}" is prohibited for ref layers`))}),d.layers.forEach(T=>{s.M(T.id)===y&&(x=T)}),x?x.ref?t.push(new s.V(c,n.ref,"ref cannot reference another ref layer")):m=s.M(x.type):typeof y=="string"&&t.push(new s.V(c,n.ref,`ref layer "${y}" not found`))}else if(m!=="background"&&m!=="sky"&&m!=="slot")if(n.source){const x=d.sources&&d.sources[n.source],T=x&&s.M(x.type);x?T==="vector"&&m==="raster"?t.push(new s.V(c,n.source,`layer "${n.id}" requires a raster source`)):T==="raster"&&m!=="raster"?t.push(new s.V(c,n.source,`layer "${n.id}" requires a vector source`)):T!=="vector"||n["source-layer"]?T==="raster-dem"&&m!=="hillshade"?t.push(new s.V(c,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(m)?m==="line"&&n.paint&&(n.paint["line-gradient"]||n.paint["line-trim-offset"])&&T==="geojson"&&!x.lineMetrics?t.push(new s.V(c,n,`layer "${n.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):m==="raster-particle"&&T!=="raster-array"&&t.push(new s.V(c,n.source,`layer "${n.id}" requires a 'raster-array' source.`)):t.push(new s.V(c,n.source,"raster-array source can only be used with layer type 'raster'.")):t.push(new s.V(c,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new s.V(c,n.source,`source "${n.source}" not found`))}else t.push(new s.V(c,n,'missing required property "source"'));return t=t.concat(un({key:c,value:n,valueSpec:p.layer,style:l.style,styleSpec:l.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Bi({key:`${c}.type`,value:n.type,valueSpec:p.layer.type,style:l.style,styleSpec:l.styleSpec,object:n,objectKey:"type"}),filter:x=>Co(s.L({layerType:m},x)),layout:x=>un({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>Cn(s.L({layerType:m},T))}}),paint:x=>un({layer:n,key:x.key,value:x.value,valueSpec:{},style:x.style,styleSpec:x.styleSpec,objectElementValidators:{"*":T=>dn(s.L({layerType:m,layer:n},T))}})}})),t}function Mo(l){const t=l.value,n=l.key,c=s.J(t);return c!=="string"?[new s.V(n,t,`string expected, ${c} found`)]:[]}const ta={promoteId:function l({key:t,value:n}){if(s.J(n)==="string")return Mo({key:t,value:n});if(Array.isArray(n)){const c=[],d=s.U(n),p=s.X(d);return p.result==="error"&&p.value.forEach(m=>{c.push(new s.V(`${t}${m.key}`,null,`${m.message}`))}),s.Z(p.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||c.push(new s.V(`${t}`,null,"promoteId expression should be only feature dependent")),c}{const c=[];for(const d in n)c.push(...l({key:`${t}.${d}`,value:n[d]}));return c}}};function Wr(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!t.type)return[new s.V(n,t,'"type" is required')];const p=s.M(t.type);let m=[];switch(["vector","raster","raster-dem","raster-array"].includes(p)&&(t.url||t.tiles||m.push(new s.K(n,t,'Either "url" or "tiles" is required.'))),p){case"vector":case"raster":case"raster-dem":case"raster-array":return m=m.concat(un({key:n,value:t,valueSpec:c[`source_${p.replace("-","_")}`],style:l.style,styleSpec:c,objectElementValidators:ta})),m;case"geojson":if(m=un({key:n,value:t,valueSpec:c.source_geojson,style:d,styleSpec:c,objectElementValidators:ta}),t.cluster)for(const y in t.clusterProperties){const[x,T]=t.clusterProperties[y],S=typeof x=="string"?[x,["accumulated"],["get",y]]:x;m.push(...An({key:`${n}.${y}.map`,value:T,expressionContext:"cluster-map"})),m.push(...An({key:`${n}.${y}.reduce`,value:S,expressionContext:"cluster-reduce"}))}return m;case"video":return un({key:n,value:t,valueSpec:c.source_video,style:d,styleSpec:c});case"image":return un({key:n,value:t,valueSpec:c.source_image,style:d,styleSpec:c});case"canvas":return[new s.V(n,null,"Please use runtime APIs to add canvas sources, rather than 
20including them in stylesheets.","source.canvas")];default:return Ao({key:`${n}.type`,value:t.type,valueSpec:{values:Mn(c)}})}}function Mn(l){return l.source.reduce((t,n)=>{const c=l[n];return c.type.type==="enum"&&(t=t.concat(Object.keys(c.type.values))),t},[])}function Yo(l){const t=l.value,n=l.styleSpec,c=n.light,d=l.style;let p=[];const m=s.J(t);if(t===void 0)return p;if(m!=="object")return p=p.concat([new s.V("light",t,`object expected, ${m} found`)]),p;for(const y in t){const x=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);p=p.concat(T&&c[T[1]]?Bi({key:y,value:t[y],valueSpec:{type:"string"},style:d,styleSpec:n}):x&&c[x[1]]&&c[x[1]].transition?Bi({key:y,value:t[y],valueSpec:n.transition,style:d,styleSpec:n}):c[y]?Bi({key:y,value:t[y],valueSpec:c[y],style:d,styleSpec:n}):[new s.V(y,t[y],`unknown property "${y}"`)])}return p}function Po(l){const t=l.value;let n=[];if(!t)return n;const c=s.J(t);if(c!=="object")return n=n.concat([new s.V("light-3d",t,`object expected, ${c} found`)]),n;const d=l.styleSpec,p=d["light-3d"],m=l.key,y=l.style,x=l.style.lights;for(const C of["type","id"])if(!(C in t))return n=n.concat([new s.V("light-3d",t,`missing property ${C} on light`)]),n;if(t.type&&x)for(let C=0;C<l.arrayIndex;C++){const E=s.M(t.type),M=x[C];s.M(M.type)===E&&n.push(new s.V(m,t.id,`duplicate light type "${t.type}", previously defined at line ${M.id.__line__}`))}const T=`properties_light_${t.type}`;if(!(T in d))return n=n.concat([new s.V("light-3d",t,`Invalid light type ${t.type}`)]),n;const S=d[T];for(const C in t)if(C==="properties"){const E=t[C],M=s.J(E);if(M!=="object")return n=n.concat([new s.V("properties",E,`object expected, ${M} found`)]),n;for(const D in E){const z=D.match(/^(.*)-transition$/),F=D.match(/^(.*)-use-theme$/);n=n.concat(F&&S[F[1]]?Bi({key:C,value:E[D],valueSpec:{type:"string"},style:y,styleSpec:d}):z&&S[z[1]]&&S[z[1]].transition?Bi({key:C,value:t[C],valueSpec:d.transition,style:y,styleSpec:d}):S[D]?Bi({key:D,value:E[D],valueSpec:S[D],style:y,styleSpec:d}):[new s.K(l.key,E[D],`unknown property "${D}"`)])}}else n=n.concat(p[C]?Bi({key:C,value:t[C],valueSpec:p[C],style:y,styleSpec:d}):[new s.K(C,t[C],`unknown property "${C}"`)]);return n}function Ko(l){const t=l.value,n=l.key,c=l.style,d=l.styleSpec,p=d.terrain;let m=[];const y=s.J(t);if(t===void 0||y==="null")return m;if(y!=="object")return m=m.concat([new s.V("terrain",t,`object expected, ${y} found`)]),m;for(const x in t){const T=x.match(/^(.*)-transition$/),S=x.match(/^(.*)-use-theme$/);m=m.concat(S&&p[S[1]]?Bi({key:x,value:t[x],valueSpec:{type:"string"},style:c,styleSpec:d}):T&&p[T[1]]&&p[T[1]].transition?Bi({key:x,value:t[x],valueSpec:d.transition,style:c,styleSpec:d}):p[x]?Bi({key:x,value:t[x],valueSpec:p[x],style:c,styleSpec:d}):[new s.K(x,t[x],`unknown property "${x}"`)])}if(t.source){const x=c.sources&&c.sources[t.source],T=x&&s.M(x.type);x?T!=="raster-dem"&&m.push(new s.V(n,t.source,`terrain cannot be used with a source of type ${String(T)}, it only be used with a "raster-dem" source type`)):m.push(new s.V(n,t.source,`source "${t.source}" not found`))}else m.push(new s.V(n,t,'terrain is missing required property "source"'));return m}function Jo(l){const t=l.value,n=l.style,c=l.styleSpec,d=c.fog;let p=[];const m=s.J(t);if(t===void 0)return p;if(m!=="object")return p=p.concat([new s.V("fog",t,`object expected, ${m} found`)]),p;for(const y in t){const x=y.match(/^(.*)-transition$/),T=y.match(/^(.*)-use-theme$/);p=p.concat(T&&d[T[1]]?Bi({key:y,value:t[y],valueSpec:{type:"string"},style:n,styleSpec:c}):x&&d[x[1]]&&d[x[1]].transition?Bi({key:y,value:t[y],valueSpec:c.transition,style:n,styleSpec:c}):d[y]?Bi({key:y,value:t[y],valueSpec:d[y],style:n,styleSpec:c}):[new s.K(y,t[y],`unknown property "${y}"`)])}return p}const ia={"*":()=>[],array:Xo,boolean:function(l){const t=l.value,n=l.key,c=s.J(t);return c!=="boolean"?[new s.V(n,t,`boolean expected, ${c} found`)]:[]},number:Ja,color:function(l){const t=l.key,n=l.value,c=s.J(n);return c!=="string"?[new s.V(t,n,`color expected, ${c} found`)]:s.a0.parseCSSColor(n)===null?[new s.V(t,n,`color expected, "${n}" found`)]:[]},enum:Ao,filter:Co,function:Io,layer:Qa,object:un,source:Wr,model:s.a4,light:Yo,"light-3d":Po,terrain:Ko,fog:Jo,string:Mo,formatted:function(l){return Mo(l).length===0?[]:An(l)},resolvedImage:function(l){return Mo(l).length===0?[]:An(l)},projection:function(l){const t=l.value,n=l.styleSpec,c=n.projection,d=l.style;let p=[];const m=s.J(t);if(m==="object")for(const y in t)p=p.concat(Bi({key:y,value:t[y],valueSpec:c[y],style:d,styleSpec:n}));else m!=="string"&&(p=p.concat([new s.V("projection",t,`object or string expected, ${m}
20 found`)]));return p},import:function(l){const{value:t,styleSpec:n}=l,{data:c,...d}=t;Object.defineProperty(d,"__line__",{value:t.__line__,enumerable:!1});let p=un(s.L({},l,{value:d,valueSpec:n.import}));return s.M(d.id)===""&&p.push(new s.V(`${l.key}.id`,d,"import id can't be an empty string")),c&&(p=p.concat(tl(c,n,{key:`${l.key}.data`}))),p},iconset:function(l){const t=l.value,n=l.key,c=l.styleSpec,d=l.style;if(!t.type)return[new s.V(n,t,'"type" is required')];const p=s.M(t.type);let m=[];if(m=m.concat(un({key:n,value:t,valueSpec:c[`iconset_${p}`],style:d,styleSpec:c})),p==="source"&&t.source){const y=d.sources&&d.sources[t.source],x=y&&s.M(y.type);y?x!=="raster-array"&&m.push(new s.V(n,t.source,`iconset cannot be used with a source of type ${String(x)}, it only be used with a "raster-array" source type`)):m.push(new s.V(n,t.source,`source "${t.source}" not found`))}return m}};function Bi(l,t=!1){const n=l.value,c=l.valueSpec,d=l.styleSpec;if(c.expression&&s.a2(s.M(n)))return Io(l);if(c.expression&&s.S(s.U(n)))return An(l);if(c.type&&ia[c.type]){const p=ia[c.type](l);return t===!0&&p.length>0&&s.J(l.value)==="array"?An(l):p}return un(s.L({},l,{valueSpec:c.type?d[c.type]:c}))}function el(l){const t=l.value,n=l.key,c=Mo(l);return c.length||(t.indexOf("{fontstack}")===-1&&c.push(new s.V(n,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&c.push(new s.V(n,t,'"glyphs" url must include a "{range}" token'))),c}function tl(l,t=s.a5,n={}){return Bi({key:n.key||"",value:l,valueSpec:t.$root,styleSpec:t,style:l,objectElementValidators:{glyphs:el,"*":()=>[]}})}function Pn(l,t=s.a5){return oe(tl(l,t))}const il=l=>oe(Wr(l)),Th=l=>oe(Yo(l)),ra=l=>oe(Po(l)),Be=l=>oe(Ko(l)),zo=l=>oe(Jo(l)),Sh=l=>oe(function(t){const n=t.value,c=t.style,d=t.styleSpec,p=d.snow;let m=[];const y=s.J(n);if(n===void 0)return m;if(y!=="object")return m=m.concat([new s.V("snow",n,`object expected, ${y} found`)]),m;for(const x in n){const T=x.match(/^(.*)-transition$/);m=m.concat(T&&p[T[1]]&&p[T[1]].transition?Bi({key:x,value:n[x],valueSpec:d.transition,style:c,styleSpec:d}):p[x]?Bi({key:x,value:n[x],valueSpec:p[x],style:c,styleSpec:d}):[new s.K(x,n[x],`unknown property "${x}"`)])}return m}(l)),rl=l=>oe(function(t){const n=t.value,c=t.style,d=t.styleSpec,p=d.rain;let m=[];const y=s.J(n);if(n===void 0)return m;if(y!=="object")return m=m.concat([new s.V("rain",n,`object expected, ${y} found`)]),m;for(const x in n){const T=x.match(/^(.*)-transition$/);m=m.concat(T&&p[T[1]]&&p[T[1]].transition?Bi({key:x,value:n[x],valueSpec:d.transition,style:c,styleSpec:d}):p[x]?Bi({key:x,value:n[x],valueSpec:p[x],style:c,styleSpec:d}):[new s.K(x,n[x],`unknown property "${x}"`)])}return m}(l)),ii=l=>oe(Qa(l)),ye=l=>oe(Co(l)),k=l=>oe(dn(l)),B=l=>oe(Cn(l)),Z=l=>oe(s.a4(l));function oe(l){return l.slice().sort((t,n)=>t.line&&n.line?t.line-n.line:0)}function W(l,t){let n=!1;if(t&&t.length)for(const c of t)c instanceof s.K?s.w(c.message):(l.fire(new s.z(new Error(c.message))),n=!0);return n}let ce;class be extends s.E{constructor(t,n="flat"){super(),this._transitionable=new s.a6(ce||(ce=new s.a7({anchor:new s.a8(s.a5.light.anchor),position:new s.a9(s.a5.light.position),color:new s.a8(s.a5.light.color),intensity:new s.a8(s.a5.light.intensity)}))),this.setLight(t,n),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(t,n,c={}){this._validate(Th,t,c)||(this._transitionable.setTransitionOrValue(t),this.id=n)}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,c){return(!c||c.validate!==!1)&&W(this,t.call(Pn,s.h({value:n,style:{glyphs:!0,sprite:!0},styleSpec:s.a5})))}}let ue=class extends s.E{constructor(l,t,n,c,d){super(),this.scope=n,this._transitionable=new s.a6(new s.a7({source:new s.a8(s.a5.terrain.source),exaggeration:new s.a8(s.a5.terrain.exaggeration)}),n,c),this._transitionable.setTransitionOrValue(l,c),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=t,this.worldview=d}get(){return this._transitionable.serialize()}set(l,t){this._transitionable.setTransitionOrValue(l,t)}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}getExaggeration(l){return this._transitioning.possiblyEvaluate(new s.aa(l,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const l=this._transitionable._values.exaggeration;if(!l)return null;const t=l.value.expression;if(!t)return null;let n=-1,c=-1,d=1;for(const p of t.zoomStops)d=t.evaluate(new s.aa(p,{worldview:this.worldview})),d>.01?(n=p,c=-1):c=p;return d<.01&&n>0&&c>n?[n,c]:null}isZoomDependent(){const l=this._transitionable._values.exaggeration;return l!=null&&l.value!=null&&l.value.expression!=null&&l.value.expression instanceof s.ab}};const xe=45,He=65,ze=.05;function ft(l,t,n,c){const d=s.af(xe,He,n),[p,m]=wt(l,c);let y=1-Math.min(1,Math.exp((t-p)/(m-p)*-6));return y*=y*y,y=Math.min(1,1.00747*y),y*d*l.alpha}function wt(l,t){const n=.5/Math.tan(.5*t);return[l.range[0]+n,l.range[1]+n]}function Et(l,t,n,c,d){const p=s.ad([],[t,n,c],d.mercatorFogMatrix);return ft(l,s.ae(p),d.pitch,d._fov)}function Gt(l,t,n,c,d,p,m){const y=[[n,c,0],[d,c,0],[d,p,0],[n,p,0]];let x=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const S of y){const C=s.ad([],S,t),E=s.ae(C);x=Math.min(x,E),T=Math.max(T,E)}return[ft(l,x,m.pitch,m._fov),ft(l,T,m.pitch,m._fov)]}class kt extends s.E{constructor(t,n,c,d){super();const p=new s.a7({range:new s.a8(s.a5.fog.range),color:new s.a8(s.a5.fog.color),"color-use-theme":new s.a8({type:"string","property-type":"data-constant",default:"default"}),"high-color":new s.a8(s.a5.fog["high-color"]),"high-color-use-theme":new s.a8({type:"string","property-type":"data-constant",default:"default"}),"space-color":new s.a8(s.a5.fog["space-color"]),"space-color-use-theme":new s.a8({type:"string","property-type":"data-constant",default:"default"}
20),"horizon-blend":new s.a8(s.a5.fog["horizon-blend"]),"star-intensity":new s.a8(s.a5.fog["star-intensity"]),"vertical-range":new s.a8(s.a5.fog["vertical-range"])});this._transitionable=new s.a6(p,c,new Map(d)),this.set(t,d),this._transitioning=this._transitionable.untransitioned(),this._transform=n,this.properties=new s.ag(p),this.scope=c}get state(){const t=this._transform,n=t.projection.name==="globe",c=s.ah(t.zoom),d=this.properties.get("range"),p=[.5,3];return{range:n?[s.ai(p[0],d[0],c),s.ai(p[1],d[1],c)]:d,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(t,n,c={}){if(this._validate(zo,t,c))return;const d=s.h({},t);for(const p of Object.keys(s.a5.fog))d[p]===void 0&&(d[p]=s.a5.fog[p].default);this._options=d,this._transitionable.setTransitionOrValue(this._options,n)}getOpacity(t){if(!this._transform.projection.supportsFog)return 0;const n=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:s.af(xe,He,t))*n.a}getOpacityAtLatLng(t,n){return this._transform.projection.supportsFog?function(c,d,p){const m=s.ac.fromLngLat(d),y=p.elevation?p.elevation.getAtPointOrZero(m):0;return Et(c,m.x,m.y,y,p)}(this.state,t,n):0}getOpacityForTile(t){if(!this._transform.projection.supportsFog)return[1,1];const n=this._transform.calculateFogTileMatrix(t.toUnwrapped());return Gt(this.state,n,0,0,s.aj,s.aj,this._transform)}getOpacityForBounds(t,n,c,d,p){return this._transform.projection.supportsFog?Gt(this.state,t,n,c,d,p,this._transform):[1,1]}getFovAdjustedRange(t){return this._transform.projection.supportsFog?wt(this.state,t):[0,1]}isVisibleOnFrustum(t){if(!this._transform.projection.supportsFog)return!1;const n=[4,5,6,7];for(const c of n){const d=t.points[c];let p;if(d[2]>=0)p=d;else{const m=t.points[c-4];p=s.ak(m,d,m[2]/(m[2]-d[2]))}if(Et(this.state,p[0],p[1],0,this._transform)>=ze)return!0}return!1}updateConfig(t){this._transitionable.setTransitionOrValue(this._options,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}_validate(t,n,c){return(!c||c.validate!==!1)&&W(this,t.call(Pn,s.h({value:n,style:{glyphs:!0,sprite:!0},styleSpec:s.a5})))}}let qt,Ei,Ht,rr,Cr=class extends s.E{constructor(l,t,n,c){super();const d=qt||(qt=new s.a7({density:new s.a8(s.a5.snow.density),intensity:new s.a8(s.a5.snow.intensity),color:new s.a8(s.a5.snow.color),opacity:new s.a8(s.a5.snow.opacity),vignette:new s.a8(s.a5.snow.vignette),"vignette-color":new s.a8(s.a5.snow["vignette-color"]),"center-thinning":new s.a8(s.a5.snow["center-thinning"]),direction:new s.a8(s.a5.snow.direction),"flake-size":new s.a8(s.a5.snow["flake-size"])}));this._transitionable=new s.a6(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ag(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=s.al(n[0]),d=-Math.max(s.al(n[1]),.01),p=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette"),y=this.properties.get("vignette-color");return y.a=m,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.am(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:y}}get(){return this._transitionable.serialize()}set(l,t,n={}){if(this._validate(Sh,l,n))return;const c=s.h({},l);for(const d of Object.keys(s.a5.snow))c[d]===void 0&&(c[d]=s.a5.snow[d].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,n){return(!n||n.validate!==!1)&&W(this,l.call(Pn,s.h({value:t,style:{glyphs:!0,sprite:!0},styleSpec:s.a5}
vendor: 4,225 bytes, line 20
20)))}},br=class extends s.E{constructor(l,t,n,c){super();const d=Ei||(Ei=new s.a7({density:new s.a8(s.a5.rain.density),intensity:new s.a8(s.a5.rain.intensity),color:new s.a8(s.a5.rain.color),opacity:new s.a8(s.a5.rain.opacity),vignette:new s.a8(s.a5.rain.vignette),"vignette-color":new s.a8(s.a5.rain["vignette-color"]),"center-thinning":new s.a8(s.a5.rain["center-thinning"]),direction:new s.a8(s.a5.rain.direction),"droplet-size":new s.a8(s.a5.rain["droplet-size"]),"distortion-strength":new s.a8(s.a5.rain["distortion-strength"])}));this._transitionable=new s.a6(d,n,new Map(c)),this.set(l,c),this._transitioning=this._transitionable.untransitioned(),this.properties=new s.ag(d),this.scope=n}get state(){const l=this.properties.get("opacity"),t=this.properties.get("color"),n=this.properties.get("direction"),c=s.al(n[0]),d=-Math.max(s.al(n[1]),.01),p=[Math.cos(c)*Math.cos(d),Math.sin(c)*Math.cos(d),Math.sin(d)],m=this.properties.get("vignette-color");return m.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new s.am(t.r,t.g,t.b,t.a*l),direction:p,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:m}}get(){return this._transitionable.serialize()}set(l,t,n={}){if(this._validate(rl,l,n))return;const c=s.h({},l);for(const d of Object.keys(s.a5.rain))c[d]===void 0&&(c[d]=s.a5.rain[d].default);this._options=c,this._transitionable.setTransitionOrValue(this._options,t)}updateConfig(l){this._transitionable.setTransitionOrValue(this._options,new Map(l))}updateTransitions(l){this._transitioning=this._transitionable.transitioned(l,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(l){this.properties=this._transitioning.possiblyEvaluate(l)}_validate(l,t,n){return(!n||n.validate!==!1)&&W(this,l.call(Pn,s.h({value:t,style:{glyphs:!0,sprite:!0},styleSpec:s.a5})))}};class bi extends s.E{constructor(t,n,c,d){super(),this.scope=c,this._options=t,this.properties=new s.ag(n),this._transitionable=new s.a6(n,c,new Map(d)),this._transitionable.setTransitionOrValue(t.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(t){this._transitionable.setTransitionOrValue(this._options.properties,new Map(t))}updateTransitions(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(t){this.properties=this._transitioning.possiblyEvaluate(t)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(t,n){this._options=t,this._transitionable.setTransitionOrValue(t.properties,n)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class oi{constructor(t,n,c){this.screenBounds=t,this.cameraPoint=c.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=n,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,c)}static createFromScreenPoints(t,n){let c,d;if(t instanceof s.P||typeof t[0]=="number"){const p=s.P.convert(t);c=[p],d=n.isPointAboveHorizon(p)}else{const p=s.P.convert(t[0]),m=s.P.convert(t[1]),y=p.add(m)._div(2);c=[p,m],d=s.ao(p,m).every(x=>n.isPointAboveHorizon(x))&&n.isPointAboveHorizon(y)}return new oi(c,d,n)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(t){return s.ao(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],d=s.ao(n,c,0,!1);return this.cameraPoint.y>c.y&&(this.cameraPoint.x>n.x&&this.cameraPoint.x<c.x?d.splice(3,0,this.cameraPoint):this.cameraPoint.x>=c.x?d[2]=this.cameraPoint:this.cameraPoint.x<=n.x&&(d[3]=this.cameraPoint)),s.ap(d,t)}bufferedCameraGeometryGlobe(t){const n=this.screenBounds[0],c=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],d=s.ao(n,c,t),p=this.cameraPoint.clone();switch(3*((p.y>n.y)+(p.y>
20c.y))+((p.x>n.x)+(p.x>c.x))){case 0:d[0]=p,d[4]=p.clone();break;case 1:d.splice(1,0,p);break;case 2:d[1]=p;break;case 3:d.splice(4,0,p);break;case 5:d.splice(2,0,p);break;case 6:d[3]=p;break;case 7:d.splice(3,0,p);break;case 8:d[2]=p}return d}containsTile(t,n,c,d=0){const p=t.queryPadding/n._pixelsPerMercatorPixel+1,m=c?this._bufferedCameraMercator(p,n):this._bufferedScreenMercator(p,n);let y=t.tileID.wrap+(m.unwrapped?d:0);const x=m.polygon.map(F=>s.aq(t.tileTransform,F,y));if(!s.ar(x,0,0,s.aj,s.aj))return;y=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?d:0);const T=this.screenGeometryMercator.polygon.map(F=>s.as(t.tileTransform,F,y)),S=T.map(F=>new s.P(F[0],F[1])),C=n.getFreeCameraOptions().position||new s.ac(0,0,0),E=s.as(t.tileTransform,C,y),M=T.map(F=>{const L=s.at(F,F,E);return s.au(L,L),new s.av(E,L)}),D=s.aw(t,1,n.zoom)*n._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:S,tilespaceRays:M,bufferedTilespaceGeometry:x,bufferedTilespaceBounds:(z=s.ax(x),z.min.x=s.ay(z.min.x,0,s.aj),z.min.y=s.ay(z.min.y,0,s.aj),z.max.x=s.ay(z.max.x,0,s.aj),z.max.y=s.ay(z.max.y,0,s.aj),z),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:D};var z}_bufferedScreenMercator(t,n){const c=Gi(t);if(this._screenRaycastCache[c])return this._screenRaycastCache[c];{let d;return d=n.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(t),n):{polygon:this.bufferedScreenGeometry(t).map(p=>n.pointCoordinate3D(p)),unwrapped:!0},this._screenRaycastCache[c]=d,d}}_bufferedCameraMercator(t,n){const c=Gi(t);if(this._cameraRaycastCache[c])return this._cameraRaycastCache[c];{let d;return d=n.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(t),n):{polygon:this.bufferedCameraGeometry(t).map(p=>n.pointCoordinate3D(p)),unwrapped:!0},this._cameraRaycastCache[c]=d,d}}_projectAndResample(t,n){const c=function(p,m){const y=s.az([],m.pixelMatrix,m.globeMatrix),x=[0,-s.aB,0,1],T=[0,s.aB,0,1],S=[0,0,0,1];s.aA(x,x,y),s.aA(T,T,y),s.aA(S,S,y);const C=new s.P(x[0]/x[3],x[1]/x[3]),E=new s.P(T[0]/T[3],T[1]/T[3]),M=s.aC(p,C)&&x[3]<S[3],D=s.aC(p,E)&&T[3]<S[3];if(!M&&!D)return null;const z=function(re,K,J){for(let Q=1;Q<re.length;Q++){const me=Xi(K.pointCoordinate3D(re[Q-1]).x),ae=Xi(K.pointCoordinate3D(re[Q]).x);if(J<0){if(me<ae)return{idx:Q,t:-me/(ae-1-me)}}else if(ae<me)return{idx:Q,t:(1-me)/(ae+1-me)}}return null}(p,m,M?-1:1);if(!z)return null;const{idx:F,t:L}=z;let N=F>1?er(p.slice(0,F),m):[],U=F<p.length?er(p.slice(F),m):[];N=N.map(re=>new s.P(Xi(re.x),re.y)),U=U.map(re=>new s.P(Xi(re.x),re.y));const q=[...N];q.length===0&&q.push(U[U.length-1]);const Y=s.ai(q[q.length-1].y,(U.length===0?N[0]:U[0]).y,L);let te;return te=M?[new s.P(0,Y),new s.P(0,0),new s.P(1,0),new s.P(1,Y)]:[new s.P(1,Y),new s.P(1,1),new s.P(0,1),new s.P(0,Y)],q.push(...te),U.length===0?q.push(N[0]):q.push(...U),{polygon:q.map(re=>new s.ac(re.x,re.y)),unwrapped:!1}}(t,n);if(c)return c;const d=function(p,m){let y=!1,x=-1/0,T=0;for(let C=0;C<p.length-1;C++)p[C].x>x&&(x=p[C].x,T=C);for(let C=0;C<p.length-1;C++){const E=(T+C)%(p.length-1),M=p[E],D=p[E+1];Math.abs(M.x-D.x)>.5&&(M.x<D.x?(M.x+=1,E===0&&(p[p.length-1].x+=1)):(D.x+=1,E+1===p.length-1&&(p[0].x+=1)),y=!0)}const S=s.aD(m.center.lng);return y&&S<Math.abs(S-1)&&p.forEach(C=>{C.x-=1}),{polygon:p,unwrapped:y}}(er(t,n).map(p=>new s.P(Xi(p.x),p.y)),n);return{polygon:d.polygon.map(p=>new s.ac(p.x,p.y)),unwrapped:d.unwrapped}}}function er(l,t){return s.aE(l,n=>{const c=t.pointCoordinate3D(n);n.x=c.x,n.y=c.y},1/256)}function Xi(l){return l<0?1+l%1:l%1}function Gi(l){return 100*l|0}function Dr(l,t,n,c,d){const p=function(y,x){if(y)return d(y);if(x){if(l.url&&x.tiles&&l.tiles&&delete l.tiles,x.variants){if(!Array.isArray(x.variants))return d(new Error("variants must be an array"));for(const S of x.variants){if(S==null||typeof S!="object"||S.constructor!==Object)return d(new Error("variant must be an object"));if(!Array.isArray(S.capabilities))return d(new Error("capabilities must be an array"));if(S.capabilities.length===1&&S.capabilities[0]==="meshopt"){x=s.h(x,S);break}}}const T=s.aF(s.h({},x,l),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);T.tiles=t.canonicalizeTileset(T,l.url),d(null,T)}},m=function(y,x,T){if(!y)return null;if(!x&&!T)return y;T=T||y.worldview_default;const S=Object.values(y.language||{});if(S.length===0)return null;const C=Object.values(y.worldview||{});if(C.length===0)return null;const E=S.every(D=>D===x),M=C.every(D=>D===T);return E&&M?y:x in(y.language_options||{})||T in(y.worldview_options||{})?null:y.language_options&&y.worldview_options?y:null}(l.data,n,c);return m?s.q.frame(()=>p(null,m)):l.url?s.n(t.transformRequest(t.normalizeSourceURL(l.url,null,n,c),s.R.Source),p):s.q.frame(()=>{const{data:y,...x}=l;p(null,x)})}function pn(l,t){const n=Math.pow(2,t.z),c=Math.floor(s.aD(l.getWest())*n),d=Math.floor(s.aH(l.getNorth())*n),p=Math.ceil(s.aD(l.getEast())*n),m=Math.ceil(s.aH(l.getSouth())*n);return t.x>=c&&t.x<p&&t.y>=d&&t.y<m}class Xr{constructor(t,n,c){this.bounds=t?s.aG.convert(this.validateBounds(t)):null,this.minzoom=n||0,this.maxzoom=c||24}
vendor: 3,233 bytes, line 20
20validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}addExtraBounds(t){if(t){this.extraBounds||(this.extraBounds=[]);for(const n of t)this.extraBounds.push(s.aG.convert(this.validateBounds(n)))}}contains(t){if(t.z>this.maxzoom||t.z<this.minzoom||this.bounds&&!pn(this.bounds,t))return!1;if(!this.extraBounds)return!0;for(const n of this.extraBounds)if(pn(n,t))return!0;return!1}static fromTileJSON(t){if(!t.bounds&&!t.extra_bounds)return null;const n=new Xr(t.bounds,t.minzoom,t.maxzoom);return n.addExtraBounds(t.extra_bounds),n}}class nl extends s.E{constructor(t,n,c,d){if(super(),this.id=t,this.dispatcher=c,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,s.h(this,s.aF(n,["url","scheme","tileSize","promoteId"])),this._options=s.h({type:"vector"},n),this._collectResourceTiming=!!n.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(d),this._tileWorkers={},this._deduped=new s.aI}load(t){this._loaded=!1,this.fire(new s.A("dataloading",{dataType:"source"}));const n=Array.isArray(this.map._language)?this.map._language.join():this.map._language,c=this.map.getWorldview();this._tileJSONRequest=Dr(this._options,this.map._requestManager,n,c,(d,p)=>{if(this._tileJSONRequest=null,this._loaded=!0,d)n&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${n}`),c&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${c}`),this.fire(new s.z(d));else if(p){if(s.h(this,p),this.hasWorldviews=!!p.worldview_options,p.worldview_default&&(this.worldviewDefault=p.worldview_default),p.vector_layers){this.vectorLayers=p.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const m of p.vector_layers)this.vectorLayerIds.push(m.id),p.worldview&&p.worldview[m.source]&&this.localizableLayerIds.add(m.id)}this.tileBounds=Xr.fromTileJSON(p),rn(p.tiles,this.map._requestManager._customAccessToken),this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))}t&&t(d)})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=s.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return s.h({},this._options)}loadTile(t,n){const c=t.tileID.canonical.url(this.tiles,this.scheme),d=this.map._requestManager.normalizeTileURL(c),p=this.map._requestManager.transformRequest(d,s.R.Tile),m=this.map.style?this.map.style.getLut(this.scope):null,y=m?{image:m.image.clone()}:null,x={request:p,data:void 0,uid:t.uid,tileID:t.tileID,tileZoom:t.tileZoom,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,lut:y,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.t
20ype,source:this.id,scope:this.scope,pixelRatio:s.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:t.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:t.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault};if(this.hasWorldviews&&s.j(c)&&(x.localizableLayerIds=this.localizableLayerIds),x.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired")t.state==="loading"?t.reloadCallback=n:t.request=t.actor.send("reloadTile",x,T.bind(this));else if(t.actor=this._tileWorkers[d]=this._tileWorkers[d]||this.dispatcher.getActor(),this.dispatcher.ready)t.request=t.actor.send("loadTile",x,T.bind(this),void 0,!0);else{const S=s.aJ.call({deduped:this._deduped},x,(C,E)=>{C||!E?T.call(this,C):(x.data={cacheControl:E.cacheControl,expires:E.expires,rawData:E.rawData.slice(0)},t.actor&&t.actor.send("loadTile",x,T.bind(this),void 0,!0))},!0);t.request={cancel:S}}function T(S,C){return delete t.request,t.aborted?n(null):S&&S.status!==404?n(S):(C&&C.resourceTiming&&(t.resourceTiming=C.resourceTiming),this.map._refreshExpiredTiles&&C&&t.setExpiryData(C),t.loadVectorData(C,this.map.painter),s.aK(this.dispatcher),n(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.t
20ype,source:this.id,scope:this.scope})}unloadTile(t,n){t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope}),t.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Br extends s.E{constructor(t,n,c,d){super(),this.id=t,this.dispatcher=c,this.setEventedParent(d),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=s.h({type:"raster"},n),s.h(this,s.aF(n,["url","scheme","tileSize"]))}load(t){this._loaded=!1,this.fire(new s.A("dataloading",{dataType:"source"}));const n=this.map.getWorldview();this._tileJSONRequest=Dr(this._options,this.map._requestManager,null,n,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?this.fire(new s.z(c)):d&&(s.h(this,d),d.raster_layers&&(this.rasterLayers=d.raster_layers,this.rasterLayerIds=this.rasterLayers.map(p=>p.id)),this.tileBounds=Xr.fromTileJSON(d),rn(d.tiles),this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))),t&&t(c)})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}reload(){this.cancelTileJSONRequest();const t=s.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(t))}setTiles(t){return this._options.tiles=t,this.reload(),this}setUrl(t){return this.url=t,this._options.url=t,this.reload(),this}onRemove(t){this.cancelTileJSONRequest()}serialize(){return s.h({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,n){const c=s.q.devicePixelRatio>=2,d=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),c,this.tileSize);t.request=s.o(this.map._requestManager.transformRequest(d,s.R.Tile),(p,m,y,x)=>(delete t.request,t.aborted?(t.state="unloaded",n(null)):p?(t.state="errored",n(p)):m?(this.map._refreshExpiredTiles&&t.setExpiryData({cacheControl:y,expires:x}),t.setTexture(m,this.map.painter),t.state="loaded",s.aK(this.dispatcher),void n(null)):n(null)))}abortTile(t,n){t.request&&(t.request.cancel(),delete t.request),n&&n()}unloadTile(t,n){t.texture&&t.texture instanceof s.T?(t.destroy(!0),t.texture&&t.texture instanceof s.T&&this.map.painter.saveTileTexture(t.texture)):t.destroy(),n&&n()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Qo extends Br{constructor(t,n,c,d){super(t,n,c,d),this.type="raster-array",this.maxzoom=22,this.partial=!0,this._options=s.h({type:"raster-array"},n)}triggerRepaint(t){const n=this.map.painter._terrain,c=this.map.style.getSourceCache(this.id);n&&n.enabled&&c&&n._clearRenderCacheForTile(c.id,t.tileID),this.map.triggerRepaint()}loadTile(t,n){const c=this.map._requestManager.normalizeTileURL(t.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),d=this.map._requestManager.transformRequest(c,s.R.Tile),p={request:d,uid:t.uid,tileID:t.tileID,type:this.t
20ype,source:this.id,scope:this.scope,partial:this.partial};t.source=this.id,t.scope=this.scope,t.requestParams=d,t.actor||(t.actor=this.dispatcher.getActor());const m=(y,x,T,S)=>{if(delete t.request,t.aborted)return t.state="unloaded",n(null);if(y)return y.name==="AbortError"?void 0:(t.state="errored",n(y));if(this.map._refreshExpiredTiles&&x&&t.setExpiryData({cacheControl:T,expires:S}),this.partial)t.state="empty";else{if(!x)return n(null);t.state="loaded",t._isHeaderLoaded=!0,t._mrt=x}n(null)};t.request=this.partial?t.fetchHeader(void 0,m.bind(this)):t.actor.send("loadTile",p,m.bind(this),void 0,!0)}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(t,n){const c=t.texturePerLayer;if(t.flushAllQueues(),c.size){t.destroy(!0);for(const d of c.values())this.map.painter.saveTileTexture(d)}else t.destroy()}prepareTile(t,n,c,d){t._isHeaderLoaded&&(t.state!=="empty"&&(t.state="reloading"),t.fetchBand(n,c,d,(p,m)=>{if(p)return t.state="errored",this.fire(new s.z(p)),void this.triggerRepaint(t);m&&(t._isHeaderLoaded=!0,t.setTexturePerLayer(c,m,this.map.painter),t.state="loaded",this.triggerRepaint(t))}))}getInitialBand(t){if(!this.rasterLayers)return 0;const n=this.rasterLayers.find(({id:p})=>p===t),c=n&&n.fields,d=c&&c.bands&&c.bands;return d?d[0]:0}getTextureDescriptor(t,n,c){if(!t)return;const d=n.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!d)return;let p=null;n instanceof s.aN?p=n.paint.get("raster-array-band"):n instanceof s.aO&&(p=n.paint.get("raster-particle-array-band"));const m=p||this.getInitialBand(d);if(m==null)return;if(!t.textureDescriptorPerLayer.get(n.id))return void this.prepareTile(t,d,n.id,m);if(t.updateNeeded(n.id,m)&&!c)return;const y=t.textureDescriptorPerLayer.get(n.id);return Object.assign({},y,{texture:t.texturePerLayer.get(n.id)})}getImages(t,n){const c=new Map;for(const d of t)for(const p of n){const[m,y]=p.split("/"),x=d.getLayer(m);if(!x||!x.hasBand(y)||!x.hasDataForBand(y))continue;const{bytes:T,tileSize:S,buffer:C}=x.getBandView(y),E=S+2*C,M={data:new s.r({width:E,height:E},T),pixelRatio:2,sdf:!1,usvg:!1,version:0};c.set(p,M)}return c}}const rc={vector:nl,raster:Br,"raster-dem":class extends Br{constructor(l,t,n,c){super(l,t,n,c),this.type="raster-dem",this.maxzoom=22,this._options=s.h({type:"raster-dem"},t),this.encoding=t.encoding||"mapbox"}loadTile(l,t){const n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function c(d,p){d&&(l.state="errored",t(d)),p&&(l.dem=p,l.dem.onDeserialize(),l.needsHillshadePrepare=!0,l.needsDEMTextureUpload=!0,l.state="loaded",t(null))}l.request=s.o(this.map._requestManager.transformRequest(n,s.R.Tile),(function(d,p,m,y){if(delete l.request,l.aborted)l.state="unloaded",t(null);else if(d)l.state="errored",t(d);else if(p){this.map._refreshExpiredTiles&&l.setExpiryData({cacheControl:m,expires:y});const x=ImageBitmap&&p instanceof ImageBitmap&&s.t(),T=1-(p.width-s.aL(p.width))/2;T<1||l.neighboringTiles||(l.neighboringTiles=this._getNeighboringTiles(l.tileID));const S=x?p:s.q.getImageData(p,T),C={uid:l.uid,tileID:l.tileID,source:this.id,type:this.t
20ype,scope:this.scope,rawImageData:S,encoding:this.encoding,padding:T};l.actor&&l.state!=="expired"||(l.actor=this.dispatcher.getActor(),l.actor.send("loadTile",C,c.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(l){const t=l.canonical,n=Math.pow(2,t.z),c=(t.x-1+n)%n,d=t.x===0?l.wrap-1:l.wrap,p=(t.x+1+n)%n,m=t.x+1===n?l.wrap+1:l.wrap,y={};return y[new s.aM(l.overscaledZ,d,t.z,c,t.y).key]={backfilled:!1},y[new s.aM(l.overscaledZ,m,t.z,p,t.y).key]={backfilled:!1},t.y>0&&(y[new s.aM(l.overscaledZ,d,t.z,c,t.y-1).key]={backfilled:!1},y[new s.aM(l.overscaledZ,l.wrap,t.z,t.x,t.y-1).key]={backfilled:!1},y[new s.aM(l.overscaledZ,m,t.z,p,t.y-1).key]={backfilled:!1}),t.y+1<n&&(y[new s.aM(l.overscaledZ,d,t.z,c,t.y+1).key]={backfilled:!1},y[new s.aM(l.overscaledZ,l.wrap,t.z,t.x,t.y+1).key]={backfilled:!1},y[new s.aM(l.overscaledZ,m,t.z,p,t.y+1).key]={backfilled:!1}),y}},"raster-array":Qo,geojson:class extends s.E{constructor(l,t,n,c){super(),this.id=l,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=n.getActor(),this.setEventedParent(c),this._data=t.data,this._options=s.h({},t),this._collectResourceTiming=t.collectResourceTiming,t.maxzoom!==void 0&&(this.maxzoom=t.maxzoom),t.minzoom!==void 0&&(this.minzoom=t.minzoom),t.type&&(this.type=t.type),t.attribution&&(this.attribution=t.attribution),this.promoteId=t.promoteId;const d=s.aj/this.tileSize;this.workerOptions=s.h({source:this.id,scope:this.scope,cluster:t.cluster||!1,geojsonVtOptions:{buffer:(t.buffer!==void 0?t.buffer:128)*d,tolerance:(t.tolerance!==void 0?t.tolerance:.375)*d,extent:s.aj,maxZoom:this.maxzoom,lineMetrics:t.lineMetrics||!1,generateId:t.generateId||!1},superclusterOptions:{maxZoom:t.clusterMaxZoom!==void 0?t.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,t.clusterMinPoints||2),extent:s.aj,radius:(t.clusterRadius!==void 0?t.clusterRadius:50)*d,log:!1,generateId:t.generateId||!1},clusterProperties:t.clusterProperties,filter:t.filter,dynamic:t.dynamic},t.workerOptions)}onAdd(l){this.map=l,this.setData(this._data)}setData(l){return this._data=l,this._updateWorkerData(),this}updateData(l){if(!this._options.dynamic)return this.fire(new s.z(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")));if(typeof l!="string"&&(l.type==="Feature"&&(l={type:"FeatureCollection",features:[l]}),l.type!=="FeatureCollection"))return this.fire(new s.z(new Error("Data to update should be a feature or a feature collection.")));if(this._coalesce&&typeof l!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"){const t=new Map;for(const n of this._data.features)t.set(n.id,n);for(const n of l.features)t.set(n.id,n);this._data.features=[...t.values()]}else this._data=l;return this._updateWorkerData(!0),this}getClusterExpansionZoom(l,t){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterChildren(l,t){return this.actor.send("geojson.getClusterChildren",{clusterId:l,source:this.id,scope:this.scope},t),this}getClusterLeaves(l,t,n,c){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:l,limit:t,offset:n},c),this}_updateWorkerData(l=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new s.A("dataloading",{dataType:"source"})),this._loaded=!1;const t=s.h({append:l},this.workerOptions);t.scope=this.scope;const n=this._data;typeof n=="string"?(t.request=this.map._requestManager.transformRequest(s.q.resolveURL(n),s.R.Source),t.request.collectResourceTiming=this._collectResourceTiming):t.data=JSON.stringify(n),this._pendingLoad=this.actor.send(`${this.type}.loadData`,t,(c,d)=>{if(this._loaded=!0,this._pendingLoad=null,c)this.fire(new s.z(c));else{const p={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&d&&d.resourceTiming&&d.resourceTiming[this.id]&&(p.resourceTiming=d.resourceTiming[this.id]),l&&(this._partialReload=!0),this.fire(new s.A("data",p)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(l),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const l=s.C(this.id,this.scope);this.map.style.clearSource(l),this._updateWorkerData()}loadTile(l,t){const n=l.actor?"reloadTile":"loadTile";l.actor=this.actor;const c=this.map.style?this.map.style.getLut(this.scope):null,d=c?{image:c.image.clone()}
20:null,p=this._partialReload,m={type:this.type,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:d,scope:this.scope,pixelRatio:s.q.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:l.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:p,worldview:this.map.getWorldview()};l.request=this.actor.send(n,m,(y,x)=>p&&!x?(l.state="loaded",t(null)):(delete l.request,l.destroy(),l.aborted?t(null):y?t(y):(l.loadVectorData(x,this.map.painter,n==="reloadTile"),t(null))),void 0,n==="loadTile")}abortTile(l){l.request&&(l.request.cancel(),delete l.request),l.aborted=!0}unloadTile(l,t){this.actor.send("removeTile",{uid:l.uid,type:this.type,source:this.id,scope:this.scope}),l.destroy()}onRemove(l){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return s.h({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends s.aP{constructor(l,t,n,c){super(l,t,n,c),this.roundZoom=!0,this.type="video",this.options=t}load(){this._loaded=!1;const l=this.options;this.urls=[];for(const t of l.urls)this.urls.push(this.map._requestManager.transformRequest(t,s.R.Source).url);s.aQ(this.urls,(t,n)=>{this._loaded=!0,t?this.fire(new s.z(t)):n&&(this.video=n,this.video.loop=!0,this.video.setAttribute("playsinline",""),this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(l){if(this.video){const t=this.video.seekable;l<t.start(0)||l>t.end(0)?this.fire(new s.z(new s.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${t.start(0)} and ${t.end(0)}-second mark.`))):this.video.currentTime=l}}getVideo(){return this.video}onAdd(l){this.map||(this.map=l,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const l=this.map.painter.context,t=l.gl;this.texture?this.video.paused||(this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this.texture=new s.T(l,this.video,t.RGBA8),this.texture.bind(t.LINEAR,t.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(l)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:s.aP,model:class extends s.E{constructor(l,t,n,c){super(),this.id=l,this.type="model",this.models=[],this._loaded=!1,this._options=t}load(){const l=[];for(const t in this._options.models){const n=this._options.models[t],c=s.aS(this.map._requestManager.transformRequest(n.uri,s.R.Model).url).then(d=>{if(!d)return;const p=s.aT(d),m=new s.aU(t,n.position,n.orientation,p);m.computeBoundsAndApplyParent(),this.models.push(m)}).catch(d=>{this.fire(new s.z(new Error(`Could not load model ${t} from ${n.uri}: ${d.message}`)))});l.push(c)}Promise.allSettled(l).then(()=>{this._loaded=!0,this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(t=>{this._loaded=!0,this.fire(new s.z(new Error(`Could not load models: ${t.message}`)))})}onAdd(l){this.map=l,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(l,t){}serialize(){return this._options}},"batched-model":class extends s.E{constructor(l,t,n,c){super(),this.type="batched-model",this.id=l,this.tileSize=512,this._options=t,this.tiles=this._options.tiles,this.maxzoom=t.maxzoom||19,this.minzoom=t.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=n,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(c)}onAdd(l){this.map=l,this.load()}reload(){this.cancelTileJSONRequest();const l=s.C(this.id,this.scope);this.load(()=>this.map.style.clearSource(l))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(l){this._loaded=!1,this.fire(new s.A("dataloading",{dataType:"source"}));const t=Array.isArray(this.map._language)?this.map._language.join():this.map._language,n=this.map.getWorldview();this._tileJSONRequest=Dr(this._options,this.map._requestManager,t,n,(c,d)=>{this._tileJSONRequest=null,this._loaded=!0,c?(t&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${t}`),n&&n.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${n}`),this.fire(new s.z(c))):d&&(s.h(this,d),d.bounds&&(this.tileBounds=new Xr(d.bounds,this.minzoom,this.maxzoom)),rn(d.tiles,this.map._requestManager._customAccessToken),this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))),l&&l(c)})}hasTransition(){return!1}hasTile(l){return!this.tileBounds||this.tileBounds.contains(l.canonical)}loaded(){return this._loaded}loadTile(l,t){const n=this.map._requestManager.normalizeTileURL(l.tileID.canonical.url(this.tiles,this.scheme)),c={request:this.map._requestManager.transformRequest(n,s.R.Tile),data:void 0,uid:l.uid,tileID:l.tileID,tileZoom:l.tileZoom,zoom:l.tileID.overscaledZ,tileSize:this.tileSize*l.tileID.overscaleFactor(),type:this.t
20ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:l.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:s.q.devicePixelRatio,promoteId:this.promoteId};if(l.actor&&l.state!=="expired")if(l.state==="loading")l.reloadCallback=t;else{if(l.buckets){const p=Object.values(l.buckets);for(const m of p)m.dirty=!0;return void(l.state="loaded")}l.request=l.actor.send("reloadTile",c,d.bind(this))}else l.actor=this.dispatcher.getActor(),l.request=l.actor.send("loadTile",c,d.bind(this),void 0,!0);function d(p,m){return l.aborted?t(null):p&&p.status!==404?t(p):(this.map._refreshExpiredTiles&&m&&l.setExpiryData(m),l.loadModelData(m,this.map.painter),l.state="loaded",void t(null))}}serialize(){return s.h({},this._options)}},canvas:class extends s.aP{constructor(l,t,n,c){super(l,t,n,c),t.coordinates?Array.isArray(t.coordinates)&&t.coordinates.length===4&&!t.coordinates.some(d=>!Array.isArray(d)||d.length!==2||d.some(p=>typeof p!="number"))||this.fire(new s.z(new s.V(`sources.${l}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.z(new s.V(`sources.${l}`,null,'missing required property "coordinates"'))),t.animate&&typeof t.animate!="boolean"&&this.fire(new s.z(new s.V(`sources.${l}`,null,'optional "animate" property must be a boolean value'))),t.canvas?typeof t.canvas=="string"||t.canvas instanceof HTMLCanvasElement||this.fire(new s.z(new s.V(`sources.${l}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new s.z(new s.V(`sources.${l}`,null,'missing required property "canvas"'))),this.options=t,this.animate=t.animate===void 0||t.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new s.z(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(l){this.map=l,this.load(),this.canvas&&this.animate&&this.play()}onRemove(l){this.pause()}prepare(){let l=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,l=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,l=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const t=this.map.painter.context;this.texture?!l&&!this._playing||this.texture instanceof s.aR||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new s.T(t,this.canvas,t.gl.RGBA8,{premultiply:!0}),this._prepareData(t)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const l of[this.canvas.width,this.canvas.height])if(isNaN(l)||l<=0)return!0;return!1}},custom:class extends s.E{constructor(l,t,n,c){super(),this.id=l,this.type="custom",this._dataType="raster",this._dispatcher=n,this._implementation=t,this.setEventedParent(c),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new s.z(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new s.z(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Xr(this._implementation.bounds,this.minzoom,this.maxzoom)),t.update=this._update.bind(this),t.clearTiles=this._clearTiles.bind(this),t.coveringTiles=this._coveringTiles.bind(this),s.h(this,s.aF(t,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return s.aF(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new s.A("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(l){this.map=l,this._loaded=!1,this.fire(new s.A("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(l),this.load()}onRemove(l){this._implementation.onRemove&&this._implementation.onRemove(l)}hasTile(l){if(this._implementation.hasTile){const{x:t,y:n,z:c}=l.canonical;return this._implementation.hasTile({x:t,y:n,z:c})}return!this.tileBounds||this.tileBounds.contains(l.canonical)}loadTile(l,t){const{x:n,y:c,z:d}=l.tileID.canonical,p=new AbortController;l.request=Promise.resolve(this._implementation.loadTile({x:n,y:c,z:d},{signal:p.signal})).then((function(m){return delete l.request,l.aborted?(l.state="unloaded",t(null)):m===void 0?(l.state="errored",t(null)):m===null?(this.loadTileData(l,{width:this.tileSize,height:this.tileSize,data:null}),l.state="loaded",t(null)):function(y){return y instanceof ImageData||y instanceof HTMLCanvasElement||y instanceof ImageBitmap||y instanceof HTMLImageElement}(m)?(this.loadTileData(l,m),l.state="loaded",void t(null)):(l.state="errored",t(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(m=>{m.name!=="AbortError"&&(l.state="errored",t(m))}),l.request.cancel=()=>p.abort()}loadTileData(l,t){l.setTexture(t,this.map.painter)}unloadTile(l,t){if(l.texture&&l.texture instanceof s.T?(l.destroy(!0),l.texture&&l.texture instanceof s.T&&this.map.painter.saveTileTexture(l.texture)):l.destroy(),this._implementation.unloadTile){const{x:n,y:c,z:d}=l.tileID.canonical;this._implementation.unloadTile({x:n,y:c,z:d})}t&&t()}abortTile(l,t){l.request&&l.request.cancel&&(l.request.cancel(),delete l.request),t&&t()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}
vendor: 4,585 bytes, line 20
20).map(l=>({x:l.canonical.x,y:l.canonical.y,z:l.canonical.z}))}_clearTiles(){const l=s.C(this.id,this.scope);this.map.style.clearSource(l)}_update(){this.fire(new s.A("data",{dataType:"source",sourceDataType:"content"}))}}},ol=function(l,t,n,c){const d=new rc[t.type](l,t,n,c);if(d.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${d.id}`);return s.aV(["load","abort","unload","serialize","prepare"],d),d};function sl(l,t,n=""){return`${n}:${t.id||""}:${t.layer.id}:${function(c){if("layerId"in c)return`layer:${c.layerId}`;{const{featuresetId:d,importId:p}=c;return`featureset:${d}${p?`:import:${p}`:""}`}}(l.target)}`}function nc(l,t,n,c=""){if(l.uniqueFeatureID){const d=sl(l,t,c);if(n.has(d))return!0;n.add(d)}return!1}function oc(l,t,n,c,d=!1){const p=t.sourceCache.transform,m=t.sourceCache.tilesIn(l,t.has3DLayers,d);m.sort(sc);const y=[];for(const x of m){const T=x.tile.queryRenderedFeatures(t,x,n,c,p,d);Object.keys(T).length&&y.push({wrappedTileID:x.tile.tileID.wrapped().key,queryResults:T})}return y.length===0?{}:function(x){const T={},S={};for(const C of x){const E=C.queryResults,M=C.wrappedTileID,D=S[M]=S[M]||{};for(const z in E){const F=E[z],L=D[z]=D[z]||{},N=T[z]=T[z]||[];for(const U of F)L[U.featureIndex]||(L[U.featureIndex]=!0,N.push(U))}}return T}(y)}function Es(l,t,n,c,d,p){const m={},y=c.queryRenderedSymbols(l),x=[];for(const T of Object.keys(y).map(Number))x.push(d[T]);x.sort(sc);for(const T of x){const S=T.featureIndex.lookupSymbolFeatures(y[T.bucketInstanceId],T.bucketIndex,T.sourceLayerIndex,t,n,p);for(const C in S){const E=m[C]=m[C]||[],M=S[C];M.sort((D,z)=>{const F=T.featureSortOrder;if(F){const L=F.indexOf(D.featureIndex);return F.indexOf(z.featureIndex)-L}return z.featureIndex-D.featureIndex});for(const D of M)E.push(D)}}return m}function al(l,t){const n=l.getRenderableIds().map(p=>l.getTileByID(p)),c=[],d={};for(let p=0;p<n.length;p++){const m=n[p],y=m.tileID.canonical.key;d[y]||(d[y]=!0,m.querySourceFeatures(c,t))}return c}function sc(l,t){const n=l.tileID,c=t.tileID;return n.overscaledZ-c.overscaledZ||n.canonical.y-c.canonical.y||n.wrap-c.wrap||n.canonical.x-c.canonical.x}function ro(l,t){const n={};if(!t)return n;for(const c of l){const d=c.layerIds.map(p=>t.getLayer(p)).filter(Boolean);if(d.length!==0){c.layers=d,c.stateDependentLayerIds&&(c.stateDependentLayers=c.stateDependentLayerIds.map(p=>d.filter(m=>m.id===p)[0]));for(const p of d)n[p.fqid]=c}}return n}const zn=32,Zn=33,Ro=new Uint16Array(8184);for(let l=0;l<2046;l++){let t=l+2,n=0,c=0,d=0,p=0,m=0,y=0;for(1&t?d=p=m=zn:n=c=y=zn;(t>>=1)>1;){const T=n+d>>1,S=c+p>>1;1&t?(d=n,p=c,n=m,c=y):(n=d,c=p,d=m,p=y),m=T,y=S}const x=4*l;Ro[x+0]=n,Ro[x+1]=c,Ro[x+2]=d,Ro[x+3]=p}const no=new Uint16Array(2178),Do=new Uint8Array(1089),ll=new Uint16Array(1089);function ho(l){return l===0?-.03125:l===32?.03125:0}const cl={type:2,extent:s.aj,loadGeometry:()=>[[new s.P(0,0),new s.P(s.aj+1,0),new s.P(s.aj+1,s.aj+1),new s.P(0,s.aj+1),new s.P(0,0)]]};class Is{constructor(t,n,c,d,p,m){this.tileID=t,this.uid=s.a$(),this.uses=0,this.tileSize=n,this.tileZoom=c,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=p,d&&d.style&&(this._lastUpdatedBrightness=d.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",d&&d.transform&&(this.projection=d.transform.projection),this.worldview=m}registerFadeDuration(t){const n=t+this.timeAdded;n<s.q.now()||this.fadeEndTime&&n<this.fadeEndTime||(this.fadeEndTime=n)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=s.aW(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(t,n,c){if(this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=ro(t.buckets,n.style),this.hasSymbolBuckets=!1;for(const d in this.buckets){const p=this.buckets[d];if(p instanceof s.b1){if(this.hasSymbolBuckets=!0,!c)break;p.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const d in this.buckets){const p=this.buckets[d];if(p instanceof s.b1&&p.hasRTLText){this.hasRTLText=!0,s.b2();break}}this.queryPadding=0;for(const d in this.buckets){const p=this.buckets[d],m=n.style.getOwnLayer(d);if(!m)continue;
20const y=m.queryRadius(p);this.queryPadding=Math.max(this.queryPadding,y)}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas),this._lastUpdatedBrightness=t.brightness}else this.collisionBoxArray=new s.b0}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}loadModelData(t,n,c){t&&(t.resourceTiming&&(this.resourceTiming=t.resourceTiming),this.buckets=Object.assign({},this.buckets,ro(t.buckets,n.style)),t.featureIndex&&(this.latestFeatureIndex=t.featureIndex))}getBucket(t){return this.buckets[t.fqid]}upload(t){for(const d in this.buckets){const p=this.buckets[d];p.uploadPending()&&p.upload(t)}const n=t.gl,c=this.imageAtlas;c&&!c.uploaded&&(this.imageAtlasTexture=new s.T(t,c.image,n.RGBA8,{useMipmap:!!c.patternPositions.size}),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new s.T(t,this.glyphAtlasImage,n.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new s.T(t,this.lineAtlas.image,n.R8),this.lineAtlas.uploaded=!0)}prepare(t,n,c){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture,c),!n||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const d=n.style.getBrightness();(this._lastUpdatedBrightness||d)&&(this._lastUpdatedBrightness&&d&&Math.abs(this._lastUpdatedBrightness-d)<.001||(this.updateBuckets(n,this._lastUpdatedBrightness!==d),this._lastUpdatedBrightness=d))}queryRenderedFeatures(t,n,c,d,p,m){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData&&!this.latestFeatureIndex.is3DTile)return{};const y=function(x,T){const S=s.bn([],[.5*x.width,.5*-x.height,1]);return s.bo(S,S,[1,-1,0]),s.az(S,S,x.calculateProjMatrix(T.toUnwrapped())),Float32Array.from(S)}(p,this.tileID);return this.latestFeatureIndex.query(t,{tilespaceGeometry:n,pixelPosMatrix:y,transform:d,availableImages:c,tileTransform:this.tileTransform,worldview:this.worldview})}querySourceFeatures(t,n){const c=this.latestFeatureIndex;if(!c||!c.rawTileData)return;const d=c.loadVTLayers(),p=n?n.sourceLayer:"",m=d._geojsonTileLayer||d[p];if(!m)return;const y=s.b3(n&&n.filter),{z:x,x:T,y:S}=this.tileID.canonical,C={z:x,x:T,y:S};for(let E=0;E<m.length;E++){const M=m.feature(E);if(y.needGeometry){const F=s.b4(M,!0);if(!y.filter(new s.aa(this.tileID.overscaledZ,{worldview:this.worldview}),F,this.tileID.canonical))continue}else if(!y.filter(new s.aa(this.tileID.overscaledZ,{worldview:this.worldview}),M))continue;const D=c.getId(M,p),z=new s.b5(M,x,T,S,D);z.tile=C,t.push(z)}}loaded(){return this.state==="loaded"||this.state==="errored"}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return!!this.imageAtlas&&!!this.imageAtlas.patternPositions.size}setExpiryData(t){const n=this.expirationTime;if(t.cacheControl){const c=s.b6(t.cacheControl);c["max-age"]&&(this.expirationTime=Date.now()+1e3*c["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){const c=Date.now();let d=!1;if(this.expirationTime>c)d=!1;else if(n)if(this.expirationTime<n)d=!0;else{const p=this.expirationTime-n;p?this.expirationTime=c+Math.max(p,3e4):d=!0}else d=!0;d?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}refreshFeatureState(t){this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)&&t&&this.updateBuckets(t)}updateBuckets(t,n){if(!this.latestFeatureIndex||!t.style)return;const c=this.latestFeatureIndex.loadVTLayers(),d=t.style.listImages(),p=t.style.getBrightness();for(const m in this.buckets){if(!t.style.hasLayer(m))continue;const y=this.buckets[m],x=y.layers[0],T=x.sourceLayer||"_geojsonTileLayer",S=c[T],C=t.style.getLayerSourceCache(x);let E={};C&&(E=C._state.getState(T,void 0));const M=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},D=Object.keys(E).length>0&&!n;D&&!y.stateDependentLayers.length&&!n||y.update(E,S,d,M,D?y.stateDependentLayers:y.layers,n,p),(y instanceof s.b7||y instanceof s.b8)&&t._terrain&&t._terrain.enabled&&C&&y.uploadPending()&&t._terrain._clearRenderCacheForTile(C.id,this.tileID);const z=t&&t.style&&t.style.getOwnLayer(m);z&&(this.queryPadding=Math.max(this.queryPadding,z.queryRadius(y)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<s.q.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=s.q.now()+t}setTexture(t,n){const c=n.context,d=c.gl;this.texture=this.texture||n.getTileTexture(t.width),this.texture&&this.texture instanceof s.T?this.texture.update(t):(this.texture=new s.T(c,t,d.RGBA8,{useMipmap:!0}),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE))}
vendor: 6,196 bytes, line 20
20setDependencies(t,n){const c={};for(const d of n)c[d]=!0;this.dependencies[t]=c}hasDependency(t,n){for(const c of t){const d=this.dependencies[c];if(d){for(const p of n)if(d[p])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(t,n){if(!n||n.name==="mercator"||this._tileDebugBuffer)return;const c=s.b9(cl,this.tileID.canonical,this.tileTransform)[0],d=new s.ba,p=new s.bb;for(let m=0;m<c.length;m++){const{x:y,y:x}=c[m];d.emplaceBack(y,x),p.emplaceBack(m)}p.emplaceBack(0),this._tileDebugIndexBuffer=t.createIndexBuffer(p),this._tileDebugBuffer=t.createVertexBuffer(d,s.bc.members),this._tileDebugSegments=s.bd.simpleSegment(0,0,d.length,p.length)}_makeTileBoundsBuffers(t,n){if(this._tileBoundsBuffer||!n||n.name==="mercator")return;const c=s.b9(cl,this.tileID.canonical,this.tileTransform)[0];let d,p;if(this.isRaster){const m=function(y,x){const T=s.aW(y,x),S=Math.pow(2,y.z);for(let F=0;F<Zn;F++)for(let L=0;L<Zn;L++){const N=s.aX((y.x+(L+ho(L))/zn)/S),U=s.aY((y.y+(F+ho(F))/zn)/S),q=x.project(N,U),Y=F*Zn+L;no[2*Y+0]=Math.round((q.x*T.scale-T.x)*s.aj),no[2*Y+1]=Math.round((q.y*T.scale-T.y)*s.aj)}Do.fill(0),ll.fill(0);for(let F=2045;F>=0;F--){const L=4*F,N=Ro[L+0],U=Ro[L+1],q=Ro[L+2],Y=Ro[L+3],te=N+q>>1,re=U+Y>>1,K=te+re-U,J=re+N-te,Q=U*Zn+N,me=Y*Zn+q,ae=re*Zn+te,Ae=Math.hypot((no[2*Q+0]+no[2*me+0])/2-no[2*ae+0],(no[2*Q+1]+no[2*me+1])/2-no[2*ae+1])>=16;Do[ae]=Do[ae]||(Ae?1:0),F<1022&&(Do[ae]=Do[ae]||Do[(U+J>>1)*Zn+(N+K>>1)]||Do[(Y+J>>1)*Zn+(q+K>>1)])}const C=new s.aZ,E=new s.a_;let M=0;function D(F,L){const N=L*Zn+F;return ll[N]===0&&(C.emplaceBack(no[2*N+0],no[2*N+1],F*s.aj/zn,L*s.aj/zn),ll[N]=++M),ll[N]-1}function z(F,L,N,U,q,Y){const te=F+N>>1,re=L+U>>1;if(Math.abs(F-q)+Math.abs(L-Y)>1&&Do[re*Zn+te])z(q,Y,F,L,te,re),z(N,U,q,Y,te,re);else{const K=D(F,L),J=D(N,U),Q=D(q,Y);E.emplaceBack(K,J,Q)}}return z(0,0,zn,zn,zn,0),z(zn,zn,0,0,0,zn),{vertices:C,indices:E}}(this.tileID.canonical,n);d=m.vertices,p=m.indices}else{d=new s.aZ,p=new s.a_;for(const{x:y,y:x}of c)d.emplaceBack(y,x,0,0);const m=s.be(d.int16.subarray(0,4*d.length),void 0,4);for(let y=0;y<m.length;y+=3)p.emplaceBack(m[y],m[y+1],m[y+2])}this._tileBoundsBuffer=t.createVertexBuffer(d,s.bf.members),this._tileBoundsIndexBuffer=t.createIndexBuffer(p),this._tileBoundsSegments=s.bd.simpleSegment(0,0,d.length,p.length)}_makeGlobeTileDebugBuffers(t,n){const c=n.projection;if(!c||c.name!=="globe"||n.freezeTileCoverage)return;const d=this.tileID.canonical,p=s.bg(d,n),m=s.bh(p),y=s.ah(n.zoom);let x;y>0&&(x=s.bi(new Float64Array(16),n.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,d,n,m,x,y),this._makeGlobeTileDebugTextBuffer(t,d,n,m,x,y)}_globePoint(t,n,c,d,p,m,y){let x=s.bj(t,n,c);if(m){const T=1<<c.z,S=s.aD(d.center.lng),C=s.aH(d.center.lat),E=(c.x+.5)/T-S;let M=0;E>.5?M=-1:E<-.5&&(M=1);let D=(t/s.aj+c.x)/T+M,z=(n/s.aj+c.y)/T;D=(D-S)*d._pixelsPerMercatorPixel+S,z=(z-C)*d._pixelsPerMercatorPixel+C;const F=[D*d.worldSize,z*d.worldSize,0];s.ad(F,F,m),x=s.bk(x,F,y)}return s.ad(x,x,p)}_makeGlobeTileDebugBorderBuffer(t,n,c,d,p,m){const y=new s.ba,x=new s.bb,T=new s.bl,S=(E,M,D,z,F)=>{const L=(D-E)/(F-1),N=(z-M)/(F-1),U=y.length;for(let q=0;q<F;q++){const Y=E+q*L,te=M+q*N;y.emplaceBack(Y,te);const re=this._globePoint(Y,te,n,c,d,p,m);T.emplaceBack(re[0],re[1],re[2]),x.emplaceBack(U+q)}},C=s.aj;S(0,0,C,0,16),S(C,0,C,C,16),S(C,C,0,C,16),S(0,C,0,0,16),this._tileDebugIndexBuffer=t.createIndexBuffer(x),this._tileDebugBuffer=t.createVertexBuffer(y,s.bc.members),this._globeTileDebugBorderBuffer=t.createVertexBuffer(T,s.bm.members),this._tileDebugSegments=s.bd.simpleSegment(0,0,y.length,x.length)}_makeGlobeTileDebugTextBuffer(t,n,c,d,p,m){const y=s.aj/4,x=new s.ba,T=new s.a_,S=new s.bl,C=25;T.reserve(32),x.reserve(C),S.reserve(C);const E=(M,D)=>C*M+D;for(let M=0;M<C;M++){const D=M*y;for(let z=0;z<C;z++){const F=z*y;x.emplaceBack(F,D);const L=this._globePoint(F,D,n,c,d,p,m);S.emplaceBack(L[0],L[1],L[2])}}for(let M=0;M<4;M++)for(let D=0;D<4;D++){const z=E(M,D),F=E(M,D+1),L=E(M+1,D),N=E(M+1,D+1);T.emplaceBack(z,F,L),T.emplaceBack(L,F,N)}this._tileDebugTextIndexBuffer=t.createIndexBuffer(T),this._tileDebugTextBuffer=t.createVertexBuffer(x,s.bc.members),this._globeTileDebugTextBuffer=t.createVertexBuffer(S,s.bm.members),this._tileDebugTextSegments=s.bd.simpleSegment(0,0,C,32)}destroy(t=!1){for(const n in this.buckets)this.buckets[n].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&(this.imageAtlasTexture.destroy(),delete this.imageAtlasTexture),this.glyphAtlasTexture&&(this.glyphAtlasTexture.destroy(),delete this.glyphAtlasTexture),this.lineAtlasTexture&&(this.lineAtlasTexture.destroy(),delete this.lineAtlasTexture),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),!t&&this.texture&&this.texture instanceof s.T&&(this.texture.destroy(),delete this.texture),this.hillshadeFBO&&(this.hillshadeFBO.destroy(),delete this.hillshadeFBO),this.dem&&delete this.dem,this.neighboringTiles&&delete this.neighboringTiles,this.demTexture&&(this.demTexture.destroy(),delete this.demTexture),this.rasterParticleState&&(this.rasterParticleState.destroy(),delete this.rasterParticleState),this.latestFeatureIndex=null,this.state="unloaded"}}s.bp.setPbf(s.bq);class na extends Is{constructor(t,n,c,d,p){super(t,n,c,d,p),this._workQueuePerLayer=new Map,this._fetchQueuePerLayer=new Map,this._isHeaderLoaded=!1,this.textureDescriptorPerLayer=new Map,this.texturePerLayer=new Map}
20getLayers(){return this._mrt?Object.values(this._mrt.layers):[]}getLayer(t){return this._mrt&&this._mrt.getLayer(t)}setTexturePerLayer(t,n,c){const d=c.context,p=d.gl;let m=this.texturePerLayer.get(t)||c.getTileTexture(n.width);m&&m instanceof s.T?m.update(n,{premultiply:!1}):m=new s.T(d,n,p.RGBA8,{premultiply:!1}),this.texturePerLayer.has(t)||this.texturePerLayer.set(t,m)}flushQueues(t){const n=this._workQueuePerLayer.get(t)||[],c=this._fetchQueuePerLayer.get(t)||[];for(;n.length;)n.pop()();for(;c.length;)c.pop()()}flushAllQueues(){for(const t of this._workQueuePerLayer.keys()){const n=this._workQueuePerLayer.get(t)||[];for(;n.length;)n.pop()()}for(const t of this._fetchQueuePerLayer.keys()){const n=this._fetchQueuePerLayer.get(t)||[];for(;n.length;)n.pop()()}}fetchHeader(t=16384,n){const c=this._mrt=new s.bp(30),d=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(t-1)}});return this.entireBuffer=null,this.request=s.br(d,(p,m,y,x)=>{if(p)n(p);else try{const T=c.getHeaderLength(m);if(T>t)return void(this.request=this.fetchHeader(T,n));c.parseHeader(m),this._isHeaderLoaded=!0;let S=0;for(const C of Object.values(c.layers))S=Math.max(S,C.dataIndex[C.dataIndex.length-1].lastByte);m.byteLength>=S&&(this.entireBuffer=m),n(null,this.entireBuffer||m,y,x)}catch(T){n(T)}}),this.request}fetchBand(t,n,c,d){const p=this._mrt;if(!this._isHeaderLoaded||!p)return void d(new Error("Tile header is not ready"));const m=this.actor;if(!m)return void d(new Error("Can't fetch tile band without an actor"));let y;const x=(E,M)=>{if(y.complete(E,M),E)return void d(E);this.updateTextureDescriptor(t,n,c);const D=this.textureDescriptorPerLayer.get(n);d(null,D&&D.img)},T=(E,M)=>{if(E)return d(E);const D=m.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:M,task:y},x,void 0,!0),z=this._workQueuePerLayer.get(n)||[];z.push(()=>{D&&D.cancel(),y.cancel()}),this._workQueuePerLayer.has(n)||this._workQueuePerLayer.set(n,z)},S=p.getLayer(t);if(!S)return void d(new Error(`Unknown sourceLayer "${t}"`));if(S.hasDataForBand(c)){this.updateTextureDescriptor(t,n,c);const E=this.textureDescriptorPerLayer.get(n);return void d(null,E?E.img:null)}const C=S.getDataRange([c]);if(y=p.createDecodingTask(C),!y||y.tasks.length)if(this.flushQueues(n),this.entireBuffer)T(null,this.entireBuffer.slice(C.firstByte,C.lastByte+1));else{const E=Object.assign({},this.requestParams,{headers:{Range:`bytes=${C.firstByte}-${C.lastByte}`}}),M=s.br(E,T),D=this._fetchQueuePerLayer.get(n)||[];D.push(()=>{M.cancel(),y.cancel()}),this._fetchQueuePerLayer.has(n)||this._fetchQueuePerLayer.set(n,D)}else d(null)}updateNeeded(t,n){return(!this.textureDescriptorPerLayer.get(t)||this.textureDescriptorPerLayer.get(t).band!==n)&&this.state!=="errored"}updateTextureDescriptor(t,n,c){if(!this._mrt)return;const d=this._mrt.getLayer(t);if(!d||!d.hasBand(c)||!d.hasDataForBand(c))return;const{bytes:p,tileSize:m,buffer:y,offset:x,scale:T}=d.getBandView(c),S=m+2*y,C=new s.r({width:S,height:S},p),E=this.texturePerLayer.get(n);E&&E instanceof s.T&&E.update(C,{premultiply:!1}),this.textureDescriptorPerLayer.set(n,{layer:t,band:c,img:C,buffer:y,offset:x,tileSize:m,format:d.pixelFormat,mix:[T,256*T,65536*T,16777216*T]})}destroy(t=!1){if(super.destroy(t),delete this._mrt,!t)for(const n of this.texturePerLayer.values())n&&n instanceof s.T&&n.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class Eh{constructor(t,n){this.max=t,this.onRemove=n,this.reset()}reset(){for(const t in this.data)for(const n of this.data[t])n.timeout&&clearTimeout(n.timeout),this.onRemove(n.value);return this.data={},this.order=[],this}add(t,n,c){const d=t.wrapped().key;this.data[d]===void 0&&(this.data[d]=[]);const p={value:n,timeout:void 0};if(c!==void 0&&(p.timeout=setTimeout(()=>{this.remove(t,p)},c)),this.data[d].push(p),this.order.push(d),this.order.length>this.max){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const n=this.data[t].shift();return n.timeout&&clearTimeout(n.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),n.value}getByKey(t){const n=this.data[t];return n?n[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,n){if(!this.has(t))return this;const c=t.wrapped().key,d=n===void 0?0:this.data[c].indexOf(n),p=this.data[c][d];return this.data[c].splice(d,1),p.timeout&&clearTimeout(p.timeout),this.data[c].length===0&&delete this.data[c],this.onRemove(p.value),this.order.splice(this.order.indexOf(c),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const n=this._getAndRemoveByKey(this.order[0]);n&&this.onRemove(n)}return this}filter(t){const n=[];for(const c in this.data)for(const d of this.data[c])t(d.value)||n.push(d);for(const c of n)this.remove(c.value.tileID,c)}}class Ih{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,n,c){const d=String(n);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][d]=this.stateChanges[t][d]||{},s.h(this.stateChanges[t][d],c),this.deletedStates[t]===null){this.deletedStates[t]={};for(const p in this.state[t])p!==d&&(this.deletedStates[t][p]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][d]===null){this.deletedStates[t][d]={};for(const p in this.state[t][d])c[p]||(this.deletedStates[t][d][p]=null)}else for(const p in c)this.deletedStates[t]&&this.deletedStates[t][d]&&this.deletedStates[t][d][p]===null&&delete this.deletedStates[t][d][p]}removeFeatureState(t,n,c){if(this.deletedStates[t]===null)return;const d=String(n);if(this.deletedStates[t]=this.deletedStates[t]||{},c&&n!==void 0)this.deletedStates[t][d]!==null&&(this.deletedStates[t][d]=this.deletedStates[t][d]||{},this.deletedStates[t][d][c]=null);else if(n!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][d])for(c in this.deletedStates[t][d]={},this.stateChanges[t][d])this.deletedStates[t][d][c]=null;else this.deletedStates[t][d]=null;else this.deletedStates[t]=null}getState(t,n){const c=this.state[t]||{},d=this.stateChanges[t]||{},p=this.deletedStates[t];if(p===null)return{};if(n!==void 0){const y=String(n),x=s.h({},c[y],d[y]);if(p){const T=p[n];if(T===null)return{};for(const S in T)delete x[S]}return x}const m=s.h({},c,d);if(p)for(const y in p)delete m[y];return m}initializeTileState(t,n){t.refreshFeatureState(n)}coalesceChanges(t,n){const c={};for(const d in this.stateChanges){this.state[d]=this.state[d]||{};const p={};for(const m in this.stateChanges[d])this.state[d][m]||(this.state[d][m]={}),s.h(this.state[d][m],this.stateChanges[d][m]),p[m]=this.state[d][m];c[d]=p}for(const d in this.deletedStates){this.state[d]=this.state[d]||{};const p={};if(this.deletedStates[d]===null)for(const m in this.state[d])p[m]={},this.state[d][m]={};else for(const m in this.deletedStates[d]){if(this.deletedStates[d][m]===null)this.state[d][m]={};else if(this.state[d][m])for(const y of Object.keys(this.deletedStates[d][m]))delete this.state[d][m][y];p[m]=this.state[d][m]}c[d]=c[d]||{},s.h(c[d],p)}if(this.stateChanges={},this.deletedStates={},Object.keys(c).length!==0)for(const d in t)t[d].refreshFeatureState(n)}}class fn extends s.E{constructor(t,n,c){super(),this.id=t,this._onlySymbols=c,n.on("data",d=>{d.dataType==="source"&&d.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&d.dataType==="source"&&d.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),n.on("error",()=>{this._sourceErrored=!0}),this._source=n,this._tiles={},this._cache=new Eh(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={}
vendor: 19,888 bytes, line 20
20,this._minTileCacheSize=n.minTileCacheSize,this._maxTileCacheSize=n.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new Ih,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(t){this.map=t,this._minTileCacheSize=this._minTileCacheSize===void 0&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&t?t._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles)if(!this._tiles[t].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(t,n){return t.isSymbolTile=this._onlySymbols,t.isExtraShadowCaster=this._shadowCasterTiles[t.tileID.key],this._source.loadTile(t,n)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t)}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t)}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const n in this._tiles){const c=this._tiles[n];c.upload(t),c.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(As).map(t=>t.key)}getRenderableIds(t,n){const c=[];for(const d in this._tiles)this._isIdRenderable(+d,t,n)&&c.push(this._tiles[d]);return t?c.sort((d,p)=>{const m=d.tileID,y=p.tileID,x=new s.P(m.canonical.x,m.canonical.y)._rotate(this.transform.angle),T=new s.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle);return m.overscaledZ-y.overscaledZ||T.y-x.y||T.x-x.x}).map(d=>d.tileID.key):c.map(d=>d.tileID).sort(As).map(d=>d.key)}hasRenderableParent(t){const n=this.findLoadedParent(t,0);return!!n&&this._isIdRenderable(n.tileID.key)}_isIdRenderable(t,n,c){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(n||!this._tiles[t].holdingForFade())&&(c||!this._shadowCasterTiles[t])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(+t,"reloading")}}_reloadTile(t,n){const c=this._tiles[t];c&&(c.state!=="loading"&&(c.state=n),this._loadTile(c,this._tileLoaded.bind(this,c,t,n)))}_tileLoaded(t,n,c,d){if(d)if(t.state="errored",d.status!==404)this._source.fire(new s.z(d,{tile:t}));else{if(this._source.fire(new s.A("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:t})),!(t.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const p=this.map.painter.terrain;this.update(this.transform,p.getScaledDemTileSize(),!0),p.resetTileLookupCache(this.id)}else this.update(this.transform)}else t.timeAdded=s.q.now(),c==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(n,t),this._source.type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new s.A("data",{dataType:"source",tile:t,coord:t.tileID,sourceCacheId:this.id}))}_backfillDEM(t){const n=this.getRenderableIds();for(let d=0;d<n.length;d++){const p=n[d];if(t.neighboringTiles&&t.neighboringTiles[p]){const m=this.getTileByID(p);c(t,m),c(m,t)}}function c(d,p){if(!d.dem||d.dem.borderReady)return;d.needsHillshadePrepare=!0,d.needsDEMTextureUpload=!0;let m=p.tileID.canonical.x-d.tileID.canonical.x;const y=p.tileID.canonical.y-d.tileID.canonical.y,x=Math.pow(2,d.tileID.canonical.z),T=p.tileID.key;m===0&&y===0||Math.abs(y)>1||(Math.abs(m)>1&&(Math.abs(m+x)===1?m+=x:Math.abs(m-x)===1&&(m-=x)),p.dem&&d.dem&&(d.dem.backfillBorder(p.dem,m,y),d.neighboringTiles&&d.neighboringTiles[T]&&(d.neighboringTiles[T].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,n,c,d){for(const p in this._tiles){let m=this._tiles[p];if(d[p]||!m.hasData()||m.tileID.overscaledZ<=n||m.tileID.overscaledZ>c)continue;let y=m.tileID;for(;m&&m.tileID.overscaledZ>n+1;){const T=m.tileID.scaledTo(m.tileID.overscaledZ-1);m=this._tiles[T.key],m&&m.hasData()&&(y=T)}let x=y;for(;x.overscaledZ>n;)if(x=x.scaledTo(x.overscaledZ-1),t[x.key]){d[y.key]=y;break}}}findLoadedParent(t,n){if(t.key in this._loadedParentTiles){const c=this._loadedParentTiles[t.key];return c&&c.tileID.overscaledZ>=n?c:null}for(let c=t.overscaledZ-1;c>=n;c--){const d=t.scaledTo(c),p=this._getLoadedTile(d);if(p)return p}}_getLoadedTile(t){const n=this._tiles[t.key];return n&&n.hasData()?n:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,n){n=n||this._source.tileSize;const c=Math.ceil(t.width/n)+1,d=Math.ceil(t.height/n)+1,p=Math.floor(c*d*5),m=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,p):p,y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(y)}handleWrapJump(t){const n=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,n){const c={};for(const d in this._tiles){const p=this._tiles[d];p.tileID=p.tileID.unwrapTo(p.tileID.wrap+n),c[p.tileID.key]=p}this._tiles=c;for(const d in this._timers)clearTimeout(this._timers[d]),delete this._timers[d];for(const d in this._tiles)this._setTileReloadTimer(+d,this._tiles[d])}}update(t,n,c,d,p){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!c)return;this.updateCacheSize(t,n),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const m=this._source.type==="batched-model";let y,x=this._source.maxzoom;const T=this.map&&this.map.painter?this.map.painter._terrain:null;if(T&&T.sourceCache===this&&T.attenuationRange()){const E=T.attenuationRange()[0],M=Math.floor(E)-Math.log2(T.getDemUpscale());x>M&&(x=M)}if(this.used||this.usedForTerrain){if(this._source.tileID)y=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(E=>new s.aM(E.canonical.z,E.wrap,E.canonical.z,E.canonical.x,E.canonical.y));else if(this.tileCoverLift!==0){const E=t.clone();E.tileCoverLift=this.tileCoverLift,y=E.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.minzoom<=1&&t.projection.name==="globe"&&(y.push(new s.aM(1,0,1,0,0)),y.push(new s.aM(1,0,1,1,0)),y.push(new s.aM(1,0,1,0,1)),y.push(new s.aM(1,0,1,1,1)))}else if(y=t.coveringTiles({tileSize:n||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:x,roundZoom:this._source.roundZoom&&!c,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:m}),this._source.hasTile){const E=this._source.hasTile.bind(this._source);y=y.filter(M=>E(M))}}else y=[];if(y.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!hl(this._source.type)){const E=t.coveringZoomLevel({tileSize:n||this._source.tileSize,roundZoom:this._source.roundZoom&&!c}),M=Math.min(E,this._source.maxzoom);if(m){const D=t.extendTileCover(y,M);for(const z of D)y.push(z)}else if(p){const D=t.extendTileCoverToNearPlane(y,this.transform.getFrustum(M),M);for(const z of D)y.push(z)}else if(this.castsShadows&&d){const D=t.extendTileCover(y,M,d);for(const z of D)this._shadowCasterTiles[z.key]=!0,y.push(z)}}const S=this._updateRetainedTiles(y);if(hl(this._source.type)&&y.length!==0){const E={},M={},D=Object.keys(S);for(const F of D){const L=S[F],N=this._tiles[F];if(!N||N.fadeEndTime&&N.fadeEndTime<=s.q.now())continue;const U=this.findLoadedParent(L,Math.max(L.overscaledZ-fn.maxOverzooming,this._source.minzoom));U&&(this._addTile(U.tileID),E[U.tileID.key]=U.tileID),M[F]=L}const z=y[y.length-1].overscaledZ;for(const F in this._tiles){const L=this._tiles[F];if(S[F]||!L.hasData())continue;let N=L.tileID;for(;N.overscaledZ>z;){N=N.scaledTo(N.overscaledZ-1);const U=this._tiles[N.key];if(U&&U.hasData()&&M[N.key]){S[F]=L.tileID;break}}}for(const F in E)S[F]||(this._coveredTiles[F]=!0,S[F]=E[F])}for(const E in S)this._tiles[E].clearFadeHold();const C=s.bs(this._tiles,S);for(const E of C){const M=this._tiles[E];M.hasSymbolBuckets&&!M.holdingForFade()?M.setHoldDuration(this.map._fadeDuration):M.hasSymbolBuckets&&!M.symbolFadeFinished()||this._removeTile(+E)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t)}_updateRetainedTiles(t){const n={};if(t.length===0)return n;const c={},d=t.reduce((T,S)=>Math.min(T,S.overscaledZ),1/0),p=t[0].overscaledZ,m=Math.max(p-fn.maxOverzooming,this._source.minzoom),y=Math.max(p+fn.maxUnderzooming,this._source.minzoom),x={};for(const T of t){const S=this._addTile(T);n[T.key]=T,S.hasData()||d<this._source.maxzoom&&(x[T.key]=T)}this._retainLoadedChildren(x,d,y,n);for(const T of t){let S=this._tiles[T.key];if(S.hasData())continue;if(T.canonical.z>=this._source.maxzoom){const E=T.children(this._source.maxzoom)[0],M=this.getTile(E);if(M&&M.hasData()){n[E.key]=E;continue}}else{const E=T.children(this._source.maxzoom);if(n[E[0].key]&&n[E[1].key]&&n[E[2].key]&&n[E[3].key])continue}let C=S.wasRequested();for(let E=T.overscaledZ-1;E>=m;--E){const M=T.scaledTo(E);if(c[M.key]||(c[M.key]=!0,S=this.getTile(M),!S&&C&&(S=this._addTile(M)),S&&(n[M.key]=M,C=S.wasRequested(),S.hasData())))break}}return n}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const n=[];let c,d=this._tiles[t].tileID;for(;d.overscaledZ>0;){if(d.key in this._loadedParentTiles){c=this._loadedParentTiles[d.key];break}n.push(d.key);const p=d.scaledTo(d.overscaledZ-1);if(c=this._getLoadedTile(p),c)break;d=p}for(const p of n)this._loadedParentTiles[p]=c}}_addTile(t){let n=this._tiles[t.key];if(n)return n.isExtraShadowCaster!==!0||this._shadowCasterTiles[t.key]||this._reloadTile(t.key,"reloading"),n;n=this._cache.getAndRemove(t),n&&(this._setTileReloadTimer(t.key,n),n.tileID=t,this._state.initializeTileState(n,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,n)));const c=!!n;if(!c){const d=this.map?this.map.painter:null,p=this._source.tileSize*t.overscaleFactor();n=this._source.type==="raster-array"?new na(t,p,this.transform.tileZoom,d,this._isRaster):new Is(t,p,this.transform.tileZoom,d,this._isRaster,this._source.worldview),this._loadTile(n,this._tileLoaded.bind(this,n,t.key,n.state))}return n.uses++,this._tiles[t.key]=n,c||this._source.fire(new s.A("dataloading",{tile:n,coord:n.tileID,dataType:"source"})),n}_setTileReloadTimer(t,n){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const c=n.getExpiryTimeout();c&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},c))}_removeTile(t){const n=this._tiles[t];n&&(n.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),n.uses>0||(n.hasData()&&n.state!=="reloading"||n.state==="empty"?this._cache.add(n.tileID,n,n.getExpiryTimeout()):(n.aborted=!0,this._abortTile(n),this._unloadTile(n))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(t,n,c){const d=[],p=this.transform;if(!p)return d;const m=p.projection.name==="globe",y=s.aD(p.center.lng);for(const x in this._tiles){const T=this._tiles[x];if(c&&T.clearQueryDebugViz(),T.holdingForFade())continue;let S;if(m){const C=T.tileID.canonical;if(C.z===0){const E=[Math.abs(s.ay(y,...oa(C,-1))-y),Math.abs(s.ay(y,...oa(C,1))-y)];S=[0,2*E.indexOf(Math.min(...E))-1]}else{const E=[Math.abs(s.ay(y,...oa(C,-1))-y),Math.abs(s.ay(y,...oa(C,0))-y),Math.abs(s.ay(y,...oa(C,1))-y)];S=[E.indexOf(Math.min(...E))-1]}}else S=[0];for(const C of S){const E=t.containsTile(T,p,n,C);E&&d.push(E)}}return d}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(t){return this._getRenderableCoordinates(t)}_getRenderableCoordinates(t,n){const c=this.getRenderableIds(t,n).map(p=>this._tiles[p].tileID),d=this.transform.projection.name==="globe";for(const p of c)p.projMatrix=this.transform.calculateProjMatrix(p.toUnwrapped()),p.expandedProjMatrix=d?this.transform.calculateProjMatrix(p.toUnwrapped(),!1,!0):p.projMatrix;return c}sortCoordinatesByDistance(t){const n=t.slice(),c=this.transform._camera.position,d=this.transform._camera.forward(),p={};for(const m of n){const y=1/(1<<m.canonical.z);p[m.key]=((m.canonical.x+.5)*y+m.wrap-c[0])*d[0]+((m.canonical.y+.5)*y-c[1])*d[1]-c[2]*d[2]}return n.sort((m,y)=>p[m.key]-p[y.key]),n}hasTransition(){if(this._source.hasTransition())return!0;if(hl(this._source.type))for(const t in this._tiles){const n=this._tiles[t];if(n.fadeEndTime!==void 0&&n.fadeEndTime>=s.q.now())return!0}return!1}setFeatureState(t,n,c){this._state.updateState(t=t||"_geojsonTileLayer",n,c)}removeFeatureState(t,n,c){this._state.removeFeatureState(t=t||"_geojsonTileLayer",n,c)}getFeatureState(t,n){return this._state.getState(t=t||"_geojsonTileLayer",n)}setDependencies(t,n,c){const d=this._tiles[t];d&&d.setDependencies(n,c)}reloadTilesForDependencies(t,n){for(const c in this._tiles)this._tiles[c].hasDependency(t,n)&&this._reloadTile(+c,"reloading");this._cache.filter(c=>!c.hasDependency(t,n))}_preloadTiles(t,n){if(!this._sourceLoaded){const x=()=>{this._sourceLoaded&&(this._source.off("data",x),this._preloadTiles(t,n))};return void this._source.on("data",x)}const c=new Map,d=Array.isArray(t)?t:[t],p=this.map.painter.terrain,m=this.usedForTerrain&&p?p.getScaledDemTileSize():this._source.tileSize;for(const x of d){const T=x.coveringTiles({tileSize:m,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const S of T)c.set(S.key,S);this.usedForTerrain&&x.updateElevation(!1)}const y=Array.from(c.values());s.bt(y,(x,T)=>{const S=new Is(x,this._source.tileSize*x.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(S,C=>{this._source.type==="raster-dem"&&S.dem&&this._backfillDEM(S),T(C,S)})},n)}}function As(l,t){const n=Math.abs(2*l.wrap)-+(l.wrap<0),c=Math.abs(2*t.wrap)-+(t.wrap<0);return l.overscaledZ-t.overscaledZ||c-n||t.canonical.y-l.canonical.y||t.canonical.x-l.canonical.x}function hl(l){return l==="raster"||l==="image"||l==="video"||l==="custom"}function oa(l,t){const n=1<<l.z;return[l.x/n+t,(l.x+1)/n+t]}fn.maxOverzooming=10,fn.maxUnderzooming=3;class Sd{constructor(t){this.style=t,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const t=!1,n=!1;for(const c in this.style._mergedLayers){const d=this.style._mergedLayers[c];if(d.type==="fill-extrusion"||d.type==="building")this.layers.push({layer:d,visible:t,visibilityChanged:n});else if(d.type==="model"){const p=this.style.getLayerSource(d);p&&p.type==="batched-model"&&this.layers.push({layer:d,visible:t,visibilityChanged:n})}}}onNewFrame(t){this.layersGotHidden=!1;for(const n of this.layers){const c=n.layer;let d=!1;c.type==="fill-extrusion"?d=!c.isHidden(t)&&c.paint.get("fill-extrusion-opacity")>0:c.type==="building"?d=!c.isHidden(t)&&c.paint.get("building-opacity")>0:c.type==="model"&&(d=!c.isHidden(t)&&c.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!d&&n.visible,n.visible=d}}updateZOffset(t,n){this.currentBuildingBuckets=[];for(const d of this.layers){const p=d.layer,m=this.style.getLayerSourceCache(p);let y=1;p.type==="fill-extrusion"?y=d.visible?p.paint.get("fill-extrusion-vertical-scale"):0:p.type==="building"&&(y=d.visible?p.paint.get("building-vertical-scale"):0);let x=m?m.getTile(n):null;if(!x&&m)for(const T in m._tiles){const S=m._tiles[T];if(n.canonical.isChildOf(S.tileID.canonical)){x=S;break}}this.currentBuildingBuckets.push({bucket:x?x.getBucket(p):null,tileID:x?x.tileID:n,verticalScale:y})}t.hasAnyZOffset=!1;let c=!1;for(let d=0;d<t.symbolInstances.length;d++){const p=t.symbolInstances.get(d),m=p.zOffset,y=this._getHeightAtTileOffset(n,p.tileAnchorX,p.tileAnchorY);p.zOffset=y!==Number.NEGATIVE_INFINITY?y:m,c||m===p.zOffset||(c=!0),t.hasAnyZOffset||p.zOffset===0||(t.hasAnyZOffset=!0)}c&&(t.zOffsetBuffersNeedUpload=!0,t.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(t,n,c,d){let p=n,m=c;if(t.canonical.z!==d.canonical.z){const y=d.canonical,x=1/(1<<t.canonical.z-y.z);p=(n+t.canonical.x*s.aj)*x-y.x*s.aj|0,m=(c+t.canonical.y*s.aj)*x-y.y*s.aj|0}return{tileX:p,tileY:m}}_getHeightAtTileOffset(t,n,c){let d,p;for(let m=0;m<this.layers.length;++m){const y=this.layers[m].layer;if(y.type!=="fill-extrusion"&&y.type!=="building")continue;const{bucket:x,tileID:T,verticalScale:S}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:C,tileY:E}=this._mapCoordToOverlappingTile(t,n,c,T),M=x.getHeightAtTileCoord(C,E);M&&M.height!==void 0&&(M.hidden?d=M.height:p=Math.max(M.height*S,p||0))}if(p!==void 0)return p;for(let m=0;m<this.layers.length;++m){const y=this.layers[m];if(y.layer.type!=="model"||!y.visible)continue;const{bucket:x,tileID:T}=this.currentBuildingBuckets[m];if(!x)continue;const{tileX:S,tileY:C}=this._mapCoordToOverlappingTile(t,n,c,T),E=x.getHeightAtTileCoord(S,C);if(E&&!E.hidden)return E.height===void 0&&d!==void 0?Math.min(E.maxHeight,d)*E.verticalScale:E.height?E.height*E.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function Ed(l,t){const n={};for(const c in l)c!=="ref"&&(n[c]=l[c]);return s.bu.forEach(c=>{c in t&&(n[c]=t[c])}),n}function ul(l){l=l.slice();const t=Object.create(null);for(let n=0;n<l.length;n++)t[l[n].id]=l[n];for(let n=0;n<l.length;n++)"ref"in l[n]&&(l[n]=Ed(l[n],t[l[n].ref]));return l}const Kt={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function ac(l,t,n){n.push({command:Kt.addSource,args:[l,t[l]]})}function sa(l,t,n){t.push({command:Kt.removeSource,args:[l]}),n[l]=!0}function dl(l,t,n,c){sa(l,n,c),ac(l,t,n)}function Mf(l,t,n){let c;for(c in l[n])if(l[n].hasOwnProperty(c)&&c!=="data"&&!s.bv(l[n][c],t[n][c]))return!1;for(c in t[n])if(t[n].hasOwnProperty(c)&&c!=="data"&&!s.bv(l[n][c],t[n][c]))return!1;return!0}function pl(l,t,n,c,d,p){let m;
vendor: 4,352 bytes, line 20
20for(m in t=t||{},l=l||{})l.hasOwnProperty(m)&&(s.bv(l[m],t[m])||n.push({command:p,args:[c,m,t[m],d]}));for(m in t)t.hasOwnProperty(m)&&!l.hasOwnProperty(m)&&(s.bv(l[m],t[m])||n.push({command:p,args:[c,m,t[m],d]}))}function Cs(l){return l.id}function es(l,t){return l[t.id]=t,l}function fl(l,t,n){const c=t.createTileMatrix(l,l.worldSize,n.toUnwrapped());return s.az(new Float32Array(16),l.projMatrix,c)}function Id(l,t,n){if(t.projection.name===n.projection.name)return l.projMatrix;const c=n.clone();return c.setProjection(t.projection),fl(c,t.getProjection(),l)}function lc(l,t,n){return t.name===n.projection.name?l.projMatrix:fl(n,t,l)}class Ad{constructor(t,n){this.reset(t,n)}reset(t,n){this.points=t||[],this._distances=[0];for(let c=1;c<this.points.length;c++)this._distances[c]=this._distances[c-1]+this.points[c].dist(this.points[c-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(n||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(t){if(this.points.length===1)return this.points[0];t=s.ay(t,0,1);let n=1,c=this._distances[n];const d=t*this.paddedLength+this.padding;for(;c<d&&n<this._distances.length;)c=this._distances[++n];const p=n-1,m=this._distances[p],y=c-m,x=y>0?(d-m)/y:0;return this.points[p].mult(1-x).add(this.points[n].mult(x))}}class aa{constructor(t,n,c){const d=this.boxCells=[],p=this.circleCells=[];this.xCellCount=Math.ceil(t/c),this.yCellCount=Math.ceil(n/c);for(let m=0;m<this.xCellCount*this.yCellCount;m++)d.push([]),p.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=n,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/n,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,n,c,d,p){this._forEachCell(n,c,d,p,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(n),this.bboxes.push(c),this.bboxes.push(d),this.bboxes.push(p)}insertCircle(t,n,c,d){this._forEachCell(n-d,c-d,n+d,c+d,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(n),this.circles.push(c),this.circles.push(d)}_insertBoxCell(t,n,c,d,p,m){this.boxCells[p].push(m)}_insertCircleCell(t,n,c,d,p,m){this.circleCells[p].push(m)}_query(t,n,c,d,p,m){if(c<0||t>this.width||d<0||n>this.height)return!p&&[];const y=[];if(t<=0&&n<=0&&this.width<=c&&this.height<=d){if(p)return!0;for(let x=0;x<this.boxKeys.length;x++)y.push({key:this.boxKeys[x],x1:this.bboxes[4*x],y1:this.bboxes[4*x+1],x2:this.bboxes[4*x+2],y2:this.bboxes[4*x+3]});for(let x=0;x<this.circleKeys.length;x++){const T=this.circles[3*x],S=this.circles[3*x+1],C=this.circles[3*x+2];y.push({key:this.circleKeys[x],x1:T-C,y1:S-C,x2:T+C,y2:S+C})}return m?y.filter(m):y}return this._forEachCell(t,n,c,d,this._queryCell,y,{hitTest:p,seenUids:{box:{},circle:{}}},m),p?y.length>0:y}_queryCircle(t,n,c,d,p){const m=t-c,y=t+c,x=n-c,T=n+c;if(y<0||m>this.width||T<0||x>this.height)return!d&&[];const S=[];return this._forEachCell(m,x,y,T,this._queryCellCircle,S,{hitTest:d,circle:{x:t,y:n,radius:c},seenUids:{box:{},circle:{}}},p),d?S.length>0:S}query(t,n,c,d,p){return this._query(t,n,c,d,!1,p)}hitTest(t,n,c,d,p){return this._query(t,n,c,d,!0,p)}hitTestCircle(t,n,c,d){return this._queryCircle(t,n,c,!0,d)}_queryCell(t,n,c,d,p,m,y,x){const T=y.seenUids,S=this.boxCells[p];if(S!==null){const E=this.bboxes;for(const M of S)if(!T.box[M]){T.box[M]=!0;const D=4*M;if(t<=E[D+2]&&n<=E[D+3]&&c>=E[D+0]&&d>=E[D+1]&&(!x||x(this.boxKeys[M]))){if(y.hitTest)return m.push(!0),!0;m.push({key:this.boxKeys[M],x1:E[D],y1:E[D+1],x2:E[D+2],y2:E[D+3]})}}}const C=this.circleCells[p];if(C!==null){const E=this.circles;for(const M of C)if(!T.circle[M]){T.circle[M]=!0;const D=3*M;if(this._circleAndRectCollide(E[D],E[D+1],E[D+2],t,n,c,d)&&(!x||x(this.circleKeys[M]))){if(y.hitTest)return m.push(!0),!0;{const z=E[D],F=E[D+1],L=E[D+2];m.push({key:this.circleKeys[M],x1:z-L,y1:F-L,x2:z+L,y2:F+L})}}}}}_queryCellCircle(t,n,c,d,p,m,y,x){const T=y.circle,S=y.seenUids,C=this.boxCells[p];if(C!==null){const M=this.bboxes;for(const D of C)if(!S.box[D]){S.box[D]=!0;const z=4*D;if(this._circleAndRectCollide(T.x,T.y,T.radius,M[z+0],M[z+1],M[z+2],M[z+3])&&(!x||x(this.boxKeys[D])))return m.push(!0),!0}}const E=this.circleCells[p];if(E!==null){const M=this.circles;for(const D of E)if(!S.circle[D]){S.circle[D]=!0;const z=3*D;
20if(this._circlesCollide(M[z],M[z+1],M[z+2],T.x,T.y,T.radius)&&(!x||x(this.circleKeys[D])))return m.push(!0),!0}}}_forEachCell(t,n,c,d,p,m,y,x){const T=this._convertToXCellCoord(t),S=this._convertToYCellCoord(n),C=this._convertToXCellCoord(c),E=this._convertToYCellCoord(d);for(let M=T;M<=C;M++)for(let D=S;D<=E;D++)if(p.call(this,t,n,c,d,this.xCellCount*D+M,m,y,x))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,n,c,d,p,m){const y=d-t,x=p-n,T=c+m;return T*T>y*y+x*x}_circleAndRectCollide(t,n,c,d,p,m,y){const x=(m-d)/2,T=Math.abs(t-(d+x));if(T>x+c)return!1;const S=(y-p)/2,C=Math.abs(n-(p+S));if(C>S+c)return!1;if(T<=x||C<=S)return!0;const E=T-x,M=C-S;return E*E+M*M<=c*c}}const Ms={unknown:0,flipRequired:1,flipNotRequired:2},Cd=Math.tan(85*Math.PI/180);function ml(l,t,n,c,d,p,m){const y=s.bz();if(n)if(p.name==="globe"){const x=s.bA(d,t);s.az(y,y,x)}else{const x=s.bB([],m);y[0]=x[0],y[1]=x[1],y[4]=x[2],y[5]=x[3],c||s.by(y,y,d.angle)}else s.az(y,d.labelPlaneMatrix,l);return y}function la(l,t,n,c,d,p,m){const y=ml(l,t,n,c,d,p,m);return p.name==="globe"&&n||(y[2]=y[6]=y[10]=y[14]=0),y}function Lo(l,t,n,c,d,p,m){if(n){if(p.name==="globe"){const y=ml(l,t,n,c,d,p,m);return s.bi(y,y),s.az(y,l,y),y}{const y=s.bw(l),x=s.bx([]);return x[0]=m[0],x[1]=m[1],x[4]=m[2],x[5]=m[3],s.az(y,y,x),c||s.by(y,y,-d.angle),y}}return d.glCoordMatrix}function Rn(l,t,n,c){const d=[l,t,n,1];n?s.aA(d,d,c):Md(d,d,c);const p=d[3];return d[0]/=p,d[1]/=p,d[2]/=p,d}function Ah(l,t){return Math.min(.5+l/t*.5,1.5)}function Ch(l,t){const n=l[0]/l[3],c=l[1]/l[3];return n>=-t[0]&&n<=t[0]&&c>=-t[1]&&c<=t[1]}function Ps(l,t,n,c,d,p,m,y,x,T){const S=n.transform,C=c?l.textSizeData:l.iconSizeData,E=s.bH(C,n.transform.zoom),M=S.projection.name==="globe",D=[256/n.width*2+1,256/n.height*2+1],z=c?l.text.dynamicLayoutVertexArray:l.icon.dynamicLayoutVertexArray;z.clear();let F=null;M&&(F=c?l.text.globeExtVertexArray:l.icon.globeExtVertexArray);const L=l.lineVertexArray,N=c?l.text.placedSymbolArray:l.icon.placedSymbolArray,U=n.transform.width/n.transform.height;let q,Y=!1;for(let te=0;te<N.length;te++){const re=N.get(te),{numGlyphs:K,writingMode:J}=re;if(J!==s.bI.vertical||Y||q===s.bI.horizontal||(Y=!0),q=J,(re.hidden||J===s.bI.vertical)&&!Y){ca(K,z);continue}Y=!1;const Q=new s.P(re.tileAnchorX,re.tileAnchorY);let{x:me,y:ae,z:Ae}=S.projection.projectTilePoint(Q.x,Q.y,T.canonical);if(x){const[lt,pt,et]=x(Q);me+=lt,ae+=pt,Ae+=et}const ve=[me,ae,Ae,1];if(s.aA(ve,ve,t),!Ch(ve,D)){ca(K,z);continue}const Me=ve[3],Ue=Ah(n.transform.getCameraToCenterDistance(S.projection),Me),_e=s.bJ(C,E,re),se=m?_e/Ue:_e*Ue,Te=Rn(me,ae,Ae,d);if(Te[3]<=0){ca(K,z);continue}let ge={};const Re=s.al(l.layers[0].layout.get("text-max-angle")),De=Math.cos(Re),Fe=m?null:x,We=cc(re,se,!1,y,t,d,p,l.glyphOffsetArray,L,z,F,Te,Q,ge,U,Fe,S.projection,T,m,De);Y=We.useVertical,Fe&&We.needsFlipping&&(ge={}),(We.notEnoughRoom||Y||We.needsFlipping&&cc(re,se,!0,y,t,d,p,l.glyphOffsetArray,L,z,F,Te,Q,ge,U,Fe,S.projection,T,m,De).notEnoughRoom)&&ca(K,z)}c?(l.text.dynamicLayoutVertexBuffer.updateData(z),F&&l.text.globeExtVertexBuffer&&l.text.globeExtVertexBuffer.updateData(F)):(l.icon.dynamicLayoutVertexBuffer.updateData(z),F&&l.icon.globeExtVertexBuffer&&l.icon.globeExtVertexBuffer.updateData(F))}function bn(l,t,n,c,d,p,m,y,x,T,S,C,E,M,D,z,F){const{lineStartIndex:L,glyphStartIndex:N,segment:U}=y,q=N+y.numGlyphs,Y=L+y.lineLength,te=t.getoffsetX(N),re=t.getoffsetX(q-1),K=_l(l*te,n,c,d,p,m,U,L,Y,x,T,S,C,E,!0,M,D,z,F);if(!K)return null;const J=_l(l*re,n,c,d,p,m,U,L,Y,x,T,S,C,E,!0,M,D,z,F);return J?{first:K,last:J}:null}function Mh(l,t,n,c){return l===s.bI.horizontal&&Math.abs(c)>Math.abs(n)?{useVertical:!0}:l===s.bI.vertical?c>0?{needsFlipping:!0}:null:t!==Ms.unknown&&function(d,p){return d===0||Math.abs(p/d)>Cd}(n,c)?t===Ms.flipRequired?{needsFlipping:!0}:null:n<0?{needsFlipping:!0}:null}function cc(l,t,n,c,d,p,m,y,x,T,S,C,E,M,D,z,F,L,N,U){const q=t/24,Y=l.lineOffsetX*q,te=l.lineOffsetY*q,{lineStartIndex:re,glyphStartIndex:K,numGlyphs:J,segment:Q,writingMode:me,flipState:ae}=l,Ae=re+l.lineLength,ve=Me=>{if(S){const[Te,ge,Re]=Me.up,De=T.length;s.bK(S,De+0,Te,ge,Re),s.bK(S,De+1,Te,ge,Re),s.bK(S,De+2,Te,ge,Re),s.bK(S,De+3,Te,ge,Re)}const[Ue,_e,se]=Me.point;s.bL(T,Ue,_e,se,Me.angle)};if(J>1){const Me=bn(q,y,Y,te,n,C,E,l,x,p,M,z,!1,F,L,N,U);if(!Me)return{notEnoughRoom:!0};if(c&&!n){let[Ue,_e,se]=Me.first.point,[Te,ge,Re]=Me.last.point;[Ue,_e]=Rn(Ue,_e,se,m),[Te,ge]=Rn(Te,ge,Re,m);const De=Mh(me,ae,(Te-Ue)*D,ge-_e);if(l.flipState=De&&De.needsFlipping?Ms.flipRequired:Ms.flipNotRequired,De)return De}ve(Me.first);for(let Ue=K+1;Ue<K+J-1;Ue++){const _e=_l(q*y.getoffsetX(Ue),Y,te,n,C,E,Q,re,Ae,x,p,M,z,!1,!1,F,L,N,U);if(!_e)return T.length-=4*(Ue-K),{notEnoughRoom:!0};ve(_e)}ve(Me.last)}else{if(c&&!n){const Ue=Rn(E.x,E.y,0,d),_e=re+Q+1,se=new s.P(x.getx(_e),x.gety(_e)),Te=Rn(se.x,se.y,0,d),ge=Te[3]>0?Te:ui(E,se,Ue,1,d,void 0,F,L.canonical),Re=Mh(me,ae,(ge[0]-Ue[0])*D,ge[1]-Ue[1]);if(l.flipState=Re&&Re.needsFlipping?Ms.flipRequired:Ms.flipNotRequired,Re)return Re}const Me=_l(q*y.getoffsetX(K),Y,te,n,C,E,Q,re,Ae,x,p,M,z,!1,!1,F,L,N,U);if(!Me)return{notEnoughRoom:!0};ve(Me)}return{}}function Ph(l,t,n,c,d){const{x:p,y:m,z:y}=c.projectTilePoint(l.x,l.y,t);if(!d)return Rn(p,m,y,n);const[x,T,S]=d(l);return Rn(p+x,m+T,y+S,n)}
vendor: 34,585 bytes, line 20
20function ui(l,t,n,c,d,p,m,y){const x=Ph(l.sub(t)._unit()._add(l),y,d,m,p);return s.at(x,n,x),s.au(x,x),s.bE(x,n,x,c)}function _l(l,t,n,c,d,p,m,y,x,T,S,C,E,M,D,z,F,L,N){const U=c?l-t:l+t;let q=U>0?1:-1,Y=0;c&&(q*=-1,Y=Math.PI),q<0&&(Y+=Math.PI);let te=y+m+(q>0?0:1)|0,re=d,K=d,J=0,Q=0;const me=Math.abs(U),ae=[],Ae=[];let ve=p,Me=ve,Ue=s.bC([]);const _e=()=>ui(Me,ve,K,me-J+1,S,E,z,F.canonical);for(;J+Q<=me;){if(te+=q,te<y||te>=x)return null;if(K=re,Me=ve,ae.push(K),M&&Ae.push(Me),ve=new s.P(T.getx(te),T.gety(te)),re=C[te],!re){const et=Ph(ve,F.canonical,S,z,E);re=et[3]>0?C[te]=et:_e()}J+=Q;const lt=s.at([],re,K),pt=s.bD(K,re);if(n&&pt>0&&Q>0&&s.bG(Ue,lt)/(Q*pt)<N)return null;Q=pt,Ue=lt}D&&E&&(C[te]&&(re=_e(),Q=s.bD(K,re),Ue=s.at([],re,K)),C[te]=re);const se=(me-J)/Q,Te=ve.sub(Me)._mult(se)._add(Me),ge=s.bE([],K,Ue,se);let Re=[0,0,1],De=Ue[0],Fe=Ue[1];if(L&&(Re=z.upVector(F.canonical,Te.x,Te.y),Re[0]!==0||Re[1]!==0||Re[2]!==1)){const lt=[Re[2],0,-Re[0]],pt=s.bF([],Re,lt);s.au(lt,lt),s.au(pt,pt),De=s.bG(Ue,lt),Fe=s.bG(Ue,pt)}if(n){const lt=s.bF([],Re,Ue);s.au(lt,lt),s.bE(ge,ge,lt,n*q)}const We=Y+Math.atan2(Fe,De);return ae.push(ge),M&&Ae.push(Te),{point:ge,angle:We,path:ae,tilePath:Ae,up:Re}}function ca(l,t){const n=t.length,c=n+4*l;t.resize(c),t.float32.fill(-1/0,4*n,4*c)}function Md(l,t,n){const c=t[0],d=t[1];return l[0]=n[0]*c+n[4]*d+n[12],l[1]=n[1]*c+n[5]*d+n[13],l[3]=n[3]*c+n[7]*d+n[15],l}const mt=100;class Pd{constructor(t,n,c=new aa(t.width+200,t.height+200,25),d=new aa(t.width+200,t.height+200,25)){this.transform=t,this.grid=c,this.ignoredGrid=d,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+mt,this.screenBottomBoundary=t.height+mt,this.gridRightBoundary=t.width+200,this.gridBottomBoundary=t.height+200,this.fogState=n}placeCollisionBox(t,n,c,d,p,m,y,x,T,S,C){let E=c.projectedAnchorX,M=c.projectedAnchorY,D=c.projectedAnchorZ;const z=c.tileAnchorX,F=c.tileAnchorY,L=c.elevation,N=c.tileID,U=t.getProjection();if(L&&N){const[Ae,ve,Me]=U.upVector(N.canonical,c.tileAnchorX,c.tileAnchorY),Ue=U.upVectorScale(N.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;E+=Ae*L*Ue,M+=ve*L*Ue,D+=Me*L*Ue}const q=t.projection.name==="globe",Y=t.projection.name==="globe"?s.ah(this.transform.zoom):0;if(N&&q&&Y<1&&!m){const Ae=1<<N.canonical.z,ve=s.bM(z,F);s.bN(ve,ve,1/s.aj),s.bO(ve,ve,s.bM(N.canonical.x,N.canonical.y)),s.bN(ve,ve,1/Ae),s.bP(ve,ve,s.bM(d[0],d[1])),ve[0]=s.bQ(ve[0],-.5,.5),s.bN(ve,ve,s.aj);const Me=s.bR(ve[0],ve[1],s.aj/(2*Math.PI),1);s.aA(Me,Me,p),E=s.ai(E,Me[0],Y),M=s.ai(M,Me[1],Y),D=s.ai(D,Me[2],Y)}const te=this.projectAndGetPerspectiveRatio(S,E,M,D,c.tileID,U.name==="globe"||!!L||this.transform.pitch>0,U),re=T*te.perspectiveRatio,K=(c.x1*n+y.x-c.padding)*re+te.point.x,J=(c.y1*n+y.y-c.padding)*re+te.point.y,Q=(c.x2*n+y.x+c.padding)*re+te.point.x,me=(c.y2*n+y.y+c.padding)*re+te.point.y,ae=te.perspectiveRatio<=.55||te.occluded;return!this.isInsideGrid(K,J,Q,me)||!x&&this.grid.hitTest(K,J,Q,me,C)||ae?{box:[],offscreen:!1,occluded:te.occluded}:{box:[K,J,Q,me],offscreen:this.isOffscreen(K,J,Q,me),occluded:!1}}placeCollisionCircles(t,n,c,d,p,m,y,x,T,S,C,E,M,D,z){const F=[],L=this.transform.elevation,N=t.getProjection(),U=L?L.getAtTileOffsetFunc(z,this.transform.center.lat,this.transform.worldSize,N):null,q=new s.P(c.tileAnchorX,c.tileAnchorY);let{x:Y,y:te,z:re}=N.projectTilePoint(q.x,q.y,z.canonical);if(U){const[Re,De,Fe]=U(q);Y+=Re,te+=De,re+=Fe}const K=N.name==="globe",J=this.projectAndGetPerspectiveRatio(y,Y,te,re,z,K||!!L||this.transform.pitch>0,N),{perspectiveRatio:Q}=J,me=(C?m/Q:m*Q)/s.bU,ae=Rn(Y,te,re,x),Ae=c.lineOffsetX*me,ve=c.lineOffsetY*me,Me=s.al(t.layers[0].layout.get("text-max-angle")),Ue=Math.cos(Me),_e=J.signedDistanceFromCamera>0?bn(me,p,Ae,ve,!1,ae,q,c,d,x,{},L&&!C?U:null,C&&!!L,N,z,C,Ue):null;let se=!1,Te=!1,ge=!0;if(_e&&!J.occluded){const Re=.5*M*Q+D,De=new s.P(-100,-100),Fe=new s.P(this.screenRightBoundary,this.screenBottomBoundary),We=new Ad,{first:lt,last:pt}=_e,et=lt.path.length;let ut=[];for(let Mt=et-1;Mt>=1;Mt--)ut.push(lt.path[Mt]);for(let Mt=1;Mt<pt.path.length;Mt++)ut.push(pt.path[Mt]);const ct=2.5*Re;T&&(ut=ut.map(([Mt,Bt,Jt],At)=>(U&&!K&&(Jt=U(At<et-1?lt.tilePath[et-1-At]:pt.tilePath[At-et+2])[2]),Rn(Mt,Bt,Jt,T))),ut.some(Mt=>Mt[3]<=0)&&(ut=[]));let Tt=[];if(ut.length>0){let Mt=1/0,Bt=-1/0,Jt=1/0,At=-1/0;for(const Qt of ut)Mt=Math.min(Mt,Qt[0]),Jt=Math.min(Jt,Qt[1]),Bt=Math.max(Bt,Qt[0]),At=Math.max(At,Qt[1]);Bt>=De.x&&Mt<=Fe.x&&At>=De.y&&Jt<=Fe.y&&(Tt=[ut.map(Qt=>new s.P(Qt[0],Qt[1]))],(Mt<De.x||Bt>Fe.x||Jt<De.y||At>Fe.y)&&(Tt=s.bS(Tt,De.x,De.y,Fe.x,Fe.y)))}for(const Mt of Tt){We.reset(Mt,.25*Re);let Bt=0;Bt=We.length<=.5*Re?1:Math.ceil(We.paddedLength/ct)+1;for(let Jt=0;Jt<Bt;Jt++){const At=Jt/Math.max(Bt-1,1),Qt=We.lerp(At),ri=Qt.x+mt,Si=Qt.y+mt;F.push(ri,Si,Re,0);const Ft=ri-Re,ei=Si-Re,ti=ri+Re,si=Si+Re;if(ge=ge&&this.isOffscreen(Ft,ei,ti,si),Te=Te||this.isInsideGrid(Ft,ei,ti,si),!n&&this.grid.hitTestCircle(ri,Si,Re,E)&&(se=!0,!S))return{circles:[],offscreen:!1,collisionDetected:se,occluded:!1}}}}return{circles:!S&&se||!Te?[]:F,offscreen:ge,collisionDetected:se,occluded:J.occluded}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const n=[];let c=1/0,d=1/0,p=-1/0,m=-1/0;for(const S of t){const C=new s.P(S.x+mt,S.y+mt);c=Math.min(c,C.x),d=Math.min(d,C.y),p=Math.max(p,C.x),m=Math.max(m,C.y),n.push(C)}const y=this.grid.query(c,d,p,m).concat(this.ignoredGrid.query(c,d,p,m)),x={},T={};for(const S of y){const C=S.key;if(x[C.bucketInstanceId]===void 0&&(x[C.bucketInstanceId]={}),x[C.bucketInstanceId][C.featureIndex])continue;const E=[new s.P(S.x1,S.y1),new s.P(S.x2,S.y1),new s.P(S.x2,S.y2),new s.P(S.x1,S.y2)];s.bT(n,E)&&(x[C.bucketInstanceId][C.featureIndex]=!0,T[C.bucketInstanceId]===void 0&&(T[C.bucketInstanceId]=[]),T[C.bucketInstanceId].push(C.featureIndex))}return T}insertCollisionBox(t,n,c,d,p){(n?this.ignoredGrid:this.grid).insert({bucketInstanceId:c,featureIndex:d,collisionGroupID:p},t[0],t[1],t[2],t[3])}insertCollisionCircles(t,n,c,d,p){const m=n?this.ignoredGrid:this.grid,y={bucketInstanceId:c,featureIndex:d,collisionGroupID:p};for(let x=0;x<t.length;x+=4)m.insertCircle(y,t[x],t[x+1],t[x+2])}projectAndGetPerspectiveRatio(t,n,c,d,p,m,y){const x=[n,c,d,1];let T=!1;d||this.transform.pitch>0?(s.aA(x,x,t),this.fogState&&p&&y.name!=="globe"&&(T=function(E,M,D,z,F,L){const N=L.calculateFogTileMatrix(F),U=[M,D,z];return s.ad(U,U,N),ft(E,s.ae(U),L.pitch,L._fov)}(this.fogState,n,c,d,p.toUnwrapped(),this.transform)>.9)):Md(x,x,t);const S=x[3];return{point:new s.P((x[0]/S+1)/2*this.transform.width+mt,(-x[1]/S+1)/2*this.transform.height+mt),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(y)/S*.5,1.5),signedDistanceFromCamera:S,occluded:m&&x[2]>S||T}}isOffscreen(t,n,c,d){return c<mt||t>=this.screenRightBoundary||d<mt||n>this.screenBottomBoundary}isInsideGrid(t,n,c,d){return c>=0&&t<this.gridRightBoundary&&d>=0&&n<this.gridBottomBoundary}getViewportMatrix(){const t=s.bx([]);return s.bo(t,t,[-100,-100,0]),t}}class gl{constructor(t,n,c,d){this.opacity=t?Math.max(0,Math.min(1,t.opacity+(t.placed?n:-n))):d&&c?1:0,this.placed=c}isHidden(){return this.opacity===0&&!this.placed}}class zs{constructor(t,n,c,d,p,m=!1){this.text=new gl(t?t.text:null,n,c,p),this.icon=new gl(t?t.icon:null,n,d,p),this.clipped=m}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Dn{constructor(t,n,c,d=!1){this.text=t,this.icon=n,this.skipFade=c,this.clipped=d}}class zh{constructor(){this.invProjMatrix=s.bz(),this.viewportMatrix=s.bz(),this.circles=[]}}class ha{constructor(t,n,c,d,p){this.bucketInstanceId=t,this.featureIndex=n,this.sourceLayerIndex=c,this.bucketIndex=d,this.tileID=p}}class dt{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){const n=++this.maxGroupID;this.collisionGroups[t]={ID:n,predicate:c=>c.collisionGroupID===n}}return this.collisionGroups[t]}}function ci(l,t,n,c,d){const{horizontalAlign:p,verticalAlign:m}=s.bZ(l),y=-(p-.5)*t,x=-(m-.5)*n,T=s.b_(l,c);return new s.P(y+T[0]*d,x+T[1]*d)}function hi(l,t,n,c,d){const p=new s.P(l,t);return n&&p._rotate(c?d:-d),p}class wn{constructor(t,n,c,d,p,m){this.transform=t.clone(),this.projection=t.projection.name,this.collisionIndex=new Pd(this.transform,p),this.buildingIndex=m,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=n,this.retainedQueryData={},this.collisionGroups=new dt(c),this.collisionCircleArrays={},this.prevPlacement=d,d&&(d.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,n,c,d,p=1){const m=c.getBucket(n),y=c.latestFeatureIndex;if(!m||!y||n.fqid!==m.layerIds[0])return;const x=m.layers[0].layout,T=m.layers[0].paint,S=c.collisionBoxArray,C=Math.pow(2,this.transform.zoom-c.tileID.overscaledZ),E=c.tileSize/s.aj,M=c.tileID.toUnwrapped();this.transform.setProjection(m.projection);const D=(z=c.tileID,F=m.getProjection(),L=this.transform,F.name===this.projection?L.calculateProjMatrix(z.toUnwrapped()):fl(L,F,z));var z,F,L;const N=x.get("text-pitch-alignment")==="map",U=x.get("text-rotation-alignment")==="map";n.compileFilter(n.options);const q=n.dynamicFilter(),Y=n.dynamicFilterNeedsFeature(),te=this.transform.calculatePixelsToTileUnitsMatrix(c),re=la(D,c.tileID.canonical,N,U,this.transform,m.getProjection(),te);let K=null;const J=m.getProjection().createInversionMatrix(this.transform,c.tileID.canonical);if(N){const se=Lo(D,c.tileID.canonical,N,U,this.transform,m.getProjection(),te);K=s.az([],this.transform.labelPlaneMatrix,se)}let Q=null;q&&c.latestFeatureIndex&&(Q={unwrappedTileID:M,dynamicFilter:q,dynamicFilterNeedsFeature:Y}),this.retainedQueryData[m.bucketInstanceId]=new ha(m.bucketInstanceId,y,m.sourceLayerIndex,m.index,c.tileID);const[me,ae]=m.layers[0].layout.get("text-size-scale-range"),Ae=s.ay(p,me,ae),[ve,Me]=x.get("icon-size-scale-range"),Ue=s.ay(p,ve,Me),_e={bucket:m,layout:x,paint:T,posMatrix:D,invMatrix:J,mercatorCenter:[s.aD(this.transform.center.lng),s.aH(this.transform.center.lat)],textLabelPlaneMatrix:re,labelToScreenMatrix:K,clippingData:Q,scale:C,textPixelRatio:E,holdingForFade:c.holdingForFade(),collisionBoxArray:S,partiallyEvaluatedTextSize:s.bH(m.textSizeData,this.transform.zoom,Ae),partiallyEvaluatedIconSize:s.bH(m.iconSizeData,this.transform.zoom,Ue),collisionGroup:this.collisionGroups.get(m.sourceID),latestFeatureIndex:c.latestFeatureIndex};if(d)for(const se of m.sortKeyRanges){const{sortKey:Te,symbolInstanceStart:ge,symbolInstanceEnd:Re}=se;t.push({sortKey:Te,symbolInstanceStart:ge,symbolInstanceEnd:Re,parameters:_e})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:_e})}attemptAnchorPlacement(t,n,c,d,p,m,y,x,T,S,C,E,M,D,z,F,L,N,U,q,Y){const{textOffset0:te,textOffset1:re,crossTileID:K}=z,J=[te,re],Q=ci(t,m,y,J,x),me=this.collisionIndex.placeCollisionBox(L,x,n,c,d,p,hi(Q.x,Q.y,T,S,this.transform.angle),D,C,E,M.predicate);if(U){const ae=L.getSymbolInstanceIconSize(Y,this.transform.zoom,z.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(L,ae,U,c,d,p,hi(Q.x,Q.y,T,S,this.transform.angle),D,C,E,M.predicate).box.length===0)return}if(me.box.length>0){let ae;return this.prevPlacement&&this.prevPlacement.variableOffsets[K]&&this.prevPlacement.placements[K]&&this.prevPlacement.placements[K].text&&(ae=this.prevPlacement.variableOffsets[K].anchor),this.variableOffsets[K]={textOffset:J,width:m,height:y,anchor:t,textScale:x,prevAnchor:ae},this.markUsedJustification(L,t,z,N),L.allowVerticalPlacement&&(this.markUsedOrientation(L,N,z),this.placedOrientations[K]=N),{shift:Q,placedGlyphBoxes:me}}}placeLayerBucketPart(t,n,c,d,p=1){const{bucket:m,layout:y,paint:x,posMatrix:T,textLabelPlaneMatrix:S,labelToScreenMatrix:C,clippingData:E,textPixelRatio:M,mercatorCenter:D,invMatrix:z,holdingForFade:F,collisionBoxArray:L,partiallyEvaluatedTextSize:N,partiallyEvaluatedIconSize:U,collisionGroup:q,latestFeatureIndex:Y}=t.parameters,te=y.get("text-optional"),re=y.get("icon-optional"),K=y.get("text-allow-overlap"),J=y.get("icon-allow-overlap"),Q=y.get("text-rotation-alignment")==="map",me=y.get("icon-rotation-alignment")==="map",ae=y.get("text-pitch-alignment")==="map",Ae=x.get("symbol-z-offset"),ve=y.get("symbol-elevation-reference")==="sea",Me=y.get("symbol-placement"),[Ue,_e]=y.get("text-size-scale-range"),[se,Te]=y.get("icon-size-scale-range"),ge=s.ay(p,Ue,_e),Re=s.ay(p,se,Te),De=y.get("text-variable-anchor"),Fe=Q&&Me!=="point",We=me&&Me!=="point",lt=De&&m.hasTextData(),pt=m.hasIconTextFit()&&lt&&m.hasIconData();this.transform.setProjection(m.projection);const et=lt||Fe,ut=We||pt;let ct=K&&(J||!m.hasIconData()||re),Tt=J&&(K||!m.hasTextData()||te);const Mt=!Ae.isConstant();!m.collisionArrays&&L&&m.deserializeCollisionBoxes(L),c&&d&&m.updateCollisionDebugBuffers(this.transform.zoom,L,ge,Re);const Bt=(At,Qt,ri)=>{const{crossTileID:Si,numVerticalGlyphVertices:Ft}=At;let ei=null;if(E&&E.dynamicFilterNeedsFeature||Mt){const nr=this.retainedQueryData[m.bucketInstanceId];ei=Y.loadFeature({featureIndex:At.featureIndex,bucketIndex:nr.bucketIndex,sourceLayerIndex:nr.sourceLayerIndex,layoutVertexArrayOffset:0})}if(E&&!(0,E.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch},ei,this.retainedQueryData[m.bucketInstanceId].tileID.canonical,new s.P(At.tileAnchorX,At.tileAnchorY),this.transform.calculateDistanceTileData(E.unwrappedTileID)))return this.placements[Si]=new Dn(!1,!1,!1,!0),void n.add(Si);const ti=Ae.evaluate(ei,{});if(n.has(Si))return;if(F)return void(this.placements[Si]=new Dn(!1,!1,!1));let si=!1,Nt=!1,mi=!0,ni=!1,Hi=!1,Yt=null,ai={box:null,offscreen:null,occluded:null},wi={box:null},pr=null,hr=null,mr=null,Fr=0,ao=0,ln=0;ri.textFeatureIndex?Fr=ri.textFeatureIndex:At.useRuntimeCollisionCircles&&(Fr=At.featureIndex),ri.verticalTextFeatureIndex&&(ao=ri.verticalTextFeatureIndex);const Sn=nr=>{nr.tileID=this.retainedQueryData[m.bucketInstanceId].tileID;const Ki=this.transform.elevation;nr.elevation=ve?ti:ti+(Ki?Ki.getAtTileOffset(nr.tileID,nr.tileAnchorX,nr.tileAnchorY):0),nr.elevation+=At.zOffset},Ur=ri.textBox;if(Ur){Sn(Ur);const nr=Ii=>{let Tr=s.bI.horizontal;if(m.allowVerticalPlacement&&!Ii&&this.prevPlacement){const Or=this.prevPlacement.placedOrientations[Si];Or&&(this.placedOrientations[Si]=Or,Tr=Or,this.markUsedOrientation(m,Tr,At))}return Tr},Ki=(Ii,Tr)=>{if(m.allowVerticalPlacement&&Ft>0&&ri.verticalTextBox){for(const Or of m.writingModes)if(Or===s.bI.vertical?(ai=Tr(),wi=ai):ai=Ii(),ai&&ai.box&&ai.box.length)break}else ai=Ii()};if(De){let Ii=De;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Si]){const or=this.prevPlacement.variableOffsets[Si];Ii.indexOf(or.anchor)>0&&(Ii=Ii.filter(Nn=>Nn!==or.anchor),Ii.unshift(or.anchor))}const Tr=(or,Nn,qs)=>{const xs=m.getSymbolInstanceTextSize(N,At,this.transform.zoom,Qt),Na=(or.x2-or.x1)*xs+2*or.padding,Va=(or.y2-or.y1)*xs+2*or.padding,Vn=At.hasIconTextFit&&!J?Nn:null;Vn&&Sn(Vn);let go={box:[],offscreen:!1,occluded:!1};const Sr=K?2*Ii.length:Ii.length;for(let jn=0;jn<Sr;++jn){const Hs=this.attemptAnchorPlacement(Ii[jn%Ii.length],or,D,z,et,Na,Va,xs,Q,ae,M,T,q,jn>=Ii.length,At,Qt,m,qs,Vn,N,U);if(Hs&&(go=Hs.placedGlyphBoxes,go&&go.box&&go.box.length)){si=!0,Yt=Hs.shift;break}}return go};Ki(()=>Tr(Ur,ri.iconBox,s.bI.horizontal),()=>{const or=ri.verticalTextBox;return or&&Sn(or),m.allowVerticalPlacement&&!(ai&&ai.box&&ai.box.length)&&Ft>0&&or?Tr(or,ri.verticalIconBox,s.bI.vertical):{box:null,offscreen:null,occluded:null}}),ai&&(si=ai.box,mi=ai.offscreen,ni=ai.occluded);const Or=nr(!(!ai||!ai.box));if(!si&&this.prevPlacement){const or=this.prevPlacement.variableOffsets[Si];or&&(this.variableOffsets[Si]=or,this.markUsedJustification(m,or.anchor,At,Or))}}else{const Ii=(Tr,Or)=>{const or=m.getSymbolInstanceTextSize(N,At,this.transform.zoom,Qt,p),Nn=this.collisionIndex.placeCollisionBox(m,or,Tr,D,z,et,new s.P(0,0),K,M,T,q.predicate);return Nn&&Nn.box&&Nn.box.length&&(this.markUsedOrientation(m,Or,At),this.placedOrientations[Si]=Or),Nn};Ki(()=>Ii(Ur,s.bI.horizontal),()=>{const Tr=ri.verticalTextBox;return m.allowVerticalPlacement&&Ft>0&&Tr?(Sn(Tr),Ii(Tr,s.bI.vertical)):{box:null,offscreen:null,occluded:null}}),nr(!!(ai&&ai.box&&ai.box.length))}}if(pr=ai,si=pr&&pr.box&&pr.box.length>0,mi=pr&&pr.offscreen,ni=pr&&pr.occluded,At.useRuntimeCollisionCircles){const nr=m.text.placedSymbolArray.get(At.centerJustifiedTextSymbolIndex>=0?At.centerJustifiedTextSymbolIndex:At.verticalPlacedTextSymbolIndex),Ki=s.bJ(m.textSizeData,N,nr),Ii=y.get("text-padding");hr=this.collisionIndex.placeCollisionCircles(m,K,nr,m.lineVertexArray,m.glyphOffsetArray,Ki,T,S,C,c,ae,q.predicate,At.collisionCircleDiameter*Ki/s.bU,Ii,this.retainedQueryData[m.bucketInstanceId].tileID),si=K||hr.circles.length>0&&!hr.collisionDetected,mi=mi&&hr.offscreen,ni=hr.occluded}if(ri.iconFeatureIndex&&(ln=ri.iconFeatureIndex),ri.iconBox){const nr=Ki=>{Sn(Ki);const Ii=At.hasIconTextFit&&Yt?hi(Yt.x,Yt.y,Q,ae,this.transform.angle):new s.P(0,0),Tr=m.getSymbolInstanceIconSize(U,this.transform.zoom,At.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(m,Tr,Ki,D,z,ut,Ii,J,M,T,q.predicate)};wi&&wi.box&&wi.box.length&&ri.verticalIconBox?(mr=nr(ri.verticalIconBox),Nt=mr.box.length>0):(mr=nr(ri.iconBox),Nt=mr.box.length>0),mi=mi&&mr.offscreen,Hi=mr.occluded}const Bn=te||At.numHorizontalGlyphVertices===0&&Ft===0,eo=re||At.numIconVertices===0;if(Bn||eo?eo?Bn||(Nt=Nt&&si):si=Nt&&si:Nt=si=Nt&&si,si&&pr&&pr.box&&this.collisionIndex.insertCollisionBox(pr.box,y.get("text-ignore-placement"),m.bucketInstanceId,wi&&wi.box&&ao?ao:Fr,q.ID),Nt&&mr&&this.collisionIndex.insertCollisionBox(mr.box,y.get("icon-ignore-placement"),m.bucketInstanceId,ln,q.ID),hr&&(si&&this.collisionIndex.insertCollisionCircles(hr.circles,y.get("text-ignore-placement"),m.bucketInstanceId,Fr,q.ID),c)){const nr=m.bucketInstanceId;let Ki=this.collisionCircleArrays[nr];Ki===void 0&&(Ki=this.collisionCircleArrays[nr]=new zh);for(let Ii=0;Ii<hr.circles.length;Ii+=4)Ki.circles.push(hr.circles[Ii+0]),Ki.circles.push(hr.circles[Ii+1]),Ki.circles.push(hr.circles[Ii+2]),Ki.circles.push(hr.collisionDetected?1:0)}const Gr=m.projection.name!=="globe";ct=ct&&(Gr||!ni),Tt=Tt&&(Gr||!Hi),this.placements[Si]=new Dn(si||ct,Nt||Tt,mi||m.justReloaded),n.add(Si)},Jt=this.retainedQueryData[m.bucketInstanceId].tileID;if(m.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(m,Jt),m.elevationType==="road"&&m.updateRoadElevation(Jt.canonical),m.updateZOffset(),m.sortFeaturesByY){const At=m.getSortedSymbolIndexes(this.transform.angle);for(let Qt=At.length-1;Qt>=0;--Qt){const ri=At[Qt];Bt(m.symbolInstances.get(ri),ri,m.collisionArrays[ri])}m.hasAnyZOffset&&s.w(`${m.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(m.hasAnyZOffset){const At=m.getSortedIndexesByZOffset();for(let Qt=0;Qt<At.length;++Qt){const ri=At[Qt];Bt(m.symbolInstances.get(ri),ri,m.collisionArrays[ri])}}else for(let At=t.symbolInstanceStart;At<t.symbolInstanceEnd;At++)Bt(m.symbolInstances.get(At),At,m.collisionArrays[At]);if(c&&m.bucketInstanceId in this.collisionCircleArrays){const At=this.collisionCircleArrays[m.bucketInstanceId];s.bi(At.invProjMatrix,T),At.viewportMatrix=this.collisionIndex.getViewportMatrix()}m.justReloaded=!1}markUsedJustification(t,n,c,d){const{leftJustifiedTextSymbolIndex:p,centerJustifiedTextSymbolIndex:m,rightJustifiedTextSymbolIndex:y,verticalPlacedTextSymbolIndex:x,crossTileID:T}=c,S=s.b$(n),C=d===s.bI.vertical?x:S==="left"?p:S==="center"?m:S==="right"?y:-1;p>=0&&(t.text.placedSymbolArray.get(p).crossTileID=C>=0&&p!==C?0:T),m>=0&&(t.text.placedSymbolArray.get(m).crossTileID=C>=0&&m!==C?0:T),y>=0&&(t.text.placedSymbolArray.get(y).crossTileID=C>=0&&y!==C?0:T),x>=0&&(t.text.placedSymbolArray.get(x).crossTileID=C>=0&&x!==C?0:T)}markUsedOrientation(t,n,c){const d=n===s.bI.horizontal||n===s.bI.horizontalOnly?n:0,p=n===s.bI.vertical?n:0,{leftJustifiedTextSymbolIndex:m,centerJustifiedTextSymbolIndex:y,rightJustifiedTextSymbolIndex:x,verticalPlacedTextSymbolIndex:T}=c,S=t.text.placedSymbolArray;m>=0&&(S.get(m).placedOrientation=d),y>=0&&(S.get(y).placedOrientation=d),x>=0&&(S.get(x).placedOrientation=d),T>=0&&(S.get(T).placedOrientation=p)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const n=this.prevPlacement;let c=!1;this.prevZoomAdjustment=n?n.zoomAdjustment(this.transform.zoom):0;const d=n?n.symbolFadeChange(t):1,p=n?n.opacities:{},m=n?n.variableOffsets:{},y=n?n.placedOrientations:{};for(const x in this.placements){const T=this.placements[x],S=p[x];S?(this.opacities[x]=new zs(S,d,T.text,T.icon,null,T.clipped),c=c||T.text!==S.text.placed||T.icon!==S.icon.placed):(this.opacities[x]=new zs(null,d,T.text,T.icon,T.skipFade,T.clipped),c=c||T.text||T.icon)}for(const x in p){const T=p[x];if(!this.opacities[x]){const S=new zs(T,d,!1,!1);S.isHidden()||(this.opacities[x]=S,c=c||T.text.placed||T.icon.placed)}}for(const x in m)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=m[x]);for(const x in y)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=y[x]);c?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=n?n.lastPlacementChangeTime:t)}updateLayerOpacities(t,n,c,d){const p=new Set;for(const m of n){const y=m.getBucket(t);y&&m.latestFeatureIndex&&t.fqid===y.layerIds[0]&&(this.updateBucketOpacities(y,p,m,m.collisionBoxArray,c,d,m.tileID,t.scope),y.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(y,m.tileID),y.elevationType==="road"&&y.updateRoadElevation(m.tileID.canonical),y.updateZOffset())}}updateBucketOpacities(t,n,c,d,p,m,y,x){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const T=t.layers[0].layout,S=t.layers[0].paint,C=!!t.layers[0].dynamicFilter(),E=new zs(null,0,!1,!1,!0),M=T.get("text-allow-overlap"),D=T.get("icon-allow-overlap"),z=T.get("text-variable-anchor"),F=T.get("text-rotation-alignment")==="map",L=T.get("text-pitch-alignment")==="map",N=S.get("symbol-z-offset"),U=T.get("symbol-elevation-reference")==="sea",q=!N.isConstant(),Y=new zs(null,0,M&&(D||!t.hasIconData()||T.get("icon-optional")),D&&(M||!t.hasTextData()||T.get("text-optional")),!0);!t.collisionArrays&&d&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(d);const te=(K,J,Q)=>{for(let me=0;me<J/4;me++)K.opacityVertexArray.emplaceBack(Q)};let re=0;m&&t.updateReplacement(y,m);for(let K=0;K<t.symbolInstances.length;K++){const J=t.symbolInstances.get(K),{numHorizontalGlyphVertices:Q,numVerticalGlyphVertices:me,crossTileID:ae,numIconVertices:Ae,tileAnchorX:ve,tileAnchorY:Me}=J;let Ue=null;const _e=this.retainedQueryData[t.bucketInstanceId];q&&J&&_e&&(Ue=c.latestFeatureIndex.loadFeature({featureIndex:J.featureIndex,bucketIndex:_e.bucketIndex,sourceLayerIndex:_e.sourceLayerIndex,layoutVertexArrayOffset:0}));const se=N.evaluate(Ue,{}),Te=n.has(ae);let ge=this.opacities[ae];Te?ge=E:ge||(ge=Y,this.opacities[ae]=ge),n.add(ae);const Re=Q>0||me>0,De=Ae>0,Fe=this.placedOrientations[ae],We=Fe===s.bI.vertical,lt=Fe===s.bI.horizontal||Fe===s.bI.horizontalOnly;!Re&&!De||ge.isHidden()||re++;let pt=!1;if((Re||De)&&m)for(const et of t.activeReplacements){if(s.bV(et,p,s.bW.Symbol,x)||et.min.x>ve||ve>et.max.x||et.min.y>Me||Me>et.max.y)continue;const ut=s.bX(ve,Me,y.canonical,et.footprintTileId.canonical);if(pt=s.bY(ut,et.footprint),pt)break}if(Re){const et=pt?ts:ua(ge.text);te(t.text,Q,We?ts:et),te(t.text,me,lt?ts:et);const ut=ge.text.isHidden(),{leftJustifiedTextSymbolIndex:ct,centerJustifiedTextSymbolIndex:Tt,rightJustifiedTextSymbolIndex:Mt,verticalPlacedTextSymbolIndex:Bt}=J,Jt=t.text.placedSymbolArray,At=ut||We?1:0;ct>=0&&(Jt.get(ct).hidden=At),Tt>=0&&(Jt.get(Tt).hidden=At),Mt>=0&&(Jt.get(Mt).hidden=At),Bt>=0&&(Jt.get(Bt).hidden=ut||lt?1:0);const Qt=this.variableOffsets[ae];Qt&&this.markUsedJustification(t,Qt.anchor,J,Fe);const ri=this.placedOrientations[ae];ri&&(this.markUsedJustification(t,"left",J,ri),this.markUsedOrientation(t,ri,J))}if(De){const et=pt?ts:ua(ge.icon),{placedIconSymbolIndex:ut,verticalPlacedIconSymbolIndex:ct}=J,Tt=t.icon.placedSymbolArray,Mt=ge.icon.isHidden()?1:0;ut>=0&&(te(t.icon,Ae,We?ts:et),Tt.get(ut).hidden=Mt),ct>=0&&(te(t.icon,J.numVerticalIconVertices,lt?ts:et),Tt.get(ct).hidden=Mt)}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const et=t.collisionArrays[K];if(et){let ut=new s.P(0,0),ct=!0;if(et.textBox||et.verticalTextBox){if(z){const Mt=this.variableOffsets[ae];Mt?(ut=ci(Mt.anchor,Mt.width,Mt.height,Mt.textOffset,Mt.textScale),F&&ut._rotate(L?this.transform.angle:-this.transform.angle)):ct=!1}C&&(ct=!ge.clipped),et.textBox&&Fo(t.textCollisionBox.collisionVertexArray,ge.text.placed,!ct||We,se,U,ut.x,ut.y),et.verticalTextBox&&Fo(t.textCollisionBox.collisionVertexArray,ge.text.placed,!ct||lt,se,U,ut.x,ut.y)}const Tt=ct&&!!(!lt&&et.verticalIconBox);et.iconBox&&Fo(t.iconCollisionBox.collisionVertexArray,ge.icon.placed,Tt,se,U,J.hasIconTextFit?ut.x:0,J.hasIconTextFit?ut.y:0),et.verticalIconBox&&Fo(t.iconCollisionBox.collisionVertexArray,ge.icon.placed,!Tt,se,U,J.hasIconTextFit?ut.x:0,J.hasIconTextFit?ut.y:0)}}}if(t.fullyClipped=re===0,t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.bucketInstanceId in this.collisionCircleArrays){const K=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=K.invProjMatrix,t.placementViewportMatrix=K.viewportMatrix,t.collisionCircleArray=K.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,n){const c=this.zoomAtLastRecencyCheck===n?1-this.zoomAdjustment(n):1;return this.zoomAtLastRecencyCheck=n,this.commitTime+this.fadeDuration*c>t}setStale(){this.stale=!0}}function Fo(l,t,n,c,d,p,m){l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0),l.emplaceBack(t?1:0,n?1:0,p||0,m||0,c,d?1:0)}const di=Math.pow(2,25),hc=Math.pow(2,24),yl=Math.pow(2,17),xl=Math.pow(2,16),Yr=Math.pow(2,9),wr=Math.pow(2,8),Pf=Math.pow(2,1);function ua(l){if(l.opacity===0&&!l.placed)return 0;if(l.opacity===1&&l.placed)return 4294967295;const t=l.placed?1:0,n=Math.floor(127*l.opacity);return n*di+t*hc+n*yl+t*xl+n*Yr+t*wr+n*Pf+t}const ts=0;class vl{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&t.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(t,n,c,d,p,m){const y=this._bucketParts;for(;this._currentTileIndex<t.length;)if(n.getBucketParts(y,d,t[this._currentTileIndex],this._sortAcrossTiles,m),this._currentTileIndex++,p())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,y.sort((x,T)=>x.sortKey-T.sortKey));this._currentPartIndex<y.length;){const x=y[this._currentPartIndex];if(n.placeLayerBucketPart(x,this._seenCrossTileIDs,c,x.symbolInstanceStart===0,m),this._currentPartIndex++,p())return!0}return!1}}class uc{constructor(t,n,c,d,p,m,y,x,T){this.placement=new wn(t,p,m,y,x,T),this._currentPlacementIndex=n.length-1,this._forceFullPlacement=c,this._showCollisionBoxes=d,this._done=!1}isDone(){return this._done}continuePlacement(t,n,c,d,p){const m=s.q.now(),y=()=>{const x=s.q.now()-m;return!this._forceFullPlacement&&x>2};for(;this._currentPlacementIndex>=0;){const x=n[t[this._currentPlacementIndex]],T=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&(!x.minzoom||x.minzoom<=T)&&(!x.maxzoom||x.maxzoom>T)){const S=x,C=S.layout.get("symbol-z-elevate"),E=S.layout.get("symbol-sort-key").constantOr(1)!==void 0,M=S.layout.get("symbol-z-order"),D=M==="viewport-y"||M==="auto"&&!(M!=="viewport-y"&&E),z=S.layout.get("text-allow-overlap")||S.layout.get("icon-allow-overlap")||S.layout.get("text-ignore-placement")||S.layout.get("icon-ignore-placement"),F=D&&z,L=this._inProgressLayer=this._inProgressLayer||new vl(S),N=s.C(x.source,x.scope);if(L.continuePlacement(C||F?d[N]:c[N],this.placement,this._showCollisionBoxes,x,y,p))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const bl=512/s.aj/2;class dc{constructor(t,n,c){this.tileID=t,this.bucketInstanceId=c,this.index=new s.c0(n.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const d=t.canonical.x*s.aj,p=t.canonical.y*s.aj;for(let m=0;m<n.length;m++){const{key:y,crossTileID:x,tileAnchorX:T,tileAnchorY:S}=n.get(m),C=Math.floor((d+T)*bl),E=Math.floor((p+S)*bl);this.index.add(C,E),this.keys.push(y),this.crossTileIDs.push(x)}this.index.finish()}findMatches(t,n,c){const d=this.tileID.canonical.z<n.canonical.z?1:Math.pow(2,this.tileID.canonical.z-n.canonical.z),p=bl/Math.pow(2,n.canonical.z-this.tileID.canonical.z),m=n.canonical.x*s.aj,y=n.canonical.y*s.aj;for(let x=0;x<t.length;x++){const T=t.get(x);if(T.crossTileID)continue;const{key:S,tileAnchorX:C,tileAnchorY:E}=T,M=Math.floor((m+C)*p),D=Math.floor((y+E)*p),z=this.index.range(M-d,D-d,M+d,D+d).sort((F,L)=>F-L);for(const F of z){const L=this.crossTileIDs[F];if(this.keys[F]===S&&!c.has(L)){c.add(L),T.crossTileID=L;break}}}}}class nn{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Oo{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){const n=Math.round((t-this.lng)/360);if(n!==0)for(const c in this.indexes){const d=this.indexes[c],p={};for(const m in d){const y=d[m];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+n),p[y.tileID.key]=y}this.indexes[c]=p}this.lng=t}addBucket(t,n,c){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===n.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let p=0;p<n.symbolInstances.length;p++)n.symbolInstances.get(p).crossTileID=0;this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]=new Set);const d=this.usedCrossTileIDs[t.overscaledZ];for(const p in this.indexes){const m=this.indexes[p];if(Number(p)>t.overscaledZ)for(const y in m){const x=m[y];x.tileID.isChildOf(t)&&x.findMatches(n.symbolInstances,t,d)}else{const y=m[t.scaledTo(Number(p)).key];y&&y.findMatches(n.symbolInstances,t,d)}}for(let p=0;p<n.symbolInstances.length;p++){const m=n.symbolInstances.get(p);m.crossTileID||(m.crossTileID=c.generate(),d.add(m.crossTileID))}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new dc(t,n.symbolInstances,n.bucketInstanceId),!0}removeBucketCrossTileIDs(t,n){for(const c of n.crossTileIDs)this.usedCrossTileIDs[t].delete(c)}removeStaleBuckets(t){let n=!1;for(const c in this.indexes){const d=this.indexes[c];for(const p in d)t[d[p].bucketInstanceId]||(this.removeBucketCrossTileIDs(c,d[p]),delete d[p],n=!0)}return n}}class mn{constructor(){this.layerIndexes={},this.crossTileIDs=new nn,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,n,c,d){let p=this.layerIndexes[t.fqid];p===void 0&&(p=this.layerIndexes[t.fqid]=new Oo);let m=!1;const y={};d.name!=="globe"&&p.handleWrapJump(c);for(const x of n){const T=x.getBucket(t);T&&t.fqid===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),p.addBucket(x.tileID,T,this.crossTileIDs)&&(m=!0),y[T.bucketInstanceId]=!0)}return p.removeStaleBuckets(y)&&(m=!0),m}pruneUnusedLayers(t){const n={};t.forEach(c=>{n[c]=!0});for(const c in this.layerIndexes)n[c]||delete this.layerIndexes[c]}}const Rs=771;class Rt{constructor(t,n,c,d){this.blendFunction=t,this.blendColor=n.toNonPremultipliedRenderColor(null),this.mask=c,this.blendEquation=d}}Rt.Replace=[1,0,1,0],Rt.disabled=new Rt(Rt.Replace,s.am.transparent,[!1,!1,!1,!1]),Rt.unblended=new Rt(Rt.Replace,s.am.transparent,[!0,!0,!0,!0]),Rt.alphaBlended=new Rt([1,Rs,1,Rs],s.am.transparent,[!0,!0,!0,!0]),Rt.alphaBlendedNonPremultiplied=new Rt([770,Rs,770,Rs],s.am.transparent,[!0,!0,!0,!0]),Rt.multiply=new Rt([774,0,774,0],s.am.transparent,[!0,!0,!0,!0]);class rt{constructor(t,n,c){this.func=t,this.mask=n,this.range=c}}rt.ReadOnly=!1,rt.ReadWrite=!0,rt.disabled=new rt(519,rt.ReadOnly,[0,1]);const Wn=7680;class vt{constructor(t,n,c,d,p,m){this.test=t,this.ref=n,this.mask=c,this.fail=d,this.depthFail=p,this.pass=m}}vt.disabled=new vt({func:519,mask:0},0,0,Wn,Wn,Wn);const xr=1029,wl=2305;class _t{constructor(t,n,c){this.enable=t,this.mode=n,this.frontFace=c}}function da(l,t){const n=s.c6(l,3);s.c8(l,t),s.cc(l,3,n)}function pa(l,t){const n=s.c3([]);return s.c4(n,n,-t),s.c5(n,n,-l),n}function is(l,t){const n=[l[0],l[1],0],c=[t[0],t[1],0];if(s.ae(n)>=1e-15){const m=s.au([],n);s.c1(c,m,s.bG(c,m)),t[0]=c[0],t[1]=c[1]}const d=s.bF([],t,l);if(s.c2(d)<1e-15)return null;const p=Math.atan2(-d[1],d[0]);return pa(Math.atan2(Math.sqrt(l[0]*l[0]+l[1]*l[1]),-l[2]),p)}_t.disabled=new _t(!1,xr,wl),_t.backCCW=new _t(!0,xr,wl),_t.backCW=new _t(!0,xr,2304),_t.frontCW=new _t(!0,1028,2304),_t.frontCCW=new _t(!0,1028,wl);class zd{constructor(t,n){this.position=t,this.orientation=n}get position(){return this._position}set position(t){if(t){const n=t instanceof s.ac?t:new s.ac(t[0],t[1],t[2]);
vendor: 4,345 bytes, line 20
20this._renderWorldCopies&&(n.x=s.bQ(n.x,0,1)),this._position=n}else this._position=null}lookAtPoint(t,n){if(this.orientation=null,!this.position)return;const c=this.position,d=this._elevation?this._elevation.getAtPointOrZero(s.ac.fromLngLat(t)):0,p=s.ac.fromLngLat(t,d),m=[p.x-c.x,p.y-c.y,p.z-c.z];n||(n=[0,0,1]),n[2]=Math.abs(n[2]),this.orientation=is(m,n)}setPitchBearing(t,n){this.orientation=pa(s.al(t),s.al(-n))}}class Xn{constructor(t,n){this._transform=s.bx([]),this.orientation=n,this.position=t}get mercatorPosition(){const t=this.position;return new s.ac(t[0],t[1],t[2])}get position(){const t=s.c6(this._transform,3);return[t[0],t[1],t[2]]}set position(t){var n;t&&s.cc(this._transform,3,[(n=t)[0],n[1],n[2],1])}get orientation(){return this._orientation}set orientation(t){this._orientation=t||s.c3([]),t&&da(this._transform,this._orientation)}getPitchBearing(){const t=this.forward(),n=this.right();return{bearing:Math.atan2(-n[1],n[0]),pitch:Math.atan2(Math.sqrt(t[0]*t[0]+t[1]*t[1]),-t[2])}}setPitchBearing(t,n){this._orientation=pa(t,n),da(this._transform,this._orientation)}forward(){const t=s.c6(this._transform,2);return[-t[0],-t[1],-t[2]]}up(){const t=s.c6(this._transform,1);return[-t[0],-t[1],-t[2]]}right(){const t=s.c6(this._transform,0);return[t[0],t[1],t[2]]}getCameraToWorld(t,n){const c=new Float64Array(16);return s.bi(c,this.getWorldToCamera(t,n)),c}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(t,n,c){const d=this.position;s.c1(d,d,-t);const p=new Float64Array(16);return s.bn(p,[c,c,c]),s.bo(p,p,d),p[10]*=n,p}getWorldToCamera(t,n){const c=new Float64Array(16),d=new Float64Array(4),p=this.position;return s.c7(d,this._orientation),s.c1(p,p,-t),s.c8(c,d),s.bo(c,c,p),c[1]*=-1,c[5]*=-1,c[9]*=-1,c[13]*=-1,c[8]*=n,c[9]*=n,c[10]*=n,c[11]*=n,c}getCameraToClipPerspective(t,n,c,d){const p=new Float64Array(16);return s.c9(p,t,n,c,d),p}getCameraToClipOrthographic(t,n,c,d,p,m){const y=new Float64Array(16);return s.ca(y,t,n,c,d,p,m),y}getDistanceToElevation(t,n=!1){const c=t===0?0:s.cb(t,n?s.aY(this.position[1]):this.position[1]),d=this.forward();return(c-this.position[2])/d[2]}clone(){return new Xn([...this.position],[...this.orientation])}}const on={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Tl{constructor(t=0,n=0,c=0,d=0){if(isNaN(t)||t<0||isNaN(n)||n<0||isNaN(c)||c<0||isNaN(d)||d<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=n,this.left=c,this.right=d}interpolate(t,n,c){return n.top!=null&&t.top!=null&&(this.top=s.ai(t.top,n.top,c)),n.bottom!=null&&t.bottom!=null&&(this.bottom=s.ai(t.bottom,n.bottom,c)),n.left!=null&&t.left!=null&&(this.left=s.ai(t.left,n.left,c)),n.right!=null&&t.right!=null&&(this.right=s.ai(t.right,n.right,c)),this}getCenter(t,n){const c=s.ay((this.left+t-this.right)/2,0,t),d=s.ay((this.top+n-this.bottom)/2,0,n);return new s.P(c,d)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Tl(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Lr=15;class Rh{constructor(t,n,c,d,p,m,y){this.tileSize=512,this._renderWorldCopies=p===void 0||p,this._minZoom=t||0,this._maxZoom=n||22,this._minPitch=c??0,this._maxPitch=d??60,this.setProjection(m),this.setMaxBounds(y),this.width=0,this.height=0,this._center=new s.ci(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Tl,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Xn,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const t=new Rh(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return t._elevation=this._elevation,t._centerAltitude=this._centerAltitude,t._centerAltitudeValidForE
vendor: 10,503 bytes, line 20
20xaggeration=this._centerAltitudeValidForExaggeration,t.tileSize=this.tileSize,t.mercatorFromTransition=this.mercatorFromTransition,t.width=this.width,t.height=this.height,t.cameraElevationReference=this.cameraElevationReference,t._center=this._center,t._setZoom(this.zoom),t._seaLevelZoom=this._seaLevelZoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._nearZ=this._nearZ,t._farZ=this._farZ,t._averageElevation=this._averageElevation,t._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._camera=this._camera.clone(),t._calcMatrices(),t.freezeTileCoverage=this.freezeTileCoverage,t.frustumCorners=this.frustumCorners,t._allowWorldUnderZoom=this._allowWorldUnderZoom,t}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<Lr}get elevation(){return this._elevation}set elevation(t){this._elevation!==t&&(this._elevation=t,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(t,n=!1){const c=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForExaggeration;(this._seaLevelZoom==null||c)&&this._updateCameraOnTerrain(),(t||c)&&this._constrainCamera(n),this._calcMatrices()}getProjection(){return s.aF(this.projection,["name","center","parallels"])}setProjection(t){this.projectionOptions=t||{name:"mercator"};const n=this.projection?this.getProjection():void 0;this.projection=s.cj(this.projectionOptions);const c=this.getProjection(),d=!s.bv(n,c);return d&&this._calcMatrices(),this.mercatorFromTransition=!1,d}setOrthographicProjectionAtLowPitch(t){return this._orthographicProjectionAtLowPitch!==t&&(this._orthographicProjectionAtLowPitch=t,this._calcMatrices(),!0)}setMercatorFromTransition(){const t=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=s.cj({name:"mercator"});const n=t!==this.projection.name;return n&&this._calcMatrices(),n}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get cameraWorldSize(){const t=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(t))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return s.cb(1,this.center.lat)*this.cameraWorldSizeForFog}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new s.P(this.width,this.height)}get bearing(){return s.bQ(this.rotation,-180,180)}set bearing(t){this.rotation=t}get rotation(){return-this.angle/Math.PI*180}set rotation(t){const n=-t*Math.PI/180;this.angle!==n&&(this._unmodified=!1,this.angle=n,this._calcMatrices(),this.rotationMatrix=s.ck(),s.cl(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const n=s.ay(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==n&&(this._unmodified=!1,this._pitch=n,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=s.al(t),this._calcMatrices())}get fovX(){return this._fov}get fovY(){const t=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/t)}get averageElevation(){return this._averageElevation}set averageElevation(t){this._averageElevation=t,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(t){const n=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==n&&(this._unmodified=!1,this._setZoom(n),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(t){this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(t){this._tileCoverLift!==t&&(this._tileCoverLift=t)}_updateCameraOnTerrain(){const t=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,n=this.elevation&&t===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||t===Number.NEGATIVE_INFINITY&&(!n||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const c=this._elevation;n||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&c.exaggeration()&&this._centerAltitudeValidForExaggeration!==c.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*c.exaggeration(),this._centerAltitudeValidForExaggeration=c.exaggeration()):(this._centerAltitude=t||0,this._centerAltitudeValidForExaggeration=c.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const t=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(t)}sampleAverageElevation(){if(!this._elevation)return 0;const t=this._elevation,n=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],c=this.horizonLineFromTop();let d=0,p=0;for(let m=0;m<n.length;m++){const y=new s.P(n[m][0]*this.width,c+n[m][1]*(this.height-c)),x=t.pointCoordinate(y);if(!x)continue;const T=1/Math.hypot(x[0]-this._camera.position[0],x[1]-this._camera.position[1]);d+=x[3]*T,p+=T}return p===0?NaN:d/p}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const t=this._seaLevelZoom,n=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),c=this.pixelsPerMeter/this.worldSize*n,d=this._mercatorZfromZoom(t),p=this._mercatorZfromZoom(this._maxZoom),m=Math.max(d-c,p);this._setZoom(this._zoomFromMercatorZ(m))}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}computeZoomRelativeTo(t){const n=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,t.toAltitude()));let c;c=t.z<this._camera.position[2]?[n.x,n.y,n.z]:[t.x,t.y,t.z];const d=s.ae(s.at([],this._camera.position,c));return s.ay(this._zoomFromMercatorZ(d),this._minZoom,this._maxZoom)}setFreeCameraOptions(t){if(!this.height||!t.position&&!t.orientation)return;this._updateCameraState();let n=!1;if(t.orientation&&!s.cm(t.orientation,this._camera.orientation)&&(n=this._setCameraOrientation(t.orientation)),t.position){const c=[t.position.x,t.position.y,t.position.z];s.cn(c,this._camera.position)||(this._setCameraPosition(c),n=!0)}n&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const t=this._camera.position,n=new zd;return n.position=new s.ac(t[0],t[1],t[2]),n.orientation=this._camera.orientation,n._elevation=this.elevation,n._renderWorldCopies=this.renderWorldCopies,n}_setCameraOrientation(t){if(!s.co(t))return!1;s.cp(t,t);const n=s.cq([],[0,0,-1],t),c=s.cq([],[0,-1,0],t);if(c[2]<0)return!1;const d=is(n,c);return!!d&&(this._camera.orientation=d,!0)}_setCameraPosition(t){const n=this.zoomScale(this.minZoom)*this.tileSize,c=this.zoomScale(this.maxZoom)*this.tileSize,d=this.cameraToCenterDistance;t[2]=s.ay(t[2],d/c,d/n),this._camera.position=t}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,n,c){this._unmodified=!1,this._edgeInsets.interpolate(t,n,c),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const n=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,n)}getVisibleUnwrappedCoordinates(t){const n=[new s.cr(0,t)];if(this.renderWorldCopies){const c=this.pointCoordinate(new s.P(0,0)),d=this.pointCoordinate(new s.P(this.width,0)),p=this.pointCoordinate(new s.P(this.width,this.height)),m=this.pointCoordinate(new s.P(0,this.height)),y=Math.floor(Math.min(c.x,d.x,p.x,m.x)),x=Math.floor(Math.max(c.x,d.x,p.x,m.x)),T=1;for(let S=y-T;S<=x+T;S++)S!==0&&n.push(new s.cr(S,t))}return n}isLODDisabled(t){return(!t||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCover(t,n,c){let d=[];const p=c!=null,m=!p;if(m&&this.zoom<n||p&&c[0]===0&&c[1]===0)return d;const y=new Set,x=(S,C,E,M,D)=>{const z=s.cV(C,S,E,M,D);y.has(z)||(d.push(new s.aM(S,C,E,M,D)),y.add(z))};for(let S=0;S<t.length;S++){const C=t[S];if(m&&C.canonical.z!==n)continue;const E=C.canonical,M=C.overscaledZ,D=C.wrap,z=1<<E.z,F=E.x+1<z,L=E.x>0,N=E.y+1<z,U=E.y>0,q=C.wrap-(L?0:1),Y=C.wrap+(F?0:1),te=L?E.x-1:z-1,re=F?E.x+1:0;if(p)c[0]<0?(x(M,Y,E.z,re,E.y),c[1]<0&&N&&(x(M,D,E.z,E.x,E.y+1),x(M,Y,E.z,re,E.y+1)),c[1]>0&&U&&(x(M,D,E.z,E.x,E.y-1),x(M,Y,E.z,re,E.y-1))):c[0]>0?(x(M,q,E.z,te,E.y),c[1]<0&&N&&(x(M,D,E.z,E.x,E.y+1),x(M,q,E.z,te,E.y+1)),c[1]>0&&U&&(x(M,D,E.z,E.x,E.y-1),x(M,q,E.z,te,E.y-1))):c[1]<0&&N?x(M,D,E.z,E.x,E.y+1):U&&x(M,D,E.z,E.x,E.y-1);else{const K=C.visibleQuadrants;
201&K&&(x(M,q,E.z,te,E.y),U&&(x(M,D,E.z,E.x,E.y-1),x(M,q,E.z,te,E.y-1))),2&K&&(x(M,Y,E.z,re,E.y),U&&(x(M,D,E.z,E.x,E.y-1),x(M,Y,E.z,re,E.y-1))),4&K&&(x(M,q,E.z,te,E.y),N&&(x(M,D,E.z,E.x,E.y+1),x(M,q,E.z,te,E.y+1))),8&K&&(x(M,Y,E.z,re,E.y),N&&(x(M,D,E.z,E.x,E.y+1),x(M,Y,E.z,re,E.y+1)))}}const T=[];for(const S of d)d.some(C=>S.isChildOf(C))||T.push(S);if(d=T.filter(S=>!t.some(C=>!!(S.overscaledZ<n&&C.isChildOf(S))||S.equals(C)||S.isChildOf(C))),m){const S=1<<n,C=this.projection.name==="globe"?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),E=[S*C.x,S*C.y],M=4,D=M*M;d=d.filter(z=>{const F=z.canonical.x+.5-E[0],L=z.canonical.y+.5-E[1];return F*F+L*L<D})}return d}extendTileCoverToNearPlane(t,n,c){const d=[],p=new Set;for(const N of t)p.add(N.key);const m=(N,U,q,Y,te)=>{const re=s.cV(U,N,q,Y,te);p.has(re)||(d.push(new s.aM(N,U,q,Y,te)),p.add(re))},y=t.reduce((N,U)=>Math.max(N,U.overscaledZ),c),x=1<<c,T=[new s.P(0,0),new s.P(s.aj,0),new s.P(s.aj,s.aj),new s.P(0,s.aj)],S=new s.P(0,0),C=new s.P(0,0),E=(N,U)=>{const q=Math.floor(N[0]),Y=Math.floor(N[1]),te=(N[0]-q)*s.aj,re=(N[1]-Y)*s.aj,K=Math.floor(U[0]),J=Math.floor(U[1]),Q=(U[0]-K)*s.aj,me=(U[1]-J)*s.aj;for(let ae=-1;ae<=1;ae++){const Ae=q+ae;if(!(Ae<0||Ae>=x)){S.x=te-ae*s.aj,C.x=Q-(Ae-K)*s.aj;for(let ve=-1;ve<=1;ve++){const Me=Y+ve;S.y=re-ve*s.aj,C.y=me-(Me-J)*s.aj,s.cW(S,C,T)&&m(y,0,c,Ae,Me)}}}},M=n.points,D=M[s.cs],z=M[s.ct],F=this._projectToGround(D,M[s.cu]),L=this._projectToGround(z,M[s.cv]);return E(D,F),E(z,L),d}_projectToGround(t,n){return s.cw(s.cx(),t,n,t[2]/(t[2]-n[2]))}coveringTiles(t){let n=this.coveringZoomLevel(t);const c=n,d=this.elevation&&this.elevation.exaggeration(),p=d&&!t.isTerrainDEM,m=this.projection.name==="mercator";if(t.minzoom!==void 0&&n<t.minzoom)return[];t.maxzoom!==void 0&&n>t.maxzoom&&(n=t.maxzoom);const y=this.locationCoordinate(this.center),x=this.center.lat,T=1<<n,S=[T*y.x,T*y.y,0],C=this.projection.name==="globe",E=!C,M=s.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,n,E),D=C?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),z=T*s.cb(1,this.center.lat),F=this._camera.position[2]/s.cb(1,this.center.lat),L=[T*D.x,T*D.y,F*(E?1:z)],N=C||d,U=this.cameraToCenterDistance/t.tileSize*(t.roundZoom?1:.502),q=this.isLODDisabled(!0)?n:0;let Y;if(this._elevation&&t.isTerrainDEM)Y=1e4*this._elevation.exaggeration();else if(this._elevation){const se=this._elevation.getMinMaxForVisibleTiles();Y=se?se.max:this._centerAltitude}else Y=this._centerAltitude;const te=t.isTerrainDEM?-Y:this._elevation?this._elevation.getMinElevationBelowMSL():0,re=this.projection.isReprojectedInTileSpace?s.cz(this):1,K=se=>{const ge=new s.ac(se.x+25e-6,se.y,se.z),Re=new s.ac(se.x,se.y+25e-6,se.z),De=se.toLngLat(),Fe=ge.toLngLat(),We=Re.toLngLat(),lt=this.locationCoordinate(De),pt=this.locationCoordinate(Fe),et=this.locationCoordinate(We),ut=Math.hypot(pt.x-lt.x,pt.y-lt.y),ct=Math.hypot(et.x-lt.x,et.y-lt.y);return Math.sqrt(ut*ct)*re/25e-6},J=se=>{const Te=Y,ge=te;return{aabb:s.cC(this,T,0,0,0,se,ge,Te,this.projection),zoom:0,x:0,y:0,minZ:ge,maxZ:Te,wrap:se,fullyVisible:!1}},Q=[];let me=[];const ae=n,Ae=t.reparseOverscaled?c:n,ve=(F-this._centerAltitude)*z,Me=se=>{if(!this._elevation||!se.tileID||!m)return;const Te=this._elevation.getMinMaxForTile(se.tileID),ge=se.aabb;Te?(ge.min[2]=Te.min,ge.max[2]=Te.max,ge.center[2]=(ge.min[2]+ge.max[2])/2):(se.shouldSplit=_e(se),se.shouldSplit||(ge.min[2]=ge.max[2]=ge.center[2]=this._centerAltitude))},Ue=(se,Te)=>{if(.707*Te<se)return 1;const ge=Te/se;return ge/(1.4144271570014144+(Math.pow(1.1,ge-1.4144271570014144+1)-1)/(1.1-1)-1)},_e=se=>{if(se.zoom<q)return!0;if(se.zoom===ae)return!1;if(se.shouldSplit!=null)return se.shouldSplit;const Te=se.aabb.distanceX(L),ge=se.aabb.distanceY(L);let Re=ve,De=1;if(C){Re=se.aabb.distanceZ(L);const ct=Math.pow(2,se.zoom),Tt=s.aY((se.y+1)/ct),Mt=s.aY(se.y/ct),Bt=Math.min(Math.max(x,Tt),Mt),Jt=s.c_(Bt)/s.c_(x);if(De=Bt===x?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,Jt/this._mercatorScaleRatio),this.zoom<=s.cX&&se.zoom===ae-1&&Jt>=.9)return!0}else if(p&&(Re=se.aabb.distanceZ(L)*z),this.projection.isReprojectedInTileSpace&&c<=5){const ct=Math.pow(2,se.zoom),Tt=K(new s.ac((se.x+.5)/ct,(se.y+.5)/ct));De=Tt>.85?1:Tt}if(!m){const ct=Math.sqrt(Te*Te+ge*ge+Re*Re);let Tt=(1<<ae-se.zoom)*U*De;return Tt*=Ue(Math.max(Re,ve),ct),ct<Tt}let Fe=Number.MAX_VALUE,We=0;const lt=se.aabb.getCorners(),pt=[];
vendor: 12,477 bytes, line 20
20for(const ct of lt){s.at(pt,ct,L),C||(p?pt[2]*=z:pt[2]=ve);const Tt=s.bG(pt,this._camera.forward());Tt<Fe&&(Fe=Tt,We=Math.abs(pt[2]))}let et=(1<<ae-se.zoom)*U*De;if(et*=Ue(Math.max(We,ve),Fe),Fe<et)return!0;const ut=se.aabb.closestPoint(S);return ut[0]===S[0]&&ut[1]===S[1]};if(this.renderWorldCopies)for(let se=1;se<=3;se++)Q.push(J(-se)),Q.push(J(se));for(Q.push(J(0));Q.length>0;){const se=Q.pop(),Te=se.x,ge=se.y;let Re=se.fullyVisible;const De=()=>this.projection.name==="globe"&&(se.y===0||se.y===(1<<se.zoom)-1);if(!Re){let Fe=N?se.aabb.intersects(M):se.aabb.intersectsFlat(M);if(Fe===0&&De()){const We=new s.cA(se.zoom,Te,ge);Fe=s.cB(this,T,We,!0).intersects(M)}if(Fe===0)continue;Re=Fe===2}if(se.zoom!==ae&&_e(se))for(let Fe=0;Fe<4;Fe++){const We=(Te<<1)+Fe%2,lt=(ge<<1)+(Fe>>1),pt={aabb:m?se.aabb.quadrant(Fe):s.cC(this,T,se.zoom+1,We,lt,se.wrap,se.minZ,se.maxZ,this.projection),zoom:se.zoom+1,x:We,y:lt,wrap:se.wrap,fullyVisible:Re,tileID:void 0,shouldSplit:void 0,minZ:se.minZ,maxZ:se.maxZ};p&&!C&&(pt.tileID=new s.aM(se.zoom+1===ae?Ae:se.zoom+1,se.wrap,se.zoom+1,We,lt),Me(pt)),Q.push(pt)}else{const Fe=se.zoom===ae?Ae:se.zoom;if(t.minzoom&&t.minzoom>Fe)continue;let We=0;if(!Re){let ut=N?se.aabb.intersectsPrecise(M):se.aabb.intersectsPreciseFlat(M);if(ut===0&&De()){const ct=new s.cA(se.zoom,Te,ge);ut=s.cB(this,T,ct,!0).intersectsPrecise(M)}if(ut===0)continue;if(t.calculateQuadrantVisibility)if(M.containsPoint(se.aabb.center))We=15;else for(let ct=0;ct<4;ct++)se.aabb.quadrant(ct).intersects(M)!==0&&(We|=1<<ct)}const lt=S[0]-(.5+Te+(se.wrap<<se.zoom))*(1<<n-se.zoom),pt=S[1]-.5-ge,et=se.tileID?se.tileID:new s.aM(Fe,se.wrap,se.zoom,Te,ge);t.calculateQuadrantVisibility&&(et.visibleQuadrants=We),me.push({tileID:et,distanceSq:lt*lt+pt*pt})}}if(this.fogCullDistSq){const se=this.fogCullDistSq,Te=this.horizonLineFromTop();me=me.filter(ge=>{const Re=[0,0,0,1],De=[s.aj,s.aj,0,1],Fe=this.calculateFogTileMatrix(ge.tileID.toUnwrapped());s.aA(Re,Re,Fe),s.aA(De,De,Fe);const We=s.cD([],Re,De),lt=s.cE([],Re,De),pt=s.cY(We,lt);if(pt===0)return!0;let et=!1;const ut=this._elevation;if(ut&&pt>se&&Te!==0){const ct=this.calculateProjMatrix(ge.tileID.toUnwrapped());let Tt;t.isTerrainDEM||(Tt=ut.getMinMaxForTile(ge.tileID)),Tt||(Tt={min:te,max:Y});const Mt=s.cF(this.rotation),Bt=[Mt[0]*s.aj,Mt[1]*s.aj,Tt.max];s.ad(Bt,Bt,ct),et=(1-Bt[1])*this.height*.5<Te}return pt<se||et})}return me.sort((se,Te)=>se.distanceSq-Te.distanceSq).map(se=>se.tileID)}resize(t,n){this.width=t,this.height=n,this.pixelsToGLUnits=[2/t,-2/n],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const n=s.ay(t.lat,-s.cG,s.cG),c=this.projection.project(t.lng,n);return new s.P(c.x*this.worldSize,c.y*this.worldSize)}unproject(t){return this.projection.unproject(t.x/this.worldSize,t.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/s.cb(1,this.center.lat)/this.worldSize}setLocationAtPoint(t,n){let c,d;const p=this.centerPoint;if(this.projection.name==="globe"){const y=this.worldSize;c=(n.x-p.x)/y,d=(n.y-p.y)/y}else{const y=this.pointCoordinate(n),x=this.pointCoordinate(p);c=y.x-x.x,d=y.y-x.y}const m=this.locationCoordinate(t);this.setLocation(new s.ac(m.x-c,m.y-d))}setLocation(t){this.center=this.coordinateLocation(t),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(t,n){return this.projection.locationPoint(this,t,n)}locationPoint3D(t,n){return this.projection.locationPoint(this,t,n,!0)}pointLocation(t){return this.coordinateLocation(this.pointCoordinate(t))}pointLocation3D(t,n){return this.coordinateLocation(this.pointCoordinate3D(t,n))}locationCoordinate(t,n){const c=n?s.cb(n,t.lat):void 0,d=this.projection.project(t.lng,t.lat);return new s.ac(d.x,d.y,c)}coordinateLocation(t){return this.projection.unproject(t.x,t.y)}pointRayIntersection(t,n){const c=n??this._centerAltitude,d=[t.x,t.y,0,1],p=[t.x,t.y,1,1];s.aA(d,d,this.pixelMatrixInverse),s.aA(p,p,this.pixelMatrixInverse);const m=p[3];s.cH(d,d,1/d[3]),s.cH(p,p,1/m);const y=d[2],x=p[2];return{p0:d,p1:p,t:y===x?0:(c-y)/(x-y)}}screenPointToMercatorRay(t){const n=[t.x,t.y,0,1],c=[t.x,t.y,1,1];return s.aA(n,n,this.pixelMatrixInverse),s.aA(c,c,this.pixelMatrixInverse),s.cH(n,n,1/n[3]),s.cH(c,c,1/c[3]),n[2]=s.cb(n[2],this._center.lat)*this.worldSize,c[2]=s.cb(c[2],this._center.lat)*this.worldSize,s.cH(n,n,1/this.worldSize),s.cH(c,c,1/this.worldSize),new s.av([n[0],n[1],n[2]],s.au([],s.at([],c,n)))}rayIntersectionCoordinate(t){const{p0:n,p1:c,t:d}=t,p=s.cb(n[2],this._center.lat),m=s.cb(c[2],this._center.lat);return new s.ac(s.ai(n[0],c[0],d)/this.worldSize,s.ai(n[1],c[1],d)/this.worldSize,s.ai(p,m,d))}pointCoordinate(t,n=this._centerAltitude){return this.projection.pointCoordinate(this,t.x,t.y,n)}pointCoordinate3D(t,n){if(!this.elevation)return this.pointCoordinate(t,n);let c=this.projection.pointCoordinate3D(this,t.x,t.y);if(c)return new s.ac(c[0],c[1],c[2]);let d=0,p=this.horizonLineFromTop();if(t.y>p)return this.pointCoordinate(t,n);const m=.02*p,y=t.clone();for(let x=0;x<10&&p-d>m;x++){y.y=s.ai(d,p,.66);const T=this.projection.pointCoordinate3D(this,y.x,y.y);T?(p=y.y,c=T):d=y.y}return c?new s.ac(c[0],c[1],c[2]):this.pointCoordinate(t)}isPointAboveHorizon(t){return this.projection.isPointAboveHorizon(this,t)}isPointOnSurface(t){if(t.y<0||t.y>this.height||t.x<0||t.x>this.width)return!1;if(this.elevation||this.zoom>=s.cI)return!this.isPointAboveHorizon(t);const n=this.pointCoordinate(t);return n.y>=0&&n.y<=1}_coordinatePoint(t,n){const c=n&&this.elevation?this.elevation.getAtPointOrZero(t,this._centerAltitude):this._centerAltitude,d=[t.x*this.worldSize,t.y*this.worldSize,c+t.toAltitude(),1];return s.aA(d,d,this.pixelMatrix),d[3]>0?new s.P(d[0]/d[3],d[1]/d[3]):new s.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:t,left:n}=this._edgeInsets,c=this.height-this._edgeInsets.bottom,d=this.width-this._edgeInsets.right,p=this.pointLocation3D(new s.P(n,t)),m=this.pointLocation3D(new s.P(d,t)),y=this.pointLocation3D(new s.P(d,c)),x=this.pointLocation3D(new s.P(n,c));let T=Math.min(p.lng,m.lng,y.lng,x.lng),S=Math.max(p.lng,m.lng,y.lng,x.lng),C=Math.min(p.lat,m.lat,y.lat,x.lat),E=Math.max(p.lat,m.lat,y.lat,x.lat);const M=Math.pow(2,-this.zoom)/16*270,D=this.projection.name==="globe"?1:4,z=(F,L,N,U,q)=>{const Y=(F+N)/2,te=(L+U)/2,re=new s.P(Y,te),{lng:K,lat:J}=this.pointLocation3D(re),Q=Math.max(0,T-K,C-J,K-S,J-E);T=Math.min(T,K),S=Math.max(S,K),C=Math.min(C,J),E=Math.max(E,J),(q<D||Q>M)&&(z(F,L,Y,te,q+1),z(Y,te,N,U,q+1))};if(z(n,t,d,t,1),z(d,t,d,c,1),z(d,c,n,c,1),z(n,c,n,t,1),this.projection.name==="globe"){const[F,L]=s.cJ(this);F?(E=90,S=180,T=-180):L&&(C=-90,S=180,T=-180)}return new s.aG(new s.ci(T,C),new s.ci(S,E))}_getBoundsRectangular(t,n){const{top:c,left:d}=this._edgeInsets,p=this.height-this._edgeInsets.bottom,m=this.width-this._edgeInsets.right,y=new s.P(d,c),x=new s.P(m,c),T=new s.P(m,p),S=new s.P(d,p);let C=this.pointCoordinate(y,t),E=this.pointCoordinate(x,t);const M=this.pointCoordinate(T,n),D=this.pointCoordinate(S,n),z=(F,L)=>(L.y-F.y)/(L.x-F.x);return C.y>1&&E.y>=0?C=new s.ac((1-D.y)/z(D,C)+D.x,1):C.y<0&&E.y<=1&&(C=new s.ac(-D.y/z(D,C)+D.x,0)),E.y>1&&C.y>=0?E=new s.ac((1-M.y)/z(M,E)+M.x,1):E.y<0&&C.y<=1&&(E=new s.ac(-M.y/z(M,E)+M.x,0)),new s.aG().extend(this.coordinateLocation(C)).extend(this.coordinateLocation(E)).extend(this.coordinateLocation(D)).extend(this.coordinateLocation(M))}_getBoundsRectangularTerrain(){const t=this.elevation;if(!t.visibleDemTiles.length||t.isUsingMockSource())return this._getBoundsRectangular(0,0);const n=t.visibleDemTiles.reduce((c,d)=>{if(d.dem){const p=d.dem.tree;c.min=Math.min(c.min,p.minimums[0]),c.max=Math.max(c.max,p.maximums[0])}return c},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(n.min*t.exaggeration(),n.max*t.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(t=!0){const n=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,c=this.height/2-n*(1-this._horizonShift);return t?Math.max(0,c):c}getMaxBounds(){return this.maxBounds}setMaxBounds(t){this.maxBounds=t,this.minLat=-s.cG,this.maxLat=s.cG,this.minLng=-180,this.maxLng=180,t&&(this.minLat=t.getSouth(),this.maxLat=t.getNorth(),this.minLng=t.getWest(),this.maxLng=t.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=s.aD(this.minLng)*this.tileSize,this.worldMaxX=s.aD(this.maxLng)*this.tileSize,this.worldMinY=s.aH(this.maxLat)*this.tileSize,this.worldMaxY=s.aH(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(t,n){return this.projection.createTileMatrix(this,n,t)}calculateDistanceTileData(t){const n=t.key,c=this._distanceTileDataCache;if(c[n])return c[n];const d=t.canonical,p=1/this.height,m=this.cameraWorldSize,y=m/this.zoomScale(d.z),x=(d.x+Math.pow(2,d.z)*t.wrap)*y,T=d.y*y,S=this.point;S.x*=m/this.worldSize,S.y*=m/this.worldSize;const C=this.angle,E=Math.sin(-C),M=-Math.cos(-C);return c[n]={bearing:[E,M],center:[(S.x-x)*p,(S.y-T)*p],scale:y/s.aj*p},c[n]}calculateFogTileMatrix(t){const n=t.key,c=this._fogTileMatrixCache;if(c[n])return c[n];const d=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,t);return s.az(d,this.worldToFogMatrix,d),c[n]=new Float32Array(d),c[n]}calculateProjMatrix(t,n=!1,c=!1){const d=t.key;let p;if(p=c?this._expandedProjMatrixCache:n?this._alignedProjMatrixCache:this._projMatrixCache,p[d])return p[d];const m=this.calculatePosMatrix(t,this.worldSize);let y;return y=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:c?this.expandedFarZProjMatrix:n?this.alignedProjMatrix:this.projMatrix,s.az(m,y,m),p[d]=new Float32Array(m),p[d]}calculatePixelsToTileUnitsMatrix(t){const n=t.tileID.key,c=this._pixelsToTileUnitsCache;if(c[n])return c[n];const d=s.cK(t,this);return c[n]=d,c[n]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const t=1/this.worldSize,n=s.bn([],[t,t,t]);return s.az(n,n,this.globeMatrix),n}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const t=this._elevation;this._updateCameraState();const n=s.cb(1,this._center.lat)*this.worldSize,c=this._computeCameraPosition(n),d=this._camera.forward(),p=s.cb(1,this._center.lat);c[2]/=p,d[2]/=p,s.au(d,d);const m=t.raycast(c,d,t.exaggeration());if(m){const y=s.bE([],c,d,m),x=new s.ac(y[0],y[1],s.cb(y[2],s.aY(y[1]))),T=(x.z+s.ae([x.x-c[0],x.y-c[1],x.z-c[2]*p]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(T),this._centerAltitude=x.toAltitude(),this._center=this.coordinateLocation(x),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(t=!1){if(!this._elevation)return;const n=this._elevation,c=s.cb(1,this._center.lat)*this.worldSize,d=this._computeCameraPosition(c),p=n.getAtPointOrZero(new s.ac(...d)),m=this.pixelsPerMeter/this.worldSize*p,y=this._minimumHeightOverTerrain(),x=d[2]-m;if(x<=y)if(x<0||t){const T=this.locationCoordinate(this._center,this._centerAltitude),S=[d[0],d[1],T.z-d[2]],C=s.ae(S);S[2]-=(y-x)/this._pixelsPerMercatorPixel;const E=s.ae(S);if(E===0)return;s.c1(S,S,C/E*this._pixelsPerMercatorPixel),this._camera.position=[d[0],d[1],T.z*this._pixelsPerMercatorPixel-S[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const t=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||t){const E=this.center;return E.lat=s.ay(E.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!t)&&(E.lng=s.ay(E.lng,this.minLng,this.maxLng)),this.center=E,void(this._constraining=!1)}const n=this._unmodified,{x:c,y:d}=this.point;let p=0,m=c,y=d;const x=this.width/2,T=this.height/2,S=this.worldMinY*this.scale,C=this.worldMaxY*this.scale;if(d-T<S&&(y=S+T),d+T>C&&(y=C-T),C-S<this.height&&(p=Math.max(p,this.height/(C-S)),y=(C+S)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const E=this.worldMinX*this.scale,M=this.worldMaxX*this.scale,D=this.worldSize/2-(E+M)/2;
20m=(c+D+this.worldSize)%this.worldSize-D,m-x<E&&(m=E+x),m+x>M&&(m=M-x),M-E<this.width&&(p=Math.max(p,this.width/(M-E)),m=(M+E)/2)}m===c&&y===d||this._allowWorldUnderZoom||(this.center=this.unproject(new s.P(m,y))),p&&!this._allowWorldUnderZoom&&(this.zoom+=this.scaleZoom(p)),this._constrainCamera(),this._unmodified=n,this._constraining=!1}_minZoomForBounds(){let t=Math.max(0,this.scaleZoom(Math.max(0,this.height)/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(t=Math.max(t,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),t}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,n=this.projection.name==="globe",c=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=s.cb(1,this.center.lat)/s.cb(1,s.c$));const d=s.cL(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,d),this.cameraToCenterDistance=.5/Math.tan(.5*this._fov)*this.height*this._pixelsPerMercatorPixel,this._updateCameraState(),this._farZ=this.projection.farthestPixelDistance(this),this._nearZ=this.height/50;const p=this.projection.zAxisUnit==="meters"?c:1,m=this._camera.getWorldToCamera(this.worldSize,p);let y;const x=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(x[8]=2*-t.x/this.width,x[9]=2*t.y/this.height,this.isOrthographic){let J=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),Q=J*this.aspect,me=-Q,ae=-J;Q-=t.x,me-=t.x,J+=t.y,ae+=t.y,y=this._camera.getCameraToClipOrthographic(me,Q,ae,J,this._nearZ,this._farZ),((Ae,ve,Me,Ue)=>{for(let _e=0;_e<16;_e++)Ae[_e]=s.ai(ve[_e],Me[_e],Ue)})(y,y,x,s.cZ(this.pitch>=Lr?1:this.pitch/Lr))}else y=x;const T=s.cM([],x,m);let S=s.cM([],y,m);if(this.projection.isReprojectedInTileSpace){const J=this.locationCoordinate(this.center),Q=s.bx([]);s.bo(Q,Q,[J.x*this.worldSize,J.y*this.worldSize,0]),s.az(Q,Q,s.cN(this)),s.bo(Q,Q,[-J.x*this.worldSize,-J.y*this.worldSize,0]),s.az(S,S,Q),s.az(T,T,Q),this.inverseAdjustmentMatrix=s.cO(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=s.cP([],S,[this.worldSize,this.worldSize,this.worldSize/p,1]),this.projMatrix=S,this.invProjMatrix=s.bi(new Float64Array(16),this.projMatrix),n){const J=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);J[8]=2*-t.x/this.width,J[9]=2*t.y/this.height,this.expandedFarZProjMatrix=s.cM([],J,m)}else this.expandedFarZProjMatrix=this.projMatrix;const C=s.bi([],y);this.frustumCorners=s.cQ.fromInvProjectionMatrix(C,this.horizonLineFromTop(),this.height),this.cameraFrustum=s.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!n);const E=new Float32Array(16);s.bx(E),s.cP(E,E,[1,-1,1]),s.cR(E,E,this._pitch),s.by(E,E,this.angle);const M=s.c9(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=s.bw(M);const D=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;M[8]=2*-t.x/this.width,M[9]=2*(t.y+D)/this.height,this.skyboxMatrix=s.az(E,M,E);const z=this.point,F=z.x,L=z.y,N=this.width%2/2,U=this.height%2/2,q=Math.cos(this.angle),Y=Math.sin(this.angle),te=F-Math.round(F)+q*N+Y*U,re=L-Math.round(L)+q*U+Y*N,K=new Float64Array(S);if(s.bo(K,K,[te>.5?te-1:te,re>.5?re-1:re,0]),this.alignedProjMatrix=K,S=s.bz(),s.cP(S,S,[this.width/2,-this.height/2,1]),s.bo(S,S,[1,-1,0]),this.labelPlaneMatrix=S,S=s.bz(),s.cP(S,S,[1,-1,1]),s.bo(S,S,[-1,-1,0]),s.cP(S,S,[2/this.width,2/this.height,1]),this.glCoordMatrix=S,this.pixelMatrix=s.az(new Float64Array(16),this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},S=s.bi(new Float64Array(16),this.pixelMatrix),!S)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=S,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=s.cS(this);const J=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=s.ad(J,J,m),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=S;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const t=this.cameraWorldSizeForFog,n=this.cameraPixelsPerMeter,c=this._camera.position,d=1/this.height/this._pixelsPerMercatorPixel,p=[t,t,n];s.c1(p,p,d),s.c1(c,c,-1),s.cT(c,c,p);const m=s.bz();s.bo(m,m,c),s.cP(m,m,p),this.mercatorFogMatrix=m,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(t,n,d)}_computeCameraPosition(t){const n=(t=t||this.pixelsPerMeter)/this.pixelsPerMeter,c=this._camera.forward(),d=this.point,p=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*n-t/this.worldSize*this._centerAltitude;return[d.x/this.worldSize-c[0]*p,d.y/this.worldSize-c[1]*p,t/this.worldSize*this._centerAltitude-c[2]*p]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(t){const n=this._maxCameraBoundsDistance()*Math.cos(this._pitch),c=this._camera.position[2],d=t[2];let p=1;this.projection.wrap&&(this.center=this.center.wrap()),d>0&&(p=Math.min((n-c)/d,1)),this._camera.position=s.bE([],this._camera.position,t,p),this._updateStateFromCamera()}_updateStateFromCamera(){const t=this._camera.position,n=this._camera.forward(),{pitch:c,bearing:d}=this._camera.getPitchBearing(),p=s.cb(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,m=this._mercatorZfromZoom(this._maxZoom)*Math.cos(s.al(this._maxPitch)),y=Math.max((t[2]-p)/Math.cos(c),m),x=this._zoomFromMercatorZ(y);s.bE(t,t,n,y),this._pitch=s.ay(c,s.al(this.minPitch),s.al(this.maxPitch)),this.angle=s.bQ(d,-Math.PI,Math.PI),this._setZoom(s.ay(x,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new s.ac(t[0],t[1],t[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(t){return Math.pow(2,t)*this.tileSize}_mercatorZfromZoom(t){return this.cameraToCenterDistance/this._worldSizeFromZoom(t)}_minimumHeightOverTerrain(){const t=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(t)}_zoomFromMercatorZ(t){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,t)*this.tileSize))}zoomFromMercatorZAdjusted(t){let n=0,c=s.cI,d=0,p=1/0;for(;c-n>1e-6&&c>n;){const m=n+.5*(c-n),y=this.tileSize*Math.pow(2,m),x=this.getCameraToCenterDistance(this.projection,m,y),T=this.scaleZoom(x/(Math.max(0,t)*this.tileSize)),S=Math.abs(m-T);S<p&&(p=S,d=m),m<T?n=m:c=m}return d}_terrainEnabled(){return!(!this._elevation||!this.projection.supportsTerrain&&(s.w("Terrain is not yet supported with alternate projections. Use mercator or globe to enable terrain."),1))}anyCornerOffEdge(t,n){const c=Math.min(t.x,n.x),d=Math.max(t.x,n.x),p=Math.min(t.y,n.y),m=Math.max(t.y,n.y);if(p<this.horizonLineFromTop(!1))return!0;
20if(this.projection.name!=="mercator")return!1;const y=[new s.P(c,p),new s.P(d,m),new s.P(c,m),new s.P(d,p)],x=this.renderWorldCopies?-3:0,T=this.renderWorldCopies?4:1;for(const S of y){const C=this.pointRayIntersection(S);if(C.t<0)return!0;const E=this.rayIntersectionCoordinate(C);if(E.x<x||E.y<0||E.x>T||E.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+s.cU(this.fovAboveCenter)>88||this.anyCornerOffEdge(new s.P(0,0),new s.P(this.width,this.height))}zoomDeltaToMovement(t,n){const c=s.ae(s.at([],this._camera.position,t)),d=this._zoomFromMercatorZ(c)+n;return c-this._mercatorZfromZoom(d)}getCameraPoint(){if(this.projection.name==="globe"){const t=function([n,c,d],p){const m=[n,c,d,1];s.aA(m,m,p);const y=m[3]=Math.max(m[3],1e-6);return m[0]/=y,m[1]/=y,m[2]/=y,m}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new s.P(t[0],t[1])}{const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.P(0,t))}}getCameraToCenterDistance(t,n=this.zoom,c=this.worldSize){const d=s.cL(t,n,this.width,this.height,1024),p=t.pixelSpaceConversion(this.center.lat,c,d);let m=.5/Math.tan(.5*this._fov)*this.height*p;return this.isOrthographic&&(m=s.ai(1,m,s.cZ(this.pitch>=Lr?1:this.pitch/Lr))),m}getWorldToCameraMatrix(){const t=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&s.az(t,t,this.globeMatrix),t}getFrustum(t){return s.cy.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,t,this.projection.zAxisUnit==="meters")}}const uo=(l,t)=>{if(t>0&&l.terrain&&s.w("Cutoff is currently disabled on terrain"),t<=0||l.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const n=l.transform,c=Math.max(Math.abs(n._zoom-(l.minCutoffZoom-1)),1),d=n.isLODDisabled(!1)?s.af(60,45,n.pitch):s.af(30,15,n.pitch),p=n._farZ-n._nearZ,m=t*n.height,y=((1-(x=d))*n.cameraToCenterDistance+x*(n._farZ+m))*c;var x;return{shouldRenderCutoff:d<1,uniformValues:{u_cutoff_params:[n._nearZ,n._farZ,(y-n._nearZ)/p,(y-m-n._nearZ)/p]}}},Kr={cascadeCount:2,normalOffset:3,shadowMapResolution:2048};class Sl{constructor(t,n){this.aabb=t,this.lastCascade=n}}class zf{add(t,n){const c=this.receivers[t.key];c!==void 0?(c.aabb.min[0]=Math.min(c.aabb.min[0],n.min[0]),c.aabb.min[1]=Math.min(c.aabb.min[1],n.min[1]),c.aabb.min[2]=Math.min(c.aabb.min[2],n.min[2]),c.aabb.max[0]=Math.max(c.aabb.max[0],n.max[0]),c.aabb.max[1]=Math.max(c.aabb.max[1],n.max[1]),c.aabb.max[2]=Math.max(c.aabb.max[2],n.max[2])):this.receivers[t.key]=new Sl(n,null)}clear(){this.receivers={}}get(t){return this.receivers[t.key]}computeRequiredCascades(t,n,c){const d=s.d6.fromPoints(t.points);let p=0;for(const m in this.receivers){const y=this.receivers[m];if(!y||!d.intersectsAabb(y.aabb))continue;y.aabb.min=d.closestPoint(y.aabb.min),y.aabb.max=d.closestPoint(y.aabb.max);const x=y.aabb.getCorners();for(let T=0;T<c.length;T++){let S=!0;for(const C of x){const E=[C[0]*n,C[1]*n,C[2]];if(s.ad(E,E,c[T].matrix),E[0]<-1||E[0]>1||E[1]<-1||E[1]>1){S=!1;break}}if(y.lastCascade=T,p=Math.max(p,T),S)break}}return p+1}}class Rf{constructor(t){this.painter=t,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new zf,this._depthMode=new rt(t.context.gl.LEQUAL,rt.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1,t.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),t.tp.registerParameter(Kr,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),t.tp.registerParameter(Kr,["Shadows"],"normalOffset",{min:0,max:10,step:.05}),t.tp.registerParameter(Kr,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),t.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const t of this._cascades)t.texture.destroy(),t.framebuffer.destroy();this._cascades=[]}updateShadowParameters(t,n){const c=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!n||!n.properties)return;const d=n.properties.get("shadow-intensity");if(!n.shadowsEnabled()||d<=0||(this._shadowLayerCount=c.style.order.reduce((D,z)=>{const F=c.style._mergedLayers[z];return D+(F.hasShadowPass()&&!F.isHidden(t.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const p=c.context,m=Kr.shadowMapResolution,y=Kr.shadowMapResolution;if(this._cascades.length===0||Kr.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let D=0;D<Kr.cascadeCount;++D){const z=c._shadowMapDebug,F=p.gl,L=p.createFramebuffer(m,y,z,"texture"),N=new s.T(p,{width:m,height:y,data:null},F.DEPTH_COMPONENT16);if(L.depthAttachment.set(N.texture),z){const U=new s.T(p,{width:m,height:y,data:null},F.RGBA8);L.colorAttachment.set(U.texture)}this._cascades.push({framebuffer:L,texture:N,matrix:[],far:0,boundingSphereRadius:0,frustum:new s.cy,scale:0})}}this.shadowDirection=fa(n);let x=0;if(t.elevation){const D=t.elevation,z=[1e4,-1e4];D.visibleDemTiles.filter(F=>F.dem).forEach(F=>{const L=F.dem.tree;z[0]=Math.min(z[0],L.minimums[0]),z[1]=Math.max(z[1],L.maximums[0])}),z[0]!==1e4&&(x=(z[1]-z[0])*D.exaggeration())}const T=1.5*t.cameraToCenterDistance,S=3*T,C=new Float64Array(16);for(let D=0;D<this._cascades.length;++D){const z=this._cascades[D];let F=t.height/50,L=1;Kr.cascadeCount===1?L=S:D===0?L=T:(F=T,L=S);const[N,U]=ma(t,this.shadowDirection,F,L,Kr.shadowMapResolution,x);z.scale=t.scale,z.matrix=N,z.boundingSphereRadius=U,s.bi(C,z.matrix),z.frustum=s.cy.fromInvProjectionMatrix(C,1,0,!0),z.far=L}const E=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[E].far,this._cascades[E].far],this._uniformValues.u_shadow_intensity=d,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/Kr.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=Kr.shadowMapResolution,this._uniformValues.u_shadowmap_0=on.ShadowMap0,this._uniformValues.u_shadowmap_1=on.ShadowMap0+1,this._groundShadowTiles=c.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const M=c.transform.elevation;for(const D of this._groundShadowTiles){let z={min:0,max:0};if(M){const F=M.getMinMaxForTile(D);F&&(z=F)}this.addShadowReceiver(D.toUnwrapped(),z.min,z.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(t){this._enabled=t}drawShadowPass(t,n){if(!this.enabled)return;const c=this.painter,d=c.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(c.transform.getFrustum(0),c.transform.worldSize,this._cascades),d.viewport.set([0,0,Kr.shadowMapResolution,Kr.shadowMapResolution]);for(let p=0;p<this._numCascadesToRender;++p){c.currentShadowCascade=p,d.bindFramebuffer.set(this._cascades[p].framebuffer.framebuffer),d.clear({color:s.am.white,depth:1});for(const m of t.order){const y=t._mergedLayers[m];if(!y.hasShadowPass()||y.isHidden(c.transform.zoom))continue;const x=t.getLayerSourceCache(y),T=x?n[x.id]:void 0;(y.type==="model"||T&&T.length)&&c.renderLayer(c,x,y,T)}}c.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const t=this.painter,n=t.style,c=t.context,d=c.gl,p=n.directionalLight,m=n.ambientLight;if(!p||!m)return;const y=[],x=uo(t,t.longestCutoffRange);x.shouldRenderCutoff&&y.push("RENDER_CUTOFF"),y.push("RENDER_SHADOWS","DEPTH_TEXTURE"),this.useNormalOffset&&y.push("NORMAL_OFFSET");const T=Ds(n,p,m),S=new rt(d.LEQUAL,rt.ReadOnly,t.depthRangeFor3D),C=new vt({func:d.EQUAL,mask:255},0,255,d.KEEP,d.KEEP,d.KEEP);for(const E of this._groundShadowTiles){const M=E.toUnwrapped(),D=t.isTileAffectedByFog(E),z=t.getOrCreateProgram("groundShadow",{defines:y,overrideFog:D});this.setupShadows(M,z),t.uploadCommonUniforms(c,z,M,null,x);const F={u_matrix:t.transform.calculateProjMatrix(M),u_ground_shadow_factor:T};z.draw(t,d.TRIANGLES,S,C,Rt.multiply,_t.disabled,F,"ground_shadow",t.tileExtentBuffer,t.quadTriangleIndexBuffer,t.tileExtentSegments,null,t.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?Rt.unblended:Rt.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(t){const n=this.painter.transform,c=n.calculatePosMatrix(t,n.worldSize);return s.az(c,this._cascades[this.painter.currentShadowCascade].matrix,c),Float32Array.from(c)}
20calculateShadowPassMatrixFromMatrix(t){return s.az(t,this._cascades[this.painter.currentShadowCascade].matrix,t),Float32Array.from(t)}setupShadows(t,n,c){if(!this.enabled)return;const d=this.painter.transform,p=this.painter.context,m=p.gl,y=this._uniformValues,x=new Float64Array(16),T=d.calculatePosMatrix(t,d.worldSize);for(let S=0;S<this._cascades.length;S++)s.az(x,this._cascades[S].matrix,T),y[S===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(x),p.activeTexture.set(m.TEXTURE0+on.ShadowMap0+S),this._cascades[S].texture.bindExtraParam(m.LINEAR,m.LINEAR,m.CLAMP_TO_EDGE,m.CLAMP_TO_EDGE,m.GREATER);if(this.useNormalOffset=!!c,this.useNormalOffset){const S=s.d4(t.canonical),C=2/d.tileSize*s.aj/Kr.shadowMapResolution,E=C*this._cascades[0].boundingSphereRadius,M=C*this._cascades[this._cascades.length-1].boundingSphereRadius,D=(c==="vector-tile"?1:3)*function(z,F,L,N,U){const q=s.ay((z-22)/-22,0,1);return .125*(1-q)+4*q}(d.zoom);y.u_shadow_normal_offset=[S,E*D,M*D],y.u_shadow_bias=[1e-4,.0012,.012]}else y.u_shadow_bias=[36e-5,.0012,.012];n.setShadowUniformValues(p,y)}setupShadowsFromMatrix(t,n,c=!1){if(!this.enabled)return;const d=this.painter.context,p=d.gl,m=this._uniformValues,y=new Float64Array(16);for(let x=0;x<Kr.cascadeCount;x++)s.az(y,this._cascades[x].matrix,t),m[x===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(y),d.activeTexture.set(p.TEXTURE0+on.ShadowMap0+x),this._cascades[x].texture.bindExtraParam(p.LINEAR,p.LINEAR,p.CLAMP_TO_EDGE,p.CLAMP_TO_EDGE,p.GREATER);if(this.useNormalOffset=c,c){const x=Kr.normalOffset;m.u_shadow_normal_offset=[1,x,x],m.u_shadow_bias=[6e-5,.0012,.012]}else m.u_shadow_bias=[36e-5,.0012,.012];n.setShadowUniformValues(d,m)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(t,n,c,d){if(d[2]>=0)return{};const p=function(x,T,S){const C=S/(1<<x.canonical.z);return new s.d6([x.canonical.x*C+x.wrap*S,x.canonical.y*C+x.wrap*S,0],[(x.canonical.x+1)*C+x.wrap*S,(x.canonical.y+1)*C+x.wrap*S,T])}(t,n,c).getCorners(),m=n/-d[2];d[0]<0?(s.d5(p[0],p[0],[d[0]*m,0,0]),s.d5(p[3],p[3],[d[0]*m,0,0])):d[0]>0&&(s.d5(p[1],p[1],[d[0]*m,0,0]),s.d5(p[2],p[2],[d[0]*m,0,0])),d[1]<0?(s.d5(p[0],p[0],[0,d[1]*m,0]),s.d5(p[1],p[1],[0,d[1]*m,0])):d[1]>0&&(s.d5(p[2],p[2],[0,d[1]*m,0]),s.d5(p[3],p[3],[0,d[1]*m,0]));const y={};return y.vertices=p,y.planes=[rs(p[1],p[0],p[4]),rs(p[2],p[1],p[5]),rs(p[3],p[2],p[6]),rs(p[0],p[3],p[7])],y}addShadowReceiver(t,n,c){this._receivers.add(t,s.d6.fromTileIdAndHeight(t,n,c))}getMaxCascadeForTile(t){const n=this._receivers.get(t);return n&&n.lastCascade?n.lastCascade:0}}function rs(l,t,n){const c=s.at([],n,t),d=s.at([],l,t),p=s.bF([],c,d),m=s.ae(p);return m===0?[0,0,1,0]:(s.c1(p,p,1/m),[p[0],p[1],p[2],-s.bG(p,t)])}function fa(l){const t=l.properties.get("direction"),n=s.d1(t.x,t.y,t.z);n[2]=s.ay(n[2],0,75);const c=s.d3([n[0],n[1],n[2]]);return s.d2(c.x,c.y,c.z)}function Ds(l,t,n){const c=t.properties.get("color-use-theme")==="none",d=t.properties.get("color"),p=t.properties.get("intensity"),m=t.properties.get("direction"),y=[m.x,m.y,m.z],x=n.properties.get("color-use-theme")==="none",T=n.properties.get("color"),S=n.properties.get("intensity"),C=Math.max(s.bG([0,0,1],y),0),E=[0,0,0];s.c1(E,T.toPremultipliedRenderColor(x?null:l.getLut(t.scope)).toArray01Linear().slice(0,3),S);const M=[0,0,0];return s.c1(M,d.toPremultipliedRenderColor(c?null:l.getLut(n.scope)).toArray01Linear().slice(0,3),C*p),s.d8([E[0]>0?E[0]/(E[0]+M[0]):0,E[1]>0?E[1]/(E[1]+M[1]):0,E[2]>0?E[2]/(E[2]+M[2]):0])}function ma(l,t,n,c,d,p){const m=l.zoom,y=l.scale,x=l.worldSize,T=1/x,S=l.aspect,C=Math.sqrt(1+S*S)*Math.tan(.5*l.fovX),E=C*C,M=c-n,D=c+n;let z,F;E>M/D?(z=c,F=c*C):(z=.5*D*(1+E),F=.5*Math.sqrt(M*M+2*(c*c+n*n)*E+D*D*E*E));const L=l.projection.pixelsPerMeter(l.center.lat,x),N=l._camera.getCameraToWorldMercator(),U=[0,0,-z*T];s.ad(U,U,N);let q=F*T;const Y=l._edgeInsets;if(!(Y.left===0&&Y.top===0&&Y.right===0&&Y.bottom===0||Y.left===Y.right&&Y.top===Y.bottom)){const Re=l._camera.getWorldToCamera(l.worldSize,l.projection.zAxisUnit==="meters"?L:1),De=l._camera.getCameraToClipPerspective(l._fov,l.width/l.height,n,c);De[8]=2*-l.centerOffset.x/l.width,De[9]=2*l.centerOffset.y/l.height;const Fe=new Float64Array(16);s.cM(Fe,De,Re);const We=new Float64Array(16);s.bi(We,Fe);const lt=s.cy.fromInvProjectionMatrix(We,x,m,!0);for(const pt of lt.points){const et=((te=pt)[0]/=y,te[1]/=y,te[2]=s.cb(te[2],l._center.lat),te);q=Math.max(q,s.c2(s.d7([],U,et)))}}var te;q*=d/(d-1);const re=Math.acos(t[2]),K=Math.atan2(-t[0],-t[1]),J=new Xn;
20J.position=U,J.setPitchBearing(re,K);const Q=J.getWorldToCamera(x,L),me=q*x,ae=Math.min(l._mercatorZfromZoom(17)*x*-2,-2*me),Ae=J.getCameraToClipOrthographic(-me,me,-me,me,ae,(me+p*L)/t[2]),ve=new Float64Array(16);s.az(ve,Ae,Q);const Me=s.d2(Math.floor(1e6*U[0])/1e6*x,Math.floor(1e6*U[1])/1e6*x,0),Ue=.5*d,_e=[0,0,0];s.ad(_e,Me,ve),s.c1(_e,_e,Ue);const se=[Math.floor(_e[0]),Math.floor(_e[1]),Math.floor(_e[2])],Te=[0,0,0];s.at(Te,_e,se),s.c1(Te,Te,-1/Ue);const ge=new Float64Array(16);return s.bx(ge),s.bo(ge,ge,Te),s.az(ve,ge,ve),[ve,me]}class Rd extends s.E{constructor(t){super(),this.requestManager=t,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(t,n){return s.aS(this.requestManager.transformRequest(n,s.R.Model).url).then(c=>{if(!c)return;const d=s.aT(c),p=new s.aU(t,void 0,void 0,d);return p.computeBoundsAndApplyParent(),p}).catch(c=>{if(c&&c.status===404)return null;this.fire(new s.z(new Error(`Could not load model ${t} from ${n}: ${c.message}`)))})}load(t,n,c={forceReload:!1}){this.models[n]||(this.models[n]={});const d=Object.keys(t),p=[],m=[];for(const y of d){const x=t[y];this.hasURLBeenRequested(x)&&!c.forceReload||(this.modelByURL[x]={modelId:y,scope:n},p.push(this.loadModel(y,x)),m.push(y)),this.models[n][y]||(this.models[n][y]={model:null,numReferences:1})}this.numModelsLoading[n]=(this.numModelsLoading[n]||0)+m.length,Promise.allSettled(p).then(y=>{for(let x=0;x<y.length;x++){const{status:T}=y[x];if(T==="rejected")continue;const{value:S}=y[x];this.models[n][m[x]]||(this.models[n][m[x]]={model:null,numReferences:1}),this.models[n][m[x]].model=S}this.numModelsLoading[n]-=m.length,this.fire(new s.A("data",{dataType:"style"}))}).catch(y=>{this.fire(new s.z(new Error(`Could not load models: ${y.message}`)))})}isLoaded(){for(const t in this.numModelsLoading)if(this.numModelsLoading[t]>0)return!1;return!0}hasModel(t,n,c={exactIdMatch:!1}){return!!(c.exactIdMatch?this.getModel(t,n):this.getModelByURL(this.modelUris[n][t]))}getModel(t,n){return this.models[n]||(this.models[n]={}),this.models[n][t]?this.models[n][t].model:void 0}getModelByURL(t){if(!t)return null;const n=this.modelByURL[t];return n?this.models[n.scope][n.modelId].model:null}hasModelBeenAdded(t,n){return this.models[n]&&this.models[n][t]!==void 0}getModelURIs(t){return this.modelUris[t]||{}}addModel(t,n,c){this.models[c]||(this.models[c]={}),this.modelUris[c]||(this.modelUris[c]={});const d=this.requestManager.normalizeModelURL(n);if((this.hasModel(t,c,{exactIdMatch:!0})||this.hasModelBeenAdded(t,c))&&this.modelUris[c][t]===d)this.models[c][t].numReferences++;else if(this.hasURLBeenRequested(d)){const{scope:p,modelId:m}=this.modelByURL[d];this.models[p][m].numReferences++}else this.modelUris[c][t]=d,this.load({[t]:this.modelUris[c][t]},c)}addModelURLs(t,n){this.models[n]||(this.models[n]={}),this.modelUris[n]||(this.modelUris[n]={});const c=this.modelUris[n];for(const d in t)c[d]=this.requestManager.normalizeModelURL(t[d])}reloadModels(t){this.load(this.modelUris[t],t,{forceReload:!0})}addModelsFromBucket(t,n){this.models[n]||(this.models[n]={}),this.modelUris[n]||(this.modelUris[n]={});const c={};for(const d of t)this.hasModel(d,n,{exactIdMatch:!0})||this.hasURLBeenRequested(d)?this.models[n][d].numReferences++:this.modelUris[n][d]&&!this.hasURLBeenRequested(d)?c[d]=this.modelUris[n][d]:!this.hasURLBeenRequested(d)&&s.d9(d,!1)&&(this.modelUris[n][d]=this.requestManager.normalizeModelURL(d),c[d]=this.modelUris[n][d]);this.load(c,n)}hasURLBeenRequested(t){return this.modelByURL[t]!==void 0}removeModel(t,n,c=!1,d=!1){if(this.models[n]&&this.models[n][t]&&(this.models[n][t].numReferences--,this.models[n][t].numReferences===0||d)){const p=this.modelUris[n][t];c||delete this.modelUris[n][t],delete this.modelByURL[p];const m=this.models[n][t].model;if(!m)return;delete this.models[n][t],m.destroy()}}destroy(){for(const t of Object.keys(this.models))for(const n of Object.keys(this.models[t])){const c=this.models[t][n].model;delete this.models[t][n],c&&c.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(t){return this.models[t]||(this.models[t]={}),Object.keys(this.models[t])}upload(t,n){this.models[n]||(this.models[n]={});for(const c in this.models[n])this.models[n][c].model&&this.models[n][c].model.upload(t.context)}}const pc=new s.a7({data:new s.a8(s.a5.colorTheme.data)});class Dh{constructor(t){this._scope=t,this._buildingQueryParams={target:{featuresetId:"building-outline",importId:this._scope}},this._floorQueryParams={target:{featuresetId:"floor-outline",importId:this._scope}}}execute(t){const n=this._makeBuildingsQueryArea(t),c=this._makeFloorsQueryArea(t),d=t.queryRenderedFeatures(n,this._buildingQueryParams).filter(y=>y.properties.shape_type==="building").reduce((y,x)=>{const T=x.properties.id;return x.properties.shape_type!=="building"||y.some(S=>S.properties.id===T)||y.push(x),y},[]),p=t.queryRenderedFeatures(c,this._floorQueryParams).filter(y=>y.properties.shape_type==="floor").reduce((y,x)=>{const T=x.properties.id;return x.properties.shape_type!=="floor"||y.some(S=>S.properties.id===T)||y.push(x),y},[]),m=[t.getCenter().lng,t.getCenter().lat];return{floors:p,building:this._findBuildingAtCenter(m,d)||(d.length>0?d[0]:null)}}_makeBuildingsQueryArea(t){const n=t.transform.width,c=t.transform.height,d=Math.min(n,c),p=d*(1/8),m=d*(1/8),y=.5*(n-p),x=.5*(c-m);return[new s.P(y,x),new s.P(y+p,x+m)]}_makeFloorsQueryArea(t){const n=t.transform.width,c=t.transform.height,d=n*(2/3),p=c*(2/3),m=.5*(n-d),y=.5*(c-p);return[new s.P(m,y),new s.P(m+d,y+p)]}_findBuildingAtCenter(t,n){for(const c of n)if(c.geometry.type==="Polygon"&&this._pointInPolygon(t,c.geometry.coordinates[0]))return c;return null}_pointInPolygon(t,n){let c=!1;for(let d=0,p=n.length-1;d<n.length;
20p=d++){const m=n[d][0],y=n[d][1],x=n[p][1];y>t[1]!=x>t[1]&&t[0]<(n[p][0]-m)*(t[1]-y)/(x-y)+m&&(c=!c)}return c}}class ns{constructor(){this._selectedFloorId=null,this._selectedBuildingId=null,this._floors=[]}setBuildingId(t){this._selectedBuildingId=t}setFloors(t){if(this._floors=t.filter(n=>n.properties.building_id===this._selectedBuildingId),!this._selectedFloorId||!this._floors.map(n=>n.properties.id).includes(this._selectedFloorId)){const n=this._floors.map(c=>({id:c.properties.id,level:c.properties.floor_level})).reduce((c,d)=>{const p=Math.abs(c.level-1),m=Math.abs(d.level-1);return m<p||m===p&&d.level>c.level?d:c});this._selectedFloorId=n.id}}setFloorId(t){this._selectedFloorId=t}getSelectedFloorId(){return this._selectedFloorId}getCurrentBuildingFloors(){return this._floors}reset(){this._selectedFloorId=null,this._selectedBuildingId=null,this._floors=[]}}const Df={"mbx-indoor-level-selected":{default:["literal",[]]}};function Dd(l){return l=l||{},Object.assign(l,Df)}class Lf extends s.E{constructor(t){super(),s.aV(["_onLoad","_onMove"],this),this._map=t,this._floorSelectionState=new ns,this._queryIndoor(),this._map.on("load",this._onLoad),this._map.on("move",this._onMove)}destroy(){this._map.indoor.off("load",this._onLoad),this._map.indoor.off("move",this._onMove),this._map=null,this._floorSelectionState=null}_onLoad(){this._map.style.forEachFragmentStyle(t=>{t.stylesheet.indoor&&(this._indoorDataQuery?this.fire(new s.z(new Error("Multiple indoor map styles detected, simultaneous usage is not allowed currently."))):(this._scope=t.scope,this._indoorDataQuery=new Dh(this._scope)))}),this._map._addIndoorControl(),this._queryIndoor()}_onMove(){this._queryIndoor()}_queryIndoor(){if(!this._indoorDataQuery||!this._map.isStyleLoaded())return;if(this._map.transform.zoom<16)return void this._clearIndoorData();const t=this._indoorDataQuery.execute(this._map);t&&t.floors.length!==0?(this._floorSelectionState.getSelectedFloorId()||this._map._addIndoorControl(),this._selectFloors(t)):this._clearIndoorData()}
20_selectFloors(t){if(t.building)this._floorSelectionState.setBuildingId(t.building.properties.id),this._floorSelectionState.setFloors(t.floors),this._updateUI();else{const n=this._floorSelectionState.getSelectedFloorId();if(n&&t.floors.some(c=>c.properties.id===n))return;this._clearIndoorData()}}_clearIndoorData(){this._floorSelectionState.reset(),this._map._removeIndoorControl(),this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",[]])}_updateUI(){const t=this._floorSelectionState.getCurrentBuildingFloors().map(c=>({id:c.properties.id,name:c.properties.name,shortName:c.properties.floor_level,levelOrder:c.properties.floor_level})),n=this._floorSelectionState.getSelectedFloorId();n?(this._updateIndoorConfig(),this.fire(new s.A("indoorupdate",{selectedFloorId:n,floors:t}))):console.warn("IndoorManager: Selected floor is not set")}_updateIndoorConfig(){const t=this._floorSelectionState.getSelectedFloorId();t?this._map.setConfigProperty(this._scope,"mbx-indoor-level-selected",["literal",[t]]):console.warn("IndoorManager: Selected floor is not set")}selectFloor(t){this._floorSelectionState.setFloorId(t),this._updateIndoorConfig()}}function Ld(l){if(!l.metadata||!l.metadata.content_area)return;const t=s.q.devicePixelRatio,{left:n,top:c,width:d,height:p}=l.metadata.content_area,m=n*t,y=c*t;return[m,y,m+d*t,y+p*t]}function Fd(l){if(l)return l.map(([t,n])=>[t*s.q.devicePixelRatio,n*s.q.devicePixelRatio])}class Lh{constructor(t,n,c){this.id=t,this.scope=n,this.sourceCache=c,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(t){this.missingRequests.has(t.name)||this.pendingRequests.has(t.name)||this.pendingRequests.add(t.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const t=new Map;if(!this.sourceCache.loaded())return t;const n=this.sourceCache.getVisibleCoordinates();if(n.length===0)return t;const c=this.sourceCache.getSource();if(!(c instanceof Qo))return t;const d=n.map(m=>this.sourceCache.getTile(m)),p=c.getImages(d,Array.from(this.pendingRequests));for(const[m,y]of p)t.set(s.I.from({name:m,iconsetId:this.id}),y),this.pendingRequests.delete(m);for(const m of this.pendingRequests)this.missingRequests.add(m);return this.pendingRequests.clear(),t}}const os=(l,t)=>W(l,t&&t.filter(n=>n.identifier!=="source.canvas")),Od=s.aF(Kt,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),kd=s.aF(Kt,["setCenter","setZoom","setBearing","setPitch"]),fc=new Set(["background","sky","slot","custom"]),ss={version:8,layers:[],sources:{}},El={duration:300,delay:0};class Yn extends s.E{constructor(t,n={}){super(),this.map=t,this.scope=n.scope||"",this.globalId=null,this.fragments=[],this.importDepth=n.importDepth||0,this.importsCache=n.importsCache||new Map,this.resolvedImports=n.resolvedImports||new Set,this.transition=s.h({},El),this._buildingIndex=new Sd(this),this.crossTileSymbolIndex=new mn,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=n.styleChanges||new Ka,this.dispatcher=n.dispatcher?n.dispatcher:new s.D(s.db(),this),n.imageManager?this.imageManager=n.imageManager:(this.imageManager=new cr(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=n.glyphManager?n.glyphManager:new s.dc(t._requestManager,n.localFontFamily?s.dd.all:n.localIdeographFontFamily?s.dd.ideographs:s.dd.none,n.localFontFamily||n.localIdeographFontFamily),n.modelManager?this.modelManager=n.modelManager:(this.modelManager=new Rd(t._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={}
20,this._order=[],this._markersNeedUpdate=!1,this.options=n.configOptions?n.configOptions:new Map,this._configDependentLayers=n.configDependentLayers?n.configDependentLayers:new Set,this._config=n.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:n.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=n.initialConfig,this.dispatcher.broadcast("setReferrer",s.de());const c=this;this._rtlTextPluginCallback=Yn.registerForPluginStateChange(d=>{c.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:d.pluginStatus,pluginURL:d.pluginURL},(p,m)=>{if(s.df(p),m&&m.every(y=>y))for(const y in c._sourceCaches){const x=c._sourceCaches[y],T=x.getSource().type;T!=="vector"&&T!=="geojson"||x.reload()}})}),this.on("data",d=>{if(d.dataType!=="source"||d.sourceDataType!=="metadata")return;const p=this.getOwnSource(d.sourceId);if(p&&p.vectorLayerIds)for(const m in this._layers){const y=this._layers[m];y.source===p.id&&this._validateLayer(y)}})}load(t){return t?(typeof t=="string"?this.loadURL(t):this.loadJSON(t),this):this}_getGlobalId(t){if(!t)return null;if(typeof t=="string"){if(s.j(t))return t;const n=s.dg(t);if(!n.startsWith("http"))try{return new URL(n,location.href).toString()}catch{return n}return n}return`json://${s.dh(JSON.stringify(t))}`}_diffStyle(t,n,c){this.globalId=this._getGlobalId(t);const d=(p,m)=>{try{m(null,this.setState(p,c))}catch(y){m(y,!1)}};if(typeof t=="string"){const p=this.map._requestManager.normalizeStyleURL(t),m=this.map._requestManager.transformRequest(p,s.R.Style);s.n(m,(y,x)=>{y?this.fire(new s.z(y)):x&&d(x,n)})}else typeof t=="object"&&d(t,n)}loadURL(t,n={}){this.fire(new s.A("dataloading",{dataType:"style"}));const c=typeof n.validate=="boolean"?n.validate:!s.j(t);this.globalId=this._getGlobalId(t),t=this.map._requestManager.normalizeStyleURL(t,n.accessToken),this.resolvedImports.add(t);const d=this.importsCache.get(t);if(d)return this._load(d,c);const p=this.map._requestManager.transformRequest(t,s.R.Style);this._request=s.n(p,(m,y)=>{if(this._request=null,m)this.fire(new s.z(m));else if(y)return this.importsCache.set(t,y),this._load(y,c)})}loadJSON(t,n={}){this.fire(new s.A("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(t),this._request=s.q.frame(()=>{this._request=null,this._load(t,n.validate!==!1)})}loadEmpty(){this.fire(new s.A("dataloading",{dataType:"style"})),this._load(ss,!1)}_loadImports(t,n,c){if(this.importDepth>=4)return s.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const d=[];for(const p of t){const m=this._createFragmentStyle(p),y=new Promise(S=>{m.once("style.import.load",S),m.once("error",S)}).then(()=>this.mergeAll());if(d.push(y),this.resolvedImports.has(p.url)){m.loadEmpty();continue}const x=p.data||this.importsCache.get(p.url);x?(m.loadJSON(x,{validate:n}),this._isInternalStyle(x)&&(m.globalId=null)):p.url?m.loadURL(p.url,{validate:n}):m.loadEmpty();const T={style:m,id:p.id,config:p.config};if(c){const S=this.fragments.findIndex(({id:C})=>C===c);this.fragments=this.fragments.slice(0,S).concat(T).concat(this.fragments.slice(S))}else this.fragments.push(T)}return Promise.allSettled(d)}getImportGlobalIds(t=this,n=new Set){for(const c of t.fragments)c.style.globalId&&n.add(c.style.globalId),this.getImportGlobalIds(c.style,n);return[...n.values()]}_createFragmentStyle(t){const n=this.scope?s.C(t.id,this.scope):t.id;let c;const d=this._initialConfig&&this._initialConfig[n];(t.config||d)&&(c=s.h({},t.config,d));const p=new Yn(this.map,{scope:n,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:c,configOptions:this.options,colorThemeOverride:t["color-theme"],configDependentLayers:this._configDependentLayers});return p.setEventedParent(this.map,{style:p}),p}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(t){return this.isRootStyle()&&(t.fragment||!!t.schema&&t.fragment!==!1)}_load(t,n){const c=t.indoor?Dd(t.schema):t.schema;if(this._isInternalStyle(t)){const m=s.h({},ss,{imports:[{id:"basemap",data:t,url:""}]});return void this._load(m,n)}if(this.updateConfig(this._config,c),n&&os(this,Pn(t)))return;this._loaded=!0,this.stylesheet=s.di(t);const d=()=>{for(const T in t.sources)this.addSource(T,t.sources[T],{validate:!1,isInitialLoad:!0});if(t.iconsets)for(const T in t.iconsets)this.addIconset(T,t.iconsets[T]);t.sprite?this._loadIconset(t.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&t.glyphs&&this.glyphManager.setURL(t.glyphs);
20const m=ul(this.stylesheet.layers);if(this._order=m.map(T=>T.id),this.stylesheet.light&&s.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const T=this.stylesheet.lights[0];this.light=new be(T.properties,T.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new be(this.stylesheet.light)),this._layers={};for(const T of m){const S=s.dn(T,this.scope,this._styleColorTheme.lut,this.options);S.configDependencies.size!==0&&this._configDependentLayers.add(S.fqid),S.setEventedParent(this,{layer:{id:S.id}}),this._layers[S.id]=S;const C=this.getOwnLayerSourceCache(S),E=!!this.directionalLight&&this.directionalLight.shadowsEnabled();C&&S.canCastShadows()&&E&&(C.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const y=this.stylesheet.terrain;y&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(y,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new s.A("data",{dataType:"style"}));const x=this.isRootStyle();t.imports?this._loadImports(t.imports,n).then(()=>{this._reloadImports(),this.fire(new s.A(x?"style.load":"style.import.load"))}).catch(T=>{this.fire(new s.z(new Error("Failed to load imports",T))),this.fire(new s.A(x?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new s.A(x?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const p=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(p){const m=this._evaluateColorThemeData(p);this._loadColorTheme(m).then(()=>{d()}).catch(y=>{s.w(`Couldn't load color theme from the stylesheet: ${y}`),d()})}else this._styleColorTheme.lut=null,d()}isRootStyle(){return this.importDepth===0}mergeAll(){let t,n,c,d,p,m,y,x,T,S;const C={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(E=>{if(E.stylesheet){if(E.light!=null&&(t=E.light),E.stylesheet.lights)for(const M of E.stylesheet.lights)M.type==="ambient"&&E.ambientLight!=null&&(n=E.ambientLight),M.type==="directional"&&E.directionalLight!=null&&(c=E.directionalLight);d=this._prioritizeTerrain(d,E.terrain,E.stylesheet.terrain),E.stylesheet.fog&&E.fog!=null&&(p=E.fog),E.stylesheet.snow&&E.snow!=null&&(m=E.snow),E.stylesheet.rain&&E.rain!=null&&(y=E.rain),E.stylesheet.camera!=null&&(S=E.stylesheet.camera),E.stylesheet.projection!=null&&(x=E.stylesheet.projection),E.stylesheet.transition!=null&&(T=E.stylesheet.transition),C[E.scope]=E._styleColorTheme}}),this.light=t,this.ambientLight=n,this.directionalLight=c,this.fog=p,this.snow=m,this.rain=y,this._styleColorThemeForScope=C,d===null?delete this.terrain:this.terrain=d,this.camera=S||{"camera-projection":"perspective"},this.projection=x||{name:"mercator"},this.transition=s.h({},El,T),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(t){const n=c=>{for(const d of c.fragments)n(d.style);t(c)};n(this)}_prioritizeTerrain(t,n,c){const d=t&&t.drapeRenderMode===0;return c===null?n&&n.drapeRenderMode===0?n:d?t:null:n!=null&&(!t||d||n&&n.drapeRenderMode===1)?n:t}mergeTerrain(){let t;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(n=>{t=this._prioritizeTerrain(t,n.terrain,n.stylesheet.terrain)}),t===null?delete this.terrain:this.terrain=t}mergeProjection(){let t;this.forEachFragmentStyle(n=>{n.stylesheet.projection!=null&&(t=n.stylesheet.projection)}),this.projection=t||{name:"mercator"}}mergeSources(){const t={},n={},c={};this.forEachFragmentStyle(d=>{for(const p in d._sourceCaches){const m=s.C(p,d.scope);t[m]=d._sourceCaches[p]}for(const p in d._otherSourceCaches){const m=s.C(p,d.scope);n[m]=d._otherSourceCaches[p]}for(const p in d._symbolSourceCaches){const m=s.C(p,d.scope);c[m]=d._symbolSourceCaches[p]}}),this._mergedSourceCaches=t,this._mergedOtherSourceCaches=n,this._mergedSymbolSourceCaches=c}mergeLayers(){const t={},n=[],c={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(p=>{for(const m of p._order){const y=p._layers[m];if(y.type==="slot"){const x=s.dj(m);if(t[x])continue;t[x]=[]}y.slot&&t[y.slot]?t[y.slot].push(y):n.push(y)}}),this._mergedOrder=[];const d=(p=[])=>{for(const m of p)if(m.type==="slot"){const y=s.dj(m.id);t[y]&&d(t[y]),this._mergedSlots.push(y)}else{const y=s.C(m.id,m.scope);this._mergedOrder.push(y),c[y]=m,m.is3D(!!this.terrain)&&(this._has3DLayers=!0),m.type==="circle"&&(this._hasCircleLayers=!0),m.type==="symbol"&&(this._hasSymbolLayers=!0),m.type==="clip"&&(this._clipLayerPresent=!0)}};d(n),this._mergedOrder.sort((p,m)=>{const y=c[p],x=c[m];return y.hasInitialOcclusionOpacityProperties?x.is3D(!!this.terrain)?1:0:y.is3D(!!this.terrain)&&x.hasInitialOcclusionOpacityProperties?-1:0}),this._mergedLayers=c,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(t){return this.stylesheet.camera=s.h({},this.stylesheet.camera,t),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(t){return t.data?function(n,c,d,p){const m=s.h({},c);for(const x of Object.keys(s.a5.colorTheme))m[x]===void 0&&(m[x]=s.a5.colorTheme[x].default);const y=new s.a6(pc,n,new Map(d));return y.setTransitionOrValue(m,d),y.untransitioned().possiblyEvaluate(new s.aa(0,{worldview:void 0}))}(this.scope,t,this.options).get("data"):null}_loadColorTheme(t){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const n=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((c,d)=>{const p="data:image/png;base64,";if(!t||t.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void c();let m=t;m.startsWith(p)||(m=p+m);const y=s.I.from("mapbox-reserved-lut"),x=new Image;x.src=m,x.onerror=()=>{this._styleColorTheme.lutLoading=!1,d(new Error("Failed to load image data"))},x.onload=()=>
20{if(this._styleColorTheme.lutLoadingCorrelationID!==n)return void c();this._styleColorTheme.lutLoading=!1;const{width:T,height:S,data:C}=s.q.getImageData(x);if(S>32)return void d(new Error("The height of the image must be less than or equal to 32 pixels."));if(T!==S*S)return void d(new Error("The width of the image must be equal to the height squared."));this.getImage(y)&&this.removeImage(y),this.addImage(y,{data:new s.r({width:T,height:S},C),pixelRatio:1,sdf:!1,usvg:!1,version:0});const E=this.imageManager.getImage(y,this.scope);E?(this._styleColorTheme.lut={image:E.data,data:t},c()):d(new Error("Missing LUT image."))}})}getLut(t){const n=this._styleColorThemeForScope[t];return n?n.lut:null}setProjection(t){t?this.stylesheet.projection=t:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(t){this._spriteRequest=function(n,c,d){let p,m,y;const x=s.q.devicePixelRatio>1?"@2x":"";let T=s.n(c.transformRequest(c.normalizeSpriteURL(n,x,".json"),s.R.SpriteJSON),(E,M)=>{T=null,y||(y=E,p=M,C())}),S=s.o(c.transformRequest(c.normalizeSpriteURL(n,x,".png"),s.R.SpriteImage),(E,M)=>{S=null,y||(y=E,m=M,C())});function C(){if(y)d(y);else if(p&&m){const E=s.q.getImageData(m),M={};for(const D in p){const{width:z,height:F,x:L,y:N,sdf:U,pixelRatio:q,stretchX:Y,stretchY:te,content:re}=p[D],K=new s.r({width:z,height:F});s.r.copy(E,K,{x:L,y:N},{x:0,y:0},{width:z,height:F},null),M[D]={data:K,pixelRatio:q,sdf:U,stretchX:Y,stretchY:te,content:re,usvg:!1}}d(null,M)}}return{cancel(){T&&(T.cancel(),T=null),S&&(S.cancel(),S=null)}}}(t,this.map._requestManager,(n,c)=>{if(this._spriteRequest=null,n)this.fire(new s.z(n));else if(c){const d=new Map;for(const p in c)d.set(s.I.from(p),c[p]);this.addImages(d)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.A("data",{dataType:"style"}))})}addIconset(t,n){if(n.type==="sprite")return void this._loadSprite(n.url);const c=this.getOwnSourceCache(n.source);if(!c)return void this.fire(new s.z(new Error(`Source "${n.source}" as specified by iconset "${t}" does not exist and cannot be used as an iconset source`)));const d=c.getSource();if(d.type!=="raster-array")return void this.fire(new s.z(new Error(`Source "${n.source}" as specified by iconset "${t}" is not a "raster-array" source and cannot be used as an iconset source`)));d.partial=!1;const p=new Lh(t,this.scope,c);this.imageManager.addImageProvider(p,this.scope)}removeIconset(t){this.imageManager.removeImageProvider(t,this.scope)}_loadIconset(t){if(!s.j(t)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(t);const n=this.map._spriteFormat==="auto";var c,d;this._spriteRequest=(d=(p,m)=>{if(this._spriteRequest=null,p)n?this._loadSprite(t):this.fire(new s.z(p));else if(m){const y=new Map;for(const x in m)y.set(s.I.from(x),m[x]);this.addImages(y)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.A("data",{dataType:"style"}))},s.br((c=this.map._requestManager).transformRequest(c.normalizeIconsetURL(t),s.R.Iconset),(p,m)=>{if(p)return void d(p);const y={},x=s.da(new s.bq(m));for(const T of x.icons){const S={version:1,pixelRatio:s.q.devicePixelRatio,content:Ld(T),stretchX:T.metadata?Fd(T.metadata.stretch_x_areas):void 0,stretchY:T.metadata?Fd(T.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:T};y[T.name]=S}d(null,y)}))}_validateLayer(t){const n=this.getOwnSource(t.source);if(!n)return;const c=t.sourceLayer;c&&(n.type==="geojson"||n.vectorLayerIds&&n.vectorLayerIds.indexOf(c)===-1)&&this.fire(new s.z(new Error(`Source layer "${c}" does not exist on source "${n.id}" as specified by style layer "${t.id}"`)))}
20loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const t in this._sourceCaches)if(!this._sourceCaches[t].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:t}of this.fragments)if(!t.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((t,n)=>{const c=this.fragments[n];return c&&c.style&&(t.data=c.style.serialize()),t})}_serializeSources(){const t={};for(const n in this._sourceCaches){const c=this._sourceCaches[n].getSource();t[c.id]||(t[c.id]=c.serialize())}return t}_serializeLayers(t){const n=[];for(const c of t){const d=this._layers[c];d&&d.type!=="custom"&&n.push(d.serialize())}return n}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const t in this._sourceCaches)if(this._sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(t){return t?this.order:this._mergedOrder}isLayerDraped(t){return!!this.terrain&&t.isDraped(this.getLayerSourceCache(t))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(t){const n=this.getOwnLayer(t);if(n)return n;this.fire(new s.z(new Error(`The layer '${t}' does not exist in the map's style.`)))}_checkSource(t){const n=this.getOwnSource(t);if(n)return n;this.fire(new s.z(new Error(`The source '${t}' does not exist in the map's style.`)))}precompilePrograms(t,n){const c=this.map.painter;if(c)for(let d=t.minzoom||0;d<(t.maxzoom||25.5);d++){const p=t.getProgramIds();if(p)for(const m of p){const y=t.getDefaultProgramParams(m,n.zoom,this._styleColorTheme.lut);y&&(c.style=this,this.fog&&(c._fogVisible=!0,y.overrideFog=!0,c.getOrCreateProgram(m,y)),c._fogVisible=!1,y.overrideFog=!1,c.getOrCreateProgram(m,y),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(y.overrideRtt=!0,c.getOrCreateProgram(m,y)))}}}update(t){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(t),this.directionalLight&&this.directionalLight.recalculate(t);const n=this.calculateLightsBrightness();t.brightness=n||0,n!==this._brightness&&(this._brightness=n,this.dispatcher.broadcast("setBrightness",n)),t.worldview!==this._worldview&&(this._worldview=t.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const c=this._changes.isDirty();let d=!1;if(this._changes.isDirty()){const y=this._changes.getLayerUpdatesByScope();for(const x in y){const{updatedIds:T,removedIds:S}=y[x];(T||S)&&(this._updateWorkerLayers(x,T,S),d=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(t),this.light&&this.light.updateTransitions(t),this.ambientLight&&this.ambientLight.updateTransitions(t),this.directionalLight&&this.directionalLight.updateTransitions(t),this.fog&&this.fog.updateTransitions(t),this.snow&&this.snow.updateTransitions(t),this.rain&&this.rain.updateTransitions(t),this._changes.reset()}const p={};for(const y in this._mergedSourceCaches){const x=this._mergedSourceCaches[y];p[y]=x.used,x.used=!1,x.tileCoverLift=0}for(const y of this._mergedOrder){const x=this._mergedLayers[y];if(x.recalculate(t,this._availableImages),!x.isHidden(t.zoom)){const T=this.getLayerSourceCache(x);T&&(T.used=!0,T.tileCoverLift=Math.max(T.tileCoverLift,x.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>
20{this.precompilePrograms(x,t)}):this.precompilePrograms(x,t))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&d&&this.mergeLayers();const m=this.imageManager.getPendingImageProviders();for(const y of m)y.sourceCache.used=!0;for(const y in p){const x=this._mergedSourceCaches[y];p[y]!==x.used&&x.getSource().fire(new s.A("data",{sourceDataType:"visibility",dataType:"source",sourceId:x.getSource().id}))}this.light&&this.light.recalculate(t),this.terrain&&this.terrain.recalculate(t),this.fog&&this.fog.recalculate(t),this.snow&&this.snow.recalculate(t),this.rain&&this.rain.recalculate(t),this.z=t.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),c&&this.fire(new s.A("data",{dataType:"style"}))}updateImageProviders(){const t=this.imageManager.getPendingImageProviders();for(const n of t){const c=n.resolvePendingRequests(),d=this.getFragmentStyle(n.scope);d&&d.addImages(c)}}_updateTilesForChangedImages(){const t={};for(const n in this._mergedSourceCaches){const c=this._mergedSourceCaches[n].getSource().scope;t[c]=t[c]||this._changes.getUpdatedImages(c),t[c].length!==0&&this._mergedSourceCaches[n].reloadTilesForDependencies(["icons","patterns"],t[c])}for(const n in t)this._changes.resetUpdatedImages(n)}_updateWorkerLayers(t,n,c){const d=this.getFragmentStyle(t);d&&this.dispatcher.broadcast("updateLayers",{layers:n?d._serializeLayers(n):[],scope:t,removedIds:c||[],options:d.options})}setState(t,n){if(this._checkLoaded(),os(this,Pn(t)))return!1;(t=s.di(t)).layers=ul(t.layers);const c=function(m,y){if(!m)return[{command:Kt.setStyle,args:[y]}];let x=[];try{if(!s.bv(m.version,y.version))return[{command:Kt.setStyle,args:[y]}];if(s.bv(m.center,y.center)||x.push({command:Kt.setCenter,args:[y.center]}),s.bv(m.zoom,y.zoom)||x.push({command:Kt.setZoom,args:[y.zoom]}),s.bv(m.bearing,y.bearing)||x.push({command:Kt.setBearing,args:[y.bearing]}),s.bv(m.pitch,y.pitch)||x.push({command:Kt.setPitch,args:[y.pitch]}),s.bv(m.sprite,y.sprite)||x.push({command:Kt.setSprite,args:[y.sprite]}),s.bv(m.glyphs,y.glyphs)||x.push({command:Kt.setGlyphs,args:[y.glyphs]}),s.bv(m.imports,y.imports)||function(M=[],D=[],z){D=D||[];const F=(M=M||[]).map(Cs),L=D.map(Cs),N=M.reduce(es,{}),U=D.reduce(es,{}),q=F.slice();let Y,te,re,K;for(Y=0,te=0;Y<F.length;Y++)re=F[Y],U.hasOwnProperty(re)?te++:(z.push({command:Kt.removeImport,args:[re]}),q.splice(q.indexOf(re,te),1));for(Y=0,te=0;Y<L.length;Y++)re=L[L.length-1-Y],q[q.length-1-Y]!==re&&(N.hasOwnProperty(re)?(z.push({command:Kt.removeImport,args:[re]}),q.splice(q.lastIndexOf(re,q.length-te),1)):te++,K=q[q.length-Y],z.push({command:Kt.addImport,args:[U[re],K]}),q.splice(q.length-Y,0,re));for(const J of D){const Q=N[J.id];Q&&(delete Q.data,s.bv(Q,J)||z.push({command:Kt.updateImport,args:[J.id,J]}))}}(m.imports,y.imports,x),s.bv(m.transition,y.transition)||x.push({command:Kt.setTransition,args:[y.transition]}),s.bv(m.light,y.light)||x.push({command:Kt.setLight,args:[y.light]}),s.bv(m.fog,y.fog)||x.push({command:Kt.setFog,args:[y.fog]}),s.bv(m.snow,y.snow)||x.push({command:Kt.setSnow,args:[y.snow]}),s.bv(m.rain,y.rain)||x.push({command:Kt.setRain,args:[y.rain]}),s.bv(m.projection,y.projection)||x.push({command:Kt.setProjection,args:[y.projection]}),s.bv(m.lights,y.lights)||x.push({command:Kt.setLights,args:[y.lights]}),s.bv(m.camera,y.camera)||x.push({command:Kt.setCamera,args:[y.camera]}),s.bv(m.iconsets,y.iconsets)||function(M,D,z){let F;for(F in D=D||{},M=M||{})M.hasOwnProperty(F)&&(D.hasOwnProperty(F)||z.push({command:Kt.removeIconset,args:[F]}));for(F in D){if(!D.hasOwnProperty(F))continue;const L=D[F];M.hasOwnProperty(F)?s.bv(M[F],L)||(z.push({command:Kt.removeIconset,args:[F]}),z.push({command:Kt.addIconset,args:[F,L]})):z.push({command:Kt.addIconset,args:[F,L]})}}(m.iconsets,y.iconsets,x),!s.bv(m["color-theme"],y["color-theme"]))return[{command:Kt.setStyle,args:[y]}];const T={},S=[];(function(M,D,z,F){let L;for(L in D=D||{},M=M||{})M.hasOwnProperty(L)&&(D.hasOwnProperty(L)||sa(L,z,F));for(L in D){if(!D.hasOwnProperty(L))continue;const N=D[L];
20M.hasOwnProperty(L)?s.bv(M[L],N)||(M[L].type==="geojson"&&N.type==="geojson"&&Mf(M,D,L)?z.push({command:Kt.setGeoJSONSourceData,args:[L,N.data]}):dl(L,D,z,F)):ac(L,D,z)}})(m.sources,y.sources,S,T);const C=[];m.layers&&m.layers.forEach(M=>{M.source&&T[M.source]?x.push({command:Kt.removeLayer,args:[M.id]}):C.push(M)});let E=m.terrain;E&&T[E.source]&&(x.push({command:Kt.setTerrain,args:[void 0]}),E=void 0),x=x.concat(S),s.bv(E,y.terrain)||x.push({command:Kt.setTerrain,args:[y.terrain]}),function(M,D,z){D=D||[];const F=(M=M||[]).map(Cs),L=D.map(Cs),N=M.reduce(es,{}),U=D.reduce(es,{}),q=F.slice(),Y=Object.create(null);let te,re,K,J,Q,me,ae;for(te=0,re=0;te<F.length;te++)K=F[te],U.hasOwnProperty(K)?re++:(z.push({command:Kt.removeLayer,args:[K]}),q.splice(q.indexOf(K,re),1));for(te=0,re=0;te<L.length;te++)K=L[L.length-1-te],q[q.length-1-te]!==K&&(N.hasOwnProperty(K)?(z.push({command:Kt.removeLayer,args:[K]}),q.splice(q.lastIndexOf(K,q.length-re),1)):re++,me=q[q.length-te],z.push({command:Kt.addLayer,args:[U[K],me]}),q.splice(q.length-te,0,K),Y[K]=!0);for(te=0;te<L.length;te++)if(K=L[te],J=N[K],Q=U[K],!Y[K]&&!s.bv(J,Q))if(s.bv(J.source,Q.source)&&s.bv(J["source-layer"],Q["source-layer"])&&s.bv(J.type,Q.type)){for(ae in pl(J.layout,Q.layout,z,K,null,Kt.setLayoutProperty),pl(J.paint,Q.paint,z,K,null,Kt.setPaintProperty),s.bv(J.slot,Q.slot)||z.push({command:Kt.setSlot,args:[K,Q.slot]}),s.bv(J.filter,Q.filter)||z.push({command:Kt.setFilter,args:[K,Q.filter]}),s.bv(J.minzoom,Q.minzoom)&&s.bv(J.maxzoom,Q.maxzoom)||z.push({command:Kt.setLayerZoomRange,args:[K,Q.minzoom,Q.maxzoom]}),J)J.hasOwnProperty(ae)&&ae!=="layout"&&ae!=="paint"&&ae!=="filter"&&ae!=="metadata"&&ae!=="minzoom"&&ae!=="maxzoom"&&ae!=="slot"&&(ae.indexOf("paint.")===0?pl(J[ae],Q[ae],z,K,ae.slice(6),Kt.setPaintProperty):s.bv(J[ae],Q[ae])||z.push({command:Kt.setLayerProperty,args:[K,ae,Q[ae]]}));for(ae in Q)Q.hasOwnProperty(ae)&&!J.hasOwnProperty(ae)&&ae!=="layout"&&ae!=="paint"&&ae!=="filter"&&ae!=="metadata"&&ae!=="minzoom"&&ae!=="maxzoom"&&ae!=="slot"&&(ae.indexOf("paint.")===0?pl(J[ae],Q[ae],z,K,ae.slice(6),Kt.setPaintProperty):s.bv(J[ae],Q[ae])||z.push({command:Kt.setLayerProperty,args:[K,ae,Q[ae]]}))}else z.push({command:Kt.removeLayer,args:[K]}),me=q[q.lastIndexOf(K)+1],z.push({command:Kt.addLayer,args:[Q,me]})}(C,y.layers,x)}catch(T){console.warn("Unable to compute style diff:",T),x=[{command:Kt.setStyle,args:[y]}]}return x}(this.serialize(),t).filter(m=>!(m.command in kd));if(c.length===0)return!1;const d=c.filter(m=>!(m.command in Od));if(d.length>0)throw new Error(`Unimplemented: ${d.map(m=>m.command).join(", ")}.`);const p=[];return c.forEach(m=>{p.push(this[m.command](...m.args))}),n&&Promise.all(p).then(n).catch(n),this.stylesheet=t,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(t){if(t.size===0)return this;for(const[n,c]of t.entries()){if(this.getImage(n))return this.fire(new s.z(new Error(`An image with the name "${n.name}" already exists.`)));this.imageManager.addImage(n,this.scope,c),this._changes.updateImage(n,this.scope)}return this._updateWorkerImages(),this.fire(new s.A("data",{dataType:"style"})),this}addImage(t,n){return this.getImage(t)?this.fire(new s.z(new Error(`An image with the name "${t.name}" already exists.`))):(this.imageManager.addImage(t,this.scope,n),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.A("data",{dataType:"style"})),this)}updateImage(t,n,c=!1){this.imageManager.updateImage(t,this.scope,n),c&&(this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.A("data",{dataType:"style"})))}getImage(t){return this.imageManager.getImage(t,this.scope)}removeImage(t){return this.getImage(t)?(this.imageManager.removeImage(t,this.scope),this._changes.updateImage(t,this.scope),this._updateWorkerImages(),this.fire(new s.A("data",{dataType:"style"})),this):this.fire(new s.z(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModelURLs(t){return this.modelManager.addModelURLs(t,this.scope),this._updateWorkerModels(),this.fire(new s.A("data",{dataType:"style"})),this}addModel(t,n,c={}
vendor: 10,221 bytes, line 20
20){return this._checkLoaded(),this._validate(Z,`models.${t}`,n,null,c)||(this.modelManager.addModel(t,n,this.scope),this.fire(new s.A("data",{dataType:"style"}))),this}hasModel(t){return this.modelManager.hasModel(t,this.scope)}removeModel(t){return this.hasModel(t)?(this.modelManager.removeModel(t,this.scope,!1,!0),this.fire(new s.A("data",{dataType:"style"})),this):this.fire(new s.z(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(t,n,c={}){if(this._checkLoaded(),this.getOwnSource(t)!==void 0)throw new Error(`There is already a source with ID "${t}".`);if(!n.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(n).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(n.type)>=0&&this._validate(il,`sources.${t}`,n,null,c))return;this.map&&this.map._collectResourceTiming&&(n.collectResourceTiming=!0);const d=ol(t,n,this.dispatcher,this);d.scope=this.scope,d.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(d.id),source:d.serialize(),sourceId:d.id}));const p=m=>{const y=(m?"symbol:":"other:")+d.id,x=s.C(y,this.scope),T=this._sourceCaches[y]=new fn(x,d,m);(m?this._symbolSourceCaches:this._otherSourceCaches)[d.id]=T,T.onAdd(this.map)};p(!1),n.type!=="vector"&&n.type!=="geojson"||p(!0),d.onAdd&&d.onAdd(this.map),c.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(t){this._checkLoaded();const n=this.getOwnSource(t);if(!n)throw new Error("There is no source with this ID");for(const d in this._layers)if(this._layers[d].source===t)return this.fire(new s.z(new Error(`Source "${t}" cannot be removed while layer "${d}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===t)return this.fire(new s.z(new Error(`Source "${t}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const d=Object.entries(this.stylesheet.iconsets).find(([p,m])=>m.type==="source"&&m.source===t);if(d)return this.fire(new s.z(new Error(`Source "${t}" cannot be removed while iconset "${d[0]}" is using it.`)))}const c=this.getOwnSourceCaches(t);for(const d of c){const p=s.dj(d.id);delete this._sourceCaches[p],this._changes.discardSourceCacheUpdate(d.id),d.fire(new s.A("data",{sourceDataType:"metadata",dataType:"source",sourceId:d.getSource().id})),d.setEventedParent(null),d.clearTiles()}return delete this._otherSourceCaches[t],delete this._symbolSourceCaches[t],this.mergeSources(),n.setEventedParent(null),n.onRemove&&n.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(t,n){this._checkLoaded(),this.getOwnSource(t).setData(n),this._changes.setDirty()}getOwnSource(t){const n=this.getOwnSourceCache(t);return n&&n.getSource()}getOwnSources(){const t=[];for(const n in this._otherSourceCaches){const c=this.getOwnSourceCache(n);c&&t.push(c.getSource())}return t}areTilesLoaded(){const t=this._mergedSourceCaches;for(const n in t){const c=t[n]._tiles;for(const d in c){const p=c[d];if(p.state!=="loaded"&&p.state!=="errored")return!1}}return!0}setLights(t){if(this._checkLoaded(),!t)return delete this.ambientLight,void delete this.directionalLight;const n=this._getTransitionParameters();for(const p of t){if(this._validate(ra,"lights",p))return;switch(p.type){case"ambient":if(this.ambientLight){const m=this.ambientLight;m.set(p),m.updateTransitions(n)}else this.ambientLight=new bi(p,Ht||(Ht=new s.a7({color:new s.a8(s.a5.properties_light_ambient.color),"color-use-theme":new s.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.a8(s.a5.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const m=this.directionalLight;m.set(p),m.updateTransitions(n)}else this.directionalLight=new bi(p,rr||(rr=new s.a7({direction:new s.an(s.a5.properties_light_directional.direction),color:new s.a8(s.a5.properties_light_directional.color),"color-use-theme":new s.a8({type:"string",default:"default","property-type":"data-constant"}),intensity:new s.a8(s.a5.properties_light_directional.intensity),"cast-shadows":new s.a8(s.a5.properties_light_directional["cast-shadows"]),"shadow-quality":new s.a8(s.a5.properties_light_directional["shadow-quality"]),"shadow-intensity":new s.a8(s.a5.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const c=Object.assign(n,{worldview:this.map.getWorldview()}),d=new s.aa(this.z||0,c);this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const t=this.directionalLight,n=this.ambientLight;if(!t||!n)return;const c=E=>.2126*(E[0]<=.03928?E[0]/12.92:Math.pow((E[0]+.055)/1.055,2.4))+.7152*(E[1]<=.03928?E[1]/12.92:Math.pow((E[1]+.055)/1.055,2.4))+.0722*(E[2]<=.03928?E[2]/12.92:Math.pow((E[2]+.055)/1.055,2.4)),d=t.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),p=t.properties.get("intensity"),m=t.properties.get("direction"),y=1-s.d1(m.x,m.y,m.z)[2]/90,x=c(d)*p*y,T=n.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),S=n.properties.get("intensity"),C=c(T)*S;return Number(((x+C)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const t=[];return this.directionalLight&&t.push(this.directionalLight.get()),this.ambientLight&&t.push(this.ambientLight.get()),t}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(t){if(t==null||t===""&&this.isRootStyle())return this;if(s.dk(t)){const n=s.dl(t),c=this.fragments.find(({id:p})=>p===n);if(!c)return;const d=s.dj(t);return c.style.getFragmentStyle(d)}{const n=this.fragments.find(({id:c})=>c===t);return n?n.style:void 0}}setFeaturesetSelectors(t){if(!t)return;const n={},c=(d,p="")=>`${d}::${p}`;this._featuresetSelectors={};for(const d in t){const p=this._featuresetSelectors[d]=[];for(const m of t[d].selectors){if(m.featureNamespace){const x=this.getOwnLayer(m.layer);if(!x){s.w(`Layer is undefined for selector: ${m.layer}`);continue}const T=c(x.source,x.sourceLayer);if(T in n&&n[T]!==m.featureNamespace){s.w(`"featureNamespace ${m.featureNamespace} of featureset ${d}'s selector is not associated to the same source, skip this selector`);continue}n[T]=m.featureNamespace}let y;if(m.properties)for(const x in m.properties){const T=s.X(m.properties[x]);T.result==="success"&&(y=y||{},y[x]=T.value)}p.push({layerId:m.layer,namespace:m.featureNamespace,properties:y,uniqueFeatureID:m._uniqueFeatureID})}}}getFeaturesetDescriptors(t){const n=this.getFragmentStyle(t);if(!n||!n.stylesheet.featuresets)return[];const c=[];for(const d in n.stylesheet.featuresets)c.push({featuresetId:d,importId:n.scope?n.scope:void 0});return c}getFeaturesetLayers(t,n){const c=this.getFragmentStyle(n),d=c.stylesheet.featuresets;if(!d||!d[t])return this.fire(new s.z(new Error(`The featureset '${t}' does not exist in the map's style and cannot be queried.`))),[];const p=[];for(const m of d[t].selectors){const y=c.getOwnLayer(m.layer);y&&p.push(y)}return p}getConfigProperty(t,n){const c=this.getFragmentStyle(t);if(!c)return null;const d=s.C(n,c.scope),p=c.options.get(d),m=p?p.value||p.default:null;return m?m.serialize():null}setConfigProperty(t,n,c){const d=this.getFragmentStyle(t);if(!d)return;const p=d.stylesheet.indoor?Dd(d.stylesheet.schema):d.stylesheet.schema;if(!p||!p[n])return;const m=s.X(c);if(m.result!=="success")return void os(this,m.value);const y=m.value.expression,x=s.C(n,d.scope),T=d.options.get(x);if(!T)return;let S;const{minValue:C,maxValue:E,stepValue:M,type:D,values:z}=p[n],F=s.X(p[n].default);F.result==="success"&&(S=F.value.expression),S?(this.options.set(x,Object.assign({},T,{value:y,default:S,minValue:C,maxValue:E,stepValue:M,type:D,values:z})),this.updateConfigDependencies(n)):this.fire(new s.z(new Error(`No schema defined for the config option "${n}" in the "${t}" fragment.`)))}getConfig(t){const n=this.getFragmentStyle(t);if(!n)return null;const c=n.stylesheet.schema;if(!c)return null;const d={};for(const p in c){const m=s.C(p,n.scope),y=n.options.get(m),x=y?y.value||y.default:null;d[p]=x?x.serialize():null}return d}setConfig(t,n){const c=this.getFragmentStyle(t);c&&(c.updateConfig(n,c.stylesheet.schema),this.updateConfigDependencies())}getSchema(t){const n=this.getFragmentStyle(t);return n?n.stylesheet.schema:null}setSchema(t,n){const c=this.getFragmentStyle(t);c&&(c.stylesheet.schema=n,c.updateConfig(c._config,n),this.updateConfigDependencies())}updateConfig(t,n){if(this._config=t,t||n)if(n)for(const c in n){let d,p;const m=s.X(n[c].default);if(m.result==="success"&&(d=m.value.expression),t&&t[c]!==void 0){const E=s.X(t[c]);E.result==="success"&&(p=E.value.expression)}const{minValue:y,maxValue:x,stepValue:T,type:S,values:C}=n[c];if(d){const E=s.C(c,this.scope);this.options.set(E,{default:d,value:p,minValue:y,maxValue:x,stepValue:T,type:S,values:C})}else this.fire(new s.z(new Error(`No schema defined for config option "${c}".`)))}else this.fire(new s.z(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(t){for(const n of this._configDependentLayers){const c=this.getLayer(n);if(c){if(t&&!c.configDependencies.has(t))continue;c.possiblyEvaluateVisibility(),this._updateLayer(c)}}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(n=>{const c=n._styleColorTheme.colorThemeOverride?n._styleColorTheme.colorThemeOverride:n._styleColorTheme.colorTheme;if(c){const d=n._evaluateColorThemeData(c);(!n._styleColorTheme.lut&&d!==""||n._styleColorTheme.lut&&d!==n._styleColorTheme.lut.data)&&n.setColorTheme(c)}}),this._changes.setDirty()}addLayer(t,n,c={}){this._checkLoaded();const d=t.id;if(this._layers[d])return void this.fire(new s.z(new Error(`Layer with i
20d "${d}" already exists on this map`)));let p;if(t.type==="custom"){if(os(this,s.dm(t)))return;p=s.dn(t,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof t.source=="object"&&(this.addSource(d,t.source),t=s.di(t),t=s.h(t,{source:d})),this._validate(ii,`layers.${d}`,t,{arrayIndex:-1},c))return;p=s.dn(t,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(p),p.setEventedParent(this,{layer:{id:d}})}p.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid);let m=this._order.length;if(n){const S=this._order.indexOf(n);if(S===-1)return void this.fire(new s.z(new Error(`Layer with id "${n}" does not exist on this map.`)));p.slot===this._layers[n].slot?m=S:s.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(m,0,d),this._layerOrderChanged=!0,this._layers[d]=p;const y=this.getOwnLayerSourceCache(p),x=!!this.directionalLight&&this.directionalLight.shadowsEnabled();y&&p.canCastShadows()&&x&&(y.castsShadows=!0);const T=this._changes.getRemovedLayer(p);if(T&&p.source&&y&&p.type!=="custom"){this._changes.discardLayerRemoval(p);const S=s.C(p.source,p.scope);T.type!==p.type?this._changes.updateSourceCache(S,"clear"):(this._changes.updateSourceCache(S,"reload"),y.pause())}this._updateLayer(p),p.onAdd&&p.onAdd(this.map),p.scope=this.scope,this.mergeLayers()}moveLayer(t,n){this._checkLoaded();const c=this._checkLayer(t);if(!c||t===n)return;const d=this._order.indexOf(t);this._order.splice(d,1);let p=this._order.length;if(n){const m=this._order.indexOf(n);
20if(m===-1)return void this.fire(new s.z(new Error(`Layer with id "${n}" does not exist on this map.`)));c.slot===this._layers[n].slot?p=m:s.w(`Layer with id "${n}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(p,0,t),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(t){this._checkLoaded();const n=this._checkLayer(t);if(!n)return;n.setEventedParent(null);const c=this._order.indexOf(t);this._order.splice(c,1),delete this._layers[t],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(n.fqid),this._changes.removeLayer(n);const d=this.getOwnLayerSourceCache(n);if(d&&d.castsShadows){let p=!1;for(const m in this._layers)if(this._layers[m].source===n.source&&this._layers[m].canCastShadows()){p=!0;break}d.castsShadows=p}n.onRemove&&n.onRemove(this.map),this.mergeLayers()}getOwnLayer(t){return this._layers[t]}hasLayer(t){return t in this._mergedLayers}hasLayerType(t){for(const n in this._layers)if(this._layers[n].type===t)return!0;return!1}setLayerZoomRange(t,n,c){this._checkLoaded();const d=this._checkLayer(t);d&&(d.minzoom===n&&d.maxzoom===c||(n!=null&&(d.minzoom=n),c!=null&&(d.maxzoom=c),this._updateLayer(d)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(t,n){this._checkLoaded();const c=this._checkLayer(t);c&&c.slot!==n&&(c.slot=n,this._updateLayer(c))}setFilter(t,n,c={}){this._checkLoaded();const d=this._checkLayer(t);if(d&&!s.bv(d.filter,n))return n==null?(d.filter=void 0,void this._updateLayer(d)):void(this._validate(ye,`layers.${d.id}.filter`,n,{layerType:d.type},c)||(d.filter=s.di(n),this._updateLayer(d)))}getFilter(t){const n=this._checkLayer(t);if(n)return s.di(n.filter)}setLayoutProperty(t,n,c,d={}){this._checkLoaded();const p=this._checkLayer(t);if(p&&!s.bv(p.getLayoutProperty(n),c)){if(c!=null&&(!d||d.validate!==!1)&&os(p,B.call(Pn,{key:`layers.${t}.layout.${n}`,layerType:p.type,objectKey:n,value:c,styleSpec:s.a5,style:{glyphs:!0,sprite:!0}})))return;p.setLayoutProperty(n,c),p.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid),this._updateLayer(p)}}getLayoutProperty(t,n){const c=this._checkLayer(t);if(c)return c.getLayoutProperty(n)}setPaintProperty(t,n,c,d={}){this._checkLoaded();const p=this._checkLayer(t);if(!p||s.bv(p.getPaintProperty(n),c)||c!=null&&(!d||d.validate!==!1)&&os(p,k.call(Pn,{key:`layers.${t}.paint.${n}`,layerType:p.type,objectKey:n,value:c,styleSpec:s.a5})))return;const m=p.setPaintProperty(n,c);p.configDependencies.size!==0&&this._configDependentLayers.add(p.fqid),m&&this._updateLayer(p),this._changes.updatePaintProperties(p)}getPaintProperty(t,n){const c=this._checkLayer(t);if(c)return c.getPaintProperty(n)}setFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:T}=t.target,S=this.getFragmentStyle(T),C=S.getFeaturesetLayers(x);for(const{source:E,sourceLayer:M}of C)S.setFeatureState({id:t.id,source:E,sourceLayer:M},n)}else if("layerId"in t.target){const{layerId:x}=t.target,T=this.getLayer(x);this.setFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},n)}return}const c=t.source,d=t.sourceLayer,p=this._checkSource(c);if(!p)return;const m=p.type;if(m==="geojson"&&d)return void this.fire(new s.z(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(m==="vector"&&!d)return void this.fire(new s.z(new Error("The sourceLayer parameter must be provided for vector source types.")));t.id===void 0&&this.fire(new s.z(new Error("The feature id parameter must be provided.")));const y=this.getOwnSourceCaches(c);for(const x of y)x.setFeatureState(d,t.id,n)}removeFeatureState(t,n){if(this._checkLoaded(),"target"in t){if("featuresetId"in t.target){const{featuresetId:x,importId:T}=t.target,S=this.getFragmentStyle(T),C=S.getFeaturesetLayers(x);for(const{source:E,sourceLayer:M}of C)S.removeFeatureState({id:t.id,source:E,sourceLayer:M},n)}else if("layerId"in t.target){const{layerId:x}=t.target,T=this.getLayer(x);this.removeFeatureState({id:t.id,source:T.source,sourceLayer:T.sourceLayer},n)}return}const c=t.source,d=this._checkSource(c);if(!d)return;const p=d.type,m=p==="vector"?t.sourceLayer:void 0;if(p==="vector"&&!m)return void this.fire(new s.z(new Error("The sourceLayer parameter must be provided for vector source types.")));if(n&&typeof t.id!="string"&&typeof t.id!="number")return void this.fire(new s.z(new Error("A feature id is required to remove its specific state property.")));const y=this.getOwnSourceCaches(c);for(const x of y)x.removeFeatureState(m,t.id,n)}getFeatureState(t){if(this._checkLoaded(),"target"in t){let p;if("featuresetId"in t.target){const{featuresetId:m,importId:y}=t.target,x=this.getFragmentStyle(y),T=x.getFeaturesetLayers(m);for(const{source:S,sourceLayer:C}of T){const E=x.getFeatureState({id:t.id,source:S,sourceLayer:C});if(E&&!p)p=E;else if(!s.bv(p,E))return void this.fire(new s.z(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in t.target){const{layerId:m}=t.target,y=this.getLayer(m);p=this.getFeatureState({id:t.id,source:y.source,sourceLayer:y.sourceLayer})}return p}const n=t.source,c=t.sourceLayer,d=this._checkSource(n);if(d){if(d.type!=="vector"||c)return t.id===void 0&&this.fire(new s.z(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(n)[0].getFeatureState(c,t.id);this.fire(new s.z(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(t){return this.stylesheet.transition=s.h({},this.stylesheet.transition,t),this.transition=this.stylesheet.transition,this}getTransition(){return s.h({},this.stylesheet.transition)}serialize(){this._checkLoaded();const t=this.getTerrain(),n=t&&this.terrain&&this.terrain.scope===this.scope?t:this.stylesheet.terrain;return s.dp({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:n,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},c=>c!==void 0)}_updateFilteredLayers(t){for(const n of Object.values(this._mergedLayers))t(n)&&this._updateLayer(n)}_updateLayer(t){this._changes.updateLayer(t);const n=this.getLayerSourceCache(t),c=s.C(t.source,t.scope),d=this._changes.getUpd
vendor: 9,938 bytes, line 20
20atedSourceCaches();t.source&&!d[c]&&n&&n.getSource().type!=="raster"&&(this._changes.updateSourceCache(c,"reload"),n.pause()),t.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(t){const n=y=>this._mergedLayers[y].is3D(!!this.terrain),c=this.order,d={},p=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(n(x)){d[x]=y;for(const T of t){const S=T[x];if(S)for(const C of S)p.push(C)}}}p.sort((y,x)=>x.intersectionZ-y.intersectionZ);const m=[];for(let y=c.length-1;y>=0;y--){const x=c[y];if(n(x))for(let T=p.length-1;T>=0;T--){const S=p[T].feature;if(S.layer&&d[S.layer.id]<y)break;m.push(S),p.pop()}else for(const T of t){const S=T[x];if(S)for(const C of S)m.push(C.feature)}}return m}queryRenderedFeatures(t,n,c){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(ye,"queryRenderedFeatures.filter",n.filter,null,n),d=s.b3(n.filter));const p={},m=S=>{if(fc.has(S.type))return;const C=this.getOwnLayerSourceCache(S),E=p[C.id]=p[C.id]||{sourceCache:C,layers:{},has3DLayers:!1};S.is3D(!!this.terrain)&&(E.has3DLayers=!0),E.layers[S.fqid]=E.layers[S.fqid]||{styleLayer:S,targets:[]},E.layers[S.fqid].targets.push({filter:d})};if(n&&n.layers){if(!Array.isArray(n.layers))return this.fire(new s.z(new Error("parameters.layers must be an Array."))),[];for(const S of n.layers){const C=this._layers[S];if(!C)return this.fire(new s.z(new Error(`The layer '${S}' does not exist in the map's style and cannot be queried for features.`))),[];m(C)}}else for(const S in this._layers)m(this._layers[S]);const y=this._queryRenderedFeatures(t,p,c),x=this._flattenAndSortRenderedFeatures(y),T=[];for(const S of x)s.dq(S.layer.id)===this.scope&&T.push(S);return T}queryRenderedFeatureset(t,n,c){let d;n&&!Array.isArray(n)&&n.filter&&(this._validate(ye,"queryRenderedFeatures.filter",n.filter,null,n),d=s.b3(n.filter));const p="mock",m=[];if(n&&n.target)m.push(Object.assign({},n,{targetId:p,filter:d}));else{const S=this.getFeaturesetDescriptors();for(const C of S)m.push({targetId:p,filter:d,target:C});for(const{style:C}of this.fragments){const E=C.getFeaturesetDescriptors();for(const M of E)m.push({targetId:p,filter:d,target:M})}}const y=this.queryRenderedTargets(t,m,c),x=[],T=new Set;for(const S of y)for(const C of S.variants[p])nc(C,S,T)||x.push(new s.dr(S,C));return x}queryRenderedTargets(t,n,c){const d={},p=(y,x,T,S)=>{const C=d[x.id]=d[x.id]||{sourceCache:x,layers:{},has3DLayers:!1};if(C.layers[y.fqid]=C.layers[y.fqid]||{styleLayer:y,targets:[]},y.is3D(!!this.terrain)&&(C.has3DLayers=!0),!S)return T.uniqueFeatureID=!1,void C.layers[y.fqid].targets.push(T);C.layers[y.fqid].targets.push(Object.assign({},T,{namespace:S.namespace,properties:S.properties,uniqueFeatureID:S.uniqueFeatureID}))};for(const y of n)if("featuresetId"in y.target){const{featuresetId:x,importId:T}=y.target,S=this.getFragmentStyle(T);if(!S||!S._featuresetSelectors)continue;const C=S._featuresetSelectors[x];if(!C){this.fire(new s.z(new Error(`The featureset '${x}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const E of C){const M=S.getOwnLayer(E.layerId);M&&!fc.has(M.type)&&p(M,S.getOwnLayerSourceCache(M),y,E)}}else if("layerId"in y.target){const{layerId:x}=y.target,T=this.getLayer(x);if(!T||fc.has(T.type))continue;p(T,this.getLayerSourceCache(T),y)}const m=this._queryRenderedFeatures(t,d,c);return this._flattenAndSortRenderedFeatures(m)}_queryRenderedFeatures(t,n,c){const d=[],p=!!this.map._showQueryGeometry,m=oi.createFromScreenPoints(t,c);for(const y in n){const x=oc(m,n[y],this._availableImages,c,p);Object.keys(x).length&&d.push(x)}if(this.placement)for(const y in n){if(!n[y].sourceCache._onlySymbols)continue;const x=Es(m.screenGeometry,n[y],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(x).length&&d.push(x)}return d}querySourceFeatures(t,n){const c=n&&n.filter;c&&this._validate(ye,"querySourceFeatures.filter",c,null,n);let d=[];const p=this.getOwnSourceCaches(t);for(const m of p)d=d.concat(al(m,n));return d}addSourceType(t,n,c){return Yn.getSourceType(t)?c(new Error(`A source type called "${t}" already exists.`)):(Yn.setSourceType(t,n),n.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:t,url:n.workerSourceURL},c):c(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(t,n,c={}){this._checkLoaded();const d=this.light.getLight();let p=!1;for(const y in t)if(!s.bv(t[y],d[y])){p=!0;break}if(!p)return;const m=this._getTransitionParameters();this.light.setLight(t,n,c),this.light.updateTransitions(m)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=s.q.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&s.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(t,n=1){if(this._checkLoaded(),!t)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),n===0&&delete this.terrain,t===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let c=t;const d=t.source==null;if(n===1){if(this.disableElevatedTerrain)return;if(typeof c.source=="object"){const y="terrain-dem-src";this.addSource(y,c.source),c=s.di(c),c=s.h(c,{source:y})}const p=s.h({},c),m={};if(this.terrain&&d){p.source=this.terrain.get().source;const y=this.terrain?this.getFragmentStyle(this.terrain.scope):null;y&&(m.style=y.serialize())}if(this._validate(Be,"terrain",p,m))return}if(!this.terrain||this.terrain.scope!==this.scope&&!d||this.terrain&&n!==this.terrain.drapeRenderMode){if(!c)return;this._createTerrain(c,n),this.fire(new s.A("data",{dataType:"style"}))}else{const p=this.terrain,m=p.get();for(const y of Object.keys(s.a5.terrain))!c.hasOwnProperty(y)&&s.a5.terrain[y].default&&(c[y]=s.a5.terrain[y].default);for(const y in t)if(!s.bv(t[y],m[y])){p.set(t,this.options),this.stylesheet.terrain=t;const x=this._getTransitionParameters({duration:0});p.updateTransitions(x),this.fire(new s.A("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(t){const n=this.fog=new kt(t,this.map.transform,this.scope,this.options);this.stylesheet.fog=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_createSnow(t){const n=this.snow=new Cr(t,this.map.transform,this.scope,this.options);this.stylesheet.snow=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_createRain(t){const n=this.rain=new br(t,this.map.transform,this.scope,this.options);this.stylesheet.rain=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const t of this.map._markers)t._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(t){if(this._checkLoaded(),!t)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const n=this.fog;if(!s.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.fog=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createFog(t);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(t){if(this._checkLoaded(),!t)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const n=this.snow;if(!s.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.snow=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createSnow(t);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(t){if(this._checkLoaded(),!t)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const n=this.rain;if(!s.bv(n.get(),t)){n.set(t,this.options),this.stylesheet.rain=n.get();const c=this._getTransitionParameters({duration:0});n.updateTransitions(c)}}else this._createRain(t);this._markersNeedUpdate=!0}_reloadColorTheme(){const t=()=>{for(const d in this._layers)this._layers[d].lut=this._styleColorTheme.lut;for(const d in this._sourceCaches)this._sourceCaches[d].clearTiles()},n=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!n)return this._styleColorTheme.lut=null,void t();const c=this._evaluateColorThemeData(n);this._loadColorTheme(c).then(()=>{this.fire(new s.A("colorthemeset")),t()}).catch(d=>{s.w(`Couldn't set color theme: ${d}`)})}setColorTheme(t){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&s.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=t,this._reloadColorTheme()}setImportColorTheme(t,n){const c=this.getFragmentStyle(t);c&&(c._styleColorTheme.colorThemeOverride=n,c._reloadColorTheme())}_getTransitionParameters(t){return{now:s.q.now(),transition:s.h(this.transition,t)}}updateDrapeFirstLayers(){if(!this.terrain)return;const t=[],n=[];for(const c of this._mergedOrder)this.isLayerDraped(this._mergedLayers[c])?t.push(c):n.push(c);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...t),this._drapedFirstOrder.push(...n)}_createTerrain(t,n){const c=this.terrain=new ue(t,n,this.scope,this.options,this.map.getWorldview());n===1&&(this.stylesheet.terrain=t),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const d=this._getTransitionParameters({duration:0});c.updateTransitions(d)}_force3DLayerUpdate(){for(const t in this._layers){const n=this._layers[t];n.type==="fill-extrusion"&&this._updateLayer(n)}}
20_forceSymbolLayerUpdate(){for(const t in this._layers){const n=this._layers[t];n.type==="symbol"&&this._updateLayer(n)}}_validate(t,n,c,d,p={}){if(p&&p.validate===!1)return!1;const m=s.h({},this.serialize());return os(this,t.call(Pn,s.h({key:n,style:m,value:c,styleSpec:s.a5},d)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),s.ds.off("pluginStateChange",this._rtlTextPluginCallback);for(const t in this._mergedLayers)this._mergedLayers[t].setEventedParent(null);for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles(),this._mergedSourceCaches[t].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(t){const n=this.getSourceCaches(t);for(const c of n)c.clearTiles()}clearSources(){for(const t in this._mergedSourceCaches)this._mergedSourceCaches[t].clearTiles()}clearLayers(){for(const t in this._mergedLayers){const n=this._mergedLayers[t];n._clear&&n._clear()}}reloadSource(t){const n=this.getSourceCaches(t);for(const c of n)c.resume(),c.reload()}reloadSources(){for(const t of this.getSources())t.reload&&t.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(t=>{t.modelManager.reloadModels(t.scope)})}updateSources(t){let n;this.directionalLight&&(n=fa(this.directionalLight));const c=new Set;for(const d in this._mergedLayers){const p=this._mergedLayers[d];
vendor: 5,502 bytes, line 20
20p.hasElevation()&&!c.has(p.source)&&c.add(p.source)}for(const d in this._mergedSourceCaches){const p=this._mergedSourceCaches[d],m=c.has(p._source.id);p.update(t,void 0,void 0,n,m)}}_generateCollisionBoxes(){for(const t in this._sourceCaches){const n=this._sourceCaches[t];n.resume(),n.reload()}}_updatePlacement(t,n,c,d,p,m,y=!1){let x=!1,T=!1;const S={},C={};for(const E of this._mergedOrder){const M=this._mergedLayers[E];if(M.type!=="symbol")continue;const D=s.C(M.source,M.scope);let z=S[D];if(!z){const L=this.getLayerSourceCache(M);if(!L)continue;const N=L.getRenderableIds(!0).map(U=>L.getTileByID(U));C[D]=N.slice(),z=S[D]=N.sort((U,q)=>q.tileID.overscaledZ-U.tileID.overscaledZ||(U.tileID.isLessThan(q.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(M,z,n.center.lng,n.projection);x=x||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),y=y||this._layerOrderChanged||d===0,this._layerOrderChanged&&this.fire(new s.A("neworder")),(y||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(s.q.now(),n.zoom))&&(this.pauseablePlacement=new uc(n,this._mergedOrder,y,c,d,p,this.placement,this.fog&&n.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,S,C,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(s.q.now()),T=!0),x&&this.pauseablePlacement.placement.setStale()),T||x){this._buildingIndex.onNewFrame(n.zoom);for(let E=0;E<this._mergedOrder.length;E++){const M=this._mergedLayers[this._mergedOrder[E]];if(M.type!=="symbol")continue;const D=this.isLayerClipped(M);this.placement.updateLayerOpacities(M,S[s.C(M.source,M.scope)],E,D?m:null)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(s.q.now())}}_releaseSymbolFadeTiles(){for(const t in this._sourceCaches)this._sourceCaches[t].releaseSymbolFadeTiles()}addImport(t,n){this._checkLoaded();const c=this.stylesheet.imports=this.stylesheet.imports||[];if(c.findIndex(({id:p})=>p===t.id)!==-1)return void this.fire(new s.z(new Error(`Import with id '${t.id}' already exists in the map's style.`)));if(!n)return c.push(t),this._loadImports([t],!0);const d=c.findIndex(({id:p})=>p===n);return d===-1&&this.fire(new s.z(new Error(`Import with id "${n}" does not exist on this map.`))),this.stylesheet.imports=c.slice(0,d).concat(t).concat(c.slice(d)),this._loadImports([t],!0,n)}updateImport(t,n){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);return d===-1?this:typeof n=="string"?(this.setImportUrl(t,n),this):(n.url&&n.url!==c[d].url&&this.setImportUrl(t,n.url),s.bv(n.config,c[d].config)||this.setImportConfig(t,n.config,n.data.schema),s.bv(n.data,c[d].data)||this.setImportData(t,n.data),this)}moveImport(t,n){this._checkLoaded();let c=this.stylesheet.imports||[];const d=this.getImportIndex(t);if(d===-1)return this;const p=this.getImportIndex(n);if(p===-1)return this;const m=c[d],y=this.fragments[d];return c=c.filter(({id:x})=>x!==t),this.fragments=this.fragments.filter(({id:x})=>x!==t),this.stylesheet.imports=c.slice(0,p).concat(m).concat(c.slice(p)),this.fragments=this.fragments.slice(0,p).concat(y).concat(this.fragments.slice(p)),this.mergeLayers(),this}setImportUrl(t,n){this._checkLoaded();const c=this.stylesheet.imports||[],d=this.getImportIndex(t);if(d===-1)return this;c[d].url=n;const p=this.fragments[d];return p.style=this._createFragmentStyle(c[d]),p.style.on("style.import.load",()=>this.mergeAll()),p.style.loadURL(n),this}setImportData(t,n){this._checkLoaded();const c=this.getImportIndex(t),d=this.stylesheet.imports||[];return c===-1?this:n?(this.fragments[c].style.setState(n),this._reloadImports(),this):(delete d[c].data,this.setImportUrl(t,d[c].url))}setImportConfig(t,n,c){this._checkLoaded();const d=this.getImportIndex(t),p=this.stylesheet.imports||[];if(d===-1)return this;n?p[d].config=n:delete p[d].config;const m=this.fragments[d];c&&m.style.stylesheet&&(m.style.stylesheet.schema=c);const y=m.style.stylesheet&&m.style.stylesheet.schema;return m.config=n,m.style.updateConfig(n,y),this.updateConfigDependencies(),this}removeImport(t){this._checkLoaded();const n=this.stylesheet.imports||[],c=this.getImportIndex(t);c!==-1&&(n.splice(c,1),this.fragments[c].style._remove(),this.fragments.splice(c,1),this._reloadImports())}getImportIndex(t){const n=(this.stylesheet.imports||[]).findIndex(c=>c.id===t);return n===-1&&this.fire(new s.z(new Error(`Import '${t}' does not exist in the map's style and cannot be updated.`))),n}getLayer(t){return this._mergedLayers[t]}getSources(){const t=[];for(const n in this._mergedOtherSourceCaches){const c=this._mergedOtherSourceCaches[n];c&&t.push(c.getSource())}return t}getSource(t,n){const c=this.getSourceCache(t,n);return c&&c.getSource()}getLayerSource(t){const n=this.getLayerSourceCache(t);return n&&n.getSource()}getSourceCache(t,n){const c=s.C(t,n);return this._mergedOtherSourceCaches[c]}getLayerSourceCache(t){const n=s.C(t.source,t.scope);return t.type==="symbol"?this._mergedSymbolSourceCaches[n]:this._mergedOtherSourceCaches[n]}getSourceCaches(t){if(t==null)return Object.values(this._mergedSourceCaches);const n=[];return this._mergedOtherSourceCaches[t]&&n.push(this._mergedOtherSourceCaches[t]),this._mergedSymbolSourceCaches[t]&&n.push(this._mergedSymbolSourceCaches[t]),n}
20updateSourceCaches(){const t=this._changes.getUpdatedSourceCaches();for(const n in t){const c=t[n];c==="reload"?this.reloadSource(n):c==="clear"&&this.clearSource(n)}}updateLayers(t){const n=this._changes.getUpdatedPaintProperties();for(const c of n){const d=this.getLayer(c);d&&d.updateTransitions(t)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(t){this.stylesheet.glyphs=t,this.glyphManager.setURL(t)}getImages(t,n,c){this.imageManager.getImages(n.images,n.scope,c),this._updateTilesForChangedImages();const d=m=>{if(m){const y=n.images.map(x=>s.I.toString(x));m.setDependencies(n.tileID.key,n.type,y)}},p=s.C(n.source,n.scope);d(this._mergedOtherSourceCaches[p]),d(this._mergedSymbolSourceCaches[p]),n.images.some(m=>m.iconsetId)&&this.fire(new s.A("data",{dataType:"style"}))}rasterizeImages(t,n,c){this.imageManager.rasterizeImages(n,c)}getGlyphs(t,n,c){this.glyphManager.getGlyphs(n.stacks,c)}getResource(t,n,c){return s.dt(n,c)}getOwnSourceCache(t){return this._otherSourceCaches[t]}getOwnLayerSourceCache(t){return t.type==="symbol"?this._symbolSourceCaches[t.source]:this._otherSourceCaches[t.source]}getOwnSourceCaches(t){const n=[];return this._otherSourceCaches[t]&&n.push(this._otherSourceCaches[t]),this._symbolSourceCaches[t]&&n.push(this._symbolSourceCaches[t]),n}_isSourceCacheLoaded(t){const n=this.getOwnSourceCaches(t);return n.length===0?(this.fire(new s.z(new Error(`There is no source with ID '${t}'`))),!1):n.every(c=>c.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(t,n){if(!this._clipLayerPresent&&t.type!=="fill-extrusion"&&t.type!=="building")return!1;const c=t.type==="fill-extrusion"&&(t.sourceLayer==="building"||t.sourceLayer==="procedural_buildings"),d=t.type==="building";if(t.is3D(!!this.terrain)){if(c||d||n&&n.type==="batched-model"||t.type==="model")return!0}else if(t.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(t=>{t.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Yn.getSourceType=function(l){return rc[l]},Yn.setSourceType=function(l,t){rc[l]=t},Yn.registerForPluginStateChange=s.du;var Fh=`
21#define EPSILON 0.0000001
22#define PI 3.141592653589793
23#ifdef RENDER_CUTOFF
24float cutoff_opacity(vec4 cutoff_params,float depth) {float near=cutoff_params.x;float far=cutoff_params.y;float cutoffStart=cutoff_params.z;float cutoffEnd=cutoff_params.w;float linearDepth=(depth-near)/(far-near);return clamp((linearDepth-cutoffStart)/(cutoffEnd-cutoffStart),0.0,1.0);}
25#endif`,_a=`
26out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)
27{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}highp vec4 pack_depth(highp float ndc_z) {highp float depth=ndc_z*0.5+0.5;const highp vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);const highp vec4 bit_mask =vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);highp vec4 res=fract(depth*bit_shift);res-=res.xxyz*bit_mask;return res;}
28#ifdef INDICATOR_CUTOUT
29uniform vec3 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;
30#endif
31vec4 applyCutout(vec4 color,float height) {
32#ifdef INDICATOR_CUTOUT
33float verticalFadeRange=u_indicator_cutout_centers.z*0.25;float holeMinOpacity=mix(1.0,u_indicator_cutout_params.x,smoothstep(u_indicator_cutout_centers.z,u_indicator_cutout_centers.z+verticalFadeRange,height));float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;float fadeStart=u_indicator_cutout_params.w;float distA=distance(vec2(gl_FragCoord.x,gl_FragCoord.y*holeAspectRatio),vec2(u_indicator_cutout_centers[0],u_indicator_cutout_centers[1]*holeAspectRatio));return color*min(smoothstep(fadeStart,holeRadius,distA)+holeMinOpacity,1.0);
34#else
35return color;
36#endif
37}
38#ifdef DEBUG_WIREFRAME
39#define HANDLE_WIREFRAME_DEBUG \\
40glFragColor=vec4(0.7,0.0,0.0,0.7); \\
41gl_FragDepth=gl_FragCoord.z-0.0001;
42#else
43#define HANDLE_WIREFRAME_DEBUG
44#endif
45#ifdef RENDER_CUTOFF
46uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;
47#endif
48vec4 textureLodCustom(sampler2D image,highp vec2 pos,highp vec2 lod_coord) {highp vec2 size=vec2(textureSize(image,0));highp vec2 dx=dFdx(lod_coord.xy*size);highp vec2 dy=dFdy(lod_coord.xy*size);highp float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));highp float lod=0.5*log2(delta_max_sqr);return textureLod(image,pos,lod);}vec4 applyLUT(highp sampler3D lut,vec4 col) {vec3 size=vec3(textureSize(lut,0));vec3 uvw=(col.rbg*float(size-1.0)+0.5)/size;return vec4(texture(lut,uvw).rgb,col.a);}vec3 applyLUT(highp sampler3D lut,vec3 col) {return applyLUT(lut,vec4(col,1.0)).rgb;}`,ga=`
49#define EXTENT 8192.0
50#define RAD_TO_DEG 180.0/PI
51#define DEG_TO_RAD PI/180.0
52#define GLOBE_RADIUS EXTENT/PI/2.0
53float wrap(float n,float min,float max) {float d=max-min;float w=mod(mod(n-min,d)+d,d)+min;return (w==min) ? max : w;}
54#ifdef PROJECTION_GLOBE_VIEW
55vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
56#ifndef PROJECTED_POS_ON_VIEWPORT
57float tiles=tile_id.z;vec2 mercator=(tile_anchor/EXTENT+tile_id.xy)/tiles;mercator-=mercator_center;mercator.x=wrap(mercator.x,-0.5,0.5);vec4 mercator_tile=vec4(mercator.xy*EXTENT,EXTENT/(2.0*PI),1.0);mercator_tile=matrix*mercator_tile;return mercator_tile.xyz;
58#else
59return vec3(0.0);
60#endif
61}vec3 mix_globe_mercator(vec3 globe,vec3 mercator,float t) {return mix(globe,mercator,t);}mat3 globe_mercator_surface_vectors(vec3 pos_normal,vec3 up_dir,float zoom_transition) {vec3 normal=zoom_transition==0.0 ? pos_normal : normalize(mix(pos_normal,up_dir,zoom_transition));vec3 xAxis=normalize(vec3(normal.z,0.0,-normal.x));vec3 yAxis=normalize(cross(normal,xAxis));return mat3(xAxis,yAxis,normal);}
62#endif
63vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(
64unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
65);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const vec2 units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (units_to_pixels*pos+offset)/pattern_size;}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {return get_pattern_pos(pixel_coord_upper,pixel_coord_lower,pattern_size,vec2(tile_units_to_pixels),pos);}float mercatorXfromLng(float lng) {return (180.0+lng)/360.0;}float mercatorYfromLat(float lat) {return (180.0-(RAD_TO_DEG*log(tan(PI/4.0+lat/2.0*DEG_TO_RAD))))/360.0;}vec3 latLngToECEF(vec2 latLng) {latLng=DEG_TO_RAD*latLng;float cosLat=cos(latLng[0]);float sinLat=sin(latLng[0]);float cosLng=cos(latLng[1]);float sinLng=sin(latLng[1]);float sx=cosLat*sinLng*GLOBE_RADIUS;float sy=-sinLat*GLOBE_RADIUS;float sz=cosLat*cosLng*GLOBE_RADIUS;return vec3(sx,sy,sz);}
66#ifdef RENDER_CUTOFF
67uniform vec4 u_cutoff_params;out float v_cutoff_opacity;
68#endif
69const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)
70{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}`,Oh="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;void main() {const mat3 half_neg_pi_around_x=mat3(1.0,0.0, 0.0,0.0,0.0,-1.0,0.0,1.0, 0.0);v_uv=half_neg_pi_around_x*a_pos_3f;vec4 pos=u_matrix*vec4(a_pos_3f,1.0);gl_Position=pos.xyww;}",mc=`
71#define ELEVATION_SCALE 7.0
72#define ELEVATION_OFFSET 450.0
73#ifdef PROJECTION_GLOBE_VIEW
74uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix(
75mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;}
76#else
77vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
78#endif
79#ifdef TERRAIN
80uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) {
81#ifdef TERRAIN_DEM_FLOAT_FORMAT
82vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r;
83#else
84float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
85#endif
86}float prevElevation(vec2 apos) {
87#ifdef TERRAIN_DEM_FLOAT_FORMAT
88vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r;
89#else
90float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);
91#endif
92}
93#ifdef TERRAIN_VERTEX_MORPHING
94float elevation(vec2 apos) {
95#ifdef ZERO_EXAGGERATION
96return 0.0;
97#endif
98float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
99#else
100float elevation(vec2 apos) {
101#ifdef ZERO_EXAGGERATION
102return 0.0;
103#endif
104return currentElevation(apos);}
105#endif
106vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);}
107#else
108float elevation(vec2 pos) { return 0.0; }
109#endif
110#ifdef DEPTH_OCCLUSION
111uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset;
112#ifdef DEPTH_D24
113float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);}
114#else
115highp float unpack_depth_rgba(vec4 rgba_depth)
116{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}
117#endif
118bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;
119#ifdef DEPTH_D24
120float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);
121#else
122float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));
123#endif
124return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_
124size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5;
125#ifdef DEPTH_D24
126highp vec4 depth=vec4(
127texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r
128);depth=unpack_depth4(depth);
129#else
130highp vec4 depth=vec4(
131unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy))
132);
133#endif
134return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5;int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) {
135#ifdef DEPTH_D24
136highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r);
137#else
138highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)));
139#endif
140res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));}
141#else
142bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; }
143#endif//DEPTH_OCCLUSION`,Ln=`#ifdef FOG
144uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);}
145#endif`,_c=`#ifdef FOG
146uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;
147#ifdef FLIP_Y
148uv.y=1.0-uv.y;
149#endif
150highp vec3 ray_dir=mix(
151mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}
151vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}
152#endif`,Xe=`#ifdef RASTER_ARRAY
153uniform highp sampler2D u_image0;uniform sampler2D u_image1;const vec4 NODATA=vec4(1);ivec4 _raTexLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}vec2 _raTexLinearMix(highp vec2 fxy,highp vec4 colorMix,highp float colorOffset,highp vec4 t00,highp vec4 t10,highp vec4 t01,highp vec4 t11) {vec2 c00=t00==NODATA ? vec2(0) : vec2(colorOffset+dot(t00,colorMix),1);vec2 c10=t10==NODATA ? vec2(0) : vec2(colorOffset+dot(t10,colorMix),1);vec2 c01=t01==NODATA ? vec2(0) : vec2(colorOffset+dot(t01,colorMix),1);vec2 c11=t11==NODATA ? vec2(0) : vec2(colorOffset+dot(t11,colorMix),1);return mix(mix(c01,c11,fxy.x),mix(c00,c10,fxy.x),fxy.y);}vec2 raTexture2D_image0_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image0,c.yz,0),texelFetch(u_image0,c.xz,0),texelFetch(u_image0,c.yw,0),texelFetch(u_image0,c.xw,0)
154);}vec2 raTexture2D_image1_linear(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec2 fxy;ivec4 c=_raTexLinearCoord(texCoord,texResolution,fxy);return _raTexLinearMix(fxy,colorMix,colorOffset,texelFetch(u_image1,c.yz,0),texelFetch(u_image1,c.xz,0),texelFetch(u_image1,c.yw,0),texelFetch(u_image1,c.xw,0)
155);}vec2 raTexture2D_image0_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image0,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}vec2 raTexture2D_image1_nearest(highp vec2 texCoord,highp vec2 texResolution,highp vec4 colorMix,highp float colorOffset) {vec4 t=texelFetch(u_image1,ivec2(texCoord*texResolution),0);return t==NODATA ? vec2(0) : vec2(colorOffset+dot(t,colorMix),1);}
156#endif`,kh=`#ifdef RASTER_ARRAY
157uniform sampler2D u_velocity;uniform mediump vec2 u_velocity_res;uniform mediump float u_max_speed;const vec4 NO_DATA=vec4(1);const vec2 INVALID_VELOCITY=vec2(-1);uniform highp vec2 u_uv_offset;uniform highp float u_data_offset;uniform highp vec2 u_data_scale;ivec4 rasterArrayLinearCoord(highp vec2 texCoord,highp vec2 texResolution,out highp vec2 fxy) {texCoord=texCoord*texResolution-0.5;fxy=fract(texCoord);texCoord-=fxy;return ivec4(texCoord.xxyy+vec2(1.5,0.5).xyxy);}highp vec2 lookup_velocity(highp vec2 uv) {uv=u_uv_offset.x+u_uv_offset.y*uv;highp vec2 fxy;ivec4 c=rasterArrayLinearCoord(uv,u_velocity_res,fxy);highp vec4 tl=texelFetch(u_velocity,c.yz,0);highp vec4 tr=texelFetch(u_velocity,c.xz,0);highp vec4 bl=texelFetch(u_velocity,c.yw,0);highp vec4 br=texelFetch(u_velocity,c.xw,0);if (tl==NO_DATA) {return INVALID_VELOCITY;}if (tr==NO_DATA) {return INVALID_VELOCITY;}if (bl==NO_DATA) {return INVALID_VELOCITY;}if (br==NO_DATA) {return INVALID_VELOCITY;}highp vec4 t=mix(mix(bl,br,fxy.x),mix(tl,tr,fxy.x),fxy.y);highp vec2 velocity=u_data_offset+vec2(dot(t.rg,u_data_scale),dot(t.ba,u_data_scale));velocity.y=-velocity.y;velocity/=max(u_max_speed,length(velocity));return velocity;}
158#endif
159uniform highp float u_particle_pos_scale;uniform highp vec2 u_particle_pos_offset;highp vec4 pack_pos_to_rgba(highp vec2 p) {highp vec2 v=(p+u_particle_pos_offset)/u_particle_pos_scale;highp vec4 r=vec4(v.x,fract(v.x*255.0),v.y,fract(v.y*255.0));return vec4(r.x-r.y/255.0,r.y,r.z-r.w/255.0,r.w);}highp vec2 unpack_pos_from_rgba(highp vec4 v) {v=floor(v*255.0+0.5)/255.0;highp vec2 p=vec2(v.x+(v.y/255.0),v.z+(v.w/255.0));return u_particle_pos_scale*p-u_particle_pos_offset;}`,gc=`#ifdef RENDER_SHADOWS
160uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_normal_offset;vec3 shadow_normal_offset(vec3 normal) {float tileInMeters=u_shadow_normal_offset[0];vec3 n=vec3(-normal.xy,tileInMeters*normal.z);float dotScale=min(1.0-dot(normal,u_shadow_direction),1.0)*0.5+0.5;return n*dotScale;}vec3 shadow_normal_offset_model(vec3 normal) {vec3 transformed_normal=vec3(-normal.xy,normal.z);float NDotL=dot(normalize(transformed_normal),u_shadow_direction);float dotScale=min(1.0-NDotL,1.0)*0.5+0.5;return normal*dotScale;}float shadow_normal_offset_multiplier0() {return u_shadow_normal_offset[1];}float shadow_normal_offset_multiplier1() {return u_shadow_normal_offset[2];}
161#endif//RENDER_SHADOWS`,yc=`#ifdef RENDER_SHADOWS
162precision highp sampler2DShadow;uniform sampler2DShadow u_shadowmap_0;uniform sampler2DShadow u_shadowmap_1;uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;float shadow_sample(sampler2DShadow shadowmap,highp vec3 pos,high
162p float bias) {
163#ifdef CLIP_ZERO_TO_ONE
164highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z-bias);
165#else
166highp vec3 coord=vec3(pos.xy*0.5+0.5,pos.z*0.5+0.5-bias);
167#endif
168return texture(shadowmap,coord);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {light_view_pos0.xyz/=light_view_pos0.w;
169#ifdef SHADOWS_SINGLE_CASCADE
170vec2 abs_bounds=abs(light_view_pos0.xy);if (abs_bounds.x >=1.0 || abs_bounds.y >=1.0) {return 0.0;}return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);
171#else
172light_view_pos1.xyz/=light_view_pos1.w;vec4 abs_bounds=abs(vec4(light_view_pos0.xy,light_view_pos1.xy));if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {return shadow_sample(u_shadowmap_0,light_view_pos0.xyz,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}float occlusion1=shadow_sample(u_shadowmap_1,light_view_pos1.xyz,bias);return clamp(mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth)),0.0,1.0);
173#endif
174}highp float calculate_shadow_bias(float NDotL) {
175#ifdef NORMAL_OFFSET
176return 0.5*u_shadow_bias.x;
177#else
178return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));
179#endif
180}float shadowed_light_factor_normal(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_opacity(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,float shadow_opacity) {float NDotL=dot(N,u_shadow_direction);float bias=calculate_shadow_bias(NDotL);float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias)*shadow_opacity;return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}float shadowed_light_factor_normal_unbiased(vec3 N,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float NDotL=dot(N,u_shadow_direction);float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return mix(0.0,(1.0-(u_shadow_intensity*occlusion))*NDotL,step(0.0,NDotL));}highp vec2 compute_receiver_plane_depth_bias(highp vec3 pos_dx,highp vec3 pos_dy)
181{highp vec2 biasUV=vec2(
182pos_dy.y*pos_dx.z-pos_dx.y*pos_dy.z,pos_dx.x*pos_dy.z-pos_dy.x*pos_dx.z);biasUV*=1.0/((pos_dx.x*pos_dy.y)-(pos_dx.y*pos_dy.x));return biasUV;}float shadowed_light_factor_plane_bias(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {highp vec3 light_view_pos0_xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;highp vec3 light_view_pos0_ddx=dFdx(light_view_pos0_xyz);highp vec3 light_view_pos0_ddy=dFdy(light_view_pos0_xyz);highp vec2 plane_depth_bias=compute_receiver_plane_depth_bias(light_view_pos0_ddx,light_view_pos0_ddy);highp float bias=dot(vec2(u_shadow_texel_size,u_shadow_texel_size),plane_depth_bias)+0.0001;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadowed_light_factor(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=0.0;float occlusion=shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);return 1.0-(u_shadow_intensity*occlusion);}float shadow_occlusion(float ndotl,highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth) {float bias=calculate_shadow_bias(ndotl);return shadow_occlusion(light_view_pos0,light_view_pos1,view_depth,bias);}
183#endif`;const Il=[];oo(Fh,Il),oo(ga,Il),oo(_a,Il);const Ls={"_prelude_fog.vertex.glsl":Ln,"_prelude_terrain.vertex.glsl":mc,"_prelude_shadow.vertex.glsl":gc,"_prelude_fog.fragment.glsl":_c,"_prelude_shadow.fragment.glsl":yc,"_prelude_lighting.glsl":`
184#ifdef LIGHTING_3D_MODE
185uniform mediump vec3 u_lighting_ambient_color;uniform mediump vec3 u_lighting_directional_dir;uniform mediump vec3 u_lighting_directional_color;uniform mediump vec3 u_ground_radiance;float calculate_ambient_directional_factor(vec3 normal) {float NdotL=dot(normal,u_lighting_directional_dir);const float factor_reduction_max=0.3;float dir_luminance=dot(u_lighting_directional_color,vec3(0.2126,0.7152,0.0722));float directional_factor_min=1.0-factor_reduction_max*min(dir_luminance,1.0);float ambient_directional_factor=mix(directional_factor_min,1.0,min((NdotL+1.0),1.0
185));const float vertical_factor_min=0.92;float vertical_factor=mix(vertical_factor_min,1.0,normal.z*0.5+0.5);return vertical_factor*ambient_directional_factor;}vec3 linearProduct(vec3 srgbIn,vec3 k) {return srgbIn*pow(k,vec3(1./2.2));}vec3 apply_lighting(vec3 color,vec3 normal,float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return linearProduct(color,ambient_contrib+directional_contrib);}vec4 apply_lighting(vec4 color,vec3 normal,float dir_factor) {return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting(vec3 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return apply_lighting(color.rgb,normal,dir_factor);}vec4 apply_lighting(vec4 color,vec3 normal) {float dir_factor=max(dot(normal,u_lighting_directional_dir),0.0);return vec4(apply_lighting(color.rgb,normal,dir_factor),color.a);}vec3 apply_lighting_ground(vec3 color) {return color*u_ground_radiance;}vec4 apply_lighting_ground(vec4 color) {return vec4(apply_lighting_ground(color.rgb),color.a);}float calculate_NdotL(vec3 normal) {const float ext=0.70710678118;return (clamp(dot(normal,u_lighting_directional_dir),-ext,1.0)+ext)/(1.0+ext);}vec4 apply_lighting_with_emission_ground(vec4 color,float emissive_strength) {return mix(apply_lighting_ground(color),color,emissive_strength);}vec3 compute_flood_lighting(vec3 flood_light_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=flood_light_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);float occlusion_ramp=smoothstep(0.0,0.2,1.0-occlusion);return mix(fully_occluded_color,flood_light_color,occlusion_ramp);}vec3 compute_emissive_draped(vec3 unlit_color,float fully_occluded_factor,float occlusion,vec3 ground_shadow_factor) {vec3 fully_occluded_color=unlit_color*mix(ground_shadow_factor,vec3(1.0),fully_occluded_factor);return mix(fully_occluded_color,unlit_color,1.0-occlusion);}
186#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":Xe,"_prelude_raster_particle.glsl":kh},Kn={};Zt("",mc),Zt(_c,Ln),Zt(yc,gc),Zt(Xe,""),Zt(kh,"");const xc=Zt(_a,ga),as=Fh;var Al={background:Zt(`#include "_prelude_fog.fragment.glsl"
187#include "_prelude_lighting.glsl"
188uniform vec4 u_color;uniform float u_opacity;
189#ifdef LIGHTING_3D_MODE
190in vec4 v_color;
191#endif
192void main() {vec4 out_color;
193#ifdef LIGHTING_3D_MODE
194out_color=v_color;
195#else
196out_color=u_color;
197#endif
198#ifdef FOG
199out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
200#endif
201glFragColor=out_color*u_opacity;
202#ifdef OVERDRAW_INSPECTOR
203glFragColor=vec4(1.0);
204#endif
205HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
206#include "_prelude_lighting.glsl"
207in vec2 a_pos;uniform mat4 u_matrix;
208#ifdef LIGHTING_3D_MODE
209uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;
210#endif
211void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
212#ifdef LIGHTING_3D_MODE
213v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);
214#endif
215#ifdef FOG
216v_fog_pos=fog_position(a_pos);
217#endif
218}`),backgroundPattern:Zt(`#include "_prelude_fog.fragment.glsl"
219#include "_prelude_lighting.glsl"
220uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);
221#ifdef LIGHTING_3D_MODE
222out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
223#endif
224#ifdef FOG
225out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
226#endif
227glFragColor=out_color*u_opacity;
228#ifdef OVERDRAW_INSPECTOR
229glFragColor=vec4(1.0);
230#endif
231HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
232uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos);
233#ifdef FOG
234v_fog_pos=fog_position(a_pos);
235#endif
236}`),building:Zt(`#include "_prelude_fog.fragment.glsl"
237#include "_prelude_shadow.fragment.glsl"
238#include "_prelude_lighting.glsl"
239const float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos;
240#ifdef BUILDING_FAUX_FACADE
241in lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity;
242#endif
243#ifdef RENDER_SHADOWS
244in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;
245#endif
246uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));}
247#ifdef BUILDING_FAUX_FACADE
248float hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}
248float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y;
249#if 0
250if (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0;
251#else
252if (x_major) {out_normal=sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao;
253#endif
254return out_color;}
255#endif
256vec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a;
257#ifdef BUILDING_FAUX_FACADE
258if (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);}
259#endif
260vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0;
261#ifdef RENDER_SHADOWS
262shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
263#else
264shadowed_lighting_factor=dot(normal,u_lighting_directional_dir);
265#endif
266color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=mix(color.rgb,base_color.rgb,emissive);
267#ifdef FOG
268color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z));
269#endif
270color.rgb=linearTosRGB(color.rgb);color*=u_opacity;
271#ifdef INDICATOR_CUTOUT
272color=applyCutout(color,v_pos.z);
273#endif
274glFragColor=color; 
275#ifdef DEBUG_SHOW_NORMALS
276color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color;
277#endif
278#ifdef OVERDRAW_INSPECTOR
279glFragColor=vec4(1.0);
280#endif
281HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
282#include "_prelude_shadow.vertex.glsl"
283in vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos;
284#ifdef BUILDING_FAUX_FACADE
285out lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive;
286#endif
287#ifdef RENDER_SHADOWS
288uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;
289#endif
290const float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
291#ifdef BUILDING_FAUX_FACADE
292mat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);}
293#endif
294#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive
295#pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive
296void main() {
297#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive
298#pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive
299vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;
300#ifdef BUILDING_FAUX_FACADE
301v_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);}
302#endif
303v_pos=a_pos_3f;
304#ifdef RENDER_CUTOFF
305vec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity;
306#endif
307#ifdef RENDER_SHADOWS
308vec3 shadow_pos=v_pos;
309#ifdef NORMAL_OFFSET
310vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0();
311#endif
312v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0);v_depth_shadows=gl_Position.w;
313#endif
314#ifdef FOG
315v_fog_pos=fog_position(v_pos);
316#endif
317gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);}`),buildingBloom:Zt(`in vec4 v_color_emissive;
318#pragma mapbox: define-attribute highp vec4 bloom_attenuation
319#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
320float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0;
321#ifdef HAS_ATTRIBUTE_a_bloom_attenuation
322float distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));
322opacity*=saturate(1.0-distance*distance);
323#endif
324glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f;
325#pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive
326#pragma mapbox: define-attribute highp vec4 bloom_attenuation
327out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
328#pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive
329#pragma mapbox: initialize-attribute highp vec4 bloom_attenuation
330#ifdef HAS_ATTRIBUTE_a_part_color_emissive
331vec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive);
332#else
333v_color_emissive=vec4(1.0);
334#endif
335gl_Position=u_matrix*vec4(a_pos_3f,1.0);}`),buildingDepth:Zt(`in highp float v_depth;void main() {
336#ifndef DEPTH_TEXTURE
337glFragColor=pack_depth(v_depth);
338#endif
339}`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:Zt(`#include "_prelude_fog.fragment.glsl"
340#include "_prelude_lighting.glsl"
341in vec3 v_data;in float v_visibility;
342#pragma mapbox: define highp vec4 color
343#pragma mapbox: define mediump float radius
344#pragma mapbox: define lowp float blur
345#pragma mapbox: define lowp float opacity
346#pragma mapbox: define highp vec4 stroke_color
347#pragma mapbox: define mediump float stroke_width
348#pragma mapbox: define lowp float stroke_opacity
349uniform float u_emissive_strength;void main() {
350#pragma mapbox: initialize highp vec4 color
351#pragma mapbox: initialize mediump float radius
352#pragma mapbox: initialize lowp float blur
353#pragma mapbox: initialize lowp float opacity
354#pragma mapbox: initialize highp vec4 stroke_color
355#pragma mapbox: initialize mediump float stroke_width
356#pragma mapbox: initialize lowp float stroke_opacity
357vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? 
358smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : 
359smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
360antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
361);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
362#ifdef LIGHTING_3D_MODE
363out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
364#endif
365#ifdef FOG
366out_color=fog_apply_premultiplied(out_color,v_fog_pos);
367#endif
368glFragColor=out_color*(v_visibility*opacity_t);
369#ifdef OVERDRAW_INSPECTOR
370glFragColor=vec4(1.0);
371#endif
372}`,`#include "_prelude_fog.vertex.glsl"
373#include "_prelude_terrain.vertex.glsl"
374#define NUM_VISIBILITY_RINGS 2
375#define INV_SQRT2 0.70710678
376#define ELEVATION_BIAS 0.0001
377#define NUM_SAMPLES_PER_RING 16
378uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos;
379#ifdef PROJECTION_GLOBE_VIEW
380in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
381#endif
382#ifdef ELEVATED_ROADS
383in float a_circle_z_offset;
384#endif
385out vec3 v_data;out float v_visibility;
386#pragma mapbox: define highp vec4 color
387#pragma mapbox: define mediump float radius
388#pragma mapbox: define lowp float blur
389#pragma mapbox: define lowp float opacity
390#pragma mapbox: define highp vec4 stroke_color
391#pragma mapbox: define mediump float stroke_width
392#pragma mapbox: define lowp float stroke_opacity
393vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) {
394#if defined(TERRAIN)
395return elevation(pos)+ELEVATION_BIAS;
396#else
397return 0.0;
398#endif
399}vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale);
400#ifdef PITCH_WITH_MAP
401#ifdef PROJECTION_GLOBE_VIEW
402return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
403#else
404return u_matrix*( world_center+vec4(sample_offset,0,0) );
405#endif
406#else
407return projected_center+vec4(sample_offset,0,0);
408#endif
409}float get_sample_step() {
410#ifdef PITCH_WITH_MAP
411return 2.0*PI/float(NUM_SAMPLES_PER_RING);
412#else
413return PI/float(NUM_SAMPLES_PER_RING);
414#endif
415}void main(void) {
416#pragma mapbox: initialize highp vec4 color
417#pragma mapbox: initialize mediump float radius
418#pragma mapbox: initialize lowp float blur
419#pragma mapbox: initialize lowp float opacity
420#pragma mapbox: initialize highp vec4 stroke_color
421#pragma mapbox: initialize mediump float stroke_width
422#pragma mapbox: initialize lowp float stroke_opacity
423vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors;
424#ifdef PROJECTION_GLOBE_VIEW
425vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1);
426#else 
427surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);
428#endif
429#ifdef ELEVATED_ROADS
430world_center.z+=a_circle_z_offset+ELEVATION_BIAS;
431#endif
432vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
433#ifdef PITCH_WITH_MAP
434#ifdef SCALE_WITH_MAP
435view_scale=1.0;
436#else
437view_scale=projected_center.w/u_camera_to_center_distance;
438#endif
439#else
440#ifdef SCALE_WITH_MAP
441view_scale=u_camera_to_center_distance;
442#else
443view_scale=projected_center.w;
444#endif
445#endif
446gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0;
447#ifdef TERRAIN
448float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
449#ifdef PITCH_WITH_MAP
450float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center;
451#else
452occlusion_world_center=world_center;occlusion_projected_center=projected_center;
453#endif
454for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING);
455#else
456visibility=1.0;
457#endif
458#ifdef PROJECTION_GLOBE_VIEW
459visibility=1.0;
460#endif
461v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
462#ifdef FOG
463v_fog_pos=fog_position(world_center.xyz);
464#endif
465}`),clippingMask:Zt("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Zt(`#include "_prelude_fog.fragment.glsl"
466uniform highp float u_intensity;in vec2 v_extrude;
467#pragma mapbox: define highp float weight
468#define GAUSS_COEF 0.3989422804014327
469void main() {
470#pragma mapbox: initialize highp float weight
471float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0);
472#ifdef FOG
473if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
474#endif
475#ifdef OVERDRAW_INSPECTOR
476glFragColor=vec4(1.0);
477#endif
478HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
479#include "_prelude_fog.vertex.glsl"
480uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;
481#ifdef PROJECTION_GLOBE_VIEW
482in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;
483#endif
484out vec2 v_extrude;
485#pragma mapbox: define highp float weight
486#pragma mapbox: define mediump float radius
487const highp float ZERO=1.0/255.0/16.0;
488#define GAUSS_COEF 0.3989422804014327
489void main(void) {
490#pragma mapbox: initialize highp float weight
491#pragma mapbox: initialize mediump float radius
492vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos;
493#ifdef PROJECTION_GLOBE_VIEW
494vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
495#else
496pos=vec3(tilePos+extrude,elevation(tilePos));
497#endif
498gl_Position=u_matrix*vec4(pos,1);
499#ifdef FOG
500v_fog_pos=fog_position(pos);
501#endif
502}`),heatmapTexture:Zt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity;
503#ifdef OVERDRAW_INSPECTOR
504glFragColor=vec4(0.0);
505#endif
506HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Zt("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl"
507in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;
508#ifdef PROJECTION_GLOBE_VIEW
509uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition;
510#endif
511out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation);
512#ifdef PROJECTION_GLOBE_VIEW
513#ifndef PROJECTED_POS_ON_VIEWPORT
514vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition);
515#endif
516#endif
517vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(
5180.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Zt("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd  =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz  /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(
519mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp(
5200.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Zt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl"
521in vec2 a_pos;
522#ifdef PROJECTION_GLOBE_VIEW
523in vec3 a_pos_3;
524#endif
525out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0;
526#ifdef PROJECTION_GLOBE_VIEW
527gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);
528#else
529gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);
530#endif
531}`),elevatedStructuresDepth:Zt(`void main() {
532#ifndef DEPTH_TEXTURE
533glFragColor=vec4(0.);
534#endif
535}`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Zt(`#ifdef DEPTH_RECONSTRUCTION
536in float v_height;
537#endif
538void main() {
539#ifdef DEPTH_RECONSTRUCTION
540if (v_height >=0.0)
541discard;
542#endif
543glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth;
544#ifdef DEPTH_RECONSTRUCTION
545out float v_height;
546#endif
547void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale);
548#ifdef DEPTH_RECONSTRUCTION
549if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height;
550#endif
551gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:Zt(`#include "_prelude_fog.fragment.glsl"
552#include "_prelude_lighting.glsl"
553#include "_prelude_shadow.fragment.glsl"
554in vec3 v_normal;in float v_height;
555#ifdef RENDER_SHADOWS
556in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth;
557#endif
558vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
558vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color)
559{color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength;
560#pragma mapbox: define highp vec4 structure_color
561void main() {
562#pragma mapbox: initialize highp vec4 structure_color
563vec3 color=structure_color.xyz;
564#ifdef LIGHTING_3D_MODE
565vec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz);
566#ifdef RENDER_SHADOWS
567float shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor);
568#else
569color=apply_lighting(color,transformed_normal);
570#endif
571color=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);}
572#endif
573#ifdef FOG
574color=fog_apply(color,v_fog_pos);
575#endif
576vec4 out_color=vec4(color,1.0);
577#ifdef INDICATOR_CUTOUT
578out_color=applyCutout(out_color,v_height);
579#endif
580#ifdef FEATURE_CUTOUT
581out_color=apply_feature_cutout(out_color,gl_FragCoord);
582#endif
583glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
584#include "_prelude_shadow.vertex.glsl"
585in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height;
586#ifdef RENDER_SHADOWS
587uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth;
588#endif
589#pragma mapbox: define highp vec4 structure_color
590void main() {
591#pragma mapbox: initialize highp vec4 structure_color
592v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1);
593#ifdef RENDER_SHADOWS
594vec3 shd_pos0=pos;vec3 shd_pos1=pos;
595#ifdef NORMAL_OFFSET
596vec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
597#endif
598v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
599#endif
600#ifdef FOG
601v_fog_pos=fog_position(a_pos);
602#endif
603}`),fill:Zt(`#include "_prelude_fog.fragment.glsl"
604#include "_prelude_lighting.glsl"
605#include "_prelude_shadow.fragment.glsl"
606#pragma mapbox: define highp vec4 color
607#pragma mapbox: define lowp float opacity
608uniform float u_emissive_strength;
609#ifdef RENDER_SHADOWS
610uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
611#endif
612#ifdef ELEVATED_ROADS
613in highp float v_road_z_offset;
614#endif
615#ifdef INDICATOR_CUTOUT
616in highp float v_z_offset;
617#endif
618void main() {
619#pragma mapbox: initialize highp vec4 color
620#pragma mapbox: initialize lowp float opacity
621vec4 out_color=color;
622#ifdef LIGHTING_3D_MODE
623out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
624#ifdef RENDER_SHADOWS
625float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
626#endif
627#endif
628#ifdef FOG
629out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
630#endif
631out_color*=opacity;
632#ifdef INDICATOR_CUTOUT
633if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);}
634#endif
635#ifdef FEATURE_CUTOUT
636out_color=apply_feature_cutout(out_color,gl_FragCoord);
637#endif
638glFragColor=out_color;
639#ifdef OVERDRAW_INSPECTOR
640glFragColor=vec4(1.0);
641#endif
642HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
643#include "_prelude_shadow.vertex.glsl"
644in vec2 a_pos;
645#ifdef ELEVATED_ROADS
646in float a_road_z_offset;out highp float v_road_z_offset;
647#endif
648#ifdef RENDER_SHADOWS
649uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
650#endif
651#ifdef INDICATOR_CUTOUT
652out highp float v_z_offset;
653#endif
654uniform mat4 u_matrix;
655#pragma mapbox: define highp vec4 color
656#pragma mapbox: define lowp float opacity
657#pragma mapbox: define highp float z_offset
658void main() {
659#pragma mapbox: initialize highp vec4 color
660#pragma mapbox: initialize lowp float opacity
661#pragma mapbox: initialize highp float z_offset
662#ifdef ELEVATED_ROADS
663z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
664#endif
665float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
666#ifdef RENDER_SHADOWS
667vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
668#ifdef NORMAL_OFFSET
669vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
670#endif
671v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
672#endif
673#ifdef FOG
674v_fog_pos=fog_position(a_pos);
675#endif
676#ifdef INDICATOR_CUTOUT
677v_z_offset=z_offset;
678#endif
679}`),fillOutline:Zt(`#include "_prelude_fog.fragment.glsl"
680#include "_prelude_lighting.glsl"
681#include "_prelude_shadow.fragment.glsl"
682in highp vec2 v_pos;uniform float u_emissive_strength;
683#ifdef RENDER_SHADOWS
684uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
685#endif
686#pragma mapbox: define highp vec4 outline_color
687#pragma mapbox: define lowp float opacity
688void main() {
689#pragma mapbox: initialize highp vec4 outline_color
690#pragma mapbox: initialize lowp float opacity
691float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;
692#ifdef LIGHTING_3D_MODE
693out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
694#ifdef RENDER_SHADOWS
695float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
696#endif
697#endif
698#ifdef FOG
699out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
700#endif
701#ifdef FEATURE_CUTOUT
702out_color=apply_feature_cutout(out_color,gl_FragCoord);
703#endif
704glFragColor=out_color*(alpha*opacity);
705#ifdef OVERDRAW_INSPECTOR
706glFragColor=vec4(1.0);
707#endif
708HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
709#include "_prelude_shadow.vertex.glsl"
710in vec2 a_pos;
711#ifdef ELEVATED_ROADS
712in float a_road_z_offset;
713#endif
714#ifdef RENDER_SHADOWS
715uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
716#endif
717uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;
718#pragma mapbox: define highp vec4 outline_color
719#pragma mapbox: define lowp float opacity
720#pragma mapbox: define highp float z_offset
721void main() {
722#pragma mapbox: initialize highp vec4 outline_color
723#pragma mapbox: initialize lowp float opacity
724#pragma mapbox: initialize highp float z_offset
725#ifdef ELEVATED_ROADS
726z_offset+=a_road_z_offset;
727#endif
728float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);
729#ifdef FLIP_Y
730v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
731#else
732v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
733#endif
734#ifdef RENDER_SHADOWS
735vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
736#ifdef NORMAL_OFFSET
737vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
738#endif
739v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
740#endif
741#ifdef FOG
742v_fog_pos=fog_position(a_pos);
743#endif
744}`),fillOutlinePattern:Zt(`#include "_prelude_fog.fragment.glsl"
745#include "_prelude_lighting.glsl"
746#include "_prelude_shadow.fragment.glsl"
747uniform vec2 u_texsize;uniform sampler2D u_image;
748#ifdef FILL_PATTERN_TRANSITION
749uniform float u_pattern_transition;
750#endif
751uniform float u_emissive_strength;
752#ifdef RENDER_SHADOWS
753uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
754#endif
755in highp vec2 v_pos;in highp vec2 v_pos_world;
756#pragma mapbox: define lowp float opacity
757#pragma mapbox: define lowp vec4 pattern
758#ifdef FILL_PATTERN_TRANSITION
759#pragma mapbox: define mediump vec4 pattern_b
760#endif
761void main() {
762#pragma mapbox: initialize lowp float opacity
763#pragma mapbox: initialize mediump vec4 pattern
764#ifdef FILL_PATTERN_TRANSITION
765#pragma mapbox: initialize mediump vec4 pattern_b
766#endif
767vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
768#ifdef FILL_PATTERN_TRANSITION
769vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
770#endif
771#ifdef LIGHTING_3D_MODE
772out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
773#ifdef RENDER_SHADOWS
774float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
775#endif
776#endif
777#ifdef FEATURE_CUTOUT
778out_color=apply_feature_cutout(out_color,gl_FragCoord);
779#endif
780#ifdef FOG
781out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
782#endif
783glFragColor=out_color*(alpha*opacity);
784#ifdef OVERDRAW_INSPECTOR
785glFragColor=vec4(1.0);
786#endif
787HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
788#include "_prelude_shadow.vertex.glsl"
789uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;
790#ifdef ELEVATED_ROADS
791in float a_road_z_offset;
792#endif
793#ifdef RENDER_SHADOWS
794uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
795#endif
796out highp vec2 v_pos;out highp vec2 v_pos_world;
797#pragma mapbox: define lowp float opacity
798#pragma mapbox: define lowp vec4 pattern
799#ifdef FILL_PATTERN_TRANSITION
800#pragma mapbox: define mediump vec4 pattern_b
801#endif
802#pragma mapbox: define lowp float pixel_ratio
803#pragma mapbox: define highp float z_offset
804void main() {
805#pragma mapbox: initialize lowp float opacity
806#pragma mapbox: initialize mediump vec4 pattern
807#ifdef FILL_PATTERN_TRANSITION
808#pragma mapbox: initialize mediump vec4 pattern_b
809#endif
810#pragma mapbox: initialize lowp float pixel_ratio
811#pragma mapbox: initialize highp float z_offset
812vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;
813#ifdef ELEVATED_ROADS
814z_offset+=a_road_z_offset;
815#endif
816float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
817#ifdef FLIP_Y
818v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world;
819#else
820v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
821#endif
822#ifdef RENDER_SHADOWS
823vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
824#ifdef NORMAL_OFFSET
825vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
826#endif
827v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
828#endif
829#ifdef FOG
830v_fog_pos=fog_position(a_pos);
831#endif
832}`),fillPattern:Zt(`#include "_prelude_fog.fragment.glsl"
833#include "_prelude_lighting.glsl"
834#include "_prelude_shadow.fragment.glsl"
835uniform vec2 u_texsize;uniform sampler2D u_image;
836#ifdef FILL_PATTERN_TRANSITION
837uniform float u_pattern_transition;
838#endif
839in highp vec2 v_pos;uniform float u_emissive_strength;
840#ifdef RENDER_SHADOWS
841uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
842#endif
843#ifdef ELEVATED_ROADS
844in highp float v_road_z_offset;
845#endif
846#pragma mapbox: define lowp float opacity
847#pragma mapbox: define lowp vec4 pattern
848#ifdef FILL_PATTERN_TRANSITION
849#pragma mapbox: define mediump vec4 pattern_b
850#endif
851void main() {
852#pragma mapbox: initialize lowp float opacity
853#pragma mapbox: initialize mediump vec4 pattern
854#ifdef FILL_PATTERN_TRANSITION
855#pragma mapbox: initialize mediump vec4 pattern_b
856#endif
857vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
858#ifdef FILL_PATTERN_TRANSITION
859vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
860#endif
861#ifdef LIGHTING_3D_MODE
862out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
863#ifdef RENDER_SHADOWS
864float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
865#ifdef ELEVATED_ROADS
866out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
867#else
868out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
869#endif
870#endif
871#endif
872#ifdef FEATURE_CUTOUT
873out_color=apply_feature_cutout(out_color,gl_FragCoord);
874#endif
875#ifdef FOG
876out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
877#endif
878glFragColor=out_color*opacity;
879#ifdef OVERDRAW_INSPECTOR
880glFragColor=vec4(1.0);
881#endif
882HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
883#include "_prelude_shadow.vertex.glsl"
884uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;
885#ifdef ELEVATED_ROADS
886in float a_road_z_offset;out highp float v_road_z_offset;
887#endif
888#ifdef RENDER_SHADOWS
889uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
890#endif
891out highp vec2 v_pos;
892#pragma mapbox: define lowp float opacity
893#pragma mapbox: define lowp vec4 pattern
894#ifdef FILL_PATTERN_TRANSITION
895#pragma mapbox: define mediump vec4 pattern_b
896#endif
897#pragma mapbox: define lowp float pixel_ratio
898#pragma mapbox: define highp float z_offset
899void main() {
900#pragma mapbox: initialize lowp float opacity
901#pragma mapbox: initialize mediump vec4 pattern
902#pragma mapbox: initialize lowp float pixel_ratio
903#pragma mapbox: initialize highp float z_offset
904#ifdef FILL_PATTERN_TRANSITION
905#pragma mapbox: initialize mediump vec4 pattern_b
906#endif
907vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;
908#ifdef ELEVATED_ROADS
909z_offset+=a_road_z_offset;v_road_z_offset=z_offset;
910#endif
911float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
912#ifdef RENDER_SHADOWS
913vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset);
914#ifdef NORMAL_OFFSET
915vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
916#endif
917v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
918#endif
919#ifdef FOG
920v_fog_pos=fog_position(a_pos);
921#endif
922}`),fillExtrusion:Zt(`#include "_prelude_fog.fragment.glsl"
923#include "_prelude_shadow.fragment.glsl"
924#include "_prelude_lig
924hting.glsl"
925in vec4 v_color;in vec4 v_flat;
926#ifdef RENDER_SHADOWS
927in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
928#endif
929uniform lowp float u_opacity;
930#ifdef FAUX_AO
931uniform lowp vec2 u_ao;in vec2 v_ao;
932#endif
933#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
934in vec4 v_roof_color;
935#endif
936#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
937in highp vec3 v_normal;
938#endif
939uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;
940#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
941in float v_flood_radius;in float v_has_floodlight;
942#endif
943in float v_height;
944#pragma mapbox: define highp float emissive_strength
945void main() {
946#pragma mapbox: initialize highp float emissive_strength
947#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
948vec3 normal=normalize(v_normal);
949#endif
950float z;vec4 color=v_color;
951#ifdef ZERO_ROOF_RADIUS
952z=float(normal.z > 0.00001);
953#ifdef LIGHTING_3D_MODE
954normal=mix(normal,vec3(0.0,0.0,1.0),z);
955#else
956color=mix(v_color,v_roof_color,z);
957#endif
958#endif
959float h=max(0.0,v_height);float ao_shade=1.0;
960#ifdef FAUX_AO
961float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;
962#ifdef ZERO_ROOF_RADIUS
963concave*=(1.0-z);
964#endif
965float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave);
966#ifdef LIGHTING_3D_MODE
967#ifdef FLOOD_LIGHT
968color.rgb*=mix(ao_shade,1.0,v_has_floodlight);
969#else
970color.rgb*=ao_shade;
971#endif
972#else
973color.rgb*=ao_shade;
974#endif
975#endif
976#ifdef LIGHTING_3D_MODE
977float flood_radiance=0.0;
978#ifdef FLOOD_LIGHT
979flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;
980#endif
981#ifdef RENDER_SHADOWS
982#ifdef FLOOD_LIGHT
983float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance);
984#else
985float shadowed_lighting_factor;
986#ifdef RENDER_CUTOFF
987shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;}
988#else
989shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
990#endif
991color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);
992#endif
993#else
994color.rgb=apply_lighting(color.rgb,normal);
995#ifdef FLOOD_LIGHT
996color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);
997#endif
998#endif
999color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity;
1000#endif
1001#ifdef FOG
1002color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));
1003#endif
1004#ifdef INDICATOR_CUTOUT
1005color=applyCutout(color,h);
1006#endif
1007#ifdef FEATURE_CUTOUT
1008color=apply_feature_cutout(color,gl_FragCoord);
1009#endif
1010glFragColor=color;
1011#ifdef OVERDRAW_INSPECTOR
1012glFragColor=vec4(1.0);
1013#endif
1014HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1015#include "_prelude_terrain.vertex.glsl"
1016#include "_prelude_shadow.vertex.glsl"
1017#include "_prelude_lighting.glsl"
1018uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1019#ifdef RENDER_WALL_MODE
1020in vec3 a_join_normal_inside;
1021#endif
1022#ifdef PROJECTION_GLOBE_VIEW
1023in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
1024#endif
1025#ifdef TERRAIN
1026uniform int u_height_type;uniform int u_base_type;
1027#endif
1028uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;
1029#ifdef RENDER_SHADOWS
1030uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;
1031#endif
1032#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1033out vec4 v_roof_color;
1034#endif
1035#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1036out highp vec3 v_normal;
1037#endif
1038#ifdef FAUX_AO
1039uniform lowp vec2 u_ao;out vec2 v_ao;
1040#endif
1041#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
1042out float v_flood_radius;out float v_has_floodlight;
1043#endif
1044out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}
1045#pragma mapbox: define highp float base
1046#pragma mapbox: define highp float height
1047#pragma mapbox: define highp vec4 color
1048#pragma mapbox: define highp float flood_light_wall_radius
1049#pragma mapbox: define highp float line_width
1050#pragma mapbox: define highp float emissive_strength
1051void main() {
1052#pragma mapbox: initialize highp float base
1053#pragma mapbox: initialize highp float height
1054#pragma mapbox: initialize highp vec4 color
1055#pragma mapbox: initialize highp float flood_light_wall_radius
1056#pragma mapbox: initialize highp float line_width
1057#pragma mapbox: initialize highp float emissive_strength
1058base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));
1059#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
1060v_normal=normal;
1061#endif
1062base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
1063#if defined(HAS_CENTROID) || defined(TERRAIN)
1064centroid_pos=a_centroid_pos;
1065#endif
1066float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;
1067#ifdef TERRAIN
1068bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);
1069#else
1070h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);
1071#endif
1072#ifdef PROJECTION_GLOBE_VIEW
1073float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
1074#endif
1075float cutoff=1.0;vec3 scaled_pos=pos;
1076#ifdef RENDER_CUTOFF
1077vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);
1078#ifdef CLIP_ZERO_TO_ONE
1079cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w);
1080#else
1081cutoff=cutoff_opacity(u_cutoff_params,ground.z);
1082#endif
1083if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);
1084#endif
1085float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0));
1086#ifdef RENDER_WALL_MODE
1087vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
1088#endif
1089gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;
1090#ifdef RENDER_SHADOWS
1091vec3 shd_pos0=pos;vec3 shd_pos1=pos;
1092#ifdef NORMAL_OFFSET
1093vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
1094#endif
1095v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);
1096#endif
1097float NdotL=0.0;float colorvalue=0.0;
1098#ifndef LIGHTING_3D_MODE
1099colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=(
1100(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1101#endif
1102#ifdef FAUX_AO
1103float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
1104#ifdef TERRAIN
1105top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
1106#endif
1107v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
1108#ifdef PROJECTION_GLOBE_VIEW
1109top_height+=u_height_lift;
1110#endif
1111gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1112#endif
1113#ifdef LIGHTING_3D_MODE
1114#ifdef FLOOD_LIGHT
1115float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale;
1116#endif
1117v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0);
1118#else
1119v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity;
1120#endif
1121#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
1122float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity;
1123#endif
1124#ifdef FOG
1125v_fog_pos=fog_position(pos);
1126#endif
1127}`),fillExtrusionDepth:Zt(`in highp float v_depth;void main() {
1128#ifndef DEPTH_TEXTURE
1129glFragColor=pack_depth(v_depth);
1130#endif
1131}`,`#include "_prelude_terrain.vertex.glsl"
1132uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale;
1133#ifdef TERRAIN
1134uniform int u_height_type;uniform int u_base_type;
1135#endif
1136in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1137#ifdef RENDER_WALL_MODE
1138in vec3 a_join_normal_inside;
1139#endif
1140#pragma mapbox: define highp float base
1141#pragma mapbox: define highp float height
1142#pragma mapbox: define highp float line_width
1143#pragma mapbox: define highp vec4 color
1144out highp float v_depth;void main() {
1145#pragma mapbox: initialize highp float base
1146#pragma mapbox: initialize highp float height
1147#pragma mapbox: initialize highp float line_width
1148#pragma mapbox: initialize highp vec4 color
1149base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0);
1150#if defined(HAS_CENTROID) || defined(TERRAIN)
1151centroid_pos=a_centroid_pos;
1152#endif
1153vec3 pos;
1154#ifdef TERRAIN
1155bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h);
1156#else
1157pos=vec3(pos_nx.xy,t > 0.0 ? height : base);
1158#endif
1159#ifdef RENDER_WALL_MODE
1160vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5;
1161#endif
1162float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Zt(`#include "_prelude_fog.fragment.glsl"
1163#include "_prelude_lighting.glsl"
1164uniform vec2 u_texsize;uniform sampler2D u_image;
1165#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1166uniform float u_pattern_transition;
1167#endif
1168#ifdef FAUX_AO
1169uniform lowp vec2 u_ao;in vec3 v_ao;
1170#endif
1171#ifdef LIGHTING_3D_MODE
1172in vec3 v_normal;
1173#endif
1174in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;
1175#pragma mapbox: define highp float base
1176#pragma mapbox: define highp float height
1177#pragma mapbox: define mediump vec4 pattern
1178#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1179#pragma mapbox: define mediump vec4 pattern_b
1180#endif
1181#pragma mapbox: define highp float pixel_ratio
1182void main() {
1183#pragma mapbox: initialize highp float base
1184#pragma mapbox: initialize highp float height
1185#pragma mapbox: initialize mediump vec4 pattern
1186#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1187#pragma mapbox: initialize mediump vec4 pattern_b
1188#endif
1189#pragma mapbox: initialize highp float pixel_ratio
1190vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
1191#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1192vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
1193#endif
1194#ifdef LIGHTING_3D_MODE
1195out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;
1196#else
1197out_color=out_color*v_lighting;
1198#endif
1199#ifdef FAUX_AO
1200float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0
1200),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade;
1201#endif
1202#ifdef FOG
1203out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1204#endif
1205#ifdef INDICATOR_CUTOUT
1206out_color=applyCutout(out_color,height);
1207#endif
1208glFragColor=out_color;
1209#ifdef OVERDRAW_INSPECTOR
1210glFragColor=vec4(1.0);
1211#endif
1212HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1213#include "_prelude_terrain.vertex.glsl"
1214#include "_prelude_lighting.glsl"
1215uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
1216#ifdef RENDER_WALL_MODE
1217in vec3 a_join_normal_inside;
1218#endif
1219#ifdef PROJECTION_GLOBE_VIEW
1220in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift;
1221#endif
1222#ifdef TERRAIN
1223uniform int u_height_type;uniform int u_base_type;
1224#endif
1225out highp vec2 v_pos;out vec4 v_lighting;
1226#ifdef FAUX_AO
1227uniform lowp vec2 u_ao;out vec3 v_ao;
1228#endif
1229#ifdef LIGHTING_3D_MODE
1230out vec3 v_normal;
1231#endif
1232#pragma mapbox: define highp float base
1233#pragma mapbox: define highp float height
1234#pragma mapbox: define highp vec4 color
1235#pragma mapbox: define mediump vec4 pattern
1236#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1237#pragma mapbox: define mediump vec4 pattern_b
1238#endif
1239#pragma mapbox: define highp float pixel_ratio
1240#pragma mapbox: define highp float line_width
1241void main() {
1242#pragma mapbox: initialize highp float base
1243#pragma mapbox: initialize highp float height
1244#pragma mapbox: initialize highp vec4 color
1245#pragma mapbox: initialize mediump vec4 pattern
1246#ifdef FILL_EXTRUSION_PATTERN_TRANSITION
1247#pragma mapbox: initialize mediump vec4 pattern_b
1248#endif
1249#pragma mapbox: initialize highp float pixel_ratio
1250#pragma mapbox: initialize highp float line_width
1251vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0);
1252#if defined(HAS_CENTROID) || defined(TERRAIN)
1253centroid_pos=a_centroid_pos;
1254#endif
1255float ele=0.0;float h=z;vec3 p;float c_ele;
1256#ifdef TERRAIN
1257bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h);
1258#else
1259p=vec3(pos_nx.xy,z);
1260#endif
1261#ifdef PROJECTION_GLOBE_VIEW
1262float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);
1263#endif
1264#ifdef RENDER_WALL_MODE
1265vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5;
1266#endif
1267float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0
1268? pos_nx.xy
1269: vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0;
1270#ifdef LIGHTING_3D_MODE
1271NdotL=calculate_NdotL(normal);
1272#else
1273NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
1274#endif
1275if (normal.y !=0.0) {float r=0.84;
1276#ifndef LIGHTING_3D_MODE
1277r=mix(0.7,0.98,1.0-u_lightintensity);
1278#endif
1279NdotL*=(
1280(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
1281#ifdef FAUX_AO
1282float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height;
1283#ifdef TERRAIN
1284top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
1285#endif
1286v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
1287#ifdef PROJECTION_GLOBE_VIEW
1288top_height+=u_height_lift;
1289#endif
1290gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
1291#endif
1292#ifdef LIGHTING_3D_MODE
1293v_normal=normal;
1294#else
1295v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
1296#endif
1297#ifdef FOG
1298v_fog_pos=fog_position(p);
1299#endif
1300}`),groundShadow:Zt(`#include "_prelude_shadow.fragment.glsl"
1301precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
1302#ifdef FOG
1303in float v_fog_opacity;
1304#endif
1305void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light);
1306#ifdef RENDER_CUTOFF
1307shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));
1308#endif
1309#ifdef FOG
1310shadow=mix(shadow,vec3(1.0),v_fog_opacity);
1311#endif
1312#ifdef INDICATOR_CUTOUT
1313shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r);
1314#endif
1315glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl"
1316uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
1317#ifdef FOG
1318out float v_fog_opacity;
1319#endif
1320void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0);
1321#ifdef FOG
1322v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);
1323#endif
1324}`),fillExtrusionGroundEffect:Zt(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size;
1325#ifdef SDF_SUBPASS
1326in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);}
1327#ifdef FOG
1328in highp float v_fog;
1329#endif
1330#endif
1331void main() {
1332#ifdef CLEAR_SUBPASS
1333vec4 color=vec4(1.0);
1334#ifdef CLEAR_FROM_TEXTURE
1335color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));
1336#endif
1337glFragColor=color;
1338#else
1339#ifdef SDF_SUBPASS
1340highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0;
1341#ifdef FOG
1342fog=v_fog;
1343#endif
1344#ifdef RENDER_CUTOFF
1345fog*=v_cutoff_opacity;
1346#endif
1347glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
1348#else
1349vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);
1350#ifdef OVERDRAW_INSPECTOR
1351color=vec4(1.0);
1352#endif
1353glFragColor=color;
1354#endif
1355HANDLE_WIREFRAME_DEBUG;
1356#endif
1357}`,`#include "_prelude_fog.vertex.glsl"
1358in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;
1359#ifdef SDF_SUBPASS
1360out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;
1361#ifdef FOG
1362out highp float v_fog;
1363#endif
1364#endif
1365uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao;
1366#pragma mapbox: define highp float flood_light_ground_radius
1367const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
1368#pragma mapbox: initialize highp float flood_light_ground_radius
1369vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp;
1370#ifdef SDF_SUBPASS
1371v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius);
1372#ifdef FOG
1373v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);
1374#endif
1375#endif
1376float hidden_by_landmark=0.0;
1377#ifdef HAS_CENTROID
1378hidden_by_landmark=a_hidden_by_landmark;
1379#endif
1380float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0));
1381#ifdef RENDER_CUTOFF
1382v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
1383#endif
1384}`),hillshadePrepare:Zt(`precision highp float;uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2(
1385(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
1386)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(
1387deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Zt(`#include "_prelude_fog.fragment.glsl"
1388#include "_prelude_lighting.glsl"
1389uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color;
1390#ifdef LIGHTING_3D_MODE
1391glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);
1392#endif
1393#ifdef FOG
1394glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));
1395#endif
1396#ifdef OVERDRAW_INSPECTOR
1397glFragColor=vec4(1.0);
1398#endif
1399HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1400uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;
1401#ifdef FOG
1402v_fog_pos=fog_position(a_pos);
1403#endif
1404}`),line:Zt(`#include "_prelude_fog.fragment.glsl"
1405#include "_prelude_lighting.glsl"
1406#include "_prelude_shadow.fragment.glsl"
1407uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;
1407uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv;
1408#ifdef ELEVATED_ROADS
1409in highp float v_road_z_offset;
1410#endif
1411#ifdef RENDER_LINE_DASH
1412uniform sampler2D u_dash_image;in vec2 v_tex;
1413#endif
1414#ifdef RENDER_LINE_GRADIENT
1415uniform sampler2D u_gradient_image;
1416#endif
1417#ifdef INDICATOR_CUTOUT
1418in highp float v_z_offset;
1419#endif
1420#ifdef RENDER_SHADOWS
1421uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
1422#endif
1423float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;
1424#pragma mapbox: define highp vec4 color
1425#pragma mapbox: define lowp float floorwidth
1426#pragma mapbox: define lowp vec4 dash
1427#pragma mapbox: define lowp float blur
1428#pragma mapbox: define lowp float opacity
1429#pragma mapbox: define lowp float border_width
1430#pragma mapbox: define lowp vec4 border_color
1431float linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
1432#pragma mapbox: initialize highp vec4 color
1433#pragma mapbox: initialize lowp float floorwidth
1434#pragma mapbox: initialize lowp vec4 dash
1435#pragma mapbox: initialize lowp float blur
1436#pragma mapbox: initialize lowp float opacity
1437#pragma mapbox: initialize lowp float border_width
1438#pragma mapbox: initialize lowp vec4 border_color
1439float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);
1440#ifdef RENDER_LINE_DASH
1441float sdfdist=texture(u_dash_image,v_tex).r;
1441float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist);
1442#endif
1443highp vec4 out_color;
1444#ifdef RENDER_LINE_GRADIENT
1445out_color=texture(u_gradient_image,v_uv.xy);
1446#else
1447out_color=color;
1448#endif
1449float trim_alpha=1.0;
1450#ifdef RENDER_LINE_TRIM_OFFSET
1451highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;}
1452#endif
1453if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}
1454#ifdef RENDER_LINE_BORDER
1455float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}}
1456#endif
1457#ifdef LIGHTING_3D_MODE
1458out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
1459#ifdef RENDER_SHADOWS
1460float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1461#ifdef ELEVATED_ROADS
1462out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1463#else
1464out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1465#endif
1466#endif
1467#endif
1468#ifdef FOG
1469out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
1470#endif
1471out_color*=(alpha*opacity);
1472#ifdef INDICATOR_CUTOUT
1473out_color=applyCutout(out_color,v_z_offset);
1474#endif
1475#ifdef FEATURE_CUTOUT
1476out_color=apply_feature_cutout(out_color,gl_FragCoord);
1477#endif
1478glFragColor=out_color;
1479#ifdef OVERDRAW_INSPECTOR
1480glFragColor=vec4(1.0);
1481#endif
1482HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1483#include "_prelude_shadow.vertex.glsl"
1484#include "_prelude_terrain.vertex.glsl"
1485#define EXTRUDE_SCALE 0.015873016
1486in vec2 a_pos_normal;in vec4 a_data;
1487#if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH)
1488in vec3 a_z_offset_width;
1489#endif
1490#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1491in highp vec3 a_packed;
1492#endif
1493#ifdef RENDER_LINE_DASH
1494in float a_linesofar;
1495#endif
1496uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale;
1497#ifdef ELEVATED
1498uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1499#ifdef ELEVATION_REFERENCE_SEA
1500return 0.0;
1501#else
1502return elevation(apos);
1503#endif
1504}
1505#endif
1506out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv;
1507#ifdef ELEVATED_ROADS
1508out highp float v_road_z_offset;
1509#endif
1510#ifdef RENDER_LINE_DASH
1511uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;
1512#endif
1513#ifdef RENDER_LINE_GRADIENT
1514uniform float u_image_height;
1515#endif
1516#ifdef INDICATOR_CUTOUT
1517out highp float v_z_offset;
1518#endif
1519#ifdef RENDER_SHADOWS
1520uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
1521#endif
1522#pragma mapbox: define highp vec4 color
1523#pragma mapbox: define lowp float floorwidth
1524#pragma mapbox: define lowp vec4 dash
1525#pragma mapbox: define lowp float blur
1526#pragma mapbox: define lowp float opacity
1527#pragma mapbox: define mediump float gapwidth
1528#pragma mapbox: define lowp float offset
1529#pragma mapbox: define mediump float width
1530#pragma mapbox: define lowp float border_width
1531#pragma mapbox: define lowp vec4 border_color
1532void main() {
1533#pragma mapbox: initialize highp vec4 color
1534#pragma mapbox: initialize lowp float floorwidth
1535#pragma mapbox: initialize lowp vec4 dash
1536#pragma mapbox: initialize lowp float blur
1537#pragma mapbox: initialize lowp float opacity
1538#pragma mapbox: initialize mediump float gapwidth
1539#pragma mapbox: initialize lowp float offset
1540#pragma mapbox: initialize mediump float width
1541#pragma mapbox: initialize lowp float border_width
1542#pragma mapbox: initialize lowp vec4 border_color
1543float a_z_offset;
1544#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1545a_z_offset=a_z_offset_width.x;
1546#endif
1547float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth;
1548#ifdef VARIABLE_LINE_WIDTH
1549float left=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);halfwidth=(u_width_scale*(left==1.0 ? a_z_offset_width.y : a_z_offset_width.z))/2.0;
1550#else
1551halfwidth=(u_width_scale*width)/2.0;
1552#endif
1553offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1553vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1554#ifdef ELEVATED_ROADS
1555v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;
1556#else
1557#ifdef ELEVATED
1558vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;
1559#ifdef CROSS_SLOPE_VERTICAL
1560float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
1561#else
1562#ifdef CROSS_SLOPE_HORIZONTAL
1563float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;
1564#else
1565float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;
1566#endif
1567#endif
1568gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);
1569#else
1570gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
1571#endif
1572#endif
1573#ifdef ELEVATED_ROADS
1574#ifdef RENDER_SHADOWS
1575vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1576#ifdef NORMAL_OFFSET
1577vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
1578#endif
1579v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
1580#endif
1581#endif
1582#ifndef RENDER_TO_TEXTURE
1583float epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));
1584#else
1585v_gamma_scale=1.0;
1586#endif
1587#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1588highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2];
1589#ifdef RENDER_LINE_GRADIENT
1590highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress);
1591#else
1592v_uv=vec3(a_uv_x,0.0,line_progress);
1593#endif
1594#endif
1595#ifdef RENDER_LINE_DASH
1596float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y);
1597#endif
1598v_width2=vec2(outset,inset);
1599#ifdef FOG
1600v_fog_pos=fog_position(pos);
1601#endif
1602#ifdef INDICATOR_CUTOUT
1603v_z_offset=a_z_offset;
1604#endif
1605}`),linePattern:Zt(`#include "_prelude_fog.fragment.glsl"
1606#include "_prelude_lighting.glsl"
1607#include "_prelude_shadow.fragment.glsl"
1608uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image;
1609#ifdef LINE_PATTERN_TRANSITION
1610uniform float u_pattern_transition;
1611#endif
1612in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;
1613#ifdef RENDER_LINE_TRIM_OFFSET
1614in highp vec3 v_uv;
1615#endif
1616#ifdef ELEVATED_ROADS
1617in highp float v_road_z_offset;
1618#endif
1619#ifdef LINE_JOIN_NONE
1620in vec2 v_pattern_data;
1621#endif
1622#ifdef INDICATOR_CUTOUT
1623in highp float v_z_offset;
1624#endif
1625#ifdef RENDER_SHADOWS
1626uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
1627#endif
1628uniform float u_emissive_strength;
1629#pragma mapbox: define mediump vec4 pattern
1630#ifdef LINE_PATTERN_TRANSITION
1631#pragma mapbox: define mediump vec4 pattern_b
1632#endif
1633#pragma mapbox: define mediump float pixel_ratio
1634#pragma mapbox: define mediump float blur
1635#pragma mapbox: define mediump float opacity
1636void main() {
1637#pragma mapbox: initialize mediump vec4 pattern
1638#ifdef LINE_PATTERN_TRANSITION
1639#pragma mapbox: initialize mediump vec4 pattern_b
1640#endif
1641#pragma mapbox: initialize mediump float pixel_ratio
1642#pragma mapbox: initialize mediump float blur
1643#pragma mapbox: initialize mediump float opacity
1644vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos);
1645#ifdef LINE_PATTERN_TRANSITION
1646vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition;
1647#endif
1648#ifdef RENDER_LINE_TRIM_OFFSET
1649highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);}
1650#endif
1651#ifdef LINE_JOIN_NONE
1652highp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);}
1653#endif
1654#ifdef LIGHTING_3D_MODE
1655color=apply_lighting_with_emission_ground(color,u_emissive_strength);
1656#ifdef RENDER_SHADOWS
1657float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1658#ifdef ELEVATED_ROADS
1659color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1660#else
1661color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1662#endif
1663#endif
1664#endif
1665#ifdef FOG
1666color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
1667#endif
1668color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}
1669#ifdef INDICATOR_CUTOUT
1670color=applyCutout(color,v_z_offset);
1671#endif
1672glFragColor=color;
1673#ifdef OVERDRAW_INSPECTOR
1674glFragColor=vec4(1.0);
1675#endif
1676HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1677#include "_prelude_shadow.vertex.glsl"
1678#include "_prelude_terrain.vertex.glsl"
1679#define scale 0.015873016
1680in vec2 a_pos_normal;in vec4 a_data;
1681#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1682in vec3 a_z_offset_width;
1683#endif
1684#ifdef RENDER_LINE_TRIM_OFFSET
1685in highp vec3 a_packed;
1686#endif
1687in highp float a_linesofar;
1688#ifdef LINE_JOIN_NONE
1689in highp vec3 a_pattern_data;out vec2 v_pattern_data;
1690#endif
1691#ifdef INDICATOR_CUTOUT
1692out highp float v_z_offset;
1693#endif
1694uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale;
1695#ifdef ELEVATED
1696uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) {
1697#ifdef ELEVATION_REFERENCE_SEA
1698return 0.0;
1699#else
1700return elevation(apos);
1701#endif
1702}
1703#endif
1704out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;
1705#ifdef RENDER_LINE_TRIM_OFFSET
1706out highp vec3 v_uv;
1707#endif
1708#ifdef ELEVATED_ROADS
1709out highp float v_road_z_offset;
1710#endif
1711#ifdef RENDER_SHADOWS
1712uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
1713#endif
1714#pragma mapbox: define mediump float blur
1715#pragma mapbox: define mediump float opacity
1716#pragma mapbox: define mediump float offset
1717#pragma mapbox: define mediump float gapwidth
1718#pragma mapbox: define mediump float width
1719#pragma mapbox: define mediump float floorwidth
1720#pragma mapbox: define mediump vec4 pattern
1721#ifdef LINE_PATTERN_TRANSITION
1722#pragma mapbox: define mediump vec4 pattern_b
1723#endif
1724#pragma mapbox: define mediump float pixel_ratio
1725void main() {
1726#pragma mapbox: initialize mediump float blur
1727#pragma mapbox: initialize mediump float opacity
1728#pragma mapbox: initialize mediump float offset
1729#pragma mapbox: initialize mediump float gapwidth
1730#pragma mapbox: initialize mediump float width
1731#pragma mapbox: initialize mediump float floorwidth
1732#pragma mapbox: initialize mediump vec4 pattern
1733#ifdef LINE_PATTERN_TRANSITION
1734#pragma mapbox: initialize mediump vec4 pattern_b
1735#endif
1736#pragma mapbox: initialize mediump float pixel_ratio
1737float a_z_offset;
1738#if defined(ELEVATED) || defined(ELEVATED_ROADS)
1739a_z_offset=a_z_offset_width.x;
1740#endif
1741float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;
1741vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy;
1742#ifdef ELEVATED_ROADS
1743v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude;
1744#else
1745#ifdef ELEVATED
1746vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0;
1747#ifdef CROSS_SLOPE_VERTICAL
1748float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0);
1749#else
1750#ifdef CROSS_SLOPE_HORIZONTAL
1751float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset;
1752#else
1753float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset;
1754#endif
1755#endif
1756gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden);
1757#else
1758gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden);
1759#endif
1760#endif
1761#ifdef ELEVATED_ROADS
1762#ifdef RENDER_SHADOWS
1763vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos;
1764#ifdef NORMAL_OFFSET
1765vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
1766#endif
1767v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
1768#endif
1769#endif
1770#ifndef RENDER_TO_TEXTURE
1771float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur));
1772#else
1773v_gamma_scale=1.0;
1774#endif
1775#ifdef RENDER_LINE_TRIM_OFFSET
1776highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress);
1777#endif
1778v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale);
1779#ifdef LINE_JOIN_NONE
1780v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y);
1781#endif
1782#ifdef FOG
1783v_fog_pos=fog_position(pos);
1784#endif
1785#ifdef INDICATOR_CUTOUT
1786v_z_offset=a_z_offset;
1787#endif
1788}`),raster:Zt(`#include "_prelude_fog.fragment.glsl"
1789#include "_prelude_lighting.glsl"
1790#include "_prelude_raster_array.glsl"
1791uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth;
1792#ifdef PROJECTION_GLOBE_VIEW
1793in float v_split_fade;
1794#endif
1795uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength;
1796#ifndef RASTER_ARRAY
1797uniform highp sampler2D u_image0;uniform sampler2D u_image1;
1798#endif
1799#ifdef RASTER_COLOR
1800uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;
1801#endif
1802void main() {vec4 color0,color1,color;vec2 value;
1803#ifdef RASTER_COLOR
1804#ifdef RASTER_ARRAY
1805#ifdef RASTER_ARRAY_LINEAR
1806value=mix(
1807raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
1808);
1809#else
1810value=mix(
1811raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t
1812);
1813#endif
1814if (value.y > 0.0) value.x/=value.y;
1815#else
1816color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a);
1817#endif
1818color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;
1819#else
1820color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);
1821#endif
1822color.a*=u_opacity;
1823#ifdef GLOBE_POLES
1824color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);
1825#endif
1826vec3 rgb=color.rgb;rgb=vec3(
1827dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb);
1828#ifdef LIGHTING_3D_MODE
1829out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;
1830#endif
1831#ifdef FOG
1832highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));
1833#endif
1834glFragColor=vec4(out_color*color.a,color.a);
1835#ifdef PROJECTION_GLOBE_VIEW
1836glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));
1837#endif
1838#ifdef RENDER_CUTOFF
1839glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);
1840#endif
1841#ifdef OVERDRAW_INSPECTOR
1842glFragColor=vec4(1.0);
1843#endif
1844HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1845uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;
1846#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
1847#ifdef GLOBE_POLES
1848in vec3 a_globe_pos;in vec2 a_uv;
1849#else
1850in vec2 a_pos;in vec2 a_texture_pos;
1851#endif
1852out vec2 v_pos0;out vec2 v_pos1;out float v_depth;
1853#ifdef PROJECTION_GLOBE_VIEW
1854out float v_split_fade;
1855#endif
1856void main() {vec2 uv;
1857#ifdef GLOBE_POLES
1858vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos   ,1.0);uv=a_uv;
1859#ifdef FOG
1860v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
1861#endif
1862#else
1863float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;
1864#ifdef PROJECTION_GLOBE_VIEW
1865vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);    
1866v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];
1866if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;
1867#ifdef FOG
1868v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
1869#endif
1870#else
1871gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
1872#ifdef FOG
1873v_fog_pos=fog_position(a_pos);
1874#endif
1875#endif
1876#endif
1877v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1;
1878#ifdef RENDER_CUTOFF
1879v_depth=gl_Position.z;
1880#endif
1881}`),rasterParticle:Zt(`#include "_prelude_fog.fragment.glsl"
1882#include "_prelude_lighting.glsl"
1883uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb;
1884#ifdef LIGHTING_3D_MODE
1885out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;
1886#endif
1887#ifdef FOG
1888highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit));
1889#endif
1890glFragColor=vec4(out_color*color.a,color.a);
1891#ifdef OVERDRAW_INSPECTOR
1892glFragColor=vec4(1.0);
1893#endif
1894HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1895uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center;
1896#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
1897in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;
1898#ifdef PROJECTION_GLOBE_VIEW
1899vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos;
1900#ifdef FOG
1901v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
1902#endif
1903#else
1904uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
1905#ifdef FOG
1906v_fog_pos=fog_position(a_pos);
1907#endif
1908#endif
1909v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Zt("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl"
1910in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2(
1911mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:Zt("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}
1911"),rasterParticleUpdate:Zt(`#include "_prelude_raster_particle.glsl"
1912uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return  clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow(
1913linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)
1914);highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Zt(`#include "_prelude_lighting.glsl"
1915#include "_prelude_shadow.fragment.glsl"
1916#define SDF_PX 8.0
1917#define SDF 1.0
1918#define ICON 0.0
1919uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor;
1920#ifdef ICON_TRANSITION
1921uniform float u_icon_transition;
1922#endif
1923#ifdef COLOR_ADJUSTMENT
1924uniform mat4 u_color_adj_mat;
1925#endif
1926#ifdef INDICATOR_CUTOUT
1927in highp float v_z_offset;
1928#else
1929#ifdef RENDER_SHADOWS
1930in highp float v_z_offset;
1931#endif
1932#endif
1933in vec2 v_tex_a;
1934#ifdef ICON_TRANSITION
1935in vec2 v_tex_b;
1936#endif
1937in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity;
1938#ifdef RENDER_TEXT_AND_SYMBOL
1939in float is_sdf;in vec2 v_tex_a_icon;
1940#endif
1941#ifdef RENDER_SHADOWS
1942uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth;
1943#endif
1944#pragma mapbox: define highp vec4 fill_color
1945#pragma mapbox: define highp vec4 halo_color
1946#pragma mapbox: define lowp float opacity
1947#pragma mapbox: define lowp float halo_width
1948#pragma mapbox: define lowp float halo_blur
1949#pragma mapbox: define lowp float emissive_strength
1950void main() {
1951#pragma mapbox: initialize highp vec4 fill_color
1952#pragma mapbox: initialize highp vec4 halo_color
1953#pragma mapbox: initialize lowp float opacity
1954#pragma mapbox: initialize lowp float halo_width
1955#pragma mapbox: initialize lowp float halo_blur
1956#pragma mapbox: initialize lowp float emissive_strength
1957vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2];
1958#ifdef RENDER_TEXT_AND_SYMBOL
1959if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;
1960#ifdef OVERDRAW_INSPECTOR
1961glFragColor=vec4(1.0);
1962#endif
1963return;}
1964#endif
1965#ifdef RENDER_SDF
1966float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha;
1967#else
1968#ifdef ICON_TRANSITION
1969vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b);
1970#else
1971out_color=texture(u_texture,v_tex_a);
1972#endif
1973#ifdef COLOR_ADJUSTMENT
1974out_color=u_color_adj_mat*out_color;
1975#endif
1976#endif
1977out_color*=opacity*fade_opacity;
1978#ifdef LIGHTING_3D_MODE
1979out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
1980#ifdef RENDER_SHADOWS
1981float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);
1982#ifdef TERRAIN
1983out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light);
1984#else
1985out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light);
1986#endif
1987#endif
1988#endif
1989#ifdef INDICATOR_CUTOUT
1990out_color=applyCutout(out_color,v_z_offset);
1991#endif
1992#ifdef FEATURE_CUTOUT
1993out_color=apply_feature_cutout(out_color,gl_FragCoord);
1994#endif
1995glFragColor=out_color;
1996#ifdef OVERDRAW_INSPECTOR
1997glFragColor=vec4(1.0);
1998#endif
1999HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
2000#include "_prelude_shadow.vertex.glsl"
2001in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;
2002#ifdef Z_OFFSET
2003in float a_auto_z_offset;
2004#endif
2005#ifdef PROJECTION_GLOBE_VIEW
2006in vec3 a_globe_anchor;in vec3 a_globe_normal;
2007#endif
2008#ifdef ICON_TRANSITION
2009in vec2 a_texb;
2010#endif
2011#ifdef OCCLUSION_QUERIES
2012in float a_occlusion_query_opacity;
2013#endif
2014#ifdef ELEVATED_ROADS
2015in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale;
2016#endif
2017#ifdef INDICATOR_CUTOUT
2018out highp float v_z_offset;
2019#else
2020#ifdef RENDER_SHADOWS
2021out highp float v_z_offset;
2022#endif
2023#endif
2024uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo;
2025#ifdef PROJECTION_GLOBE_VIEW
2026uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix;
2027#endif
2028out vec2 v_tex_a;
2029#ifdef ICON_TRANSITION
2030out vec2 v_tex_b;
2031#endif
2032out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity;
2033#ifdef RENDER_TEXT_AND_SYMBOL
2034out float is_sdf;out vec2 v_tex_a_icon;
2035#endif
2036#ifdef RENDER_SHADOWS
2037uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth;
2038#endif
2039#pragma mapbox: define highp vec4 fill_color
2040#pragma mapbox: define highp vec4 halo_color
2041#pragma mapbox: define lowp float opacity
2042#pragma mapbox: define lowp float halo_width
2043#pragma mapbox: define lowp float halo_blur
2044#pragma mapbox: define lowp float emissive_strength
2045#pragma mapbox: define lowp float occlusion_opacity
2046#pragma mapbox: define lowp float z_offset
2047void main() {
2048#pragma mapbox: initialize highp vec4 fill_color
2049#pragma mapbox: initialize highp vec4 halo_color
2050#pragma mapbox: initialize lowp float opacity
2051#pragma mapbox: initialize lowp float halo_width
2052#pragma mapbox: initialize lowp float halo_blur
2053#pragma mapbox: initialize lowp float emissive_strength
2054#pragma mapbox: initialize lowp float occlusion_opacity
2055#pragma mapbox: initialize lowp float z_offset
2056vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor);
2057#ifdef Z_OFFSET
2058e+=a_auto_z_offset;
2059#endif
2060vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;
2061#ifdef PROJECTION_GLOBE_VIEW
2062mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0;
2063#else
2064world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
2065#endif
2066vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ?
2067camera_to_anchor_distance/u_camera_to_center_distance :
2068u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
20690.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;
2070#ifdef PROJECTION_GLOBE_VIEW
2071vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w;
2072#else
2073offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;
2074#endif
2075vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
2076#ifdef PROJECTION_GLOBE_VIEW
2077#ifdef PROJECTED_POS_ON_VIEWPORT
2078projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0);
2079#else
2080vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);    
2081#endif
2082#else
2083projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
2084#endif
2085highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0);
2086#ifdef TERRAIN
2087#ifdef PITCH_WITH_MAP_TERRAIN
2088vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
2089#endif
2090#endif
2091#ifdef Z_OFFSET
2092z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0;
2093#else
2094z+=u_pitch_with_map ? z_offset : 0.0;
2095#endif
2096float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));
2097#ifdef DEPTH_OCCLUSION
2098float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier;
2099#endif
2100#ifdef OCCLUSION_QUERIES
2101float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;
2102#endif
2103float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos;
2104#ifdef PROJECTION_GLOBE_VIEW
2105vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;
2106#else
2107#ifdef ELEVATED_ROADS
2108vec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y;
2109#else
2110pos=vec3(projected_pos.xy/projected_pos.w+offset,z);
2111#endif
2112#endif
2113gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize;
2114#ifdef RENDER_TEXT_AND_SYMBOL
2115is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon;
2116#endif
2117#ifdef ICON_TRANSITION
2118v_tex_b=a_texb/u_texsize;
2119#endif
2120#ifdef RENDER_SHADOWS
2121vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz;
2122#ifdef NORMAL_OFFSET
2123vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1();
2124#endif
2125v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w;
2126#endif
2127#ifdef INDICATOR_CUTOUT
2128v_z_offset=e;
2129#else
2130#ifdef RENDER_SHADOWS
2131v_z_offset=e;
2132#endif
2133#endif
2134}`),terrainRaster:Zt(`#include "_prelude_fog.fragment.glsl"
2135#include "_prelude_shadow.fragment.glsl"
2136#include "_prelude_lighting.glsl"
2137uniform sampler2D u_image0;in vec2 v_pos0;
2138#ifdef FOG
2139in float v_fog_opacity;
2140#endif
2141#ifdef RENDER_SHADOWS
2142in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
2143#endif
2144uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;
2145#ifdef LIGHTING_3D_MODE
2146const vec3 normal=vec3(0.0,0.0,1.0);
2147#ifdef RENDER_SHADOWS
2148float cutoffOpacity=1.0;
2149#ifdef RENDER_CUTOFF
2150cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);
2151#endif
2152#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2153vec3 unlit_base=image_color.rgb*(1.0-image_color.a);vec3 emissive_base=image_color.rgb*image_color.a;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0;
2154#else
2155float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity));
2156#endif
2157#else
2158float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);
2159#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2160color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;
2161#endif
2162#endif
2163#else
2164color=image_color;
2165#endif
2166#ifdef FOG
2167#ifdef ZERO_EXAGGERATION
2168color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2169#else
2170color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
2171#endif
2172#endif
2173glFragColor=color;
2174#ifdef OVERDRAW_INSPECTOR
2175glFragColor=vec4(1.0);
2176#endif
2177HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2178#include "_prelude_terrain.vertex.glsl"
2179uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;
2180#ifdef FOG
2181out float v_fog_opacity;
2182#endif
2183#ifdef RENDER_SHADOWS
2184uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;
2185#endif
2186void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0);
2187#ifdef FOG
2188#ifdef ZERO_EXAGGERATION
2189v_fog_pos=fog_position(decodedPos);
2190#else
2191v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
2192#endif
2193#endif
2194#ifdef RENDER_SHADOWS
2195vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.);
2196#endif
2197}`),terrainDepth:Zt("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
2198uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_
2198pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Zt(`#include "_prelude_fog.fragment.glsl"
2199in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep(
2200cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb;
2201#ifdef FOG
2202sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
2203#endif
2204sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);
2205#ifdef OVERDRAW_INSPECTOR
2206glFragColor=vec4(1.0);
2207#endif
2208}`,Oh),skyboxGradient:Zt(`#include "_prelude_fog.fragment.glsl"
2209in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5));
2210#ifdef FOG
2211color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
2212#endif
2213color*=u_opacity;glFragColor=color;
2214#ifdef OVERDRAW_INSPECTOR
2215glFragColor=vec4(1.0);
2216#endif
2217}`,Oh),skyboxCapture:Zt
vendor: 3,792 bytes, lines 2217-2228
2217(`
2218in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float;
2219#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)
2220#define BETA_M                  vec3(21e-6,21e-6,21e-6)
2221#define MIE_G                   0.76
2222#define DENSITY_HEIGHT_SCALE_R  8000.0
2223#define DENSITY_HEIGHT_SCALE_M  1200.0
2224#define PLANET_RADIUS           6360e3
2225#define ATMOSPHERE_RADIUS       6420e3
2226#define SAMPLE_STEPS            10
2227#define DENSITY_STEPS           4
2228float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globe
2228Raster:Zt(`#include "_prelude_fog.fragment.glsl"
2229#include "_prelude_lighting.glsl"
2230uniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;
2231#ifndef FOG
2232uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport;
2233#endif
2234void main() {vec4 color;
2235#ifdef CUSTOM_ANTIALIASING
2236highp vec2 uv=gl_FragCoord.xy/u_viewport;
2237#ifdef FLIP_Y
2238uv.y=1.0-uv.y;
2239#endif
2240highp vec3 ray_dir=mix(
2241mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);
2242#ifdef LIGHTING_3D_MODE
2243#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2244raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias);
2245#else
2246raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);
2247#endif
2248#else
2249color=vec4(raster.rgb*antialias,raster.a*antialias);
2250#endif
2251#else
2252color=texture(u_image0,v_pos0);
2253#ifdef LIGHTING_3D_MODE
2254#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
2255color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;
2256#else
2257color=apply_lighting_ground(color);
2258#endif
2259#endif
2260#endif
2261#ifdef FOG
2262color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
2263#endif
2264color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;
2265#ifdef OVERDRAW_INSPECTOR
2266glFragColor=vec4(1.0);
2267#endif
2268HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2269#include "_prelude_terrain.vertex.glsl"
2270uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height;
2271#ifdef GLOBE_POLES
2272in vec3 a_globe_pos;in vec2 a_uv;
2273#else
2274in vec2 a_pos;
2275#endif
2276out vec2 v_pos0;void main() {
2277#ifdef GLOBE_POLES
2278vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
2279#else
2280float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY);
2281#endif
2282v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;
2283#ifdef GLOBE_POLES
2284vec3 up_vector=globe_derived_up_vector;
2285#else
2286vec3 up_vector=elevationVector(tile_pos);
2287#endif
2288float height=elevation(tile_pos);globe_pos+=up_vector*height;
2289#ifndef GLOBE_POLES
2290globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;
2291#endif
2292#ifdef GLOBE_POLES
2293vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
2294#else
2295vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0);
2296#endif
2297gl_Position=u_proj_matrix*interpolated_pos;
2298#ifdef FOG
2299v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
2300#endif
2301}`),globeAtmosphere:Zt(`#include "_prelude_fog.fragment.glsl"
2302uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir;
2303#ifdef PROJECTION_GLOBE_VIEW
2304globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) {
2305#ifdef ALPHA_PASS
2306glFragColor=vec4(0,0,0,0);return;
2307#else
2308#ifdef NATIVE
2309glFragColor=vec4(1,1,1,1);
2310#else
2311glFragColor=vec4(0,0,0,1);
2312#endif
2313return;
2314#endif
2315}
2316#endif
2317highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
23180.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;
2319#ifdef PROJECTION_GLOBE_VIEW
2320highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ?
2321PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t);
2322#else
2323horizon_angle=horizon_angle_mercator;
2324#endif
2325horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_color.rgb;vec3 color_stop_1=u_high_color.rgb;
2325vec3 color_stop_2=u_space_color.rgb;
2326#ifdef ALPHA_PASS
2327float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a);
2328#else
2329vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t);
2330#endif
2331}`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix(
2332mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix(
2333mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:Zt(`#include "_prelude_fog.fragment.glsl"
2334#include "_prelude_shadow.fragment.glsl"
2335#include "_prelude_lighting.glsl"
2336uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix;
2337#ifdef RENDER_SHADOWS
2338in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows;
2339#endif
2340#ifdef OCCLUSION_TEXTURE_TRANSFORM
2341uniform vec4 u_occlusionTextureTransform;
2342#endif
2343#pragma mapbox: define-attribute highp vec3 normal_3f
2344#pragma mapbox: define-attribute highp vec3 color_3f
2345#pragma mapbox: define-attribute highp vec4 color_4f
2346#pragma mapbox: define-attribute highp vec2 uv_2f
2347#pragma mapbox: initialize-attribute highp vec3 normal_3f
2348#pragma mapbox: initialize-attribute highp vec3 color_3f
2349#pragma mapbox: initialize-attribute highp vec4 color_4f
2350#pragma mapbox: initialize-attribute highp vec2 uv_2f
2351#ifdef HAS_ATTRIBUTE_a_pbr
2352in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;
2353#endif
2354#ifdef HAS_TEXTURE_u_baseColorTexture
2355uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;
2356#endif
2357#ifdef HAS_TEXTURE_u_metallicRoughnessTexture
2358uniform sampler2D u_metallicRoughnessTexture;
2359#endif
2360#ifdef HAS_TEXTURE_u_occlusionTexture
2361uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;
2362#endif
2363#ifdef HAS_TEXTURE_u_normalTexture
2364uniform sampler2D u_normalTexture;
2365#endif
2366#ifdef HAS_TEXTURE_u_emissionTexture
2367uniform sampler2D u_emissionTexture;
2368#endif
2369#ifdef APPLY_LUT_ON_GPU
2370uniform highp sampler3D u_lutTexture;
2371#endif
2372#ifdef TERRAIN_FRAGMENT_OCCLUSION
2373in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack;
2374#ifdef DEPTH_D24
2375highp float unpack_depth(highp float depth) {return  depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}
2376#else
2377highp float unpack_depth_rgba(highp vec4 rgba_depth)
2378{const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;}
2379#endif
2380bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size;
2381#ifdef DEPTH_D24
2382highp float depth=unpack_depth(texture(u_depthTexture,coord).r);
2383#else
2384highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));
2385#endif
2386return v_depth > depth+0.0005;}
2387#endif
2388#define saturate(_x) clamp(_x,0.,1.)
2389vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor)
2390{
2391#ifdef LIGHTING_3D_MODE
2392vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;
2393#ifdef RENDER_SHADOWS
2394lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2395#else
2396lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));
2397#endif
2398return apply_lighting(albedo,transformed_normal,lighting_factor);
2399#else
2400vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-light
2400Color),vec3(1.0));return c3;
2401#endif
2402}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;
2403#ifdef HAS_ATTRIBUTE_a_color_3f
2404albedo*=vec4(color_3f,1.0);
2405#endif
2406#ifdef HAS_ATTRIBUTE_a_pbr
2407#else
2408#ifdef HAS_ATTRIBUTE_a_color_4f
2409albedo*=color_4f;
2410#endif
2411#endif
2412#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)
2413vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}
2414#ifdef UNPREMULT_TEXTURE_IN_SHADER
2415if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;
2416#endif
2417if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}
2418#endif
2419vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);
2420#ifdef APPLY_LUT_ON_GPU
2421color=applyLUT(u_lutTexture,color);
2422#endif
2423return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {
2424#ifdef HAS_TEXTURE_u_normalTexture
2425highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;
2426#ifdef FLIP_Y
2427T=-T;B=-B;
2428#endif
2429highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;
2430#else
2431return mat3(1.0);
2432#endif
2433}highp vec3 getNormal(){highp vec3 n;
2434#ifdef HAS_ATTRIBUTE_a_normal_3f
2435n=normalize(normal_3f);
2436#else
2437highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));
2438#ifdef FLIP_Y
2439n=normalize(cross(fdx,fdy));
2440#else
2441n=normalize(cross(fdx,fdy))*-1.0;
2442#endif
2443#endif
2444#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2445vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap);
2446#endif
2447return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor;
2448#ifdef HAS_ATTRIBUTE_a_pbr
2449mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;
2450#endif
2451#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 
2452vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;
2453#endif
2454const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness)
2455{float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH)
2456{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)
2457{float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness)
2458{highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV)
2459{float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat)
2460{
2461#ifdef LIGHTING_3D_MODE
2462return mat.diffuseColor;
2463#else
2464return mat.diffuseColor/PI;
2465#endif
2466}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)
2467{vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal)
2468{vec3 env_light=vec3(0.65,0.65,0.65);
2469#ifdef LIGHTING_3D_MODE
2470float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;
2471#endif
2472vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor)
2473{highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor;
2474#ifdef RENDER_SHADOWS
2475lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
2476#else
2477lighting_factor=NdotL;
2478#endif
2479vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
2479Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;
2480#if !defined(LIGHTING_3D_MODE)
2481const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL);
2482#endif
2483color*=intensityFactor;return color;}void main() {
2484#ifdef TERRAIN_FRAGMENT_OCCLUSION
2485if (isOccluded()) {discard;}
2486#endif
2487vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;
2488#ifdef LIGHTING_3D_MODE
2489lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;
2490#endif
2491vec4 finalColor;
2492#ifdef DIFFUSE_SHADED
2493vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);
2494#ifdef HAS_TEXTURE_u_occlusionTexture
2495float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;
2496#endif
2497finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;
2498#else
2499Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;
2500#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2501#ifdef OCCLUSION_TEXTURE_TRANSFORM
2502vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;
2503#else
2504vec2 uv=uv_2f;
2505#endif
2506ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;
2507#endif
2508vec4 emissive=u_emissiveFactor;
2509#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
2510emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);
2511#endif
2512#ifdef APPLY_LUT_ON_GPU
2513float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;
2514#endif
2515color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;
2516#ifdef HAS_ATTRIBUTE_a_pbr
2517float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb;
2518#ifdef APPLY_LUT_ON_GPU
2519color_mix=applyLUT(u_lutTexture,color_mix);
2520#endif
2521color=mix(color,color_mix,min(1.0,resEmission));
2522#ifdef HAS_ATTRIBUTE_a_color_4f
2523float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
2523y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance);
2524#endif
2525#endif
2526vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);
2527#endif
2528#ifdef FOG
2529finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));
2530#endif
2531#ifdef RENDER_CUTOFF
2532finalColor*=v_cutoff_opacity;
2533#endif
2534#ifdef INDICATOR_CUTOUT
2535finalColor=applyCutout(finalColor,v_position_height.w);
2536#endif
2537#ifdef FEATURE_CUTOUT
2538finalColor=apply_feature_cutout(finalColor,gl_FragCoord);
2539#endif
2540glFragColor=finalColor;
2541#ifdef OVERDRAW_INSPECTOR
2542glFragColor=vec4(1.0);
2543#endif
2544HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2545#include "_prelude_shadow.vertex.glsl"
2546in vec3 a_pos_3f;
2547#pragma mapbox: define-attribute highp vec3 normal_3f
2548#pragma mapbox: define-attribute highp vec2 uv_2f
2549#pragma mapbox: define-attribute highp vec3 color_3f
2550#pragma mapbox: define-attribute highp vec4 color_4f
2551#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr
2552#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength
2553uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;
2554#ifdef INSTANCED_ARRAYS
2555in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2556#else
2557uniform highp mat4 u_normal_matrix;
2558#endif
2559#ifdef RENDER_SHADOWS
2560uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows;
2561#endif
2562out vec4 v_position_height;out lowp vec4 v_color_mix;
2563#ifdef TERRAIN_FRAGMENT_OCCLUSION
2564out highp float v_depth;
2565#endif
2566#ifdef HAS_ATTRIBUTE_a_pbr
2567out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;
2568#endif
2569vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
2570#pragma mapbox: initialize-attribute highp vec3 normal_3f
2571#pragma mapbox: initialize-attribute highp vec2 uv_2f
2572#pragma mapbox: initialize-attribute highp vec3 color_3f
2573#pragma mapbox: initialize-attribute highp vec4 color_4f
2574#pragma mapbox: initialize-attribute-custom highp vec4 pbr
2575#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength
2576highp mat4 normal_matrix;
2577#ifdef INSTANCED_ARRAYS
2578normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2579#else
2580normal_matrix=u_normal_matrix;
2581#endif
2582vec3 local_pos;mat3 rs;
2583#ifdef MODEL_POSITION_ON_GPU
2584vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos;
2585#else
2586local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a);
2587#endif
2588v_position_height.w=a_pos_3f.z;
2589#ifdef HAS_ATTRIBUTE_a_pbr
2590vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x;
2591#endif
2592#ifdef FOG
2593v_fog_pos=fog_position(local_pos);
2594#endif
2595#ifdef RENDER_CUTOFF
2596v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
2597#endif
2598#ifdef TERRAIN_FRAGMENT_OCCLUSION
2599v_depth=gl_Position.z/gl_Position.w;
2600#endif
2601#ifdef HAS_ATTRIBUTE_a_normal_3f
2602#ifdef MODEL_POSITION_ON_GPU
2603float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f);
2604#else
2605normal_3f=vec3(normal_matrix*vec4(normal_3f,0));
2606#endif
2607#endif
2608#ifdef HAS_ATTRIBUTE_a_pbr
2609#ifdef HAS_ATTRIBUTE_a_color_4f
2610v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0);
2611#endif
2612#endif
2613#ifdef RENDER_SHADOWS
2614vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);
2615#ifdef NORMAL_OFFSET
2616#ifdef HAS_ATTRIBUTE_a_normal_3f
2617#ifdef MODEL_POSITION_ON_GPU
2618vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2619#else
2620vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2621#endif
2622#endif
2623#endif
2624v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w;
2625#endif
2626}`),modelDepth:Zt(`in highp float v_depth;void main() {
2627#ifndef DEPTH_TEXTURE
2628glFragColor=pack_depth(v_depth);
2629#endif
2630}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;
2631#ifdef MODEL_POSITION_ON_GPU
2632#ifdef INSTANCED_ARRAYS
2633in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2634#else
2635uniform highp mat4 u_instance;
2636#endif
2637uniform highp mat4 u_node_matrix;
2638#endif
2639void main() {
2640#ifdef MODEL_POSITION_ON_GPU
2641highp mat4 instance;
2642#ifdef INSTANCED_ARRAYS
2643instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2644#else
2645instance=u_instance;
2646#endif
2647vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;
2647rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden);
2648#else
2649gl_Position=u_matrix*vec4(a_pos_3f,1);
2650#endif
2651v_depth=gl_Position.z/gl_Position.w;}`),stars:Zt(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)
2652{float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,`
2653in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:Zt("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}",`
2654in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 
2655uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; 
2656uniform float u_horizontalOscillationRate; 
2657uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+
2658localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}`),rainParticle:Zt("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}",`
2659in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; 
2660uniform float u_velocity; 
2661uniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;
2661pos*=halfBoxSize; 
2662pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+
2663localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}`),vignette:Zt("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:Zt("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl"
2664in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos;
2665#ifdef TERRAIN
2666float e=elevation(world_pos.xy);world_pos.z+=e;
2667#endif
2668vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function oo(l,t){const n=l.replace(/\s*\/\/[^\n]*\n/g,`
2669`).split(`
2670`);for(let c of n)if(c=c.trim(),c[0]==="#"&&c.includes("if")&&!c.includes("endif")){c=c.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const d=c.split(" ");for(const p of d)t.includes(p)||t.push(p)}}function Zt(l,t){const n=/#include\s+"([^"]+)"/g,c=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let d=t.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);d&&(d=d.map(T=>{const S=T.split(" ");return S[S.length-1]}),d=[...new Set(d)]);const p={},m=[],y=[];if(l=l.replace(n,(T,S)=>(y.push(S),"")),(t=t.replace(n,(T,S)=>(m.push(S),""))).includes("flat out"))return void console.error('The usage of "flat" qualifier is disallowed, see: https://bugs.webkit.org/show_bug.cgi?id=268071');let x=[...Il];oo(l,x),oo(t,x);for(const T of[...m,...y])Ls[T]||console.error(`Undefined include: ${T}`),Kn[T]||(Kn[T]=[],oo(Ls[T],Kn[T])),x=[...x,...Kn[T]];return{fragmentSource:l=l.replace(c,(T,S,C,E,M)=>(p[M]=!0,S==="define"?`
2671#ifndef HAS_UNIFORM_u_${M}
2672in ${C} ${E} ${M};
2673#else
2674uniform ${C} ${E} u_${M};
2675#endif
2676`:S==="initialize"?`
2677#ifdef HAS_UNIFORM_u_${M}
2678    ${C} ${E} ${M} = u_${M};
2679#endif
2680`:S==="define-attribute"?`
2681#ifdef HAS_ATTRIBUTE_a_${M}
2682    in ${C} ${E} ${M};
2683#endif
2684`:S==="initialize-attribute"?"":void 0)),vertexSource:t=t.replace(c,(T,S,C,E,M)=>{const D=E==="float"?"vec2":E,z=M.match(/color/)?"color":D;return S==="define-attribute-vertex-shader-only"?`
2685#ifdef HAS_ATTRIBUTE_a_${M}
2686in ${C} ${E} a_${M};
2687#endif
2688`:p[M]?S==="define"?`
2689#ifndef HAS_UNIFORM_u_${M}
2690uniform lowp float u_${M}_t;
2691in ${C} ${D} a_${M};
2692out ${C} ${E} ${M};
2693#else
2694uniform ${C} ${E} u_${M};
2695#endif
2696`:S==="initialize"?z==="vec4"?`
2697#ifndef HAS_UNIFORM_u_${M}
2698    ${M} = a_${M};
2699#else
2700    ${C} ${E} ${M}
2700 = u_${M};
2701#endif
2702`:`
2703#ifndef HAS_UNIFORM_u_${M}
2704    ${M} = unpack_mix_${z}(a_${M}, u_${M}_t);
2705#else
2706    ${C} ${E} ${M} = u_${M};
2707#endif
2708`:S==="define-attribute"?`
2709#ifdef HAS_ATTRIBUTE_a_${M}
2710    in ${C} ${E} a_${M};
2711    out ${C} ${E} ${M};
2712#endif
2713`:S==="initialize-attribute"?`
2714#ifdef HAS_ATTRIBUTE_a_${M}
2715    ${M} = a_${M};
2716#endif
2717`:void 0:S==="define"?`
2718#ifndef HAS_UNIFORM_u_${M}
2719uniform lowp float u_${M}_t;
2720in ${C} ${D} a_${M};
2721#else
2722uniform ${C} ${E} u_${M};
2723#endif
2724`:S==="define-instanced"?z==="mat4"?`
2725#ifdef INSTANCED_ARRAYS
2726in vec4 a_${M}0;
2727in vec4 a_${M}1;
2728in vec4 a_${M}2;
2729in vec4 a_${M}3;
2730#else
2731uniform ${C} ${E} u_${M};
2732#endif
2733`:`
2734#ifdef INSTANCED_ARRAYS
2735in ${C} ${D} a_${M};
2736#else
2737uniform ${C} ${E} u_${M};
2738#endif
2739`:S==="initialize-attribute-custom"?`
2740#ifdef HAS_ATTRIBUTE_a_${M}
2741    ${C} ${E} ${M} = a_${M};
2742#endif
2743`:z==="vec4"?`
2744#ifndef HAS_UNIFORM_u_${M}
2745    ${C} ${E} ${M} = a_${M};
2746#else
2747    ${C} ${E} ${M} = u_${M};
2748#endif
2749`:`
2750#ifndef HAS_UNIFORM_u_${M}
2751    ${C} ${E} ${M} = unpack_mix_${z}(a_${M}, u_${M}_t);
2752#else
2753    ${C} ${E} ${M} = u_${M};
2754#endif
2755`}),staticAttributes:d,usedDefines:x,vertexIncludes:m,fragmentIncludes:y}}class Ff{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(t,n,c,d,p,m,y,x){this.context=t;let T=this.boundPaintVertexBuffers.length!==d.length;for(let C=0;!T&&C<d.length;C++)this.boundPaintVertexBuffers[C]!==d[C]&&(T=!0);let S=this.boundDynamicVertexBuffers.length!==y.length;for(let C=0;!S&&C<y.length;C++)this.boundDynamicVertexBuffers[C]!==y[C]&&(S=!0);if(!this.vao||this.boundProgram!==n||this.boundLayoutVertexBuffer!==c||T||S||this.boundIndexBuffer!==p||this.boundVertexOffset!==m)this.freshBind(n,c,d,p,m,y,x);else{t.bindVertexArrayOES.set(this.vao);for(const C of y)C&&(C.bind(),x&&C.instanceCount&&C.setVertexAttribDivisor(t.gl,n,x));p&&p.dynamicDraw&&p.bind()}}freshBind(t,n,c,d,p,m,y){const x=t.numAttributes,T=this.context,S=T.gl;this.vao&&this.destroy(),this.vao=T.gl.createVertexArray(),T.bindVertexArrayOES.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=n,this.boundPaintVertexBuffers=c,this.boundIndexBuffer=d,this.boundVertexOffset=p,this.boundDynamicVertexBuffers=m,n.enableAttributes(S,t),n.bind(),n.setVertexAttribPointers(S,t,p);for(const C of c)C.enableAttributes(S,t),C.bind(),C.setVertexAttribPointers(S,t,p);for(const C of m)C&&(C.enableAttributes(S,t),C.bind(),C.setVertexAttribPointers(S,t,p),y&&C.instanceCount&&C.setVertexAttribDivisor(S,t,y));d&&d.bind(),T.currentNumAttributes=x}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Bh(l,t){const n=Math.pow(2,t.canonical.z),c=t.canonical.y;return[new s.ac(0,c/n).toLngLat().lat,new s.ac(0,(c+1)/n).toLngLat().lat]}function Of(l,t,n,c,d,p,m){const y=l.context,x=y.gl,T=n.hillshadeFBO;if(!T)return;l.prepareDrawTile();const S=l.isTileAffectedByFog(t),C=l.getOrCreateProgram("hillshade",{overrideFog:S});y.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,T.colorAttachment.get());const E=((F,L,N,U)=>{const q=N.paint.get("hillshade-shadow-color"),Y=N.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",te=N.paint.get("hillshade-highlight-color"),re=N.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",K=N.paint.get("hillshade-accent-color"),J=N.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Q=N.paint.get("hillshade-emissive-strength");let me=s.al(N.paint.get("hillshade-illumination-direction"));if(N.paint.get("hillshade-illumination-anchor")==="viewport")me-=F.transform.angle;else if(F.style&&F.style.enable3dLights()&&F.style.directionalLight){const Ae=F.style.directionalLight.properties.get("direction"),ve=s.d1(Ae.x,Ae.y,Ae.z);me=s.al(ve[1])}const ae=!F.options.moving;return{u_matrix:U||F.transform.calculateProjMatrix(L.tileID.toUnwrapped(),ae),u_image:0,u_latrange:Bh(0,L.tileID),u_light:[N.paint.get("hillshade-exaggeration"),me],u_shadow:q.toPremultipliedRenderColor(Y?null:N.lut),u_highlight:te.toPremultipliedRenderColor(re?null:N.lut),u_emissive_strength:Q,u_accent:K.toPremultipliedRenderColor(J?null:N.lut)}})(l,n,c,l.terrain?t.projMatrix:null);l.uploadCommonUniforms(y,C,t.toUnwrapped());const{tileBoundsBuffer:M,tileBoundsIndexBuffer:D,tileBoundsSegments:z}=l.getTileBoundsBuffers(n);C.draw(l,x.TRIANGLES,d,p,m,_t.disabled,E,c.id,M,D,z)}
vendor: 38,642 bytes, lines 2755-2756
2755function Nh(l,t,n){if(!t.needsDEMTextureUpload)return;const c=l.context,d=c.gl;c.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||l.getTileTexture(n.stride);const p=n.getPixels();t.demTexture?t.demTexture.update(p,{premultiply:!1}):t.demTexture=new s.T(c,p,d.R32F,{premultiply:!1}),t.needsDEMTextureUpload=!1}function Bd(l,t,n){const c=l.context,d=c.gl;if(!t.dem)return;const p=t.dem;if(c.activeTexture.set(d.TEXTURE1),Nh(l,t,p),!t.demTexture)return;t.demTexture.bind(d.NEAREST,d.CLAMP_TO_EDGE);const m=p.dim;c.activeTexture.set(d.TEXTURE0);let y=t.hillshadeFBO;if(!y){const E=new s.T(c,{width:m,height:m,data:null},d.RGBA8);E.bind(d.LINEAR,d.CLAMP_TO_EDGE),y=t.hillshadeFBO=c.createFramebuffer(m,m,!0,"renderbuffer"),y.colorAttachment.set(E.texture)}c.bindFramebuffer.set(y.framebuffer),c.viewport.set([0,0,m,m]);const{tileBoundsBuffer:x,tileBoundsIndexBuffer:T,tileBoundsSegments:S}=l.getMercatorTileBoundsBuffers(),C=[];l.linearFloatFilteringSupported()&&C.push("TERRAIN_DEM_FLOAT_FORMAT"),l.getOrCreateProgram("hillshadePrepare",{defines:C}).draw(l,d.TRIANGLES,rt.disabled,vt.disabled,Rt.unblended,_t.disabled,((E,M)=>{const D=M.stride,z=s.bz();return s.ca(z,0,s.aj,-s.aj,0,0,1),s.bo(z,z,[0,-s.aj,0]),{u_matrix:z,u_image:1,u_dimension:[D,D],u_zoom:E.overscaledZ}})(t.tileID,p),n.id,x,T,S),t.needsHillshadePrepare=!1}class ji{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class kf extends ji{getDefault(){return s.am.transparent.toNonPremultipliedRenderColor(null)}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Bf extends ji{getDefault(){return 1}set(t){(t!==this.current||this.dirty)&&(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}}class Nf extends ji{getDefault(){return 0}set(t){(t!==this.current||this.dirty)&&(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}}class Vf extends ji{getDefault(){return[!0,!0,!0,!0]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Nd extends ji{getDefault(){return!0}set(t){(t!==this.current||this.dirty)&&(this.gl.depthMask(t),this.current=t,this.dirty=!1)}}class jf extends ji{getDefault(){return 255}set(t){(t!==this.current||this.dirty)&&(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}}class vc extends ji{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){const n=this.current;(t.func!==n.func||t.ref!==n.ref||t.mask!==n.mask||this.dirty)&&(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}}class Uf extends ji{getDefault(){const t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||this.dirty)&&(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}}class Vd extends ji{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.STENCIL_TEST):n.disable(n.STENCIL_TEST),this.current=t,this.dirty=!1}}class Vh extends ji{getDefault(){return[0,1]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||this.dirty)&&(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}}class bc extends ji{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.DEPTH_TEST):n.disable(n.DEPTH_TEST),this.current=t,this.dirty=!1}}class jh extends ji{getDefault(){return this.gl.LESS}set(t){(t!==this.current||this.dirty)&&(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}}class Fs extends ji{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.BLEND):n.disable(n.BLEND),this.current=t,this.dirty=!1}}class ya extends ji{getDefault(){const t=this.gl;return[t.ONE,t.ZERO,t.ONE,t.ZERO]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.blendFuncSeparate(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class wc extends ji{getDefault(){return s.am.transparent.toNonPremultipliedRenderColor(null)}set(t){const n=this.current;(t.r!==n.r||t.g!==n.g||t.b!==n.b||t.a!==n.a||this.dirty)&&(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}}class Tc extends ji{getDefault(){return this.gl.FUNC_ADD}set(t){(t!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(t,t),this.current=t,this.dirty=!1)}}class xa extends ji{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;t?n.enable(n.CULL_FACE):n.disable(n.CULL_FACE),this.current=t,this.dirty=!1}}class jd extends ji{getDefault(){return this.gl.BACK}set(t){(t!==this.current||this.dirty)&&(this.gl.cullFace(t),this.current=t,this.dirty=!1)}}class Uh extends ji{getDefault(){return this.gl.CCW}set(t){(t!==this.current||this.dirty)&&(this.gl.frontFace(t),this.current=t,this.dirty=!1)}}let Ud=class extends ji{getDefault(){return null}set(l){(l!==this.current||this.dirty)&&(this.gl.useProgram(l),this.current=l,this.dirty=!1)}};class va extends ji{getDefault(){return this.gl.TEXTURE0}set(t){(t!==this.current||this.dirty)&&(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}}class Sc extends ji{getDefault(){const t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){const n=this.current;(t[0]!==n[0]||t[1]!==n[1]||t[2]!==n[2]||t[3]!==n[3]||this.dirty)&&(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}}class Ec extends ji{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindFramebuffer(n.FRAMEBUFFER,t),this.current=t,this.dirty=!1}}class Gh extends ji{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindRenderbuffer(n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Ic extends ji{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindTexture(n.TEXTURE_2D,t),this.current=t,this.dirty=!1}}class Cl extends ji{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.bindBuffer(n.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class Gd extends ji{getDefault(){return null}set(t){const n=this.gl;n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}}class qd extends ji{getDefault(){return null}set(t){this.gl&&(t!==this.current||this.dirty)&&(this.gl.bindVertexArray(t),this.current=t,this.dirty=!1)}}class Hd extends ji{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}}class ba extends ji{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}}class $d extends ji{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;const n=this.gl;n.pixelStorei(n.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}}class qh extends ji{constructor(t,n){super(t),this.context=t,this.parent=n}getDefault(){return null}}class Gf extends qh{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class Zd extends qh{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferRenderbuffer(n.FRAMEBUFFER,this.attachment(),n.RENDERBUFFER,t),this.current=t,this.dirty=!1}}class Hh extends qh{attachment(){return this.gl.DEPTH_ATTACHMENT}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const n=this.gl;n.framebufferTexture2D(n.FRAMEBUFFER,this.attachment(),n.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}}class $h extends Zd{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Zh=(l,t,n)=>({u_matrix:l,u_image0:0,u_skirt_height:t,u_ground_shadow_factor:n}),Ac=(l,t,n,c,d,p,m,y,x,T,S,C,E,M,D,z)=>({u_proj_matrix:Float32Array.from(l),u_globe_matrix:t,u_normalize_matrix:Float32Array.from(c),u_merc_matrix:n,u_zoom_transition:d,u_merc_center:p,u_image0:0,u_frustum_tl:m,u_frustum_tr:y,u_frustum_br:x,u_frustum_bl:T,u_globe_pos:S,u_globe_radius:C,u_viewport:E,u_grid_matrix:z?Float32Array.from(z):new Float32Array(9),u_skirt_height:M,u_far_z_cutoff:D});function Wh(l,t){return l!=null&&t!=null&&!(!l.hasData()||!t.hasData())&&l.demTexture!=null&&t.demTexture!=null&&l.tileID.key!==t.tileID.key}const Os=new class{constructor(){this.operations={}}newMorphing(l,t,n,c,d){if(l in this.operations){const p=this.operations[l];p.to.tileID.key!==n.tileID.key&&(p.queued=n)}else this.operations[l]={startTime:c,phase:0,duration:d,from:t,to:n,queued:null}}getMorphValuesForProxy(l){if(!(l in this.operations))return null;const t=this.operations[l];return{from:t.from,to:t.to,phase:t.phase}}update(l){for(const t in this.operations){const n=this.operations[t];for(n.phase=(l-n.startTime)/n.duration;n.phase>=1||!this._validOp(n);)if(!this._nextOp(n,l)){delete this.operations[t];break}}}_nextOp(l,t){return!!l.queued&&(l.from=l.to,l.to=l.queued,l.queued=null,l.phase=0,l.startTime=t,!0)}_validOp(l){return l.from.hasData()&&l.to.hasData()}},Wd={0:null,1:"TERRAIN_VERTEX_MORPHING"};function wa(l,t,n){if(t===0)return 0;const c=t<1&&n===514?.25/t:1;return 6*Math.pow(1.5,22-l)*Math.max(t,1)*c}function Ml(l,t){const n=1<<l.z;return!t&&(l.x===0||l.x===n-1)||l.y===0||l.y===n-1}const Cc=l=>({u_matrix:l});function _n(l,t,n,c,d){if(d>0){const p=s.q.now(),m=(p-l.timeAdded)/d,y=t?(p-t.timeAdded)/d:-1,x=n.getSource(),T=c.coveringZoomLevel({tileSize:x.tileSize,roundZoom:x.roundZoom}),S=!t||Math.abs(t.tileID.overscaledZ-T)>Math.abs(l.tileID.overscaledZ-T),C=S&&l.refreshedUponExpiration?1:s.ay(S?m:1-y,0,1);return l.refreshedUponExpiration&&m>=1&&(l.refreshedUponExpiration=!1),t?{opacity:1,mix:1-C}:{opacity:C,mix:0}}return{opacity:1,mix:0}}class Xh extends fn{constructor(t){const n=ol("mock-dem",{type:"raster-dem",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("mock-dem",n,!1),n.setEventedParent(this),this._sourceLoaded=!0}_loadTile(t,n){t.state="loaded",n(null)}}class Mc extends fn{constructor(t){const n=ol("proxy",{type:"geojson",maxzoom:t.transform.maxZoom},t.style.dispatcher,t.style);super("proxy",n,!1),n.setEventedParent(this),this.map=this.getSource().map=t,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(t,n,c){if(t.freezeTileCoverage)return;this.transform=t;const d=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((p,m)=>{if(p[m.key]="",!this._tiles[m.key]){const y=new Is(m,this._source.tileSize*m.overscaleFactor(),t.tileZoom,void 0,void 0,this._source.worldview);y.state="loaded",this._tiles[m.key]=y}return p},{});for(const p in this._tiles)p in d||(this.freeFBO(p),this._tiles[p].unloadVectorData(),delete this._tiles[p])}freeFBO(t){const n=this.proxyCachedFBO[t];if(n!==void 0){const c=Object.values(n);this.renderCachePool.push(...c),delete this.proxyCachedFBO[t]}}deallocRenderCache(){this.renderCache.forEach(t=>t.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Pl extends s.aM{constructor(t,n,c){super(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y),this.proxyTileKey=n,this.projMatrix=c}}class Pc extends s.dF{constructor(t,n){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},t.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),t.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),t.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=t,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[c,d,p]=function(x){const T=new s.ba,S=new s.a_,C=131;T.reserve(17161),S.reserve(33800);const E=s.aj/128,M=s.aj+E/2,D=M+E;for(let F=-E;F<D;F+=E)for(let L=-E;L<D;L+=E){const N=L<0||L>M||F<0||F>M?24575:0,U=s.ay(Math.round(L),0,s.aj),q=s.ay(Math.round(F),0,s.aj);T.emplaceBack(U+N,q)}const z=(F,L)=>{const N=L*C+F;S.emplaceBack(N+1,N,N+C),S.emplaceBack(N+C,N+C+1,N+1)};for(let F=1;F<129;F++)for(let L=1;L<129;L++)z(L,F);return[0,129].forEach(F=>{for(let L=0;L<130;L++)z(L,F),z(F,L)}),[T,S,32768]}(),m=t.context;this.gridBuffer=m.createVertexBuffer(c,s.bc.members),this.gridIndexBuffer=m.createIndexBuffer(d),this.gridSegments=s.bd.simpleSegment(0,0,c.length,d.length),this.gridNoSkirtSegments=s.bd.simpleSegment(0,0,c.length,p),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Mc(n.map),this.orthoMatrix=s.bz(),s.ca(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,s.aj,0,s.aj,0,1);const y=m.gl;this._overlapStencilMode=new vt({func:y.GEQUAL,mask:255},0,255,y.KEEP,y.KEEP,y.REPLACE),this._previousZoom=t.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=n,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Xh(n.map),this._pendingGroundEffectLayers=[]}set style(t){t.on("data",this._onStyleDataEvent.bind(this)),this._style=t,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(t,n,c){if(t&&t.terrain){this._style!==t&&(this.style=t,this._evaluationZoom=void 0);const d=t.terrain.properties,p=t.terrain.drapeRenderMode===0,m=t.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=s.q.now();const y=t.terrain&&t.terrain.scope,x=d.get("source"),T=p?this._mockSourceCache:t.getSourceCache(x,y);if(!T)return void s.w(`Couldn't find terrain source "${x}".`);if(this.sourceCache=T,this._attenuationRange=t.terrain.getAttenuationRange(),this._exaggeration=m?this.calculateExaggeration(n):d.get("exaggeration"),!n.projection.requiresDraping&&m&&this._exaggeration===0)return void this._disable();this.enabled=!0;const S=()=>{this.sourceCache.used&&s.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
2756This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const C=this.getScaledDemTileSize();this.sourceCache.update(n,C,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,S(),this._initializing=!0),S(),n.updateElevation(!0,c),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(n),this._emptyDEMTextureDirty=!0,this._previousZoom=n.zoom}else this._disable()}calculateExaggeration(t){if(this._attenuationRange&&t.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(t.zoom);const n=this._previousCameraAltitude,c=t.getFreeCameraOptions().position.z/t.pixelsPerMeter*t.worldSize;this._previousCameraAltitude=c;const d=n!=null?c-n:Number.MAX_VALUE;if(Math.abs(d)<2)return this._exaggeration;const p=t.zoom,m=this._style.terrain;if(!this._previousUpdateTimestamp)return m.getExaggeration(p);let y=p-this._previousZoom;const x=this._previousUpdateTimestamp;let T=p;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(p-T)>.5&&(y=.5*(p-T+y)),y*d<0&&(T+=y)),this._evaluationZoom=T;const S=m.getExaggeration(T),C=S===m.getExaggeration(Math.max(0,T-.1));if(C&&Math.abs(S-this._exaggeration)<.01)return S;let E=Math.min(.1,.00375*(this._updateTimestamp-x));return(C||S<.1||Math.abs(y)<1e-4)&&(E=Math.min(.2,4*E)),s.ai(this._exaggeration,S,E)}resetTileLookupCache(t){this._findCoveringTileCache[t]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(t){t.coord&&t.dataType==="source"?this._clearRenderCacheForTile(t.sourceCacheId,t.coord):t.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const t in this._style._mergedSourceCaches)this._style._mergedSourceCaches[t].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(t=>t.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const t=2*this.proxySourceCache.getSource().tileSize;return[t,t]}set useVertexMorphing(t){this._useVertexMorphing=t}updateTileBinding(t){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const n=this.proxySourceCache,c=this.painter.transform;this._initializing&&(this._initializing=c._centerAltitude===0&&this.getAtPointOrZero(s.ac.fromLngLat(c.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const d=this.proxyCoords=n.getIds().map(x=>{const T=n.getTileByID(x).tileID;return T.projMatrix=c.calculateProjMatrix(T.toUnwrapped()),T});(function(x,T){const S=T.transform.pointCoordinate(T.transform.getCameraPoint()),C=new s.P(S.x,S.y);x.sort((E,M)=>{if(M.overscaledZ-E.overscaledZ)return M.overscaledZ-E.overscaledZ;const D=new s.P(E.canonical.x+(1<<E.canonical.z)*E.wrap,E.canonical.y),z=new s.P(M.canonical.x+(1<<M.canonical.z)*M.wrap,M.canonical.y),F=C.mult(1<<E.canonical.z);return F.x-=.5,F.y-=.5,F.distSqr(D)-F.distSqr(z)})})(d,this.painter);const p=this.proxyToSource||{};this.proxyToSource={},d.forEach(x=>{this.proxyToSource[x.key]={}}),this.terrainTileForTile={};const m=this._style._mergedSourceCaches;for(const x in m){const T=m[x];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,t[x],p),T.usedForTerrain))continue;const S=t[x];T.getSource().reparseOverscaled&&this._assignTerrainTiles(S)}this.proxiedCoords[n.id]=d.map(x=>new Pl(x,x.key,this.orthoMatrix)),this._assignTerrainTiles(d),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(p),this.renderingToTexture=!1;const y={};this._visibleDemTiles=[];for(const x of this.proxyCoords){const T=this.terrainTileForTile[x.key];if(!T)continue;const S=T.tileID.key;S in y||(this._visibleDemTiles.push(T),y[S]=S)}}_assignTerrainTiles(t){this._initializing||t.forEach(n=>{if(this.terrainTileForTile[n.key])return;const c=this._findTileCoveringTileID(n,this.sourceCache);c&&(this.terrainTileForTile[n.key]=c)})}_prepareDEMTextures(){const t=this.painter.context,n=t.gl;for(const c in this.terrainTileForTile){const d=this.terrainTileForTile[c],p=d.dem;!p||d.demTexture&&!d.needsDEMTextureUpload||(t.activeTexture.set(n.TEXTURE1),Nh(this.painter,d,p))}}_prepareDemTileUniforms(t,n,c,d){if(!n||n.demTexture==null)return!1;const p=t.tileID.canonical,m=Math.pow(2,n.tileID.canonical.z-p.z),y=d||"";return c[`u_dem_tl${y}`]=[p.x*m%1,p.y*m%1],c[`u_dem_scale${y}`]=m,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let t=0;const n=this._visibleDemTiles.reduce((c,d)=>{if(!d.dem)return c;const p=d.dem.tree.minimums[0];return p>0&&t++,c+p},0);return t?n/t:0}_updateEmptyDEMTexture(){const t=this.painter.context,n=t.gl;t.activeTexture.set(n.TEXTURE2);const c=this._getLoadedAreaMinimum(),d=new s.dG({width:1,height:1},new Float32Array([c]));this._emptyDEMTextureDirty=!1;let p=this._emptyDEMTexture;return p?p.update(d,{premultiply:!1}):p=this._emptyDEMTexture=new s.T(t,d,n.R32F,{premultiply:!1}),p}setupElevationDraw(t,n,c){const d=this.painter.context,p=d.gl,m={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};m.u_exaggeration=this.exaggeration();let y=null,x=null,T=1;if(c&&c.morphing&&this._useVertexMorphing){const M=c.morphing.srcDemTile,D=c.morphing.dstDemTile;T=c.morphing.phase,M&&D&&(this._prepareDemTileUniforms(t,M,m,"_prev")&&(x=M),this._prepareDemTileUniforms(t,D,m)&&(y=D))}const S=M=>M&&M.demTexture&&this.painter.linearFloatFilteringSupported()?p.LINEAR:p.NEAREST;let C=null;var E;if(this.enabled?x&&y?(C=y.demTexture,d.activeTexture.set(p.TEXTURE4),x.demTexture.bind(S(x),p.CLAMP_TO_EDGE),m.u_dem_lerp=T):(y=this.terrainTileForTile[t.tileID.key],C=this._prepareDemTileUniforms(t,y,m)?y.demTexture:this.emptyDEMTexture):C=this.emptyDEMTexture,d.activeTexture.set(p.TEXTURE2),C&&(m.u_dem_size=(E=C).size[0]===1?1:E.size[0]-2,C.bind(S(y),p.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(c&&c.useDepthForOcclusion,n,m),c&&c.useMeterToDem&&y){const M=(1<<y.tileID.canonical.z)*s.cb(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;m.u_meter_to_dem=M}if(c&&c.labelPlaneMatrixInv&&(m.u_label_plane_matrix_inv=c.labelPlaneMatrixInv),n.setTerrainUniformValues(d,m),this.painter.transform.projection.name==="globe"){const M=this.globeUniformValues(this.painter.transform,t.tileID.canonical,c&&c.useDenormalizedUpVectorScale);n.setGlobeUniformValues(d,M)}}globeUniformValues(t,n,c){const d=t.projection;return{u_tile_tl_up:d.upVector(n,0,0),u_tile_tr_up:d.upVector(n,s.aj,0),u_tile_br_up:d.upVector(n,s.aj,s.aj),u_tile_bl_up:d.upVector(n,0,s.aj),u_tile_up_scale:c?s.dH(1):d.upVectorScale(n,t.center.lat,t.worldSize).metersToTile}}renderToBackBuffer(t){const n=this.painter,c=this.painter.context;t.length!==0&&(c.bindFramebuffer.set(null),c.viewport.set([0,0,n.width,n.height]),n.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(d,p,m,y,x){if(d.transform.projection.name==="globe")(function(T,S,C,E,M){const D=T.context,z=D.gl;let F,L;const N=T.transform,U=s.dy(T,D,N),q=(Ae,ve)=>{if(L===ve)return;const Me=[Wd[ve],"PROJECTION_GLOBE_VIEW"];U&&Me.push("CUSTOM_ANTIALIASING");const Ue=T.isTileAffectedByFog(Ae);F=T.getOrCreateProgram("globeRaster",{defines:Me,overrideFog:Ue}),L=ve},Y=T.colorModeForRenderPass(),te=new rt(z.LEQUAL,rt.ReadWrite,T.depthRangeFor3D);Os.update(M);const re=s.dz(N),K=[s.aD(N.center.lng),s.aH(N.center.lat)],J=T.globeSharedBuffers,Q=[N.width*s.q.devicePixelRatio,N.height*s.q.devicePixelRatio],me=Float32Array.from(N.globeMatrix),ae={useDenormalizedUpVectorScale:!0};{const Ae=T.transform,ve=wa(Ae.zoom,S.exaggeration(),S.sourceCache._source.tileSize);L=-1;const Me=z.TRIANGLES;for(const Ue of E){const _e=C.getTile(Ue),se=vt.disabled,Te=S.prevTerrainTileForTile[Ue.key],ge=S.terrainTileForTile[Ue.key];Wh(Te,ge)&&Os.newMorphing(Ue.key,Te,ge,M,250),D.activeTexture.set(z.TEXTURE0),_e.texture&&_e.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);const Re=Os.getMorphValuesForProxy(Ue.key),De=Re?1:0;Re&&s.L(ae,{morphing:{srcDemTile:Re.from,dstDemTile:Re.to,phase:s.dx(Re.phase)}});const Fe=s.dA(Ue.canonical),We=s.dB(Fe.getCenter().lat),lt=s.dC(Ue.canonical,Fe,We,Ae.worldSize/Ae._pixelsPerMercatorPixel),pt=s.bh(s.dD(Ue.canonical)),et=Ac(Ae.expandedFarZProjMatrix,me,re,pt,s.ah(Ae.zoom),K,Ae.frustumCorners.TL,Ae.frustumCorners.TR,Ae.frustumCorners.BR,Ae.frustumCorners.BL,Ae.globeCenterInViewSpace,Ae.globeRadius,Q,ve,Ae._farZ,lt);if(q(Ue,De),F&&(S.setupElevationDraw(_e,F,ae),T.uploadCommonUniforms(D,F,Ue.toUnwrapped()),J)){const[ut,ct,Tt]=J.getGridBuffers(We,ve!==0);F.draw(T,Me,te,se,Y,_t.backCCW,et,"globe_raster",ut,ct,Tt)}}}if(J&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const Ae=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];U&&Ae.push("CUSTOM_ANTIALIASING"),F=T.getOrCreateProgram("globeRaster",{defines:Ae});for(const ve of E){const{x:Me,y:Ue,z:_e}=ve.canonical,se=Ue===0,Te=Ue===(1<<_e)-1,[ge,Re,De,Fe]=J.getPoleBuffers(_e,!1);if(Fe&&(se||Te)){const We=C.getTile(ve);D.activeTexture.set(z.TEXTURE0),We.texture&&We.texture.bind(z.LINEAR,z.CLAMP_TO_EDGE);let lt=s.dE(_e,Me,N);const pt=s.bh(s.dD(ve.canonical)),et=(ut,ct)=>ut.draw(T,z.TRIANGLES,te,vt.disabled,Y,_t.disabled,Ac(N.expandedFarZProjMatrix,lt,lt,pt,0,K,N.frustumCorners.TL,N.frustumCorners.TR,N.frustumCorners.BR,N.frustumCorners.BL,N.globeCenterInViewSpace,N.globeRadius,Q,0,N._farZ),"globe_pole_raster",ct,De,Fe);S.setupElevationDraw(We,F,ae),T.uploadCommonUniforms(D,F,ve.toUnwrapped()),se&&T.renderDefaultNorthPole&&et(F,ge),Te&&T.renderDefaultSouthPole&&(lt=s.cP(s.bz(),lt,[1,-1,1]),et(F,Re))}}}})(d,p,m,y,x);else{const T=d.context,S=T.gl;let C,E;const M=d.shadowRenderer,D=uo(d,d.longestCutoffRange),z=Y=>{if(E===Y)return;const te=[];te.push(Wd[Y]),D.shouldRenderCutoff&&te.push("RENDER_CUTOFF"),M&&(te.push("RENDER_SHADOWS","DEPTH_TEXTURE"),M.useNormalOffset&&te.push("NORMAL_OFFSET")),C=d.getOrCreateProgram("terrainRaster",{defines:te}),E=Y},F=d.colorModeForRenderPass(),L=new rt(S.LEQUAL,rt.ReadWrite,d.depthRangeFor3D);Os.update(x);const N=d.transform,U=wa(N.zoom,p.exaggeration(),p.sourceCache._source.tileSize);let q=[0,0,0];if(M){const Y=d.style.directionalLight,te=d.style.ambientLight;Y&&te&&(q=Ds(d.style,Y,te))}{E=-1;const Y=S.TRIANGLES,[te,re]=[p.gridIndexBuffer,p.gridSegments];for(const K of y){const J=m.getTile(K),Q=vt.disabled,me=p.prevTerrainTileForTile[K.key],ae=p.terrainTileForTile[K.key];Wh(me,ae)&&Os.newMorphing(K.key,me,ae,x,250),T.activeTexture.set(S.TEXTURE0),J.texture&&J.texture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const Ae=Os.getMorphValuesForProxy(K.key),ve=Ae?1:0;let Me;Ae&&(Me={morphing:{srcDemTile:Ae.from,dstDemTile:Ae.to,phase:s.dx(Ae.phase)}});const Ue=Zh(K.projMatrix,Ml(K.canonical,N.renderWorldCopies)?U/10:U,q);if(z(ve),!C)continue;p.setupElevationDraw(J,C,Me);const _e=K.toUnwrapped();M&&M.setupShadows(_e,C),d.uploadCommonUniforms(T,C,_e,null,D),C.draw(d,Y,L,Q,F,_t.backCCW,Ue,"terrain_raster",p.gridBuffer,te,re)}}}}(n,this,this.proxySourceCache,t,this._updateTimestamp),this.renderingToTexture=!0,n.gpuTimingDeferredRenderEnd(),t.splice(0,t.length))}renderBatch(t){if(this._drapedRenderBatches.length===0)return t+1;this.renderingToTexture=!0;const n=this.painter,c=this.painter.context,d=this.proxySourceCache,p=this.proxiedCoords[d.id],m=this._drapedRenderBatches.shift(),y=n.style.order,x=[];let T=0;for(const S of p){const C=d.getTileByID(S.proxyTileKey),E=d.proxyCachedFBO[S.key]?d.proxyCachedFBO[S.key][t]:void 0,M=E!==void 0?d.renderCache[E]:this.pool[T++],D=E!==void 0;if(C.texture=M.tex,D&&!M.dirty){x.push(C.tileID);continue}let z;c.bindFramebuffer.set(M.fb.framebuffer),this.renderedToTile=!1,M.dirty&&(c.clear({color:s.am.transparent,stencil:0}),M.dirty=!1);for(let F=m.start;F<=m.end;++F){const L=n.style._mergedLayers[y[F]];if(L.isHidden(n.transform.zoom))continue;const N=n.style.getLayerSourceCache(L),U=N?this.proxyToSource[S.key][N.id]:[S];if(!U)continue;const q=U;c.viewport.set([0,0,M.fb.width,M.fb.height]),z!==(N?N.id:null)&&(this._setupStencil(M,U,L,N),z=N?N.id:null),n.renderLayer(n,N,L,q)}if(this._drapedRenderBatches.length===0)for(const F of this._pendingGroundEffectLayers){const L=n.style._mergedLayers[y[F]];if(L.isHidden(n.transform.zoom))continue;const N=n.style.getLayerSourceCache(L),U=N?this.proxyToSource[S.key][N.id]:[S];if(!U)continue;const q=U;c.viewport.set([0,0,M.fb.width,M.fb.height]),z!==(N?N.id:null)&&(this._setupStencil(M,U,L,N),z=N?N.id:null),n.renderLayer(n,N,L,q)}this.renderedToTile?(M.dirty=!0,x.push(C.tileID)):D||--T,T===5&&(T=0,this.renderToBackBuffer(x))}return this.renderToBackBuffer(x),this.renderingToTexture=!1,c.bindFramebuffer.set(null),c.viewport.set([0,0,n.width,n.height]),m.end+1}postRender(){}isLayerOrderingCorrect(t){const n=t.order.length;let c=-1,d=n;for(let p=0;p<n;++p)this._style.isLayerDraped(t._mergedLayers[t.order[p]])?c=Math.max(c,p):d=Math.min(d,p);return d>c}getMinElevationBelowMSL(){let t=0;return this._visibleDemTiles.filter(n=>n.dem).forEach(n=>{t=Math.min(t,n.dem.tree.minimums[0])}),t===0?t:(t-30)*this._exaggeration}raycast(t,n,c){if(!this._visibleDemTiles)return null;const d=this._visibleDemTiles.filter(p=>p.dem).map(p=>{const m=p.tileID,y=1<<m.overscaledZ,{x,y:T}=m.canonical,S=x/y,C=(x+1)/y,E=T/y,M=(T+1)/y;return{minx:S,miny:E,maxx:C,maxy:M,t:p.dem.tree.raycastRoot(S,E,C,M,t,n,c),tile:p}});d.sort((p,m)=>(p.t!==null?p.t:Number.MAX_VALUE)-(m.t!==null?m.t:Number.MAX_VALUE));for(const p of d){if(p.t==null)return null;const m=p.tile.dem.tree.raycast(p.minx,p.miny,p.maxx,p.maxy,t,n,c);if(m!=null)return m}return null}_createFBO(){const t=this.painter.context,n=t.gl,c=this.drapeBufferSize;t.activeTexture.set(n.TEXTURE0);const d=new s.T(t,{width:c[0],height:c[1],data:null},n.RGBA8);d.bind(n.LINEAR,n.CLAMP_TO_EDGE);const p=t.createFramebuffer(c[0],c[1],!0,null);return p.colorAttachment.set(d.texture),p.depthAttachment=new $h(t,p.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=t.createRenderbuffer(t.gl.DEPTH_STENCIL,c[0],c[1]),this._stencilRef=0,p.depthAttachment.set(this._sharedDepthStencil),t.clear({stencil:0})):p.depthAttachment.set(this._sharedDepthStencil),t.extTextureFilterAnisotropic&&n.texParameterf(n.TEXTURE_2D,t.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,t.extTextureFilterAnisotropicMax),{fb:p,tex:d,dirty:!1}}_initFBOPool(){for(;this.pool.length<Math.min(5,this.proxyCoords.length);)this.pool.push(this._createFBO())}_shouldDisableRenderCache(){if(this._debugParams.disableRenderCache||this._style.hasLightTransitions())return!0;for(const t in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[t].hasTransition())return!0;return this._style.order.some(t=>{const n=this._style._mergedLayers[t],c=n.isHidden(this.painter.transform.zoom);return n.type==="hillshade"||n.type==="custom"?!c&&n.shouldRedrape():!c&&n.hasTransition()})}_clearLineLayersFromRenderCache(){let t=!1;for(const c of this._style.getSources())if(c instanceof nl){t=!0;break}if(!t)return;const n={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],p=this._style.getLayerSourceCache(d);if(p&&!n[p.id]&&!d.isHidden(this.painter.transform.zoom)&&d.type==="line"&&d.widthExpression()instanceof s.ab){n[p.id]=!0;for(const m of this.proxyCoords){const y=this.proxyToSource[m.key][p.id];if(y)for(const x of y)this._clearRenderCacheForTile(p.id,x)}}}}_clearRasterLayersFromRenderCache(){let t=!1;for(const c in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[c]._source instanceof Br){t=!0;break}if(!t)return;const n={};for(let c=0;c<this._style.order.length;++c){const d=this._style._mergedLayers[this._style.order[c]],p=this._style.getLayerSourceCache(d);if(!p||n[p.id]||d.isHidden(this.painter.transform.zoom)||d.type!=="raster")continue;const m=d.paint.get("raster-fade-duration");for(const y of this.proxyCoords){const x=this.proxyToSource[y.key][p.id];if(x)for(const T of x){const S=_n(p.getTile(T),p.findLoadedParent(T,0),p,this.painter.transform,m);(S.opacity!==1||S.mix!==0)&&this._clearRenderCacheForTile(p.id,T)}}}}_setupDrapedRenderBatches(){this._style.updateDrapeFirstLayers();const t=this._style.order,n=t.length;if(n===0)return;const c=[];this._pendingGroundEffectLayers=[];let d,p=0,m=this._style._mergedLayers[t[p]];for(;!this._style.isLayerDraped(m)&&m.isHidden(this.painter.transform.zoom)&&++p<n;)m=this._style._mergedLayers[t[p]];for(;p<n;++p){const y=this._style._mergedLayers[t[p]];y.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(y)?d===void 0&&(d=p):(y.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(p),d!==void 0&&(c.push({start:d,end:p-1}),d=void 0)))}if(d!==void 0&&c.push({start:d,end:p-1}),c.length!==0){const y=c[c.length-1];this._pendingGroundEffectLayers.every(x=>x>y.end)||s.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=c}_setupRenderCache(t){const n=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,n.renderCache.length>n.renderCachePool.length){const m=Object.values(n.proxyCachedFBO);n.proxyCachedFBO={};for(let y=0;y<m.length;++y){const x=Object.values(m[y]);n.renderCachePool.push(...x)}}return}this._clearRasterLayersFromRenderCache();const c=this.proxyCoords,d=this._tilesDirty;for(let m=c.length-1;m>=0;m--){const y=c[m];if(n.getTileByID(y.key),n.proxyCachedFBO[y.key]!==void 0){const x=t[y.key],T=this.proxyToSource[y.key];let S=0;for(const C in T){const E=T[C],M=x[C];if(!M||M.length!==E.length||E.some((D,z)=>D!==M[z]||d[C]&&d[C].hasOwnProperty(D.key))){S=-1;break}++S}for(const C in n.proxyCachedFBO[y.key])n.renderCache[n.proxyCachedFBO[y.key][C]].dirty=S<0||S!==Object.values(x).length}}const p=[...this._drapedRenderBatches];p.sort((m,y)=>y.end-y.start-(m.end-m.start));for(const m of p)for(const y of c){if(n.proxyCachedFBO[y.key])continue;let x=n.renderCachePool.pop();x===void 0&&n.renderCache.length<50&&(x=n.renderCache.length,n.renderCache.push(this._createFBO())),x!==void 0&&(n.proxyCachedFBO[y.key]={},n.proxyCachedFBO[y.key][m.start]=x,n.renderCache[x].dirty=!0)}this._tilesDirty={}}_setupStencil(t,n,c,d){if(!d||!this._sourceTilesOverlap[d.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const p=this.painter.context,m=p.gl;if(n.length<=1)return void(this._overlapStencilType=!1);let y;if(c.isTileClipped())y=n.length,this._overlapStencilMode.test={func:m.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(n[0].overscaledZ>n[n.length-1].overscaledZ))return void(this._overlapStencilType=!1);y=1,this._overlapStencilMode.test={func:m.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+y>255&&(p.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=y,this._overlapStencilMode.ref=this._stencilRef,c.isTileClipped()&&this._renderTileClippingMasks(n,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(t){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[t.key]),this._overlapStencilMode):vt.disabled}_renderTileClippingMasks(t,n){const c=this.painter,d=this.painter.context,p=d.gl;c._tileClippingMaskIDs={},d.setColorMode(Rt.disabled),d.setDepthMode(rt.disabled);const m=c.getOrCreateProgram("clippingMask");for(const y of t){const x=c._tileClippingMaskIDs[y.key]=--n;m.draw(c,p.TRIANGLES,rt.disabled,new vt({func:p.ALWAYS,mask:0},x,255,p.KEEP,p.KEEP,p.REPLACE),Rt.disabled,_t.disabled,Cc(y.projMatrix),"$clipping",c.tileExtentBuffer,c.quadTriangleIndexBuffer,c.tileExtentSegments)}}pointCoordinate(t){const n=this.painter.transform;if(t.x<0||t.x>n.width||t.y<0||t.y>n.height)return null;const c=[t.x,t.y,1,1];s.aA(c,c,n.pixelMatrixInverse),s.cH(c,c,1/c[3]),c[0]/=n.worldSize,c[1]/=n.worldSize;const d=n._camera.position,p=s.cb(1,n.center.lat),m=[d[0],d[1],d[2]/p,0],y=s.d7([],c.slice(0,3),m);s.au(y,y);const x=this.raycast(m,y,this._exaggeration);return x!==null&&x?(s.bE(m,m,y,x),m[3]=m[2],m[2]*=p,m):null}_setupProxiedCoordsForOrtho(t,n,c){if(t.getSource()instanceof s.aP)return this._setupProxiedCoordsForImageSource(t,n,c);this._findCoveringTileCache[t.id]=this._findCoveringTileCache[t.id]||{};const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords;for(let x=0;x<p.length;x++){const T=p[x],S=this._findTileCoveringTileID(T,t);if(S){const C=this._createProxiedId(T,S,c[T.key]&&c[T.key][t.id]);d.push(C),this.proxyToSource[T.key][t.id]=[C]}}let m=!1;const y=new Set;for(let x=0;x<n.length;x++){const T=t.getTile(n[x]);if(!T||!T.hasData())continue;const S=this._findTileCoveringTileID(T.tileID,this.proxySourceCache);if(S&&S.tileID.canonical.z!==T.tileID.canonical.z){const C=this.proxyToSource[S.tileID.key][t.id],E=this._createProxiedId(S.tileID,T,c[S.tileID.key]&&c[S.tileID.key][t.id]);C?C.splice(C.length-1,0,E):this.proxyToSource[S.tileID.key][t.id]=[E];const M=this.proxyToSource[S.tileID.key][t.id];y.has(M)||y.add(M),d.push(E),m=!0}}if(this._sourceTilesOverlap[t.id]=m,m&&this._debugParams.sortTilesHiZFirst)for(const x of y)x.sort((T,S)=>S.overscaledZ-T.overscaledZ)}_setupProxiedCoordsForImageSource(t,n,c){if(!t.getSource().loaded())return;const d=this.proxiedCoords[t.id]=[],p=this.proxyCoords,m=t.getSource(),y=m.tileID;if(!y)return;const x=new s.P(y.x,y.y)._div(1<<y.z),T=m.coordinates.map(s.ac.fromLngLat).reduce((C,E)=>(C.min.x=Math.min(C.min.x,E.x-x.x),C.min.y=Math.min(C.min.y,E.y-x.y),C.max.x=Math.max(C.max.x,E.x-x.x),C.max.y=Math.max(C.max.y,E.y-x.y),C),{min:new s.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new s.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),S=(C,E)=>{const M=C.wrap+C.canonical.x/(1<<C.canonical.z),D=C.canonical.y/(1<<C.canonical.z),z=s.aj/(1<<C.canonical.z),F=E.wrap+E.canonical.x/(1<<E.canonical.z),L=E.canonical.y/(1<<E.canonical.z);return M+z<F+T.min.x||M>F+T.max.x||D+z<L+T.min.y||D>L+T.max.y};for(let C=0;C<p.length;C++){const E=p[C];for(let M=0;M<n.length;M++){const D=t.getTile(n[M]);if(!D||!D.hasData()||S(E,D.tileID))continue;const z=this._createProxiedId(E,D,c[E.key]&&c[E.key][t.id]),F=this.proxyToSource[E.key][t.id];F?F.push(z):this.proxyToSource[E.key][t.id]=[z],d.push(z)}}}_createProxiedId(t,n,c){let d=this.orthoMatrix;if(c){const p=c.find(m=>m.key===n.tileID.key);if(p)return p}if(n.tileID.key!==t.key){const p=t.canonical.z-n.tileID.canonical.z;let m,y,x;d=s.bz();const T=n.tileID.wrap-t.wrap<<t.overscaledZ;p>0?(m=s.aj>>p,y=m*((n.tileID.canonical.x<<p)-t.canonical.x+T),x=m*((n.tileID.canonical.y<<p)-t.canonical.y)):(m=s.aj<<-p,y=s.aj*(n.tileID.canonical.x-(t.canonical.x+T<<-p)),x=s.aj*(n.tileID.canonical.y-(t.canonical.y<<-p))),s.ca(d,0,m,0,m,0,1),s.bo(d,d,[y,x,0])}return new Pl(n.tileID,t.key,d)}_findTileCoveringTileID(t,n){let c=n.getTile(t);if(c&&c.hasData())return c;const d=this._findCoveringTileCache[n.id],p=d[t.key];
2756if(c=p?n.getTileByID(p):null,c&&c.hasData()||p===null)return c;let m=c?c.tileID:t,y=m.overscaledZ;const x=n.getSource().minzoom,T=[];if(!p){const C=n.getSource().maxzoom;if(t.canonical.z>=C){const E=t.canonical.z-C;n.getSource().reparseOverscaled?(y=Math.max(t.canonical.z+2,n.transform.tileZoom),m=new s.aM(y,t.wrap,C,t.canonical.x>>E,t.canonical.y>>E)):E!==0&&(y=C,m=new s.aM(y,t.wrap,C,t.canonical.x>>E,t.canonical.y>>E))}m.key!==t.key&&(T.push(m.key),c=n.getTile(m))}const S=C=>{T.forEach(E=>{d[E]=C}),T.length=0};for(y-=1;y>=x&&(!c||!c.hasData());y--){c&&S(c.tileID.key);const C=m.calculateScaledKey(y);if(c=n.getTileByID(C),c&&c.hasData())break;const E=d[C];if(E===null)break;E===void 0?T.push(C):c=n.getTileByID(E)}return S(c?c.tileID.key:null),c&&c.hasData()?c:null}findDEMTileFor(t){return this.enabled?this._findTileCoveringTileID(t,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(t,n){let c=this._tilesDirty[t];c||(c=this._tilesDirty[t]={}),c[n.key]=!0}}function Yh(l,t,n){const c=function(y,x,T){const S=s.bG(x,y),C=s.bG(T,[.2126,.7152,.0722]),E=(D,z,F)=>(1-F)*D+F*z,M=E(1-.3*Math.min(C,1),1,Math.min(S+1,1));return E(.92,1,Math.asin(s.ay(x[2],-1,1))/Math.PI+.5)*M}(l,[0,0,1],t),d=[0,0,0];s.c1(d,n.slice(0,3),c);const p=[0,0,0];s.c1(p,t.slice(0,3),l[2]);const m=[0,0,0];return s.d5(m,d,p),s.d8(m)}const Kh=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],zc=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","elevatedStructures","model","symbol"];class Rc{static cacheKey(t,n,c,d){let p=`${n}${d?d.cacheKey:""}`;for(const m of c)t.usedDefines.includes(m)&&(p+=`/${m}`);return p}constructor(t,n,c,d,p,m){const y=t.gl;this.program=y.createProgram(),this.configuration=d,this.name=n,this.fixedDefines=[...m];const x=d?d.getBinderAttributes():[],T=(c.staticAttributes||[]).concat(x);let S=d?d.defines():[];S=S.concat(m.map(F=>`#define ${F}`));const C=`#version 300 es
2757`;let E=C+S.concat("precision mediump float;",as,xc.fragmentSource).join(`
2758`);for(const F of c.fragmentIncludes)E+=`
2759${Ls[F]}`;E+=`
2760${c.fragmentSource}`;let M=C+S.concat("precision highp float;",as,xc.vertexSource).join(`
2761`);for(const F of c.vertexIncludes)M+=`
2762${Ls[F]}`;this.forceManualRenderingForInstanceIDShaders=t.forceManualRenderingForInstanceIDShaders&&c.vertexSource.indexOf("gl_InstanceID")!==-1,this.forceManualRenderingForInstanceIDShaders&&(M+=`
2763uniform int u_instanceID;
2764`),M+=`
2765${c.vertexSource}`,this.forceManualRenderingForInstanceIDShaders&&(M=M.replaceAll("gl_InstanceID","u_instanceID"));const D=y.createShader(y.FRAGMENT_SHADER);if(y.isContextLost())return void(this.failedToCreate=!0);y.shaderSource(D,E),y.compileShader(D),y.attachShader(this.program,D);const z=y.createShader(y.VERTEX_SHADER);if(y.isContextLost())this.failedToCreate=!0;else{y.shaderSource(z,M),y.compileShader(z),y.attachShader(this.program,z),this.attributes={},this.numAttributes=T.length;for(let F=0;F<this.numAttributes;F++)if(T[F]){const L=T[F].startsWith("a_")?T[F]:`a_${T[F]}`;y.bindAttribLocation(this.program,F,L),this.attributes[L]=F}y.linkProgram(this.program),y.deleteShader(z),y.deleteShader(D),this.fixedUniforms=p(t),this.binderUniforms=d?d.getUniforms(t):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(F=>({u_instanceID:new s.cd(F)}))(t)),(m.includes("TERRAIN")||n.indexOf("symbol")!==-1||n.indexOf("circle")!==-1)&&(this.terrainUniforms=(F=>({u_dem:new s.cd(F),u_dem_prev:new s.cd(F),u_dem_tl:new s.cg(F),u_dem_scale:new s.cf(F),u_dem_tl_prev:new s.cg(F),u_dem_scale_prev:new s.cf(F),u_dem_size:new s.cf(F),u_dem_lerp:new s.cf(F),u_exaggeration:new s.cf(F),u_depth:new s.cd(F),u_depth_size_inv:new s.cg(F),u_depth_range_unpack:new s.cg(F),u_occluder_half_size:new s.cf(F),u_occlusion_depth_offset:new s.cf(F),u_meter_to_dem:new s.cf(F),u_label_plane_matrix_inv:new s.ch(F)}))(t)),m.includes("GLOBE")&&(this.globeUniforms=(F=>({u_tile_tl_up:new s.ce(F),u_tile_tr_up:new s.ce(F),u_tile_br_up:new s.ce(F),u_tile_bl_up:new s.ce(F),u_tile_up_scale:new s.cf(F)}))(t)),m.includes("FOG")&&(this.fogUniforms=(F=>({u_fog_matrix:new s.ch(F),u_fog_range:new s.cg(F),u_fog_color:new s.d0(F),u_fog_horizon_blend:new s.cf(F),u_fog_vertical_limit:new s.cg(F),u_fog_temporal_offset:new s.cf(F),u_frustum_tl:new s.ce(F),u_frustum_tr:new s.ce(F),u_frustum_br:new s.ce(F),u_frustum_bl:new s.ce(F),u_globe_pos:new s.ce(F),u_globe_radius:new s.cf(F),u_globe_transition:new s.cf(F),u_is_globe:new s.cd(F),u_viewport:new s.cg(F)}))(t)),m.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(F=>({u_cutoff_params:new s.d0(F)}))(t)),m.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(F=>({u_lighting_ambient_color:new s.ce(F),u_lighting_directional_dir:new s.ce(F),u_lighting_directional_color:new s.ce(F),u_ground_radiance:new s.ce(F)}))(t)),m.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(F=>({u_light_matrix_0:new s.ch(F),u_light_matrix_1:new s.ch(F),u_fade_range:new s.cg(F),u_shadow_normal_offset:new s.ce(F),u_shadow_intensity:new s.cf(F),u_shadow_texel_size:new s.cf(F),u_shadow_map_resolution:new s.cf(F),u_shadow_direction:new s.ce(F),u_shadow_bias:new s.ce(F),u_shadowmap_0:new s.cd(F),u_shadowmap_1:new s.cd(F)}))(t))}}setTerrainUniformValues(t,n){if(!this.terrainUniforms)return;const c=this.terrainUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d]&&c[d].set(this.program,d,n[d])}}setGlobeUniformValues(t,n){if(!this.globeUniforms)return;const c=this.globeUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d]&&c[d].set(this.program,d,n[d])}}setFogUniformValues(t,n){if(!this.fogUniforms)return;const c=this.fogUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setCutoffUniformValues(t,n){if(!this.cutoffUniforms)return;const c=this.cutoffUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setLightsUniformValues(t,n){if(!this.lightsUniforms)return;const c=this.lightsUniforms;if(!this.failedToCreate){t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}}setShadowUniformValues(t,n){if(this.failedToCreate||!this.shadowUniforms)return;const c=this.shadowUniforms;t.program.set(this.program);for(const d in n)c[d].set(this.program,d,n[d])}_drawDebugWireframe(t,n,c,d,p,m,y,x,T,S){const C=t.options.wireframe;if(C.terrain===!1&&C.layers2D===!1&&C.layers3D===!1)return;const E=t.context;if(!(!(!C.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!C.layers2D||t._terrain&&t._terrain.renderingToTexture||!Kh.includes(this.name))||!(!C.layers3D||!zc.includes(this.name))))return;const M=E.gl,D=t.wireframeDebugCache.getLinesFromTrianglesBuffer(t.frameCounter,p,E);if(!D)return;const z=[...this.fixedDefines];
2765z.push("DEBUG_WIREFRAME");const F=t.getOrCreateProgram(this.name,{config:this.configuration,defines:z});E.program.set(F.program);const L=(q,Y,te)=>{if(Y[q]&&te[q])for(const re in Y[q])te[q][re]&&te[q][re].set(te.program,re,Y[q][re].current)};T&&T.setUniforms(F.program,E,F.binderUniforms,y,{zoom:x}),L("fixedUniforms",this,F),L("terrainUniforms",this,F),L("globeUniforms",this,F),L("fogUniforms",this,F),L("lightsUniforms",this,F),L("shadowUniforms",this,F),D.bind(),E.setColorMode(new Rt([M.ONE,M.ONE_MINUS_SRC_ALPHA,M.ZERO,M.ONE],s.am.transparent,[!0,!0,!0,!1])),E.setDepthMode(new rt(n.func===M.LESS?M.LEQUAL:n.func,rt.ReadOnly,n.range)),E.setStencilMode(vt.disabled);const N=3*m.primitiveLength*2,U=3*m.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const q=S||1;for(let Y=0;Y<q;++Y)F.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",Y),M.drawElements(M.LINES,N,M.UNSIGNED_SHORT,U)}else S&&S>1?M.drawElementsInstanced(M.LINES,N,M.UNSIGNED_SHORT,U,S):M.drawElements(M.LINES,N,M.UNSIGNED_SHORT,U);p.bind(),E.program.set(this.program),E.setDepthMode(n),E.setStencilMode(c),E.setColorMode(d)}checkUniforms(t,n,c){if(this.fixedDefines.includes(n)){for(const d of Object.keys(c))if(!c[d].initialized)throw new Error(`Program '${this.name}', from draw '${t}': uniform ${d} not set but required by ${n} being defined`)}}draw(t,n,c,d,p,m,y,x,T,S,C,E,M,D,z,F){const L=t.context,N=L.gl;if(this.failedToCreate)return;L.program.set(this.program),L.setDepthMode(c),L.setStencilMode(d),L.setColorMode(p),L.setCullFace(m);for(const Y of Object.keys(this.fixedUniforms))this.fixedUniforms[Y].set(this.program,Y,y[Y]);D&&D.setUniforms(this.program,L,this.binderUniforms,E,{zoom:M});const U={[N.POINTS]:1,[N.LINES]:2,[N.TRIANGLES]:3,[N.LINE_STRIP]:1}[n];this.checkUniforms(x,"RENDER_SHADOWS",this.shadowUniforms);const q=F&&F>0?1:void 0;for(const Y of C.get()){const te=Y.vaos||(Y.vaos={});if((te[x]||(te[x]=new Ff)).bind(L,this,T,D?D.getPaintVertexBuffers():[],S,Y.vertexOffset,z||[],q),this.forceManualRenderingForInstanceIDShaders){const re=F||1;for(let K=0;K<re;++K)this.instancingUniforms.u_instanceID.set(this.program,"u_instanceID",K),S?N.drawElements(n,Y.primitiveLength*U,N.UNSIGNED_SHORT,Y.primitiveOffset*U*2):N.drawArrays(n,Y.vertexOffset,Y.vertexLength)}else F&&F>1?N.drawElementsInstanced(n,Y.primitiveLength*U,N.UNSIGNED_SHORT,Y.primitiveOffset*U*2,F):S?N.drawElements(n,Y.primitiveLength*U,N.UNSIGNED_SHORT,Y.primitiveOffset*U*2):N.drawArrays(n,Y.vertexOffset,Y.vertexLength);n===N.TRIANGLES&&S&&this._drawDebugWireframe(t,c,d,p,S,Y,E,M,D,F)}}}function Dc(l,t,n=0){const c=Math.pow(2,t.tileID.overscaledZ),d=t.tileSize*Math.pow(2,l.transform.tileZoom)/c,p=d*(t.tileID.canonical.x+t.tileID.wrap*c),m=d*t.tileID.canonical.y;return{u_image:0,u_texsize:t.imageAtlasTexture?t.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/s.aw(t,1,l.transform.tileZoom),u_pixel_coord_upper:[p>>16,m>>16],u_pixel_coord_lower:[65535&p,65535&m],u_pattern_transition:n}}const ks={terrain:0,flat:1},Jh=s.bz(),Qh=(l,t,n,c,d,p,m,y,x,T,S,C,E,M,D,z,F,L)=>{const N=t.style.light,U=N.properties.get("position"),q=[U.x,U.y,U.z],Y=s.dJ();N.properties.get("anchor")==="viewport"&&(s.dK(Y,-t.transform.angle),s.dL(q,q,Y));const te=N.properties.get("color").toPremultipliedRenderColor(null),re=t.transform,K={u_matrix:l,u_lightpos:q,u_lightintensity:N.properties.get("intensity"),u_lightcolor:[te.r,te.g,te.b],u_vertical_gradient:+n,u_opacity:c,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Jh,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:ks[T],u_base_type:ks[S],u_ao:d,u_edge_radius:p,u_width_scale:m,u_flood_light_color:D,u_vertical_scale:z,u_flood_light_intensity:F,u_ground_shadow_factor:L};return re.projection.name==="globe"&&(K.u_tile_id=[y.canonical.x,y.canonical.y,1<<y.canonical.z],K.u_zoom_transition=C,K.u_inv_rot_matrix=M,K.u_merc_center=E,K.u_up_dir=re.projection.upVector(new s.cA(0,0,0),E[0]*s.aj,E[1]*s.aj),K.u_height_lift=x),K},Xd=(l,t,n,c,d,p)=>({u_matrix:l,u_edge_radius:t,u_width_scale:n,u_vertical_scale:c,u_height_type:ks[d],u_base_type:ks[p]}),Ta=(l,t,n,c,d,p,m,y,x,T,S,C,E,M,D,z,F,L)=>{const N=Qh(l,t,n,c,d,p,m,y,T,S,C,E,M,D,z,F,1,[0,0,0]),U={u_height_factor:-Math.pow(2,y.overscaledZ
vendor: 48,989 bytes, line 2765
2765)/x.tileSize/8};return s.h(N,Dc(t,x,L),U)},Yd=(l,t,n)=>({u_matrix:l,u_emissive_strength:t,u_ground_shadow_factor:n}),Kd=(l,t,n,c,d,p=0)=>s.h(Yd(l,t,d),Dc(n,c,p)),qf=(l,t,n,c)=>({u_matrix:l,u_world:n,u_emissive_strength:t,u_ground_shadow_factor:c}),Hf=(l,t,n,c,d,p,m=0)=>s.h(Kd(l,t,n,c,p,m),{u_world:d}),$f=(l,t)=>({u_matrix:l,u_ground_shadow_factor:t}),Lc=(l,t,n,c,d)=>({u_matrix:l,u_camera_pos:[t[0],t[1],t[2]],u_depth_bias:n,u_height_scale:c,u_reset_depth:d}),eu=(l,t)=>({u_matrix:l,u_normal_matrix:t,u_opacity:1}),tu=l=>({u_matrix:l}),Jd=l=>({u_matrix:l}),Sa=(l,t,n,c,d,p,m,y)=>{const x=s.aj/p.tileSize;return{u_matrix:l,u_inv_rot_matrix:t,u_camera_to_center_distance:n.getCameraToCenterDistance(y),u_extrude_scale:[n.pixelsToGLUnits[0]/x,n.pixelsToGLUnits[1]/x],u_zoom_transition:c,u_tile_id:m,u_merc_center:d}},iu=(l,t,n=1)=>({u_matrix:l,u_color:t,u_overlay:0,u_overlay_scale:n}),Qd=s.bz(),ep=(l,t,n,c,d,p,m)=>{const y=l.transform,x=y.projection.name==="globe",T=x?s.dM(y.zoom,t.canonical)*y._pixelsPerMercatorPixel:s.aw(n,1,p),S={u_matrix:t.projMatrix,u_extrude_scale:T,u_intensity:m,u_inv_rot_matrix:Qd,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(x){S.u_inv_rot_matrix=c,S.u_merc_center=d,S.u_tile_id=[t.canonical.x,t.canonical.y,1<<t.canonical.z],S.u_zoom_transition=s.ah(y.zoom);const C=d[0]*s.aj,E=d[1]*s.aj;S.u_up_dir=y.projection.upVector(new s.cA(0,0,0),C,E)}return S};function Fc(l,[t,n,c,d],[p,m]){if(p===m)return[0,0,0,0];const y=255*(l-1)/(l*(m-p));return[t*y,n*y,c*y,d*y]}function ls(l,t,[n,c]){return n===c?0:.5/l+(t-n)*(l-1)/(l*(c-n))}const ru=(l,t,n,c,d,p,m,y,x,T,S,C,E,M,D,z,F,L,N,U,q)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:n,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity*C.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:C.paint.get("raster-brightness-min"),u_brightness_high:C.paint.get("raster-brightness-max"),u_saturation_factor:s.dO(C.paint.get("raster-saturation")),u_contrast_factor:s.dN(C.paint.get("raster-contrast")),u_spin_weights:cs(C.paint.get("raster-hue-rotate")),u_perspective_transform:E,u_raster_elevation:M,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x,u_colorization_mix:Fc(s.dP,z,L),u_colorization_offset:ls(s.dP,F,L),u_color_ramp:D,u_texture_offset:[U/(N+2*U),N/(N+2*U)],u_texture_res:[N+2*U,N+2*U],u_emissive_strength:q});function cs(l){l*=Math.PI/180;const t=Math.sin(l),n=Math.cos(l);return[(2*n+1)/3,(-Math.sqrt(3)*t-n+1)/3,(Math.sqrt(3)*t-n+1)/3]}const hs=.05,Oc=(l,t,n,c,d,p,m,y,x,T,S,C)=>({u_matrix:l,u_normalize_matrix:t,u_globe_matrix:n,u_merc_matrix:c,u_grid_matrix:d,u_tl_parent:p,u_scale_parent:T,u_fade_t:S.mix,u_opacity:S.opacity,u_image0:0,u_image1:1,u_raster_elevation:C,u_zoom_transition:m,u_merc_center:y,u_cutoff_params:x}),tp=(l,t,n,c,d,p,m,y,x,T)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_tile_offset:n,u_velocity:c,u_color_ramp:p,u_velocity_res:d,u_max_speed:m,u_uv_offset:y,u_data_scale:[255*x[0],255*x[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[hs,hs]}),ip=(l,t,n,c,d,p,m,y,x,T)=>({u_particle_texture:l,u_particle_texture_side_len:t,u_velocity:n,u_velocity_res:c,u_max_speed:d,u_speed_factor:p,u_reset_rate:m,u_rand_seed:Math.random(),u_uv_offset:y,u_data_scale:[255*x[0],255*x[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[hs,hs]}),kc=s.bz(),Bc=(l,t,n,c,d,p,m,y,x,T,S,C,E,M,D,z,F,L,N,U,q,Y,te,re)=>{const K=d.transform,J={u_is_size_zoom_constant:+(l==="constant"||l==="source"),u_is_size_feature_constant:+(l==="constant"||l==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:K.getCameraToCenterDistance(N),u_rotate_symbol:+n,u_aspect_ratio:K.width/K.height,u_fade_change:d.options.fadeDuration?d.symbolFadeChange:1,u_matrix:p,u_label_plane_matrix:m,u_coord_matrix:y,u_is_text:+T,u_elevation_from_sea:x?1:0,u_pitch_with_map:+c,u_texsize:S,u_texsize_icon:C,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:kc,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:kc,u_up_vector:[0,-1,0],u_color_adj_mat:Y,u_icon_transition:te||0,u_gamma_scale:c?d.transform.getCameraToCenterDistance(N)*Math.cos(d.terrain?0:d.transform._pitch):1,u_device_pixel_ratio:s.q.devicePixelRatio,u_is_halo:1,u_scale_factor:re||1,u_ground_shadow_factor:U,u_inv_matrix:s.bi(s.bz(),m),u_normal_scale:q};return N.name==="globe"&&(J.u_tile_id=[M.canonical.x,M.canonical.y,1<<M.canonical.z],J.u_zoom_transition=D,J.u_inv_rot_matrix=F,J.u_merc_center=z,J.u_camera_forward=K._camera.forward(),J.u_ecef_origin=s.dQ(K.globeMatrix,M.toUnwrapped()),J.u_tile_matrix=Float32Array.from(K.globeMatrix),J.u_up_vector=L),J},rp=(l,t,n,c)=>({u_matrix:l,u_emissive_strength:t,u_opacity:n,u_color:c}),nu=(l,t,n,c,d,p,m,y,x)=>s.h(function(T,S,C,E,M,D){const{width:z,height:F}=E.imageManager.getPixelSize(S),L=Math.pow(2,D.tileID.overscaledZ),N=D.tileSize*Math.pow(2,E.transform.tileZoom)/L,U=N*(D.tileID.canonical.x+D.tileID.wrap*L),q=N*D.tileID.canonical.y;return{u_image:0,u_pattern_tl:C.tl,u_pattern_br:C.br,u_texsize:[z,F],u_pattern_size:C.displaySize,u_pattern_units_to_pixels:M?[E.transform.width,-1*E.transform.height]:[1/s.aw(D,1,E.transform.tileZoom),1/s.aw(D,1,E.transform.tileZoom)],u_pixel_coord_upper:[U>>16,q>>16],u_pixel_coord_lower:[65535&U,65535&q]}}(0,p,m,c,y,x),{u_matrix:l,u_emissive_strength:t,u_opacity:n}),Bs=new Float32Array(s.bx([])),ou=(l,t,n,c,d,p,m,y,x,T,S,C,E,M=[0,0,0],D)=>{const z=d.style.light,F=z.properties.get("position"),L=[-F.x,-F.y,F.z],N=s.dJ();z.properties.get("anchor")==="viewport"&&(s.dK(N,-d.transform.angle),s.dL(L,L,N));const U=S.alphaMode==="MASK",q=z.properties.get("color").toNonPremultipliedRenderColor(null),Y=E.paint.get("model-ambient-occlusion-intensity"),te=E.paint.get("model-color").constantOr(s.am.white).toNonPremultipliedRenderColor(null);return te.a=E.paint.get("model-color-mix-intensity").constantOr(0),{u_matrix:l,u_lighting_matrix:t,u_normal_matrix:n,u_node_matrix:c||Bs,u_lightpos:L,u_lightintensity:z.properties.get("intensity"),u_lightcolor:[q.r,q.g,q.b],u_camera_pos:M,u_opacity:p,u_baseTextureIsAlpha:0,u_alphaMask:+U,u_alphaCutoff:S.alphaCutoff,u_baseColorFactor:m.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:y.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:x,u_roughnessFactor:T,u_baseColorTexture:on.BaseColor,u_metallicRoughnessTexture:on.MetallicRoughness,u_normalTexture:on.Normal,u_occlusionTexture:on.Occlusion,u_emissionTexture:on.Emission,u_lutTexture:on.LUT,u_color_mix:te.toArray01(),u_aoIntensity:Y,u_emissive_strength:C,u_occlusionTextureTransform:D||[0,0,0,0]}},np=(l,t=Bs,n=Bs)=>({u_matrix:l,u_instance:t,u_node_matrix:n}),op={fillExtrusion:l=>({u_matrix:new s.ch(l),u_lightpos:new s.ce(l),u_lightintensity:new s.cf(l),u_lightcolor:new s.ce(l),u_vertical_gradient:new s.cf(l),u_opacity:new s.cf(l),u_edge_radius:new s.cf(l),u_width_scale:new s.cf(l),u_ao:new s.cg(l),u_height_type:new s.cd(l),u_base_type:new s.cd(l),u_tile_id:new s.ce(l),u_zoom_transition:new s.cf(l),u_inv_rot_matrix:new s.ch(l),u_merc_center:new s.cg(l),u_up_dir:new s.ce(l),u_height_lift:new s.cf(l),u_flood_light_color:new s.ce(l),u_vertical_scale:new s.cf(l),u_flood_light_intensity:new s.cf(l),u_ground_shadow_factor:new s.ce(l)}),fillExtrusionDepth:l=>({u_matrix:new s.ch(l),u_edge_radius:new s.cf(l),u_width_scale:new s.cf(l),u_vertical_scale:new s.cf(l),u_height_type:new s.cd(l),u_base_type:new s.cd(l)}),fillExtrusionPattern:l=>({u_matrix:new s.ch(l),u_lightpos:new s.ce(l),u_lightintensity:new s.cf(l),u_lightcolor:new s.ce(l),u_vertical_gradient:new s.cf(l),u_height_factor:new s.cf(l),u_edge_radius:new s.cf(l),u_width_scale:new s.cf(l),u_ao:new s.cg(l),u_height_type:new s.cd(l),u_base_type:new s.cd(l),u_tile_id:new s.ce(l),u_zoom_transition:new s.cf(l),u_inv_rot_matrix:new s.ch(l),u_merc_center:new s.cg(l),u_up_dir:new s.ce(l),u_height_lift:new s.cf(l),u_image:new s.cd(l),u_texsize:new s.cg(l),u_pixel_coord_upper:new s.cg(l),u_pixel_coord_lower:new s.cg(l),u_tile_units_to_pixels:new s.cf(l),u_opacity:new s.cf(l),u_pattern_transition:new s.cf(l)}),fillExtrusionGroundEffect:l=>({u_matrix:new s.ch(l),u_opacity:new s.cf(l),u_ao_pass:new s.cf(l),u_meter_to_tile:new s.cf(l),u_ao:new s.cg(l),u_flood_light_intensity:new s.cf(l),u_flood_light_color:new s.ce(l),u_attenuation:new s.cf(l),u_edge_radius:new s.cf(l),u_fb:new s.cd(l),u_fb_size:new s.cf(l),u_dynamic_offset:new s.cf(l)}),fill:l=>({u_matrix:new s.ch(l),u_emissive_strength:new s.cf(l),u_ground_shadow_factor:new s.ce(l)}),fillPattern:l=>({u_matrix:new s.ch(l),u_emissive_strength:new s.cf(l),u_image:new s.cd(l),u_texsize:new s.cg(l),u_pixel_coord_upper:new s.cg(l),u_pixel_coord_lower:new s.cg(l),u_tile_units_to_pixels:new s.cf(l),u_ground_shadow_factor:new s.ce(l),u_pattern_transition:new s.cf(l)}),fillOutline:l=>({u_matrix:new s.ch(l),u_emissive_strength:new s.cf(l),u_world:new s.cg(l),u_ground_shadow_factor:new s.ce(l)}),fillOutlinePattern:l=>({u_matrix:new s.ch(l),u_emissive_strength:new s.cf(l),u_world:new s.cg(l),u_image:new s.cd(l),u_texsize:new s.cg(l),u_pixel_coord_upper:new s.cg(l),u_pixel_coord_lower:new s.cg(l),u_tile_units_to_pixels:new s.cf(l),u_ground_shadow_factor:new s.ce(l),u_pattern_transition:new s.cf(l)}),building:l=>({u_matrix:new s.ch(l),u_normal_matrix:new s.ch(l),u_opacity:new s.cf(l)}),buildingBloom:l=>({u_matrix:new s.ch(l)}),buildingDepth:l=>({u_matrix:new s.ch(l)}),elevatedStructuresDepth:l=>({u_matrix:new s.ch(l),u_depth_bias:new s.cf(l)}),elevatedStructures:l=>({u_matrix:new s.ch(l),u_ground_shadow_factor:new s.ce(l)}),elevatedStructuresDepthReconstruct:l=>({u_matrix:new s.ch(l),u_camera_pos:new s.ce(l),u_depth_bias:new s.cf(l),u_height_scale:new s.cf(l),u_reset_depth:new s.cf(l)}),circle:s.dT,collisionBox:l=>({u_matrix:new s.ch(l),u_inv_rot_matrix:new s.ch(l),u_camera_to_center_distance:new s.cf(l),u_extrude_scale:new s.cg(l),u_zoom_transition:new s.cf(l),u_merc_center:new s.cg(l),u_tile_id:new s.ce(l)}),collisionCircle:l=>({u_matrix:new s.ch(l),u_inv_matrix:new s.ch(l),u_camera_to_center_distance:new s.cf(l),u_viewport_size:new s.cg(l)}),debug:l=>({u_color:new s.dv(l),u_matrix:new s.ch(l),u_overlay:new s.cd(l),u_overlay_scale:new s.cf(l)}),clippingMask:l=>({u_matrix:new s.ch(l)}),heatmap:l=>({u_extrude_scale:new s.cf(l),u_intensity:new s.cf(l),u_matrix:new s.ch(l),u_inv_rot_matrix:new s.ch(l),u_merc_center:new s.cg(l),u_tile_id:new s.ce(l),u_zoom_transition:new s.cf(l),u_up_dir:new s.ce(l)}),heatmapTexture:l=>({u_image:new s.cd(l),u_color_ramp:new s.cd(l),u_opacity:new s.cf(l)}),hillshade:l=>({u_matrix:new s.ch(l),u_image:new s.cd(l),u_latrange:new s.cg(l),u_light:new s.cg(l),u_shadow:new s.dv(l),u_highlight:new s.dv(l),u_emissive_strength:new s.cf(l),u_accent:new s.dv(l)}),hillshadePrepare:l=>({u_matrix:new s.ch(l),u_image:new s.cd(l),u_dimension:new s.cg(l),u_zoom:new s.cf(l)}),line:s.dS,linePattern:s.dR,raster:l=>({u_matrix:new s.ch(l),u_normalize_matrix:new s.ch(l),u_globe_matrix:new s.ch(l),u_merc_matrix:new s.ch(l),u_grid_matrix:new s.dw(l),u_tl_parent:new s.cg(l),u_scale_parent:new s.cf(l),u_fade_t:new s.cf(l),u_opacity:new s.cf(l),u_image0:new s.cd(l),u_image1:new s.cd(l),u_brightness_low:new s.cf(l),u_brightness_high:new s.cf(l),u_saturation_factor:new s.cf(l),u_contrast_factor:new s.cf(l),u_spin_weights:new s.ce(l),u_perspective_transform:new s.cg(l),u_raster_elevation:new s.cf(l),u_zoom_transition:new s.cf(l),u_merc_center:new s.cg(l),u_cutoff_params:new s.d0(l),u_colorization_mix:new s.d0(l),u_colorization_offset:new s.cf(l),u_color_ramp:new s.cd(l),u_texture_offset:new s.cg(l),u_texture_res:new s.cg(l),u_emissive_strength:new s.cf(l)}),rasterParticle:l=>({u_matrix:new s.ch(l),u_normalize_matrix:new s.ch(l),u_globe_matrix:new s.ch(l),u_merc_matrix:new s.ch(l),u_grid_matrix:new s.dw(l),u_tl_parent:new s.cg(l),u_scale_parent:new s.cf(l),u_fade_t:new s.cf(l),u_opacity:new s.cf(l),u_image0:new s.cd(l),u_image1:new s.cd(l),u_raster_elevation:new s.cf(l),u_zoom_transition:new s.cf(l),u_merc_center:new s.cg(l),u_cutoff_params:new s.d0(l)}),rasterParticleTexture:l=>({u_texture:new s.cd(l),u_opacity:new s.cf(l)}),rasterParticleDraw:l=>({u_particle_texture:new s.cd(l),u_particle_texture_side_len:new s.cf(l),u_tile_offset:new s.cg(l),u_velocity:new s.cd(l),u_color_ramp:new s.cd(l),u_velocity_res:new s.cg(l),u_max_speed:new s.cf(l),u_uv_offset:new s.cg(l),u_data_scale:new s.cg(l),u_data_offset:new s.cf(l),u_particle_pos_scale:new s.cf(l),u_particle_pos_offset:new s.cg(l)}),rasterParticleUpdate:l=>({u_particle_texture:new s.cd(l),u_particle_texture_side_len:new s.cf(l),u_velocity:new s.cd(l),u_velocity_res:new s.cg(l),u_max_speed:new s.cf(l),u_speed_factor:new s.cf(l),u_reset_rate:new s.cf(l),u_rand_seed:new s.cf(l),u_uv_offset:new s.cg(l),u_data_scale:new s.cg(l),u_data_offset:new s.cf(l),u_particle_pos_scale:new s.cf(l),u_particle_pos_offset:new s.cg(l)}),symbol:l=>({u_is_size_zoom_constant:new s.cd(l),u_is_size_feature_constant:new s.cd(l),u_size_t:new s.cf(l),u_size:new s.cf(l),u_camera_to_center_distance:new s.cf(l),u_rotate_symbol:new s.cd(l),u_aspect_ratio:new s.cf(l),u_fade_change:new s.cf(l),u_matrix:new s.ch(l),u_label_plane_matrix:new s.ch(l),u_coord_matrix:new s.ch(l),u_is_text:new s.cd(l),u_elevation_from_sea:new s.cd(l),u_pitch_with_map:new s.cd(l),u_texsize:new s.cg(l),u_texsize_icon:new s.cg(l),u_texture:new s.cd(l),u_texture_icon:new s.cd(l),u_gamma_scale:new s.cf(l),u_device_pixel_ratio:new s.cf(l),u_tile_id:new s.ce(l),u_zoom_transition:new s.cf(l),u_inv_rot_matrix:new s.ch(l),u_merc_center:new s.cg(l),u_camera_forward:new s.ce(l),u_tile_matrix:new s.ch(l),u_up_vector:new s.ce(l),u_ecef_origin:new s.ce(l),u_is_halo:new s.cd(l),u_icon_transition:new s.cf(l),u_color_adj_mat:new s.ch(l),u_scale_factor:new s.cf(l),u_ground_shadow_factor:new s.ce(l),u_inv_matrix:new s.ch(l),u_normal_scale:new s.cf(l)}),background:l=>({u_matrix:new s.ch(l),u_emissive_strength:new s.cf(l),u_opacity:new s.cf(l),u_color:new s.dv(l)}),backgroundPattern:l=>({u_matrix:new s.ch(l),u_emissive_strength:new s.cf(l),u_opacity:new s.cf(l),u_image:new s.cd(l),u_pattern_tl:new s.cg(l),u_pattern_br:new s.cg(l),u_texsize:new s.cg(l),u_pattern_size:new s.cg(l),u_pixel_coord_upper:new s.cg(l),u_pixel_coord_lower:new s.cg(l),u_pattern_units_to_pixels:new s.cg(l)}),terrainRaster:l=>({u_matrix:new s.ch(l),u_image0:new s.cd(l),u_skirt_height:new s.cf(l),u_ground_shadow_factor:new s.ce(l)}),skybox:l=>({u_matrix:new s.ch(l),u_sun_direction:new s.ce(l),u_cubemap:new s.cd(l),u_opacity:new s.cf(l),u_temporal_offset:new s.cf(l)}),skyboxGradient:l=>({u_matrix:new s.ch(l),u_color_ramp:new s.cd(l),u_center_direction:new s.ce(l),u_radius:new s.cf(l),u_opacity:new s.cf(l),u_temporal_offset:new s.cf(l)}),skyboxCapture:l=>({u_matrix_3f:new s.dw(l),u_sun_direction:new s.ce(l),u_sun_intensity:new s.cf(l),u_color_tint_r:new s.d0(l),u_color_tint_m:new s.d0(l),u_luminance:new s.cf(l)}),globeRaster:l=>({u_proj_matrix:new s.ch(l),u_globe_matrix:new s.ch(l),u_normalize_matrix:new s.ch(l),u_merc_matrix:new s.ch(l),u_zoom_transition:new s.cf(l),u_merc_center:new s.cg(l),u_image0:new s.cd(l),u_grid_matrix:new s.dw(l),u_skirt_height:new s.cf(l),u_far_z_cutoff:new s.cf(l),u_frustum_tl:new s.ce(l),u_frustum_tr:new s.ce(l),u_frustum_br:new s.ce(l),u_frustum_bl:new s.ce(l),u_globe_pos:new s.ce(l),u_globe_radius:new s.cf(l),u_viewport:new s.cg(l)}),globeAtmosphere:l=>({u_frustum_tl:new s.ce(l),u_frustum_tr:new s.ce(l),u_frustum_br:new s.ce(l),u_frustum_bl:new s.ce(l),u_horizon:new s.cf(l),u_transition:new s.cf(l),u_fadeout_range:new s.cf(l),u_color:new s.d0(l),u_high_color:new s.d0(l),u_space_color:new s.d0(l),u_temporal_offset:new s.cf(l),u_horizon_angle:new s.cf(l)}),model:l=>({u_matrix:new s.ch(l),u_lighting_matrix:new s.ch(l),u_normal_matrix:new s.ch(l),u_node_matrix:new s.ch(l),u_lightpos:new s.ce(l),u_lightintensity:new s.cf(l),u_lightcolor:new s.ce(l),u_camera_pos:new s.ce(l),u_opacity:new s.cf(l),u_baseColorFactor:new s.d0(l),u_emissiveFactor:new s.d0(l),u_metallicFactor:new s.cf(l),u_roughnessFactor:new s.cf(l),u_baseTextureIsAlpha:new s.cd(l),u_alphaMask:new s.cd(l),u_alphaCutoff:new s.cf(l),u_baseColorTexture:new s.cd(l),u_metallicRoughnessTexture:new s.cd(l),u_normalTexture:new s.cd(l),u_occlusionTexture:new s.cd(l),u_emissionTexture:new s.cd(l),u_lutTexture:new s.cd(l),u_color_mix:new s.d0(l),u_aoIntensity:new s.cf(l),u_emissive_strength:new s.cf(l),u_occlusionTextureTransform:new s.d0(l)}),modelDepth:l=>({u_matrix:new s.ch(l),u_instance:new s.ch(l),u_node_matrix:new s.ch(l)}),groundShadow:l=>({u_matrix:new s.ch(l),u_ground_shadow_factor:new s.ce(l)}),stars:l=>({u_matrix:new s.ch(l),u_up:new s.ce(l),u_right:new s.ce(l),u_intensity_multiplier:new s.cf(l)}),snowParticle:l=>({u_modelview:new s.ch(l),u_projection:new s.ch(l),u_time:new s.cf(l),u_cam_pos:new s.ce(l),u_velocityConeAperture:new s.cf(l),u_velocity:new s.cf(l),u_horizontalOscillationRadius:new s.cf(l),u_horizontalOscillationRate:new s.cf(l),u_boxSize:new s.cf(l),u_billboardSize:new s.cf(l),u_simpleShapeParameters:new s.cg(l),u_screenSize:new s.cg(l),u_thinningCenterPos:new s.cg(l),u_thinningShape:new s.ce(l),u_thinningAffectedRatio:new s.cf(l),u_thinningParticleOffset:new s.cf(l),u_particleColor:new s.d0(l),u_direction:new s.ce(l)}),rainParticle:l=>({u_modelview:new s.ch(l),u_projection:new s.ch(l),u_time:new s.cf(l),u_cam_pos:new s.ce(l),u_texScreen:new s.cd(l),u_velocityConeAperture:new s.cf(l),u_velocity:new s.cf(l),u_boxSize:new s.cf(l),u_rainDropletSize:new s.cg(l),u_distortionStrength:new s.cf(l),u_rainDirection:new s.ce(l),u_color:new s.d0(l),u_screenSize:new s.cg(l),u_thinningCenterPos:new s.cg(l),u_thinningShape:new s.ce(l),u_thinningAffectedRatio:new s.cf(l),u_thinningParticleOffset:new s.cf(l),u_shapeDirectionalPower:new s.cf(l),u_shapeNormalPower:new s.cf(l),u_mode:new s.cf(l)}),vignette:l=>({u_vignetteShape:new s.ce(l),u_vignetteColor:new s.d0(l)}),occlusion:l=>({u_matrix:new s.ch(l),u_anchorPos:new s.ce(l),u_screenSizePx:new s.cg(l),u_occluderSizePx:new s.cg(l),u_color:new s.d0(l)})};class us{constructor(t,n,c,d){this.id=us.uniqueIdxCounter,us.uniqueIdxCounter++,this.context=t;const p=t.gl;this.buffer=p.createBuffer(),this.dynamicDraw=!!c,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),p.bufferData(p.ELEMENT_ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?p.DYNAMIC_DRAW:p.STATIC_DRAW),this.dynamicDraw||d||n.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){this.id=us.uniqueIdxCounter,us.uniqueIdxCounter++;const n=this.context.gl;this.context.unbindVAO(),this.bind(),n.bufferSubData(n.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}us.uniqueIdxCounter=0;const su={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class au{constructor(t,n,c,d,p,m){this.length=n.length,this.attributes=c,this.itemSize=n.bytesPerElement,this.dynamicDraw=d,this.instanceCount=m,this.context=t;const y=t.gl;this.buffer=y.createBuffer(),t.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,n.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||p||n.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){const n=this.context.gl;this.bind(),n.bufferSubData(n.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,n){for(let c=0;c<this.attributes.length;c++){const d=n.attributes[this.attributes[c].name];d!==void 0&&t.enableVertexAttribArray(d)}}setVertexAttribPointers(t,n,c){for(let d=0;d<this.attributes.length;d++){const p=this.attributes[d],m=n.attributes[p.name];m!==void 0&&t.vertexAttribPointer(m,p.components,t[su[p.type]],!1,this.itemSize,p.offset+this.itemSize*(c||0))}}setVertexAttribDivisor(t,n,c){for(let d=0;d<this.attributes.length;d++){const p=n.attributes[this.attributes[d].name];p!==void 0&&this.instanceCount&&this.instanceCount>0&&t.vertexAttribDivisor(p,c)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Ns{constructor(t,n,c,d,p){this.context=t,this.width=n,this.height=c;const m=this.framebuffer=t.gl.createFramebuffer();d&&(this.colorAttachment=new Gf(t,m)),p&&(this.depthAttachmentType=p,this.depthAttachment=p==="renderbuffer"?new Zd(t,m):new Hh(t,m))}destroy(){const t=this.context.gl;if(this.colorAttachment){const n=this.colorAttachment.get();n&&t.deleteTexture(n)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const n=this.depthAttachment.get();n&&t.deleteRenderbuffer(n)}else{const n=this.depthAttachment.get();n&&t.deleteTexture(n)}t.deleteFramebuffer(this.framebuffer)}}class Nc{constructor(t,n){this.gl=t,this.clearColor=new kf(this),this.clearDepth=new Bf(this),this.clearStencil=new Nf(this),this.colorMask=new Vf(this),this.depthMask=new Nd(this),this.stencilMask=new jf(this),this.stencilFunc=new vc(this),this.stencilOp=new Uf(this),this.stencilTest=new Vd(this),this.depthRange=new Vh(this),this.depthTest=new bc(this),this.depthFunc=new jh(this),this.blend=new Fs(this),this.blendFunc=new ya(this),this.blendColor=new wc(this),this.blendEquation=new Tc(this),this.cullFace=new xa(this),this.cullFaceSide=new jd(this),this.frontFace=new Uh(this),this.program=new Ud(this),this.activeTexture=new va(this),this.viewport=new Sc(this),this.bindFramebuffer=new Ec(this),this.bindRenderbuffer=new Gh(this),this.bindTexture=new Ic(this),this.bindVertexBuffer=new Cl(this),this.bindElementBuffer=new Gd(this),this.bindVertexArrayOES=new qd(this),this.pixelStoreUnpack=new Hd(this),this.pixelStoreUnpackPremultiplyAlpha=new ba(this),this.pixelStoreUnpackFlipY=new $d(this),this.options=n?Object.assign({},n):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=t.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=t.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=t.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=n&&!!n.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=t.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=t.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=t.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),this.maxPointSize=t.getParameter(t.ALIASED_POINT_SIZE_RANGE)[1]}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,n,c){return new us(this,t,n,c)}createVertexBuffer(t,n,c,d,p){return new au(this,t,n,c,d,p)}createRenderbuffer(t,n,c){const d=this.gl,p=d.createRenderbuffer();return this.bindRenderbuffer.set(p),d.renderbufferStorage(d.RENDERBUFFER,t,n,c),this.bindRenderbuffer.set(null),p}createFramebuffer(t,n,c,d){return new Ns(this,t,n,c,d)}clear({color:t,depth:n,stencil:c,colorMask:d}){const p=this.gl;let m=0;t&&(m|=p.COLOR_BUFFER_BIT,this.clearColor.set(t.toNonPremultipliedRenderColor(null)),this.colorMask.set(d||[!0,!0,!0,!0])),n!==void 0&&(m|=p.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(n),this.depthMask.set(!0)),c!==void 0&&(m|=p.STENCIL_BUFFER_BIT,this.clearStencil.set(c),this.stencilMask.set(255)),p.clear(m)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)}setStencilMode(t){t.test.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)}setColorMode(t){s.bv(t.blendFunction,Rt.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor),t.blendEquation?this.blendEquation.set(t.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(t.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let ds;function lu(l,t,n,c,d,p,m){const y=l.context,x=y.gl,T=l.transform,S=[s.aD(T.center.lng),s.aH(T.center.lat)],C=n.layout.get("symbol-placement"),E=n.layout.get("text-variable-anchor"),M=n.layout.get("icon-rotation-alignment")==="map",D=n.layout.get("text-rotation-alignment")==="map",z=C!=="point",F=[];let L=0,N=0;for(let J=0;J<c.length;J++){const Q=c[J],me=t.getTile(Q),ae=me.getBucket(n);if(!ae)continue;const Ae=ae.getProjection().createInversionMatrix(T,Q.canonical),ve=[],Me=Id(Q,ae,T),Ue=!m&&M&&z,_e=m&&D&&z,se=E&&ae.hasTextData(),Te=ae.hasIconTextFit()&&se&&ae.hasIconData(),ge=Ue||_e||m&&se||Te,Re=ae.projection.name==="globe",De=Re?s.ah(T.zoom):0;Re&&(ve.push("PROJECTION_GLOBE_VIEW"),ge&&ve.push("PROJECTED_POS_ON_VIEWPORT"));const Fe=l.getOrCreateProgram("collisionBox",{defines:ve});let We=Me;d[0]===0&&d[1]===0||(We=l.translatePosMatrix(Me,me,d,p));const lt=m?ae.textCollisionBox:ae.iconCollisionBox,pt=ae.collisionCircleArray;if(pt.length>0){const ut=s.bz(),ct=We;s.cM(ut,ae.placementInvProjMatrix,T.glCoordMatrix),s.cM(ut,ut,ae.placementViewportMatrix),F.push({circleArray:pt,circleOffset:N,transform:ct,invTransform:ut,projection:ae.getProjection()}),L+=pt.length/4,N=L}if(!lt)continue;l.terrain&&l.terrain.setupElevationDraw(me,Fe);const et=Re?[Q.canonical.x,Q.canonical.y,1<<Q.canonical.z]:[0,0,0];Fe.draw(l,x.LINES,rt.disabled,vt.disabled,l.colorModeForRenderPass(),_t.disabled,Sa(We,Ae,T,De,S,me,et,ae.getProjection()),n.id,lt.layoutVertexBuffer,lt.indexBuffer,lt.segments,null,T.zoom,null,[lt.collisionVertexBuffer,lt.collisionVertexBufferExt])}if(!m||!F.length)return;const U=l.getOrCreateProgram("collisionCircle"),q=new s.dU;q.resize(4*L),q._trim();let Y=0;for(const J of F)for(let Q=0;Q<J.circleArray.length/4;Q++){const me=4*Q,ae=J.circleArray[me+0],Ae=J.circleArray[me+1],ve=J.circleArray[me+2],Me=J.circleArray[me+3];q.emplace(Y++,ae,Ae,ve,Me,0),q.emplace(Y++,ae,Ae,ve,Me,1),q.emplace(Y++,ae,Ae,ve,Me,2),q.emplace(Y++,ae,Ae,ve,Me,3)}(!ds||ds.length<2*L)&&(ds=function(J){const Q=2*J,me=new s.a_;me.resize(Q),me._trim();for(let ae=0;ae<Q;ae++){const Ae=6*ae;me.uint16[Ae+0]=4*ae+0,me.uint16[Ae+1]=4*ae+1,me.uint16[Ae+2]=4*ae+2,me.uint16[Ae+3]=4*ae+2,me.uint16[Ae+4]=4*ae+3,me.uint16[Ae+5]=4*ae+0}return me}(L));const te=y.createIndexBuffer(ds,!0),re=y.createVertexBuffer(q,s.dV.members,!0);for(const J of F){const Q={u_matrix:J.transform,u_inv_matrix:J.invTransform,u_camera_to_center_distance:(K=T).getCameraToCenterDistance(J.projection),u_viewport_size:[K.width,K.height]};U.draw(l,x.TRIANGLES,rt.disabled,vt.disabled,l.colorModeForRenderPass(),_t.disabled,Q,n.id,re,te,s.bd.simpleSegment(0,2*J.circleOffset,J.circleArray.length,J.circleArray.length/2),null,T.zoom)}var K;re.destroy(),te.destroy()}const Vs=s.bz();function zl(l){const t=l._camera.getWorldToCamera(l.worldSize,1),n=s.az([],t,l.globeMatrix);s.bi(n,n);const c=[0,0,0],d=[0,1,0,0];return s.aA(d,d,n),c[0]=d[0],c[1]=d[1],c[2]=d[2],s.au(c,c),c}function cu({width:l,height:t,anchor:n,textOffset:c,textScale:d},p){const{horizontalAlign:m,verticalAlign:y}=s.bZ(n),x=-(m-.5)*l,T=-(y-.5)*t,S=s.b_(n,c);return new s.P((x/d+S[0])*p,(T/d+S[1])*p)}function sp(l,t,n,c,d,p,m,y,x,T){const S=l.text.placedSymbolArray,C=l.text.dynamicLayoutVertexArray,E=l.icon.dynamicLayoutVertexArray,M={},D=l.getProjection(),z=lc(m,D,d),F=d.elevation,L=D.upVectorScale(m.canonical,d.center.lat,d.worldSize).metersToTile;C.clear();for(let N=0;N<S.length;N++){const U=S.get(N),{tileAnchorX:q,tileAnchorY:Y,numGlyphs:te}=U,re=U.hidden||!U.crossTileID||l.allowVerticalPlacement&&!U.placedOrientation?null:c[U.crossTileID];if(re){let K=0,J=0,Q=0;if(F){const Te=F?F.getAtTileOffset(m,q,Y):0,[ge,Re,De]=D.upVector(m.canonical,q,Y);K=Te*ge*L,J=Te*Re*L,Q=Te*De*L}let[me,ae,Ae,ve]=Rn(U.projectedAnchorX+K,U.projectedAnchorY+J,U.projectedAnchorZ+Q,n?z:p);const Me=Ah(d.getCameraToCenterDistance(D),ve);let Ue=s.bJ(l.textSizeData,x,U)*Me/s.bU;n&&(Ue*=l.tilePixelRatio/y);const _e=cu(re,Ue);n?({x:me,y:ae,z:Ae}=D.projectTilePoint(q+_e.x,Y+_e.y,m.canonical),[me,ae,Ae]=Rn(me+K,ae+J,Ae+Q,p)):(t&&_e._rotate(-d.angle),me+=_e.x,ae+=_e.y,Ae=0);const se=l.allowVerticalPlacement&&U.placedOrientation===s.bI.vertical?Math.PI/2:0;for(let Te=0;Te<te;Te++)s.bL(C,me,ae,Ae,se);T&&U.associatedIconIndex>=0&&(M[U.associatedIconIndex]={x:me,y:ae,z:Ae,angle:se})}else ca(te,C)}if(T){E.clear();const N=l.icon.placedSymbolArray;for(let U=0;U<N.length;U++){const q=N.get(U),{numGlyphs:Y}=q,te=M[U];if(q.hidden||!te)ca(Y,E);else{const{x:re,y:K,z:J,angle:Q}=te;for(let me=0;me<Y;me++)s.bL(E,re,K,J,Q)}}l.icon.dynamicLayoutVertexBuffer.updateData(E)}l.text.dynamicLayoutVertexBuffer.updateData(C)}function hu(l,t,n,c,d,p,m={}){const y=n.paint.get("icon-translate"),x=n.paint.get("text-translate"),T=n.paint.get("icon-translate-anchor"),S=n.paint.get("text-translate-anchor"),C=n.layout.get("icon-rotation-alignment"),E=n.layout.get("text-rotation-alignment"),M=n.layout.get("icon-pitch-alignment"),D=n.layout.get("text-pitch-alignment"),z=n.layout.get("icon-keep-upright"),F=n.layout.get("text-keep-upright"),L=n.paint.get("icon-color-saturation"),N=n.paint.get("icon-color-contrast"),U=n.paint.get("icon-color-brightness-min"),q=n.paint.get("icon-color-brightness-max"),Y=n.layout.get("symbol-elevation-reference")==="sea",te=l.context,re=te.gl,K=l.transform,J=C==="map",Q=E==="map",me=M==="map",ae=D==="map",Ae=n.layout.get("symbol-sort-key").constantOr(1)!==void 0;let ve=!1;const Me=l.depthModeForSublayer(0,rt.ReadOnly),Ue=new rt(l.context.gl.LEQUAL,rt.ReadOnly,l.depthRangeFor3D),_e=[s.aD(K.center.lng),s.aH(K.center.lat)],se=n.layout.get("text-variable-anchor"),Te=K.projection.name==="globe",ge=[],Re=[0,-1,0];for(const De of c){const Fe=t.getTile(De),We=Fe.getBucket(n);if(!We||We.projection.name==="mercator"&&Te||We.fullyClipped)continue;const lt=We.projection.name==="globe",pt=lt?s.ah(K.zoom):0,et=lc(De,We.getProjection(),K),ut=K.calculatePixelsToTileUnitsMatrix(Fe),ct=se&&We.hasTextData(),Tt=We.hasIconTextFit()&&ct&&We.hasIconData(),Mt=We.getProjection().createInversionMatrix(K,De.canonical),Bt=(1<<Fe.tileID.canonical.z)*s.aj/l.transform.worldSize,Jt=mi=>{let ni=[0,0,0];if(mi){const Hi=l.style.directionalLight,Yt=l.style.ambientLight;Hi&&Yt&&(ni=Ds(l.style,Hi,Yt))}return ni},At=mi=>{K.depthOcclusionForSymbolsAndCircles&&(n.hasInitialOcclusionOpacityProperties||l.terrain)&&(mi.push("DEPTH_D24"),mi.push("DEPTH_OCCLUSION"))},Qt=()=>{const mi=J&&n.layout.get("symbol-placement")!=="point",ni=[];At(ni);const Hi=mi||Tt,Yt=We.elevationType==="road",ai=l.shadowRenderer,wi=Yt&&me&&!!ai&&ai.enabled,pr=Jt(wi),hr=Yt&&me&&!l.terrain?Ue:Me,mr=n.paint.get("icon-image-cross-fade");l.terrainRenderModeElevated()&&me&&ni.push("PITCH_WITH_MAP_TERRAIN"),lt&&(ni.push("PROJECTION_GLOBE_VIEW"),Hi&&ni.push("PROJECTED_POS_ON_VIEWPORT")),mr>0&&We.hasAnySecondaryIcon&&ni.push("ICON_TRANSITION"),!We.icon.zOffsetVertexBuffer||Yt&&l.terrain||ni.push("Z_OFFSET"),L===0&&N===0&&U===0&&q===1||ni.push("COLOR_ADJUSTMENT"),We.sdfIcons&&ni.push("RENDER_SDF"),wi&&ni.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Yt&&me&&!l.terrain&&We.icon.orientationVertexBuffer&&ni.push("ELEVATED_ROADS");const Fr=We.icon.programConfigurations.get(n.id),ao=l.getOrCreateProgram("symbol",{config:Fr,defines:ni}),ln=Fe.imageAtlasTexture?Fe.imageAtlasTexture.size:[0,0],Sn=We.iconSizeData,Ur=s.bH(Sn,K.zoom),Bn=me||!K.isOrthographic,eo=ml(et,Fe.tileID.canonical,me,J,K,We.getProjection(),ut),Gr=Lo(et,Fe.tileID.canonical,me,J,K,We.getProjection(),ut),nr=l.translatePosMatrix(Gr,Fe,y,T,!0),Ki=l.translatePosMatrix(et,Fe,y,T),Ii=Hi?Vs:eo,Tr=J&&!me&&!mi;let Or=Re;!Te&&!K.mercatorFromTransition||J||(Or=zl(K));const or=lt?Or:Re,Nn=n.getColorAdjustmentMatrix(L,N,U,q),qs=Bc(Sn.kind,Ur,Tr,me,l,Ki,Ii,nr,Y,!1,ln,[0,0],0,De,pt,_e,Mt,or,We.getProjection(),pr,Bt,Nn,mr,null),xs=Fe.imageAtlasTexture?Fe.imageAtlasTexture:null,Na=n.layout.get("icon-size").constantOr(0)!==1||We.iconsNeedLinear,Va=We.sdfIcons||l.options.rotating||l.options.zooming||Na||Bn?re.LINEAR:re.NEAREST,Vn=We.sdfIcons&&n.paint.get("icon-halo-width").constantOr(1)!==0,go=l.terrain&&me&&mi?s.bi(s.bz(),eo):Vs;if(mi&&We.icon){const Sr=K.elevation,jn=Sr?Sr.getAtTileOffsetFunc(De,K.center.lat,K.worldSize,We.getProjection()):null,Hs=la(et,Fe.tileID.canonical,me,J,K,We.getProjection(),ut);Ps(We,et,l,!1,Hs,Gr,me,z,jn,De)}return{program:ao,buffers:We.icon,uniformValues:qs,atlasTexture:xs,atlasTextureIcon:null,atlasInterpolation:Va,atlasInterpolationIcon:null,isSDF:We.sdfIcons,hasHalo:Vn,depthMode:hr,tile:Fe,renderWithShadows:wi,labelPlaneMatrixInv:go}},ri=()=>{const mi=Q&&n.layout.get("symbol-placement")!=="point",ni=[],Hi=mi||se||Tt,Yt=We.elevationType==="road",ai=l.shadowRenderer,wi=Yt&&ae&&!!ai&&ai.enabled,pr=Jt(wi),hr=Yt&&ae&&!l.terrain?Ue:Me;l.terrainRenderModeElevated()&&ae&&ni.push("PITCH_WITH_MAP_TERRAIN"),lt&&(ni.push("PROJECTION_GLOBE_VIEW"),Hi&&ni.push("PROJECTED_POS_ON_VIEWPORT")),!We.text.zOffsetVertexBuffer||Yt&&l.terrain||ni.push("Z_OFFSET"),We.iconsInText&&ni.push("RENDER_TEXT_AND_SYMBOL"),ni.push("RENDER_SDF"),wi&&ni.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Yt&&ae&&!l.terrain&&We.text.orientationVertexBuffer&&ni.push("ELEVATED_ROADS"),At(ni);const mr=We.text.programConfigurations.get(n.id),Fr=l.getOrCreateProgram("symbol",{config:mr,defines:ni});let ao,ln=[0,0],Sn=null;const Ur=We.textSizeData;We.iconsInText&&(ln=Fe.imageAtlasTexture?Fe.imageAtlasTexture.size:[0,0],Sn=Fe.imageAtlasTexture?Fe.imageAtlasTexture:null,ao=ae||!K.isOrthographic||l.options.rotating||l.options.zooming||Ur.kind==="composite"||Ur.kind==="camera"?re.LINEAR:re.NEAREST);const Bn=Fe.glyphAtlasTexture?Fe.glyphAtlasTexture.size:[0,0],eo=n.layout.get("text-size-scale-range"),Gr=s.ay(l.scaleFactor,eo[0],eo[1]),nr=s.bH(Ur,K.zoom,Gr),Ki=ml(et,Fe.tileID.canonical,ae,Q,K,We.getProjection(),ut),Ii=Lo(et,Fe.tileID.canonical,ae,Q,K,We.getProjection(),ut),Tr=l.translatePosMatrix(Ii,Fe,x,S,!0),Or=l.translatePosMatrix(et,Fe,x,S),or=Hi?Vs:Ki,Nn=Q&&!ae&&!mi;let qs=Re;!Te&&!K.mercatorFromTransition||Q||(qs=zl(K));const xs=Bc(Ur.kind,nr,Nn,ae,l,Or,or,Tr,Y,!0,Bn,ln,0,De,pt,_e,Mt,lt?qs:Re,We.getProjection(),pr,Bt,null,null,Gr),Na=Fe.glyphAtlasTexture?Fe.glyphAtlasTexture:null,Va=re.LINEAR,Vn=n.paint.get("text-halo-width").constantOr(1)!==0,go=l.terrain&&ae&&mi?s.bi(s.bz(),Ki):Vs;if(mi&&We.text){const Sr=K.elevation,jn=Sr?Sr.getAtTileOffsetFunc(De,K.center.lat,K.worldSize,We.getProjection()):null,Hs=la(et,Fe.tileID.canonical,ae,Q,K,We.getProjection(),ut);Ps(We,et,l,!0,Hs,Ii,ae,F,jn,De)}return{program:Fr,buffers:We.text,uniformValues:xs,atlasTexture:Na,atlasTextureIcon:Sn,atlasInterpolation:Va,atlasInterpolationIcon:ao,isSDF:!0,hasHalo:Vn,depthMode:hr,tile:Fe,renderWithShadows:wi,labelPlaneMatrixInv:go}},Si=We.icon.segments.get().length,Ft=We.text.segments.get().length,ei=Si&&!m.onlyText?Qt():null,ti=Ft&&!m.onlyIcons?ri():null,si=n.paint.get("icon-opacity").constantOr(1),Nt=n.paint.get("text-opacity").constantOr(1);if(Ae&&We.canOverlap){ve=!0;const mi=si&&!m.onlyText?We.icon.segments.get():[],ni=Nt&&!m.onlyIcons?We.text.segments.get():[];for(const Hi of mi)ge.push({segments:new s.bd([Hi]),sortKey:Hi.sortKey,state:ei});for(const Hi of ni)ge.push({segments:new s.bd([Hi]),sortKey:Hi.sortKey,state:ti})}else m.onlyText||ge.push({segments:si?We.icon.segments:new s.bd([]),sortKey:0,state:ei}),m.onlyIcons||ge.push({segments:Nt?We.text.segments:new s.bd([]),sortKey:0,state:ti})}ve&&ge.sort((De,Fe)=>De.sortKey-Fe.sortKey);for(const De of ge){const Fe=De.state;if(Fe)if(l.terrain?l.terrain.setupElevationDraw(Fe.tile,Fe.program,{useDepthForOcclusion:K.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Fe.labelPlaneMatrixInv}):l.setupDepthForOcclusion(K.depthOcclusionForSymbolsAndCircles,Fe.program),te.activeTexture.set(re.TEXTURE0),Fe.atlasTexture&&Fe.atlasTexture.bind(Fe.atlasInterpolation,re.CLAMP_TO_EDGE,!0),Fe.atlasTextureIcon&&(te.activeTexture.set(re.TEXTURE1),Fe.atlasTextureIcon&&Fe.atlasTextureIcon.bind(Fe.atlasInterpolationIcon,re.CLAMP_TO_EDGE,!0)),Fe.renderWithShadows&&l.shadowRenderer.setupShadows(Fe.tile.tileID.toUnwrapped(),Fe.program,"vector-tile"),l.uploadCommonLightUniforms(l.context,Fe.program),Fe.hasHalo){const We=Fe.uniformValues;We.u_is_halo=1,ps(Fe.buffers,De.segments,n,l,Fe.program,Fe.depthMode,d,p,We,2),We.u_is_halo=0}else{if(Fe.isSDF){const We=Fe.uniformValues;Fe.hasHalo&&(We.u_is_halo=1,ps(Fe.buffers,De.segments,n,l,Fe.program,Fe.depthMode,d,p,We,1)),We.u_is_halo=0}ps(Fe.buffers,De.segments,n,l,Fe.program,Fe.depthMode,d,p,Fe.uniformValues,1)}}}function ps(l,t,n,c,d,p,m,y,x,T){const S=[l.dynamicLayoutVertexBuffer,l.opacityVertexBuffer,l.iconTransitioningVertexBuffer,l.globeExtVertexBuffer,l.zOffsetVertexBuffer,l.orientationVertexBuffer];d.draw(c,c.context.gl.TRIANGLES,p,m,y,_t.disabled,x,n.id,l.layoutVertexBuffer,l.indexBuffer,t,n.paint,c.transform.zoom,l.programConfigurations.get(n.id),S,T)}function Rl(l,t){const n=1<<l.canonical.z,c=(t.x*n-l.canonical.x-l.wrap*n)*s.aj,d=(t.y*n-l.canonical.y)*s.aj,p=s.e2(t.z,t.y);return s.d2(c,d,p)}function nt(l,t,n,c,d){if(!n.layout||n.layout.get("fill-elevation-reference")==="none")return;const p=l.context.gl,m=new rt(l.context.gl.LEQUAL,rt.ReadWrite,l.depthRangeFor3D),y=new rt(l.context.gl.GREATER,rt.ReadWrite,l.depthRangeFor3D),x=function(M){const D=s.cU(M.pitch);let z=.01;return M.isOrthographic&&(z=s.ai(1e-4,z,s.cZ(D>=Lr?1:D/Lr))),2*z}(l.transform),T=l.transform.getFreeCameraOptions().position,S="elevatedStructuresDepthReconstruct",C=l.getOrCreateProgram(S,{defines:["DEPTH_RECONSTRUCTION"]}),E=l.getOrCreateProgram(S);for(const M of c){const D=t.getTile(M),z=D.getBucket(n);if(!z)continue;const F=z.elevatedStructures;if(!F)continue;const L=z.elevationBufferData.heightRange,N=Rl(M.toUnwrapped(),T),U=l.translatePosMatrix(M.projMatrix,D,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor"));let q,Y,te,re;if(d==="initialize"){if(!L||L.min>=1||F.depthSegments.segments[0].primitiveLength===0)continue;q=Lc(U,N,x,1,0),Y=m,te=F.depthSegments,re=C}else if(d==="reset"){if(!L||L.min>=0||F.maskSegments.segments[0].primitiveLength===0)continue;q=Lc(U,N,0,0,1),Y=y,te=F.maskSegments,re=C}else if(d==="geometry"){if(F.depthSegments.segments[0].primitiveLength===0)continue;q=Lc(U,N,x,1,0),Y=m,te=F.depthSegments,re=E}re.draw(l,p.TRIANGLES,Y,vt.disabled,Rt.disabled,_t.disabled,q,n.id,F.vertexBuffer,F.indexBuffer,te,n.paint,l.transform.zoom)}}function Vc(l,t,n){const{painter:c,sourceCache:d,layer:p,coords:m,colorMode:y,elevationType:x,terrainEnabled:T,pass:S}=l,C=c.context.gl,E=p.paint.get("fill-pattern"),M=p.paint.get("fill-pattern-cross-fade"),D=E.constantOr(null);let z=x;x!=="road"||t&&!T||(z="none");const F=z==="road",L=l.painter.shadowRenderer,N=F&&!!L&&L.enabled,U=new rt(c.context.gl.LEQUAL,rt.ReadOnly,c.depthRangeFor3D);let q=[0,0,0];if(N){const re=c.style.directionalLight,K=c.style.ambientLight;re&&K&&(q=Ds(c.style,re,K))}const Y=E&&E.constantOr(1),te=(re,K)=>{let J,Q,me,ae,Ae;K?(J=Y&&!p.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",me=C.LINES):(J=Y?"fillPattern":"fill",me=C.TRIANGLES);for(const ve of m){const Me=d.getTile(ve);if(Y&&!Me.patternsLoaded())continue;const Ue=Me.getBucket(p);if(!Ue)continue;const _e=t?Ue.elevationBufferData:Ue.bufferData;if(_e.isEmpty())continue;c.prepareDrawTile();const se=_e.programConfigurations.get(p.id),Te=c.isTileAffectedByFog(ve),ge=[],Re=[];F&&(ge.push("ELEVATED_ROADS"),Re.push(_e.elevatedLayoutVertexBuffer)),N&&ge.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),Y&&(c.context.activeTexture.set(C.TEXTURE0),Me.imageAtlasTexture&&Me.imageAtlasTexture.bind(C.LINEAR,C.CLAMP_TO_EDGE),se.updatePaintBuffers());let De=!1;if(D&&Me.imageAtlas){const et=Me.imageAtlas,ut=s.dZ.from(D),ct=ut.getPrimary().scaleSelf(s.q.devicePixelRatio).toString(),Tt=ut.getSecondary(),Mt=et.patternPositions.get(ct),Bt=Tt?et.patternPositions.get(Tt.scaleSelf(s.q.devicePixelRatio).toString()):null;De=!!Mt&&!!Bt,Mt&&se.setConstantPatternPositions(Mt,Bt)}M>0&&(De||se.getPatternTransitionVertexBuffer("fill-pattern"))&&ge.push("FILL_PATTERN_TRANSITION");const Fe=c.getOrCreateProgram(J,{config:se,overrideFog:Te,defines:ge}),We=c.translatePosMatrix(ve.projMatrix,Me,p.paint.get("fill-translate"),p.paint.get("fill-translate-anchor"));N&&L.setupShadows(Me.tileID.toUnwrapped(),Fe,"vector-tile");const lt=p.paint.get("fill-emissive-strength");if(K){ae=_e.lineIndexBuffer,Ae=_e.lineSegments;const et=c.terrain&&c.terrain.renderingToTexture?c.terrain.drapeBufferSize:[C.drawingBufferWidth,C.drawingBufferHeight];Q=J==="fillOutlinePattern"&&Y?Hf(We,lt,c,Me,et,q,M):qf(We,lt,et,q)}else ae=_e.indexBuffer,Ae=_e.triangleSegments,Q=Y?Kd(We,lt,c,Me,q,M):Yd(We,lt,q);c.uploadCommonUniforms(c.context,Fe,ve.toUnwrapped());let pt=re;(x==="road"&&!T||x==="offset")&&(pt=U),Fe.draw(c,me,pt,n||c.stencilModeForClipping(ve),y,_t.disabled,Q,p.id,_e.layoutVertexBuffer,ae,Ae,p.paint,c.transform.zoom,se,Re)}};c.renderPass===S&&te(c.depthModeForSublayer(1,c.renderPass==="opaque"?rt.ReadWrite:rt.ReadOnly),!1),z==="none"&&c.renderPass==="translucent"&&p.paint.get("fill-antialias")&&te(c.depthModeForSublayer(p.getPaintProperty("fill-outline-color")?2:0,rt.ReadOnly),!0)}function Dl(l,t,n,c,d,p,m,y){n.resetLayerRenderingStats(l);const x=l.context,T=x.gl,S=l.transform,C=n.paint.get("fill-extrusion-pattern"),E=n.paint.get("fill-extrusion-pattern-cross-fade"),M=C.constantOr(null),D=C.constantOr(1),z=n.paint.get("fill-extrusion-opacity"),F=l.style.enable3dLights(),L=n.paint.get(F&&!D?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),N=[n.paint.get("fill-extrusion-ambient-occlusion-intensity"),L],U=n.layout.get("fill-extrusion-edge-radius"),q=U>0&&!n.paint.get("fill-extrusion-rounded-roof"),Y=q?0:U,te=S.projection.name==="globe"?s.e5():0,re=S.projection.name==="globe",K=re?s.ah(S.zoom):0,J=[s.aD(S.center.lng),s.aH(S.center.lat)],Q=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",me=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(Q?null:n.lut).toArray01().slice(0,3),ae=n.paint.get("fill-extrusion-flood-light-intensity"),Ae=n.paint.get("fill-extrusion-vertical-scale"),ve=n.paint.get("fill-extrusion-line-width").constantOr(1)!==0,Me=n.paint.get("fill-extrusion-height-alignment"),Ue=n.paint.get("fill-extrusion-base-alignment"),_e=uo(l,n.paint.get("fill-extrusion-cutoff-fade-range")),se=[];let Te;re&&se.push("PROJECTION_GLOBE_VIEW"),N[0]>0&&se.push("FAUX_AO"),q&&se.push("ZERO_ROOF_RADIUS"),y&&se.push("HAS_CENTROID"),ae>0&&se.push("FLOOD_LIGHT"),_e.shouldRenderCutoff&&se.push("RENDER_CUTOFF"),ve&&se.push("RENDER_WALL_MODE");const ge=l.renderPass==="shadow",Re=l.shadowRenderer,De=ge&&!!Re,Fe=ge?_t.disabled:_t.backCCW;l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0);let We=[0,0,0];if(Re){const et=l.style.directionalLight,ut=l.style.ambientLight;et&&ut&&(We=Ds(l.style,et,ut)),ge||(se.push("RENDER_SHADOWS","DEPTH_TEXTURE"),Re.useNormalOffset&&se.push("NORMAL_OFFSET")),Te=se.concat(["SHADOWS_SINGLE_CASCADE"])}const lt=De?"fillExtrusionDepth":D?"fillExtrusionPattern":"fillExtrusion",pt=n.getLayerRenderingStats();for(const et of c){const ut=t.getTile(et),ct=ut.getBucket(n);if(!ct||ct.projection.name!==S.projection.name)continue;let Tt=!1;Re&&(Tt=Re.getMaxCascadeForTile(et.toUnwrapped())===0);const Mt=l.isTileAffectedByFog(et),Bt=ct.programConfigurations.get(n.id);let Jt=!1;if(M&&ut.imageAtlas){const ti=ut.imageAtlas,si=s.dZ.from(M),Nt=si.getPrimary().scaleSelf(s.q.devicePixelRatio).toString(),mi=si.getSecondary(),ni=ti.patternPositions.get(Nt),Hi=mi?ti.patternPositions.get(mi.scaleSelf(s.q.devicePixelRatio).toString()):null;Jt=!!ni&&!!Hi,ni&&Bt.setConstantPatternPositions(ni,Hi)}E>0&&(Jt||Bt.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&se.push("FILL_EXTRUSION_PATTERN_TRANSITION");const At=l.getOrCreateProgram(lt,{config:Bt,defines:Tt?Te:se,overrideFog:Mt});if(l.terrain&&l.terrain.setupElevationDraw(ut,At,{useMeterToDem:!0}),!ct.centroidVertexBuffer){const ti=At.attributes.a_centroid_pos;ti!==void 0&&T.vertexAttrib2f(ti,0,0)}!ge&&Re&&Re.setupShadows(ut.tileID.toUnwrapped(),At,"vector-tile"),D&&(l.context.activeTexture.set(T.TEXTURE0),ut.imageAtlasTexture&&ut.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),Bt.updatePaintBuffers());const Qt=n.paint.get("fill-extrusion-vertical-gradient"),ri=1/ct.tileToMeter;let Si;if(ge&&Re){if(jc(ut.tileID,ct.maxHeight,l))continue;const ti=Re.calculateShadowPassMatrixFromTile(ut.tileID.toUnwrapped());Si=Xd(ti,Y,ri,Ae,Me,Ue)}else{const ti=l.translatePosMatrix(et.expandedProjMatrix,ut,n.paint.get("fill-extrusion-translate"),n.paint.get("fill-extrusion-translate-anchor")),si=S.projection.createInversionMatrix(S,et.canonical);Si=D?Ta(ti,l,Qt,z,N,Y,ri,et,ut,te,Me,Ue,K,J,si,me,Ae,E):Qh(ti,l,Qt,z,N,Y,ri,et,te,Me,Ue,K,J,si,me,Ae,ae,We)}l.uploadCommonUniforms(x,At,et.toUnwrapped(),null,_e);let Ft=ct.segments;if(S.projection.name==="mercator"&&!ge&&(Ft=ct.getVisibleSegments(ut.tileID,l.terrain,l.transform.getFrustum(0)),!Ft.get().length))continue;if(pt)if(ge)for(const ti of Ft.get())pt.numRenderedVerticesInShadowPass+=ti.primitiveLength;else for(const ti of Ft.get())pt.numRenderedVerticesInTransparentPass+=ti.primitiveLength;const ei=[];(l.terrain||y)&&ei.push(ct.centroidVertexBuffer),re&&ei.push(ct.layoutVertexExtBuffer),ve&&ei.push(ct.wallVertexBuffer),At.draw(l,x.gl.TRIANGLES,d,p,m,Fe,Si,n.id,ct.layoutVertexBuffer,ct.indexBuffer,Ft,n.paint,l.transform.zoom,Bt,ei)}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1)}class ko{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function gn(l,t,n,c,d,p,m,y,x,T,S,C,E,M,D,z,F,L,N,U){const q=t.context,Y=q.gl,te=t.transform,re=t.transform.zoom,K=[],J=l.translate,Q=l.translateAnchor,me=l.edgeRadius,ae=uo(t,l.cutoffFadeRange);S==="clear"?(K.push("CLEAR_SUBPASS"),U&&(K.push("CLEAR_FROM_TEXTURE"),q.activeTexture.set(Y.TEXTURE0),U.bind(Y.LINEAR,Y.CLAMP_TO_EDGE))):S==="sdf"&&K.push("SDF_SUBPASS"),L&&K.push("HAS_CENTROID"),ae.shouldRenderCutoff&&K.push("RENDER_CUTOFF");const Ae=(ve,Me,Ue,_e,se)=>{const Te=Me.programConfigurations.get(c.id),ge=t.isTileAffectedByFog(ve),Re=t.getOrCreateProgram("fillExtrusionGroundEffect",{config:Te,defines:K,overrideFog:ge}),De=((We,lt,pt,et,ut,ct,Tt,Mt,Bt,Jt,At)=>({u_matrix:lt,u_opacity:pt,u_ao_pass:et?1:0,u_meter_to_tile:ut,u_ao:ct,u_flood_light_intensity:Tt,u_flood_light_color:Mt,u_attenuation:Bt,u_edge_radius:Jt,u_fb:0,u_fb_size:At,u_dynamic_offset:1}))(0,_e,C,T,se,[E,M*se],D,z,F,re>=17?0:me*se,U?U.size[0]:0),Fe=[];L&&Fe.push(Me.hiddenByLandmarkVertexBuffer),t.uploadCommonUniforms(q,Re,ve.toUnwrapped(),null,ae),Re.draw(t,q.gl.TRIANGLES,p,m,y,x,De,c.id,Me.vertexBuffer,Me.indexBuffer,
2765Ue,c.paint,re,Te,Fe)};for(const ve of d){const Me=n.getTile(ve),Ue=Me.getBucket(c);if(!Ue||Ue.projection.name!==te.projection.name||!Ue.groundEffect||Ue.groundEffect&&!Ue.groundEffect.hasData())continue;const _e=Ue.groundEffect,se=1/Ue.tileToMeter;{const Te=t.translatePosMatrix(ve.projMatrix,Me,J,Q),ge=_e.getDefaultSegment();Ae(ve,_e,ge,Te,se)}if(N)for(let Te=0;Te<4;Te++){const ge=s.e3[Te](ve),Re=n.getTile(ge);if(!Re)continue;const De=Re.getBucket(c);if(!De||De.projection.name!==te.projection.name||!De.groundEffect||De.groundEffect&&!De.groundEffect.hasData())continue;const Fe=De.groundEffect;let We,lt;Te===0?(We=[-s.aj,0,0],lt=1):Te===1?(We=[s.aj,0,0],lt=0):Te===2?(We=[0,-s.aj,0],lt=3):(We=[0,s.aj,0],lt=2);const pt=Fe.regionSegments[lt];if(!pt)continue;const et=new Float32Array(16);s.bo(et,ve.projMatrix,We),Ae(ve,Fe,pt,t.translatePosMatrix(et,Me,J,Q),se)}}}function yt(l,t,n,c,d,p,m){c.centroidVertexArray.length===0&&c.createCentroidsBuffer();const y=p?p.findDEMTileFor(n):null;if(!(y&&y.dem||m))return;p&&y&&y.dem&&c.selfDEMTileTimestamp!==y.dem._timestamp&&(c.borderDoneWithNeighborZ=[-1,-1,-1,-1],c.selfDEMTileTimestamp=y.dem._timestamp);const x=L=>
2765new s.P(Math.ceil((L+s.e7)*s.e8),0),T=L=>{const N=t.getSource().minzoom,U=Y=>{const te=t.getTileByID(Y);if(te&&te.hasData())return te.getBucket(d)},q=[0,-1,1];for(const Y of q){if(L.overscaledZ+Y<N)continue;const te=U(L.calculateScaledKey(L.overscaledZ+Y));if(te)return te}},S=[0,0,0],C=(L,N)=>(S[0]=Math.min(L.min.y,N.min.y),S[1]=Math.max(L.max.y,N.max.y),S[2]=s.aj-N.min.x>L.max.x?N.min.x-s.aj:L.max.x,S),E=(L,N)=>(S[0]=Math.min(L.min.x,N.min.x),S[1]=Math.max(L.max.x,N.max.x),S[2]=s.aj-N.min.y>L.max.y?N.min.y-s.aj:L.max.y,S),M=[(L,N)=>C(L,N),(L,N)=>C(N,L),(L,N)=>E(L,N),(L,N)=>E(N,L)],D=(L,N,U,q,Y,te,re)=>{if(!p)return 0;const K=[[te?U:L,te?L:U,0],[te?U:N,te?N:U,0]],J=re<0?s.aj+re:re,Q=[te?J:(L+N)/2,te?(L+N)/2:J,0];return U===0&&re<0||U!==0&&re>0?p.getForTilePoints(Y,[Q],!0,q):K.push(Q),p.getForTilePoints(n,K,!0,y),Math.max(K[0][2],K[1][2],Q[2])/p.exaggeration()};for(let L=0;L<4;L++){const N=c.borderFeatureIndices[L];if(N.length===0)continue;const U=s.e3[L](n),q=T(U);if(!(q&&q instanceof s.e4))continue;const Y=p?p.findDEMTileFor(U):null;if(!(Y&&Y.dem||m)||(p&&Y&&Y.dem&&c.borderDEMTileTimestamp[L]!==Y.dem._timestamp&&(c.borderDoneWithNeighborZ[L]=-1,c.borderDEMTileTimestamp[L]=Y.dem._timestamp),c.borderDoneWithNeighborZ[L]===q.canonical.z))continue;q.centroidVertexArray.length===0&&q.createCentroidsBuffer();const te=(L<2?1:5)-L,re=q.borderDoneWithNeighborZ[te]!==c.canonical.z,K=q.borderFeatureIndices[te];let J=0;if(c.canonical.z!==q.canonical.z){for(const Q of N)c.showCentroid(c.featuresOnBorder[Q]);if(re)for(const Q of K)q.showCentroid(q.featuresOnBorder[Q]);c.borderDoneWithNeighborZ[L]=q.canonical.z,q.borderDoneWithNeighborZ[te]=c.canonical.z}for(const Q of N){const me=c.featuresOnBorder[Q],ae=c.centroidData[me.centroidDataIndex],Ae=me.borders[L];let ve;for(;J<K.length;){ve=q.featuresOnBorder[K[J]];const Me=ve.borders[te];if(Me[1]>Ae[0]+3||Me[0]>Ae[0]-3)break;q.showCentroid(ve),J++}if(ve&&J<K.length){const Me=J;let Ue=0;for(;!(ve.borders[te][0]>Ae[1]-3)&&(Ue++,++J!==K.length);)ve=q.featuresOnBorder[K[J]];ve=q.featuresOnBorder[K[Me]];let _e=!1;if(Ue>=1){const ge=ve.borders[te];Math.abs(Ae[0]-ge[0])<3&&Math.abs(Ae[1]-ge[1])<3&&(Ue=1,_e=!0,J=Me+1)}else if(Ue===0){c.showCentroid(me);continue}const se=q.centroidData[ve.centroidDataIndex];m&&_e&&(((z=ae).flags|(F=se).flags)&s.e6?(z.flags|=s.e6,F.flags|=s.e6):(z.flags&=~s.e6,F.flags&=~s.e6));const Te=me.intersectsCount()>1||ve.intersectsCount()>1;if(Ue>1)J=Me,ae.centroidXY=se.centroidXY=new s.P(0,0);else if(Y&&Y.dem&&!Te){const ge=M[L](ae,se),Re=L%2?s.aj-1:0,De=D(ge[0],Math.min(s.aj-1,ge[1]),Re,Y,U,L<2,ge[2]);ae.centroidXY=se.centroidXY=x(De)}else Te?ae.centroidXY=se.centroidXY=new s.P(0,0):(ae.centroidXY=c.encodeBorderCentroid(me),se.centroidXY=q.encodeBorderCentroid(ve));c.writeCentroidToBuffer(ae),q.writeCentroidToBuffer(se)}else c.showCentroid(me)}c.borderDoneWithNeighborZ[L]=q.canonical.z,q.borderDoneWithNeighborZ[te]=c.canonical.z}var z,F;(c.needsCentroidUpdate||!c.centroidVertexBuffer&&c.centroidVertexArray.length!==0)&&c.uploadCentroid(l)}const uu=[1,0,0],Zf=[0,1,0],Wf=[0,0,1];function jc(l,t,n){const c=n.transform,d=n.shadowRenderer;if(!d)return!0;const p=l.toUnwrapped(),m=c.tileSize*d._cascades[n.currentShadowCascade].scale;let y=t;if(c.elevation){const z=c.elevation.getMinMaxForTile(l);z&&(y+=z.max)}const x=[...d.shadowDirection];x[2]=-x[2];const T=d.computeSimplifiedTileShadowVolume(p,y,m,x);if(!T)return!1;const S=[uu,Zf,Wf,x,[x[0],0,x[2]],[0,x[1],x[2]]],C=c.projection.name==="globe",E=c.scaleZoom(m),M=s.cy.fromInvProjectionMatrix(c.invProjMatrix,c.worldSize,E,!C),D=d.getCurrentCascadeFrustum();return M.intersectsPrecise(T.vertices,T.planes,S)===0||D.intersectsPrecise(T.vertices,T.planes,S)===0}function Uc(l){const{painter:t,source:n,layer:c,coords:d}=l,p=l.defines,m=t.context,y=t.renderPass==="shadow",x=t.renderPass==="light-beam",T=t.shadowRenderer;let S;T&&(S=p.concat(["SHADOWS_SINGLE_CASCADE"]));const C=s.e9(t.transform.center.lat,t.transform.zoom);for(const E of d){const M=n.getTile(E),D=M.getBucket(c);if(!D)continue;let z=!1;T&&(z=T.getMaxCascadeForTile(E.toUnwrapped())===0);const F=D.programConfigurations.get(c.id);let L,N,U=t.translatePosMatrix(E.expandedProjMatrix,M,[0,0],"map");if(U=s.cP(s.bz(),U,[1,1,l.verticalScale]),y&&T){if(jc(M.tileID,D.maxHeight*C,t))continue;let q=T.calculateShadowPassMatrixFromTile(M.tileID.toUnwrapped());q=s.cP(s.bz(),q,[1,1,l.verticalScale]),N=Jd(q),L=t.getOrCreateProgram("buildingDepth",{config:F,defines:z?S:p,overrideFog:!1})}else if(x)L=t.getOrCreateProgram("buildingBloom",{config:F,defines:z?S:p,overrideFog:!1}),N=tu(U);else{const q=t.transform.calculatePosMatrix(E.toUnwrapped(),t.transform.worldSize);s.cP(q,q,[1,1,l.verticalScale]);const Y=s.bz();s.cP(Y,q,[1,-1,1/C]),s.bi(Y,Y),s.ea(Y,Y),N=eu(U,Y),L=t.getOrCreateProgram("building",{config:F,defines:z?S:p,overrideFog:!1}
vendor: 15,202 bytes, line 2765
2765),T&&T.setupShadowsFromMatrix(q,L,!0)}if(t.uploadCommonUniforms(m,L,E.toUnwrapped(),null,null),x){const q=D.bloomGeometry;L.draw(t,m.gl.TRIANGLES,l.depthMode,vt.disabled,l.blendMode,_t.disabled,N,c.id,q.layoutVertexBuffer,q.indexBuffer,q.segmentsBucket,c.paint,t.transform.zoom,F,[q.layoutAttenuationBuffer,q.layoutColorBuffer])}else L.draw(t,m.gl.TRIANGLES,l.depthMode,vt.disabled,l.blendMode,y?_t.disabled:_t.backCW,N,c.id,D.layoutVertexBuffer,D.indexBuffer,D.segments,c.paint,t.transform.zoom,F,[D.layoutNormalBuffer,D.layoutColorBuffer])}}function ap(l){return[l[0]*s.eb,l[1]*s.eb,l[2]*s.eb,0]}function Gc(l,t,n,c,d,p,m,y,x){const T=c.getSource(),S=n.globeSharedBuffers;if(!S)return;let C,E,M;if(t&&(C=c.getTile(t)),T instanceof s.aP?(E=T.texture,M=s.dE(0,0,n.transform)):C&&t&&(E=C.texture,M=s.dE(t.canonical.z,t.canonical.x,n.transform)),!E||!M)return;l||(M=s.cP(s.bz(),M,[1,-1,1]));const D=n.context,z=D.gl,F=d.paint.get("raster-resampling")==="nearest"?z.NEAREST:z.LINEAR,L=n.colorModeForDrapableLayerRenderPass(p),N=m.defines;N.push("GLOBE_POLES");const U=new rt(z.LEQUAL,rt.ReadWrite,n.depthRangeFor3D),q=Float32Array.from(n.transform.expandedFarZProjMatrix),Y=Float32Array.from(s.bh(s.dD(new s.cA(0,0,0))));n.terrain&&n.terrain.prepareDrawTile(),D.activeTexture.set(z.TEXTURE0),E.bind(F,z.CLAMP_TO_EDGE),D.activeTexture.set(z.TEXTURE1),E.bind(F,z.CLAMP_TO_EDGE),"useMipmap"in E&&D.extTextureFilterAnisotropic&&n.transform.pitch>20&&z.texParameterf(z.TEXTURE_2D,D.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,D.extTextureFilterAnisotropicMax);const[te,re,K,J]=t?S.getPoleBuffers(t.canonical.z,!1):S.getPoleBuffers(0,!0),Q=d.paint.get("raster-elevation");let me;l?(me=te,n.renderDefaultNorthPole=Q!==0):(me=re,n.renderDefaultSouthPole=Q!==0);const ae=ap(m.mix),Ae=((Me,Ue,_e,se,Te,ge,Re,De,Fe,We,lt,pt,et)=>ru(Me,Ue,_e,new Float32Array(16),new Float32Array(9),[0,0],se,[0,0],[0,0,0,0],1,{opacity:1,mix:0},ge,[0,0],De,2,We,lt,pt,1,0,et))(q,Y,M,s.ah(n.transform.zoom),0,d,0,Q,0,ae,m.offset,m.range,p),ve=n.getOrCreateProgram("raster",{defines:N});n.uploadCommonUniforms(D,ve,null),ve.draw(n,z.TRIANGLES,U,x,L,y,Ae,d.id,me,K,J)}function Xf(l){const t=l._nearZ,n=l.projection.farthestPixelDistance(l),c=n-t,d=.2*l.height,p=t+d;return[t,n,(p-d-t)/c,(p-t)/c]}function Yf(l,t,n,c){if(l)return t instanceof Qo&&l instanceof na?t.getTextureDescriptor(l,n,!0):{texture:l.texture,mix:ap(c.mix),offset:c.offset,buffer:0,tileSize:1}}var Tn=s.ec([{name:"a_index",type:"Int16",components:1}]);class du{constructor(t,n,c,d){const p={width:c[0],height:c[1],data:null},m=t.gl;this.targetColorTexture=new s.T(t,p,m.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new s.T(t,p,m.RGBA8,{useMipmap:!1}),this.context=t,this.updateParticleTexture(n,d),this.lastInvalidatedAt=0}updateParticleTexture(t,n){if(this.particleTextureDimension===n.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const c=this.context.gl,d=n.width*n.height;this.particleTexture0=new s.T(this.context,n,c.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new s.T(this.context,n,c.RGBA8,{premultiply:!1,useMipmap:!1});const p=new s.ed;p.reserve(d);for(let m=0;m<d;m++)p.emplaceBack(m);this.particleIndexBuffer=this.context.createVertexBuffer(p,Tn.members,!0),this.particleSegment=s.bd.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=n.width}update(t){return!(this.lastInvalidatedAt<t&&(this.lastInvalidatedAt=s.q.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}function sn(l,t,n){if(!l)return null;const c=t.getTextureDescriptor(l,n,!0);if(!c)return null;let{texture:d,mix:p,offset:m,tileSize:y,buffer:x,format:T}=c;if(!d||!T)return null;let S=!1;return T==="uint32"&&(S=!0,p[3]=0,p=Fc(s.ee,p,[0,n.paint.get("raster-particle-max-speed")]),m=ls(s.ee,m,[0,n.paint.get("raster-particle-max-speed")])),{texture:d,textureOffset:[x/(y+2*x),y/(y+2*x)],tileSize:y,scalarData:S,scale:p,offset:m,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function fs(l){const t=l._nearZ,n=l.projection.farthestPixelDistance(l),c=n-t,d=.2*l.height,p=t+d;return[t,n,(p-d-t)/c,(p-t)/c]}const lp=new s.am(1,0,0,1),pu=new s.am(0,1,0,1),fu=new s.am(0,0,1,1),mu=new s.am(1,0,1,1),cp=new s.am(0,1,1,1);function po(l,t,n,c,d,p){for(let m=0;m<n.length;m++)if(d){const T=new s.am(c.r*.8,c.g*.8,c.b*.8,1);yi(l,t,n[m],c,-1,-1,p),yi(l,t,n[m],c,-1,1,p),yi(l,t,n[m],c,1,1,p),yi(l,t,n[m],c,1,-1,p),yi(l,t,n[m],T,0,0,p)}else yi(l,t,n[m],c,0,0,p)}function yi(l,t,n,c,d,p,m){const y=l.context,x=l.transform,T=y.gl,S=x.projection.name==="globe",C=S?["PROJECTION_GLOBE_VIEW"]:[];let E=s.bw(n.projMatrix);if(S&&s.ah(x.zoom)>0){const ae=s.bg(n.canonical,x),Ae=s.ef(ae);E=s.az(new Float32Array(16),x.globeMatrix,Ae),s.az(E,x.projMatrix,E)}const M=s.bz();M[12]+=2*d/(s.q.devicePixelRatio*x.width),M[13]+=2*p/(s.q.devicePixelRatio*x.height),s.az(E,M,E);const D=l.getOrCreateProgram("debug",{defines:C}),z=t.getTileByID(n.key);l.terrain&&l.terrain.setupElevationDraw(z,D);const F=rt.disabled,L=vt.disabled,N=l.colorModeForRenderPass(),U="$debug";y.activeTexture.set(T.TEXTURE0),l.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),S?z._makeGlobeTileDebugBuffers(l.context,x):z._makeDebugTileBoundsBuffers(l.context,x.projection);const q=z._tileDebugBuffer||l.debugBuffer,Y=z._tileDebugIndexBuffer||l.debugIndexBuffer,te=z._tileDebugSegments||l.debugSegments;if(D.draw(l,T.LINE_STRIP,F,L,N,_t.disabled,iu(E,c.toPremultipliedRenderColor(null)),U,q,Y,te,null,null,null,[z._globeTileDebugBorderBuffer]),m){const ae=z.latestRawTileData,Ae=Math.floor((ae&&ae.byteLength||0)/1024);let ve=n.canonical.toString();n.overscaledZ!==n.canonical.z&&(ve+=` => ${n.overscaledZ}`),ve+=` ${z.state}`,ve+=` ${Ae}kb`,function(Me,Ue){Me.initDebugOverlayCanvas();const _e=Me.debugOverlayCanvas,se=Me.context.gl,Te=Me.debugOverlayCanvas.getContext("2d");Te.clearRect(0,0,_e.width,_e.height),Te.shadowColor="white",Te.shadowBlur=2,Te.lineWidth=1.5,Te.strokeStyle="white",Te.textBaseline="top",Te.font="bold 36px Open Sans, sans-serif",Te.fillText(Ue,5,5),Te.strokeText(Ue,5,5),Me.debugOverlayTexture.update(_e),Me.debugOverlayTexture.bind(se.LINEAR,se.CLAMP_TO_EDGE)}(l,ve)}const re=t.getTile(n).tileSize,K=512/Math.min(re,512)*(n.overscaledZ/x.zoom)*.5,J=z._tileDebugTextBuffer||l.debugBuffer,Q=z._tileDebugTextIndexBuffer||l.quadTriangleIndexBuffer,me=z._tileDebugTextSegments||l.debugSegments;D.draw(l,T.TRIANGLES,F,L,Rt.alphaBlended,_t.disabled,iu(E,s.am.transparent.toPremultipliedRenderColor(null),K),U,J,Q,me,null,null,null,[z._globeTileDebugTextBuffer])}function Ll(l,t,n,c){Fl(l,0,t+n/2,l.transform.width,n,c)}function qc(l,t,n,c){Fl(l,t-n/2,0,n,l.transform.height,c)}function Fl(l,t,n,c,d,p){const m=l.context,y=m.gl;y.enable(y.SCISSOR_TEST),y.scissor(t*s.q.devicePixelRatio,n*s.q.devicePixelRatio,c*s.q.devicePixelRatio,d*s.q.devicePixelRatio),m.clear({color:p}),y.disable(y.SCISSOR_TEST)}const hp=s.ec([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:up}=hp;function ms(l,t,n,c){l.emplaceBack(t,n,c)}class js{constructor(t){this.vertexArray=new s.eg,this.indices=new s.a_,ms(this.vertexArray,-1,-1,1),ms(this.vertexArray,1,-1,1),ms(this.vertexArray,-1,1,1),ms(this.vertexArray,1,1,1),ms(this.vertexArray,-1,-1,-1),ms(this.vertexArray,1,-1,-1),ms(this.vertexArray,-1,1,-1),ms(this.vertexArray,1,1,-1),this.indices.emplaceBack(5,1,3),this.indices.emplaceBack(3,7,5),this.indices.emplaceBack(6,2,0),this.indices.emplaceBack(0,4,6),this.indices.emplaceBack(2,6,7),this.indices.emplaceBack(7,3,2),this.indices.emplaceBack(5,4,0),this.indices.emplaceBack(0,1,5),this.indices.emplaceBack(0,2,3),this.indices.emplaceBack(3,1,0),this.indices.emplaceBack(7,6,4),this.indices.emplaceBack(4,5,7),this.vertexBuffer=t.createVertexBuffer(this.vertexArray,up),this.indexBuffer=t.createIndexBuffer(this.indices),this.segment=s.bd.simpleSegment(0,0,36,12)}}function so(l,t,n,c,d,p){const m=l.context.gl,y=t.paint.get("sky-atmosphere-color"),x=t.paint.get("sky-atmosphere-halo-color"),T=t.paint.get("sky-atmosphere-sun-intensity"),S=((C,E,M,D,z)=>({u_matrix_3f:C,u_sun_direction:E,u_sun_intensity:M,u_color_tint_r:[D.r,D.g,D.b,D.a],u_color_tint_m:[z.r,z.g,z.b,z.a],u_luminance:5e-5}))(s.ei(s.dJ(),c),d,T,y.toPremultipliedRenderColor(null),x.toPremultipliedRenderColor(null));m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_CUBE_MAP_POSITIVE_X+p,t.skyboxTexture,0),n.draw(l,m.TRIANGLES,rt.disabled,vt.disabled,Rt.unblended,_t.frontCW,S,"skyboxCapture",t.skyboxGeometry.vertexBuffer,t.skyboxGeometry.indexBuffer,t.skyboxGeometry.segment)}const qe=s.ec([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class Qe{constructor(t){const n=new s.ej;n.emplaceBack(-1,1,1,0,0),n.emplaceBack(1,1,1,1,0),n.emplaceBack(1,-1,1,1,1),n.emplaceBack(-1,-1,1,0,1);const c=new s.a_;c.emplaceBack(0,1,2),c.emplaceBack(2,3,0),this.vertexBuffer=t.createVertexBuffer(n,qe.members),this.indexBuffer=t.createIndexBuffer(c),this.segments=s.bd.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Ea=s.ec([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class tr{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class de{constructor(t){this.colorModeAlphaBlendedWriteRGB=new Rt([1,Rs,1,Rs],s.am.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new Rt([1,0,1,0],s.am.transparent,[!1,!1,!1,!0]),this.params=new tr,this.updateNeeded=!0,t.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),t.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),t.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),t.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(t){const n=t.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new Qe(n);const c=this.params.sizeRange,d=this.params.intensityRange,p=function(S){const C=s.el(30),E=[];for(let M=0;M<S;++M){const D=2*Math.PI*C(),z=Math.acos(1-2*C())-.5*Math.PI;E.push(s.d2(Math.cos(z)*Math.cos(D),Math.cos(z)*Math.sin(D),Math.sin(z)))}return E}(this.params.starsCount),m=s.el(300),y=new s.ek,x=new s.a_;let T=0;for(let S=0;S<p.length;++S){const C=s.c1([],p[S],200),E=Math.max(0,1+.01*c*(1*m()-.5)),M=Math.max(0,1+.01*d*(1*m()-.5));y.emplaceBack(C[0],C[1],C[2],-1,-1,E,M),y.emplaceBack(C[0],C[1],C[2],1,-1,E,M),y.emplaceBack(C[0],C[1],C[2],1,1,E,M),y.emplaceBack(C[0],C[1],C[2],-1,1,E,M),x.emplaceBack(T+0,T+1,T+2),x.emplaceBack(T+0,T+2,T+3),T+=4}this.starsVx=n.createVertexBuffer(y,Ea.members),this.starsIdx=n.createIndexBuffer(x),this.starsSegments=s.bd.simpleSegment(0,0,y.length,x.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(t,n){const c=t.context,d=c.gl,p=t.transform,m=new rt(d.LEQUAL,rt.ReadOnly,[0,1]),y=s.ah(p.zoom),x=t.style.getLut(n.scope),T=n.properties.get("color-use-theme")==="none",S=n.properties.get("color").toNonPremultipliedRenderColor(T?null:x).toArray01(),C=n.properties.get("high-color-use-theme")==="none",E=n.properties.get("high-color").toNonPremultipliedRenderColor(C?null:x).toArray01(),M=n.properties.get("space-color-use-theme")==="none",D=n.properties.get("space-color").toNonPremultipliedRenderColor(M?null:x).toArray01(),z=5e-4,F=s.em(n.properties.get("horizon-blend"),0,1,z,.25),L=s.dy(t,c,p)&&F===z?p.worldSize/(2*Math.PI*1.025)-1:p.globeRadius,N=t.frameCounter/1e3%1,U=s.ae(p.globeCenterInViewSpace),q=Math.sqrt(Math.pow(U,2)-Math.pow(L,2)),Y=Math.acos(q/U),te=re=>{const K=p.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];re&&K.push("ALPHA_PASS");const J=t.getOrCreateProgram("globeAtmosphere",{defines:K}),Q=((ae,Ae,ve,Me,Ue,_e,se,Te,ge,Re,De,Fe)=>({u_frustum_tl:ae,u_frustum_tr:Ae,u_frustum_br:ve,u_frustum_bl:Me,u_horizon:Ue,u_transition:_e,u_fadeout_range:se,u_color:Te,u_high_color:ge,u_space_color:Re,u_temporal_offset:De,u_horizon_angle:Fe}))(p.frustumCorners.TL,p.frustumCorners.TR,p.frustumCorners.BR,p.frustumCorners.BL,p.frustumCorners.horizon,y,F,S,E,D,N,Y);t.uploadCommonUniforms(c,J);const me=this.atmosphereBuffer;me&&J.draw(t,d.TRIANGLES,m,vt.disabled,re?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,_t.backCW,Q,re?"atmosphere_glow_alpha":"atmosphere_glow",me.vertexBuffer,me.indexBuffer,me.segments)};te(!1),te(!0)}drawStars(t,n){const c=s.ay(n.properties.get("star-intensity"),0,1);if(c===0)return;const d=t.context,p=d.gl,m=t.transform,y=t.getOrCreateProgram("stars"),x=s.c3([]);s.c5(x,x,-m._pitch),s.c4(x,x,-m.angle),s.c5(x,x,s.al(m._center.lat)),s.en(x,x,-s.al(m._center.lng));const T=s.c8(new Float32Array(16),x),S=s.az([],m.starsProjMatrix,T),C=s.ei([],T),E=s.eo([],C),M=[0,1,0];s.dL(M,M,E),s.c1(M,M,this.params.sizeMultiplier);const D=[1,0,0];s.dL(D,D,E),s.c1(D,D,this.params.sizeMultiplier);const z=(F=M,L=D,N=c,{u_matrix:Float32Array.from(S),u_up:F,u_right:L,u_intensity_multiplier:N});var F,L,N;t.uploadCommonUniforms(d,y),this.starsVx&&this.starsIdx&&y.draw(t,p.TRIANGLES,rt.disabled,vt.disabled,this.colorModeAlphaBlendedWriteRGB,_t.disabled,z,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class dp{constructor(){this.visibleTiles=[]}updateBorders(t,n){const c=[],d=[],p=t._getRenderableCoordinates(!1,!0);for(const x of p){const T=t.getTile(x);if(!T.hasData())continue;const S=T.getBucket(n);S&&(S.isEmpty()||(c.push(x.key),d.push({bucket:S,tileID:x.canonical})))}let m=c.length!==this.visibleTiles.length;if(!m){c.sort();for(let x=0;x<c.length;x++)if(c[x]!==this.visibleTiles[x]){m=!0;break}}if(!m)return;const y=new Set;this.visibleTiles=c,d.sort((x,T)=>x.tileID.z-T.tileID.z||x.tileID.x-T.tileID.x||x.tileID.y-T.tileID.y);for(const x of d){const T=new Array,S=new Array,C=x.bucket;for(const E of C.featuresOnBorder)y.has(E.featureId)?S.push(E.footprintIndex):(y.add(E.featureId),T.push(E.footprintIndex));C.updateFootprintHiddenFlags(T,s.ep,!1),C.updateFootprintHiddenFlags(S,s.ep,!0)}}}function Ol(l,t){const n=[...l],c=t.cameraWorldSizeForFog/t.worldSize,d=s.bx([]);return s.cP(d,d,[c,c,1]),s.az(n,d,n),s.az(n,t.worldToFogMatrix,n),n}function kl(l,t,n,c,d){const p=n.material,m=c.context,{baseColorTexture:y,metallicRoughnessTexture:x}=p.pbrMetallicRoughness,{normalTexture:T,occlusionTexture:S,emissionTexture:C}=p;function E(D,z,F){if(D&&(l.push(z),m.activeTexture.set(m.gl.TEXTURE0+F),D.gfxTexture)){const{minFilter:L,magFilter:N,wrapS:U,wrapT:q}=D.sampler;D.gfxTexture.bindExtraParam(L,N,U,q)}
2765}E(y,"HAS_TEXTURE_u_baseColorTexture",on.BaseColor),E(x,"HAS_TEXTURE_u_metallicRoughnessTexture",on.MetallicRoughness),E(T,"HAS_TEXTURE_u_normalTexture",on.Normal),E(S,"HAS_TEXTURE_u_occlusionTexture",on.Occlusion),E(C,"HAS_TEXTURE_u_emissionTexture",on.Emission),d&&(d.texture||(d.texture=new s.et(c.context,d.image,[d.image.height,d.image.height,d.image.height],m.gl.RGBA8)),m.activeTexture.set(m.gl.TEXTURE0+on.LUT),d.texture&&d.texture.bind(m.gl.LINEAR,m.gl.CLAMP_TO_EDGE),l.push("APPLY_LUT_ON_GPU")),n.texcoordBuffer&&(l.push("HAS_ATTRIBUTE_a_uv_2f"),t.push(n.texcoordBuffer)),n.colorBuffer&&(l.push(n.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),t.push(n.colorBuffer)),n.normalBuffer&&(l.push("HAS_ATTRIBUTE_a_normal_3f"),t.push(n.normalBuffer)),n.pbrBuffer&&(l.push("HAS_ATTRIBUTE_a_pbr"),l.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),t.push(n.pbrBuffer)),p.alphaMode!=="OPAQUE"&&p.alphaMode!=="MASK"||l.push("UNPREMULT_TEXTURE_IN_SHADER"),p.defined||l.push("DIFFUSE_SHADED");const M=c.shadowRenderer;M&&(l.push("RENDER_SHADOWS","DEPTH_TEXTURE"),M.useNormalOffset&&l.push("NORMAL_OFFSET"))}function Ia(l,t,n,c,d,p){const m=n.paint.get("model-opacity").constantOr(1),y=t.context,x=new rt(t.context.gl.LEQUAL,rt.ReadWrite,t.depthRangeFor3D),T=t.transform,S=l.mesh,C=S.material,E=C.pbrMetallicRoughness,M=t.style.fog;let D;D=t.transform.projection.zAxisUnit==="pixels"?[...l.nodeModelMatrix]:s.az([],c.zScaleMatrix,l.nodeModelMatrix),s.az(D,c.negCameraPosMatrix,D);const z=s.bi([],D);s.ea(z,z);const F=n.paint.get("model-color-use-theme").constantOr("default")==="none",L=n.paint.get("model-emissive-strength").constantOr(0),N=ou(new Float32Array(l.worldViewProjection),new Float32Array(D),new Float32Array(z),null,t,m,E.baseColorFactor,C.emissiveFactor,E.metallicFactor,E.roughnessFactor,C,L,n),U={defines:[]},q=[],Y=t.shadowRenderer;Y&&(Y.useNormalOffset=!1),kl(U.defines,q,S,t,F?null:n.lut);let te=null;if(M){const J=Ol(l.nodeModelMatrix,t.transform);if(te=new Float32Array(J),T.projection.name!=="globe"){const Q=S.aabb.min,me=S.aabb.max,[ae,Ae]=M.getOpacityForBounds(J,Q[0],Q[1],me[0],me[1]);U.overrideFog=ae>=ze||Ae>=ze}}const re=uo(t,n.paint.get("model-cutoff-fade-range"));re.shouldRenderCutoff&&U.defines.push("RENDER_CUTOFF");const K=t.getOrCreateProgram("model",U);t.uploadCommonUniforms(y,K,null,te,re),t.renderPass!=="shadow"&&Y&&Y.setupShadowsFromMatrix(l.nodeModelMatrix,K),K.draw(t,y.gl.TRIANGLES,x,d,p,S.material.doubleSided?_t.disabled:_t.backCCW,N,n.id,S.vertexBuffer,S.indexBuffer,S.segments,n.paint,t.transform.zoom,void 0,q)}function _u(l,t,n,c,d,p,m){let y;y=l.projection.name==="globe"?s.er(n,l):[...n],s.az(y,y,t.matrix);const x=s.az([],c,y);if(t.meshes)for(const T of t.meshes){if(T.material.alphaMode!=="BLEND"){m.push({mesh:T,depth:0,modelIndex:d,worldViewProjection:x,nodeModelMatrix:y});continue}const S=s.ad([],T.centroid,x);!l.isOrthographic&&S[2]<=0||p.push({mesh:T,depth:S[2],modelIndex:d,worldViewProjection:x,nodeModelMatrix:y})}if(t.children)for(const T of t.children)_u(l,T,n,c,d,p,m)}function Hc(l,t,n,c){const d=n.shadowRenderer;if(!d)return;const p=d.getShadowPassDepthMode(),m=d.getShadowPassColorMode(),y=d.calculateShadowPassMatrixFromMatrix(t),x=np(y);n.getOrCreateProgram("modelDepth",{defines:n._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(n,n.context.gl.TRIANGLES,p,vt.disabled,m,_t.backCCW,x,c.id,l.vertexBuffer,l.indexBuffer,l.segments,c.paint,n.transform.zoom,void 0,void 0)}function Aa(l,t,n){const c=t.updateZoomBasedPaintProperties(),d=function(p,m,y){let x,T,S,C=p.terrain?p.terrain.exaggeration():0;if(p.terrain&&C>0){const E=p.terrain,M=E.findDEMTileFor(y);M&&M.dem?x=s.eu.create(E,y,M):C=0}if(C===0&&(m.terrainElevationMin=0,m.terrainElevationMax=0),C===m.validForExaggeration&&(C===0||x&&x._demTile&&x._demTile.tileID===m.validForDEMTile.id&&x._dem._timestamp===m.validForDEMTile.timestamp))return!1;for(const E in m.instancesPerModel){const M=m.instancesPerModel[E];for(let D=0;D<M.instancedDataArray.length;++D){const z=(x?C*x.getElevationAt(0|M.instancedDataArray.float32[16*D],0|M.instancedDataArray.float32[16*D+1],!0,!0):0)+M.instancesEvaluatedElevation[D];M.instancedDataArray.float32[16*D+6]=z,T=T?Math.min(m.terrainElevationMin,z):z,S=S?Math.max(m.terrainElevationMax,z):z}}return m.terrainElevationMin=T||0,m.terrainElevationMax=S||0,m.validForExaggeration=C,m.validForDEMTile=x&&x._demTile?{id:x._demTile.tileID,timestamp:x._dem._timestamp}:{id:void 0,timestamp:0},!0}(l,t,n);(c||d)&&(t.uploaded=!1,t.upload(l.context))}const fo={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new s.d6([0,0,0],[s.aj,s.aj,0])};function Kf(l,t){const n=1<<l.canonical.z,c=t.getFreeCameraOptions().position,d=t.elevation,p=l.canonical.x/n,m=(l.canonical.x+1)/n,y=l.canonical.y/n,x=(l.canonical.y+1)/n;let T=t._centerAltitude;if(d){const M=d.getMinMaxForTile(l);M&&M.max>T&&(T=M.max)}const S=s.ay(c.x,p,m)-c.x,C=s.ay(c.y,y,x)-c.y,E=s.cb(T,t.center.lat)-c.z;return t._zoomFromMercatorZ(Math.sqrt(S*S+C*C+E*E))}function gu(l,t,n,c,d,p,m){const y=l.context,x=l.renderPass==="shadow",T=l.shadowRenderer,S=x&&T?T.getShadowPassDepthMode():new rt(y.gl.LEQUAL,rt.ReadWrite,l.depthRangeFor3D),C=l.isTileAffectedByFog(p);if(n.meshes)for(const E of n.meshes){const M=["MODEL_POSITION_ON_GPU"],D=[];let z,F,L;c.instancedDataArray.length>20&&M.push("INSTANCED_ARRAYS");const N=uo(l,t.paint.get("model-cutoff-fade-range"));if(N.shouldRenderCutoff&&M.push("RENDER_CUTOFF"),x&&T)z=l.getOrCreateProgram("modelDepth",{defines:M}),F=np(m.shadowTileMatrix,m.shadowTileMatrix,Float32Array.from(n.matrix
2765)),L=T.getShadowPassColorMode();else{kl(M,D,E,l,t.paint.get("model-color-use-theme").constantOr("default")==="none"?null:t.lut),z=l.getOrCreateProgram("model",{defines:M,overrideFog:C});const q=E.material,Y=q.pbrMetallicRoughness,te=t.paint.get("model-opacity").constantOr(1),re=t.paint.get("model-emissive-strength").constantOr(0);F=ou(p.expandedProjMatrix,Float32Array.from(n.matrix),new Float32Array(16),null,l,te,Y.baseColorFactor,q.emissiveFactor,Y.metallicFactor,Y.roughnessFactor,q,re,t,d),T&&(m.shadowUniformsInitialized?z.setShadowUniformValues(y,T.getShadowUniformValues()):(T.setupShadows(p.toUnwrapped(),z,"model-tile"),m.shadowUniformsInitialized=!0)),L=N.shouldRenderCutoff||te<1||q.alphaMode!=="OPAQUE"?Rt.alphaBlended:Rt.unblended}l.uploadCommonUniforms(y,z,p.toUnwrapped(),null,N);const U=E.material.doubleSided?_t.disabled:_t.backCCW;if(c.instancedDataArray.length>20)D.push(c.instancedDataBuffer),z.draw(l,y.gl.TRIANGLES,S,vt.disabled,L,U,F,t.id,E.vertexBuffer,E.indexBuffer,E.segments,t.paint,l.transform.zoom,void 0,D,c.instancedDataArray.length);else{const q=x?"u_instance":"u_normal_matrix";for(let Y=0;Y<c.instancedDataArray.length;++Y)F[q]=new Float32Array(c.instancedDataArray.arrayBuffer,64*Y,16),z.draw(l,y.gl.TRIANGLES,S,vt.disabled,L,U,F,t.id,E.vertexBuffer,E.indexBuffer,E.segments,t.paint,l.transform.zoom,void 0,D)}}if(n.children)for(const E of n.children)gu(l,t,E,c,d,p,m)}const $c=[1,-1,1];function yu(l,t,n,c){if(!n.modelManager)return!0;const d=n.modelManager;if(!n.shadowRenderer)return!0;const p=n.shadowRenderer,m=t.aabb;let y=!0,x=l.maxHeight;if(x===0){let S=0;for(const C in l.instancesPerModel){const E=d.getModel(C,c);E?S=Math.max(S,Math.max(Math.max(E.aabb.max[0],E.aabb.max[1]),E.aabb.max[2])):y=!1}x=l.maxScale*S*1.41+l.maxVerticalOffset,y&&(l.maxHeight=x)}m.max[2]=x,m.min[2]+=l.terrainElevationMin,m.max[2]+=l.terrainElevationMax,s.ad(m.min,m.min,t.tileMatrix),s.ad(m.max,m.max,t.tileMatrix);const T=m.intersects(p.getCurrentCascadeFrustum());return n.currentShadowCascade===0&&(l.isInsideFirstShadowMapFrustum=T===2),T===0}function pp(l,t){const n=l.uniformValues.u_cutoff_params[0],c=l.uniformValues.u_cutoff_params[1],d=l.uniformValues.u_cutoff_params[2],p=l.uniformValues.u_cutoff_params[3];return c===n||p===d?1:s.ay(((t-n)/(c-n)-d)/(p-d),0,1)}function fp(l,t,n,c){if(t.pitch<20)return 1;const d=t.getWorldToCameraMatrix();s.az(d,d,l);const p=s.bR(n.min[0],n.min[1],n.min[2],1);let m=s.aA(s.ev(),p,d),y=m,x=m;p[1]=n.max[1],m=s.aA(s.ev(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,p[0]=n.max[0],m=s.aA(s.ev(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x,p[1]=n.min[1],m=s.aA(s.ev(),p,d),y=m[1]<y[1]?m:y,x=m[1]>x[1]?m:x;const T=s.ay(c[0],0,1),S=100*t.pixelsPerMeter*s.ay(c[1],0,1),C=s.ay(c[2],0,1),E=s.ew(s.ev(),y,x,T),M=Math.tan(.5*t.fovX),D=-E[2]*M;if(S===0)return E[1]<-Math.abs(D)?C:1;const z=(-Math.abs(D)-E[1])/S,F=(N,U,q)=>(1-q)*N+q*U,L=s.ay(F(1,C,z),C,1);return F(1,L,s.ay((t.pitch-20)/20,0,1))}class Zc{}class Bl{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(t,n,c){{const C=this._storage.get(n.id);if(C)return C.lastUsedFrameIdx=t,C.buf}const d=c.gl,p=d.getBufferParameter(d.ELEMENT_ARRAY_BUFFER,d.BUFFER_SIZE),m=new ArrayBuffer(p),y=new Int16Array(m);d.getBufferSubData(d.ELEMENT_ARRAY_BUFFER,0,new Int16Array(m));const x=new s.ey;for(let C=0;C<p/2;C+=3){const E=y[C],M=y[C+1],D=y[C+2];x.emplaceBack(E,M),x.emplaceBack(M,D),x.emplaceBack(D,E)}const T=c.bindVertexArrayOES.current,S=new Zc;return S.buf=new us(c,x),S.lastUsedFrameIdx=t,this._storage.set(n.id,S),c.bindVertexArrayOES.set(T),S.buf}update(t){for(const[n,c]of this._storage)t-c.lastUsedFrameIdx>30&&(c.buf.destroy(),this._storage.delete(n))}destroy(){for(const[t,n]of this._storage)n.buf.destroy(),this._storage.delete(t)}}class Ca{constructor(t){this.occluderSize=30,this.depthOffset=-1e-4,t.registerParameter(this,["Occlusion"],"occluderSize",{min:1,max:100,step:1}),t.registerParameter(this,["Occlusion"],"depthOffset",{min:-.05,max:0,step:1e-5})}}const mp=s.ec([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_rainParticleData",components:4}]);class Jf{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}class Jr{constructor(t,n){this.revealStart=11,this.revealRange=2,t.registerParameter(this,[...n,"Reveal"],"revealStart",{min:0,max:17,step:.05}
vendor: 4,397 bytes, line 2765
2765),t.registerParameter(this,[...n,"Reveal"],"revealRange",{min:.1,max:5.1,step:.05})}}const Qf=s.ec([{type:"Float32",name:"a_pos_2f",components:2}]);class Nl{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(t,n){const c=t.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const m=new s.ez,y=new s.a_;m.emplaceBack(-1,-1),m.emplaceBack(1,-1),m.emplaceBack(1,1),m.emplaceBack(-1,1),y.emplaceBack(0,1,2),y.emplaceBack(0,2,3),this.vignetteVx=t.context.createVertexBuffer(m,Qf.members),this.vignetteIdx=t.context.createIndexBuffer(y)}const d=s.bd.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){t.uploadCommonUniforms(t.context,c);const m={u_vignetteShape:(p={vignetteShape:[n.start,n.range,Math.pow(10,n.fadePower)],vignetteColor:[n.color.r,n.color.g,n.color.b,n.color.a*n.strength]}).vignetteShape,u_vignetteColor:p.vignetteColor};c.draw(t,t.context.gl.TRIANGLES,rt.disabled,vt.disabled,Rt.alphaBlended,_t.disabled,m,"vignette",this.vignetteVx,this.vignetteIdx,d)}var p}}class Li{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(t,n){const c=t.getFreeCameraOptions().position,d=c.toAltitude(),p=c.toLngLat(),m=s.al(p.lng),y=s.al(p.lat),x=t.pixelsPerMeter/n,T=m*s.eB,S=s.eB*Math.log(Math.tan(Math.PI/4+y/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const C=-this._offsetYPrev+S,E=-this._elevationPrev+d;this._accumulatedOffsetX+=(-this._offsetXPrev+T)*x,this._accumulatedOffsetY+=C*x,this._accumulatedElevation+=E*x,this._offsetXPrev=T,this._offsetYPrev=S,this._elevationPrev=d}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function Wt(l,t){return[-(l[0]-Math.floor(l[0]/t)*t),-(l[1]-Math.floor(l[1]/t)*t),-(l[2]-Math.floor(l[2]/t)*t)]}function xu(l){const t=s.el(1323123451230),n=[];for(let c=0;c<l;++c){const d=2*t()-1,p=2*t()-1,m=2*t()-1;n.push(s.d2(d,p,m))}return n}function yn(l,t,n,c,d){const p=s.ay((d-n)/(c-n),0,1);return(1-p)*l+p*t}class Ma{constructor(t){this._movement=new Li,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new Nl,this._ppmScaleFactor=t}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(t,n){const c=t.transform;this._movement.update(c,this._ppmScaleFactor);const d=c.starsProjMatrix,p=s.c3([]);s.c5(p,p,s.al(90)-c._pitch),s.c4(p,p,-c.angle);const m=s.c8(new Float32Array(16),p),y=s.eA(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),x=s.ea([],y),T=s.az([],x,m),S=Date.now()/1e3;return this._accumulatedTimeFromStart+=(S-this._prevTime)*n,this._prevTime=S,{projectionMatrix:d,modelviewMatrix:T}}}class Pa extends Ma{constructor(t){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new Jr(t.tp,["Precipitation","Rain"]),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(t){const n=t.context;if(!this.particlesVx){const c=xu(this.particlesCount),d=new s.eC,p=new s.a_;let m=0;const y=s.el(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],S=[2*y()-1,y(),y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...S),d.emplaceBack(T[0],T[1],T[2],1,-1,...S),d.emplaceBack(T[0],T[1],T[2],1,1,...S),d.emplaceBack(T[0],T[1],T[2],-1,1,...S),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m+=4}this.particlesVx=n.createVertexBuffer(d,mp.members),this.particlesIdx=n.createIndexBuffer(p)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.rain)return;const n=this._params.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},c=t.transform.zoom;if(n.revealStart>c)return;const d=yn(0,1,n.revealStart,n.revealStart+n.revealRange,c);if(!this.particlesVx||!this.particlesIdx)return;const p=structuredClone(this._params);let m=[-p.direction.x,p.direction.y,-100];s.au(m,m);
2765const y=structuredClone(this._vignetteParams);y.strength*=d,p.overrideStyleParameters||(p.intensity=t.style.rain.state.density,p.timeFactor=t.style.rain.state.intensity,p.color=structuredClone(t.style.rain.state.color),m=structuredClone(t.style.rain.state.direction),p.screenThinning.intensity=t.style.rain.state.centerThinning,p.dropletSizeX=t.style.rain.state.dropletSize[0],p.dropletSizeYScale=t.style.rain.state.dropletSize[1]/t.style.rain.state.dropletSize[0],p.distortionStrength=100*t.style.rain.state.distortionStrength,y.strength=1,y.color=structuredClone(t.style.rain.state.vignetteColor));const x=this.updateOnRender(t,p.timeFactor),T=t.context,S=T.gl,C=t.transform;this.screenTexture&&this.screenTexture.size[0]===t.width&&this.screenTexture.size[1]===t.height||(this.screenTexture=new s.T(T,{width:t.width,height:t.height,data:null},S.RGBA8)),p.distortionStrength>0&&(T.activeTexture.set(S.TEXTURE0),this.screenTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),S.copyTexSubImage2D(S.TEXTURE_2D,0,0,0,0,0,t.width,t.height));const E=t.getOrCreateProgram("rainParticle");t.uploadCommonUniforms(T,E),T.activeTexture.set(S.TEXTURE0),this.screenTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE);const M=[p.color.r,p.color.g,p.color.b,p.color.a],D=(z,F)=>{const L=Wt(this._movement.getPosition(),z),N=p.dropletSizeX,U=p.dropletSizeX*p.dropletSizeYScale,q=t.width/2,Y=t.height/2,te=yn(0,p.screenThinning.start,0,1,p.screenThinning.intensity),re=yn(.001,p.screenThinning.range,0,1,p.screenThinning.intensity),K=yn(0,p.screenThinning.particleOffset,0,1,p.screenThinning.intensity),J=(Q={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:L,velocityConeAperture:p.velocityConeAperture,velocity:p.velocity,boxSize:z,rainDropletSize:[N,U],distortionStrength:p.distortionStrength,rainDirection:m,color:M,screenSize:[C.width,C.height],thinningCenterPos:[q,Y],thinningShape:[te,re,Math.pow(10,p.screenThinning.fadePower)],thinningAffectedRatio:p.screenThinning.affectedRatio,thinningParticleOffset:K,shapeDirectionalPower:p.shapeDirPower,shapeNormalPower:p.shapeNormalPower,mode:F?0:1},{u_modelview:Float32Array.from(Q.modelview),u_projection:Float32Array.from(Q.projection),u_time:Q.time,u_cam_pos:Q.camPos,u_texScreen:0,u_velocityConeAperture:Q.velocityConeAperture,u_velocity:Q.velocity,u_boxSize:Q.boxSize,u_rainDropletSize:Q.rainDropletSize,u_distortionStrength:Q.distortionStrength,u_rainDirection:Q.rainDirection,u_color:Q.color,u_screenSize:Q.screenSize,u_thinningCenterPos:Q.thinningCenterPos,u_thinningShape:Q.thinningShape,u_thinningAffectedRatio:Q.thinningAffectedRatio,u_thinningParticleOffset:Q.thinningParticleOffset,u_shapeDirectionalPower:Q.shapeDirectionalPower,u_shapeNormalPower:Q.shapeNormalPower,u_mode:Q.mode});var Q;const me=Math.round(p.intensity*this.particlesCount),ae=s.bd.simpleSegment(0,0,4*me,2*me);E.draw(t,S.TRIANGLES,rt.disabled,vt.disabled,Rt.alphaBlended,_t.disabled,J,"rain_particles",this.particlesVx,this.particlesIdx,ae)};p.distortionStrength>0&&D(p.boxSize,!0),D(p.boxSize,!1),this._vignette.draw(t,y)}}const Us=s.ec([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_snowParticleData",components:4},{type:"Float32",name:"a_snowParticleDataHorizontalOscillation",components:2}]);class vu extends Ma{constructor(t){super(2.25),this._params={overrideStyleParameters:!1,intensity:.85,timeFactor:.75,velocityConeAperture:70,velocity:40,horizontalOscillationRadius:4,horizontalOscillationRate:1.5,boxSize:2e3,billboardSize:2,shapeFadeStart:.27,shapeFadePower:.21,screenThinning:{intensity:.4,start:.15,range:1.4,fadePower:.24,affectedRatio:1,particleOffset:-.2},color:{r:1,g:1,b:1,a:1},direction:{x:-50,y:-35}},this._revealParams=new Jr(t.tp,["Precipitation","Snow"]),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(t){const n=t.context;if(!this.particlesVx){const c=xu(this.particlesCount),d=new s.eD,p=new s.a_;let m=0;const y=s.el(1323123451230);for(let x=0;x<c.length;++x){const T=c[x],S=y(),C=y(),E=y(),M=[x/c.length,S,C,E],D=[y(),y()];d.emplaceBack(T[0],T[1],T[2],-1,-1,...M,...D),d.emplaceBack(T[0],T[1],T[2],1,-1,...M,...D),d.emplaceBack(T[0],T[1],T[2],1,1,...M,...D),d.emplaceBack(T[0],T[1],T[2],-1,1,...M,...D),p.emplaceBack(m+0,m+1,m+2),p.emplaceBack(m+0,m+2,m+3),m
2765+=4}this.particlesVx=n.createVertexBuffer(d,Us.members),this.particlesIdx=n.createIndexBuffer(p)}}draw(t){if(!this._params.overrideStyleParameters&&!t.style.snow)return;const n=structuredClone(this._params);let c=[-n.direction.x,n.direction.y,-100];s.au(c,c);const d=structuredClone(this._vignetteParams),p=n.overrideStyleParameters?this._revealParams:{revealStart:0,revealRange:.01},m=t.transform.zoom;if(p.revealStart>m)return;const y=yn(0,1,p.revealStart,p.revealStart+p.revealRange,m);d.strength*=y,n.overrideStyleParameters||(n.intensity=t.style.snow.state.density,n.timeFactor=t.style.snow.state.intensity,n.color=structuredClone(t.style.snow.state.color),c=structuredClone(t.style.snow.state.direction),n.screenThinning.intensity=t.style.snow.state.centerThinning,n.billboardSize=2.79*t.style.snow.state.flakeSize,d.strength=1,d.color=structuredClone(t.style.snow.state.vignetteColor));const x=this.updateOnRender(t,n.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const T=t.context,S=T.gl,C=t.transform,E=t.getOrCreateProgram("snowParticle");t.uploadCommonUniforms(T,E),((M,D,z)=>{const F=Wt(this._movement.getPosition(),M),L=C.width/2,N=C.height/2,U=yn(0,z.screenThinning.start,0,1,z.screenThinning.intensity),q=yn(.001,z.screenThinning.range,0,1,z.screenThinning.intensity),Y=yn(0,z.screenThinning.particleOffset,0,1,z.screenThinning.intensity),te=(re={modelview:x.modelviewMatrix,projection:x.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:F,velocityConeAperture:z.velocityConeAperture,velocity:z.velocity,horizontalOscillationRadius:z.horizontalOscillationRadius,horizontalOscillationRate:z.horizontalOscillationRate,boxSize:M,billboardSize:1*z.billboardSize,simpleShapeParameters:[z.shapeFadeStart,z.shapeFadePower],screenSize:[C.width,C.height],thinningCenterPos:[L,N],thinningShape:[U,q,Math.pow(10,z.screenThinning.fadePower)],thinningAffectedRatio:z.screenThinning.affectedRatio,thinningParticleOffset:Y,color:[z.color.r,z.color.g,z.color.b,z.color.a],direction:c},{u_modelview:Float32Array.from(re.modelview),u_projection:Float32Array.from(re.projection),u_time:re.time,u_cam_pos:re.camPos,u_velocityConeAperture:re.velocityConeAperture,u_velocity:re.velocity,u_horizontalOscillationRadius:re.horizontalOscillationRadius,u_horizontalOscillationRate:re.horizontalOscillationRate,u_boxSize:re.boxSize,u_billboardSize:re.billboardSize,u_simpleShapeParameters:re.simpleShapeParameters,u_screenSize:re.screenSize,u_thinningCenterPos:re.thinningCenterPos,u_thinningShape:re.thinningShape,u_thinningAffectedRatio:re.thinningAffectedRatio,u_thinningParticleOffset:re.thinningParticleOffset,u_particleColor:re.color,u_direction:re.direction});var re;const K=Math.round(z.intensity*this.particlesCount),J=s.bd.simpleSegment(0,0,4*K,2*K);this.particlesVx&&this.particlesIdx&&E.draw(t,S.TRIANGLES,rt.disabled,vt.disabled,Rt.alphaBlended,_t.disabled,te,"snow_particles",this.particlesVx,this.particlesIdx,J)})(n.boxSize,0,n),this._vignette.draw(t,d)}}const bu={symbol:function(l,t,n,c,d){if(l.renderPass!=="translucent")return;const p=vt.disabled,m=l.colorModeForRenderPass(),y=n.layout.get("text-variable-anchor"),x=n.layout.get("text-size-scale-range"),T=s.ay(l.scaleFactor,x[0],x[1]);y&&function(E,M,D,z,F,L,N,U){const q=M.transform,Y=F==="map",te=L==="map";for(const re of E){const K=z.getTile(re),J=K.getBucket(D);if(!J||!J.text||!J.text.segments.get().length)continue;const Q=s.bH(J.textSizeData,q.zoom,U),me=lc(re,J.getProjection(),q),ae=q.calculatePixelsToTileUnitsMatrix(K),Ae=ml(me,K.tileID.canonical,te,Y,q,J.getProjection(),ae),ve=J.hasIconTextFit()&&J.hasIconData();Q&&sp(J,Y,te,N,q,Ae,re,Math.pow(2,q.zoom-K.tileID.overscaledZ),Q,ve)}}(c,l,n,t,n.layout.get("text-rotation-alignment"),n.layout.get("text-pitch-alignment"),d,T);const S=n.paint.get("icon-opacity").constantOr(1)!==0,C=n.paint.get("text-opacity").constantOr(1)!==0;n.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(S||C)?hu(l,t,n,c,p,m):(S&&hu(l,t,n,c,p,m,{onlyIcons:!0}),C&&hu(l,t,n,c,p,m,{onlyText:!0})),t.map.showCollisionBoxes&&(lu(l,t,n,c,n.paint.get("text-translate"),n.paint.get("text-translate-anchor"),!0),lu(l,t,n,c,n.paint.get("icon-translate"),n.paint.get("icon-translate-anchor"),!1))},circle:function(l,t,n,c){if(l.renderPass!=="translucent")return;const d=n.paint.get("circle-opacity"),p=n.paint.get("circle-stroke-width"),m=n.paint.get("circle-stroke-opacity"),y=n.layout.get("
vendor: 10,846 bytes, line 2765
2765circle-sort-key").constantOr(1)!==void 0,x=n.paint.get("circle-emissive-strength");if(d.constantOr(1)===0&&(p.constantOr(1)===0||m.constantOr(1)===0))return;const T=l.context,S=T.gl,C=l.transform,E=!(!l.terrain||!l.terrain.enabled),M=n.layout.get("circle-elevation-reference"),D=l.depthModeForSublayer(0,rt.ReadOnly),z=new rt(l.context.gl.LEQUAL,rt.ReadOnly,l.depthRangeFor3D),F=M==="none"||E?D:z,L=vt.disabled,N=l.colorModeForDrapableLayerRenderPass(x),U=C.projection.name==="globe",q=[s.aD(C.center.lng),s.aH(C.center.lat)],Y=[];for(let re=0;re<c.length;re++){const K=c[re],J=t.getTile(K),Q=J.getBucket(n);if(!Q||Q.projection.name!==C.projection.name)continue;const me=Q.programConfigurations.get(n.id),ae=Q.layoutVertexBuffer,Ae=Q.globeExtVertexBuffer,ve=Q.indexBuffer,Me=s.dW(n),Ue=[Ae],_e=l.isTileAffectedByFog(K);U&&Me.push("PROJECTION_GLOBE_VIEW"),Me.push("DEPTH_D24"),l.terrain&&C.depthOcclusionForSymbolsAndCircles&&Me.push("DEPTH_OCCLUSION"),Q.hasElevation&&!l.terrain&&(Me.push("ELEVATED_ROADS"),Ue.push(Q.elevatedLayoutVertexBuffer));const se=l.getOrCreateProgram("circle",{config:me,defines:Me,overrideFog:_e}),Te=C.projection.createInversionMatrix(C,K.canonical),ge={programConfiguration:me,program:se,layoutVertexBuffer:ae,dynamicBuffers:Ue,indexBuffer:ve,uniformValues:s.dX(l,K,J,Te,q,n),tile:J};if(y){const Re=Q.segments.get();for(const De of Re)Y.push({segments:new s.bd([De]),sortKey:De.sortKey,state:ge})}else Y.push({segments:Q.segments,sortKey:0,state:ge})}y&&Y.sort((re,K)=>re.sortKey-K.sortKey);const te={useDepthForOcclusion:C.depthOcclusionForSymbolsAndCircles};for(const re of Y){const{programConfiguration:K,program:J,layoutVertexBuffer:Q,dynamicBuffers:me,indexBuffer:ae,uniformValues:Ae,tile:ve}=re.state,Me=re.segments;l.terrain&&l.terrain.setupElevationDraw(ve,J,te),l.uploadCommonUniforms(T,J,ve.tileID.toUnwrapped()),J.draw(l,S.TRIANGLES,F,L,N,_t.disabled,Ae,n.id,Q,ae,Me,n.paint,C.zoom,K,me)}},heatmap:function(l,t,n,c){if(n.paint.get("heatmap-opacity")!==0)if(l.renderPass==="offscreen"){const d=l.context,p=d.gl,m=vt.disabled,y=new Rt([p.ONE,p.ONE,p.ONE,p.ONE],s.am.transparent,[!0,!0,!0,!0]);(function(M,D,z,F){const L=M.gl,N=D.width*F,U=D.height*F;M.activeTexture.set(L.TEXTURE1),M.viewport.set([0,0,N,U]);let q=z.heatmapFbo;if(!q||q&&(q.width!==N||q.height!==U)){q&&q.destroy();const Y=L.createTexture();L.bindTexture(L.TEXTURE_2D,Y),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,L.CLAMP_TO_EDGE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MIN_FILTER,L.LINEAR),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MAG_FILTER,L.LINEAR),q=z.heatmapFbo=M.createFramebuffer(N,U,!0,null),function(te,re,K,J,Q,me){const ae=te.gl;ae.texImage2D(ae.TEXTURE_2D,0,te.extRenderToTextureHalfFloat?ae.RGBA16F:ae.RGBA,Q,me,0,ae.RGBA,te.extRenderToTextureHalfFloat?ae.HALF_FLOAT:ae.UNSIGNED_BYTE,null),J.colorAttachment.set(K)}(M,0,Y,q,N,U)}else L.bindTexture(L.TEXTURE_2D,q.colorAttachment.get()),M.bindFramebuffer.set(q.framebuffer)})(d,l,n,l.transform.projection.name==="globe"?.5:.25),d.clear({color:s.am.transparent});const x=l.transform,T=x.projection.name==="globe",S=T?["PROJECTION_GLOBE_VIEW"]:[],C=T?_t.frontCCW:_t.disabled,E=[s.aD(x.center.lng),s.aH(x.center.lat)];for(let M=0;M<c.length;M++){const D=c[M];if(t.hasRenderableParent(D))continue;const z=t.getTile(D),F=z.getBucket(n);if(!F||F.projection.name!==x.projection.name)continue;const L=l.isTileAffectedByFog(D),N=F.programConfigurations.get(n.id),U=l.getOrCreateProgram("heatmap",{config:N,defines:S,overrideFog:L}),{zoom:q}=l.transform;l.terrain&&l.terrain.setupElevationDraw(z,U),l.uploadCommonUniforms(d,U,D.toUnwrapped());const Y=x.projection.createInversionMatrix(x,D.canonical);U.draw(l,p.TRIANGLES,rt.disabled,m,y,C,ep(l,D,z,Y,E,q,n.paint.get("heatmap-intensity")),n.id,F.layoutVertexBuffer,F.indexBuffer,F.segments,n.paint,l.transform.zoom,N,T?[F.globeExtVertexBuffer]:null)}d.viewport.set([0,0,l.width,l.height])}else l.renderPass==="translucent"&&(l.context.setColorMode(l.colorModeForRenderPass()),function(d,p){const m=d.context,y=m.gl,x=p.heatmapFbo;if(!x)return;m.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,x.colorAttachment.get()),m.activeTexture.set(y.TEXTURE1);let T=p.colorRampTexture;T||(T=p.colorRampTexture=new s.T(m,p.colorRamp,y.RGBA8)),T.bind(y.LINEAR,y.CLAMP_TO_EDGE),d.getOrCreateProgram("heatmapTexture").draw(d,y.TRIANGLES,rt.disabled,vt.disabled,d.colorModeForRenderPass(),_t.disabled,((S,C,E,M)=>({u_image:0,u_color_ramp:1,u_opacity:C.paint.get("heatmap-opacity")}))(0,p),p.id,d.viewportBuffer,d.quadTriangleIndexBuffer,d.viewportSegments,p.paint,d.transform.zoom)}(l,n))},line:function(l,t,n,c){if(l.renderPass!=="translucent")return;const d=n.paint.get("line-opacity"),p=n.paint.get("line-width");if(d.constantOr(1)===0||p.constantOr(1)===0)return;const m=n.paint.get("line-emissive-strength"),y=n.paint.get("line-occlusion-opacity"),x=n.layout.get("line-elevation-reference"),T=n.layout.get("line-width-unit")==="meters",S=x==="sea",C=!(!l.terrain||!l.terrain.enabled),E=l.context,M=E.gl;if(n.hasElevatedBuckets&&l.transform.projection.name==="globe")return;const D=n.layout.get("line-cross-slope"),z=D!==void 0,F=D<1,L=l.colorModeForDrapableLayerRenderPass(m),N=l.terrain&&l.terrain.renderingToTexture,U=N?1:s.q.devicePixelRatio,q=n.paint.get("line-dasharray"),Y=q.constantOr(1),te=n.layout.get("line-cap"),re=q.constantOr(null),K=te.constantOr(null),J=n.paint.get("line-pattern"),Q=J.constantOr(1),me=n.paint.get("line-pattern-cross-fade"),ae=J.constantOr(null),Ae=n.paint.get("line-opacity").constantOr(1);let ve=!Q&&Ae!==1||l.depthOcclusion&&y>0&&y<1;const Me=n.paint.get("line-gradient"),Ue=Q?"linePattern":"line",_e=s.dY(n);let se;if(N&&l.terrain&&l.terrain.clipOrMaskOverlapStencilType()&&(ve=!1),y!==0&&l.depthOcclusion){const De=n.paint._values["line-opacity"];De&&De.value&&De.value.kind==="constant"?se=De.value:s.w(`Occlusion opacity for layer ${n.id} is supported only when line-opacity isn't data-driven.`)}p.value.kind!=="constant"&&p.value.isLineProgressConstant===!1&&_e.push("VARIABLE_LINE_WIDTH");const Te=(De,Fe,We,lt,pt,et)=>{for(const ut of De){const ct=t.getTile(ut);if(Q&&!ct.patternsLoaded())continue;const Tt=ct.getBucket(n);if(!Tt||Tt.elevationType!=="none"&&!pt||Tt.elevationType==="none"&&pt)continue;l.prepareDrawTile();const Mt=[...Fe],Bt=l.shadowRenderer,Jt=Tt.elevationType==="road"&&!!Bt&&Bt.enabled;let At=[0,0,0];if(Jt){const Yt=l.style.directionalLight,ai=l.style.ambientLight;Yt&&ai&&(At=Ds(l.style,Yt,ai)),Mt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const Qt=Tt.programConfigurations.get(n.id);let ri=!1;if(ae&&ct.imageAtlas){const Yt=s.dZ.from(ae),ai=Yt.getPrimary().scaleSelf(U).toString(),wi=ct.imageAtlas.patternPositions.get(ai),pr=Yt.getSecondary(),hr=pr?ct.imageAtlas.patternPositions.get(pr.scaleSelf(U).toString()):null;ri=!!wi&&!!hr,wi&&Qt.setConstantPatternPositions(wi,hr)}me>0&&(ri||Qt.getPatternTransitionVertexBuffer("line-pattern"))&&Mt.push("LINE_PATTERN_TRANSITION");const Si=l.isTileAffectedByFog(ut),Ft=l.getOrCreateProgram(Ue,{config:Qt,defines:Mt,overrideFog:Si});if(!Q&&re&&K&&ct.lineAtlas){const Yt=ct.lineAtlas.getDash(re,K);Yt&&Qt.setConstantPatternPositions(Yt)}Jt&&Bt.setupShadows(ct.tileID.toUnwrapped(),Ft,"vector-tile");let[ei,ti]=n.paint.get("line-trim-offset");(K==="round"||K==="square")&&ei!==ti&&(ei===0&&(ei-=1),ti===1&&(ti+=1));const si=N?ut.projMatrix:null,Nt=T?1/Tt.tileToMeter/s.aw(ct,1,l.transform.zoom):1,mi=T?1/Tt.tileToMeter/s.aw(ct,1,Math.floor(l.transform.zoom)):1,ni=Q?s.d_(l,ct,n,si,U,Nt,mi,[ei,ti],At,me):s.d$(l,ct,n,si,Tt.lineClipsArray.length,U,Nt,mi,[ei,ti],At);if(Me){const Yt=Tt.gradients[n.id];let ai=Yt.texture;if(n.gradientVersion!==Yt.version){let wi=256;if(n.stepInterpolant){const pr=t.getSource().maxzoom,hr=ut.canonical.z===pr?Math.ceil(1<<l.transform.maxZoom-ut.canonical.z):1;wi=s.ay(s.e0(Tt.maxLineLength/s.aj*1024*hr),256,E.maxTextureSize)}Yt.gradient=s.e1({expression:n.gradientExpression(),evaluationKey:"lineProgress",resolution:wi,image:Yt.gradient||void 0,clips:Tt.lineClipsArray}),Yt.texture?Yt.texture.update(Yt.gradient):Yt.texture=new s.T(E,Yt.gradient,M.RGBA8),Yt.version=n.gradientVersion,ai=Yt.texture}E.activeTexture.set(M.TEXTURE1),ai.bind(n.stepInterpolant?M.NEAREST:M.LINEAR,M.CLAMP_TO_EDGE)}Y&&(E.activeTexture.set(M.TEXTURE0),ct.lineAtlasTexture&&ct.lineAtlasTexture.bind(M.LINEAR,M.REPEAT),Qt.updatePaintBuffers()),Q&&(E.activeTexture.set(M.TEXTURE0),ct.imageAtlasTexture&&ct.imageAtlasTexture.bind(M.LINEAR,M.CLAMP_TO_EDGE),Qt.updatePaintBuffers()),pt&&!S&&l.terrain.setupElevationDraw(ct,Ft),l.uploadCommonUniforms(E,Ft,ut.toUnwrapped());const Hi=Yt=>{se!=null&&(se.value=Ae*y),Ft.draw(l,M.TRIANGLES,We,Yt,L,_t.disabled,ni,n.id,Tt.layoutVertexBuffer,Tt.indexBuffer,Tt.segments,n.paint,l.transform.zoom,Qt,[Tt.layoutVertexBuffer2,Tt.patternVertexBuffer,Tt.zOffsetVertexBuffer]),se!=null&&(se.value=Ae)};if(ve&&!pt){const Yt=l.stencilModeForClipping(ut).ref;Yt===0&&N&&E.clear({stencil:0});const ai={func:M.EQUAL,mask:255};ni.u_alpha_discard_threshold=.8,Hi(new vt(ai,Yt,255,M.KEEP,M.KEEP,M.INVERT)),ni.u_alpha_discard_threshold=0,Hi(new vt(ai,Yt,255,M.KEEP,M.KEEP,M.KEEP))}else ni.u_alpha_discard_threshold=ve&&pt&&et?.8:0,Hi(pt?lt:l.stencilModeForClipping(ut))}};let ge=l.depthModeForSublayer(0,rt.ReadOnly);const Re=new rt(l.depthOcclusion?M.GREATER:M.LEQUAL,rt.ReadOnly,l.depthRangeFor3D);if(n.hasNonElevatedBuckets){const De=!N&&l.terrain;y!==0&&De?s.w(`Occlusion opacity for layer ${n.id} is supported on terrain only if the layer has line-z-offset enabled.`):De?s.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${n.id}.`):Te(c,_e,ge,vt.disabled,!1,!0)}if(n.hasElevatedBuckets){x==="hd-road-markup"?C||(ge=Re,_e.push("ELEVATED_ROADS")):(_e.push("ELEVATED"),ge=Re,z&&_e.push(F?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),S&&_e.push("ELEVATION_REFERENCE_SEA"));const De=ve?l.stencilModeFor3D():vt.disabled;l.forceTerrainMode=!0,Te(c,_e,ge,De,!0,!0),ve&&Te(c,_e,ge,De,!0,!1),l.forceTerrainMode=!1}ve&&(l.resetStencilClippingMasks(),N&&E.clear({stencil:0})),y===0||l.depthOcclusion||N||l.layersWithOcclusionOpacity.push(l.currentLayer)},fill:function(l,t,n,c){const d=n.paint.get("fill-color"),p=n.paint.get("fill-opacity");if(p.constantOr(1)===0)return;const m=n.paint.get("fill-emissive-strength"),y=l.colorModeForDrapableLayerRenderPass(m),x=n.paint.get("fill-pattern"),T=l.opaquePassEnabledForLayer()&&!x.constantOr(1)&&d.constantOr(s.am.transparent).a===1&&p.constantOr(0)===1?"opaque":"translucent";let S="none";n.layout.get("fill-elevation-reference")!=="none"?S="road":n.paint.get("fill-z-offset").constantOr(1)!==0&&(S="offset");const C=!(!l.terrain||!l.terrain.enabled),E={painter:l,sourceCache:t,layer:n,coords:c,colorMode:y,elevationType:S,terrainEnabled:C,pass:T};
2765if(l.renderPass!=="shadow")if(S!=="offset"){if(Vc(E,!1),S==="road"){const M=!C&&l.renderPass==="translucent";M&&nt(l,t,n,c,"geometry"),Vc(E,!0,vt.disabled),M&&function(D){const{painter:z,sourceCache:F,layer:L,coords:N,colorMode:U}=D,q=z.context.gl,Y=D.painter.shadowRenderer,te=!!Y&&Y.enabled,re=new rt(z.context.gl.LEQUAL,rt.ReadOnly,z.depthRangeFor3D);let K=[0,0,0];if(te){const Q=z.style.directionalLight,me=z.style.ambientLight;Q&&me&&(K=Ds(z.style,Q,me))}const J=Q=>{for(const me of N){const ae=F.getTile(me),Ae=ae.getBucket(L);if(!Ae)continue;const ve=Ae.elevatedStructures;if(!ve)continue;let Me,Ue;if(Q?(Me=ve.renderableBridgeSegments,Ue=ve.bridgeProgramConfigurations.get(L.id)):(Me=ve.renderableTunnelSegments,Ue=ve.tunnelProgramConfigurations.get(L.id)),!Me||Me.segments[0].primitiveLength===0)continue;Ue.updatePaintBuffers(),z.prepareDrawTile();const _e=z.isTileAffectedByFog(me),se=[];te&&se.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Te=z.getOrCreateProgram("elevatedStructures",{config:Ue,overrideFog:_e,defines:se}),ge=z.translatePosMatrix(me.projMatrix,ae,L.paint.get("fill-translate"),L.paint.get("fill-translate-anchor"));te&&Y.setupShadows(ae.tileID.toUnwrapped(),Te,"vector-tile");const Re=$f(ge,K);z.uploadCommonUniforms(z.context,Te,me.toUnwrapped()),Te.draw(z,q.TRIANGLES,re,vt.disabled,U,_t.backCCW,Re,L.id,ve.vertexBuffer,ve.indexBuffer,Me,L.paint,z.transform.zoom,Ue,[ve.vertexBufferNormal])}};J(!0),J(!1)}(E)}}else Vc(E,!1,l.stencilModeFor3D());else l.shadowRenderer&&S==="road"&&!C&&function(M){const{painter:D,sourceCache:z,layer:F,coords:L}=M,N=D.context.gl,U=M.painter.shadowRenderer;for(const q of L){const Y=z.getTile(q),te=Y.getBucket(F);if(!te)continue;const re=te.elevatedStructures;if(!re||!re.shadowCasterSegments||re.shadowCasterSegments.segments[0].primitiveLength===0)continue;D.prepareDrawTile();const K=te.bufferData.programConfigurations.get(F.id),J=D.isTileAffectedByFog(q),Q=D.getOrCreateProgram("elevatedStructuresDepth",{config:K,overrideFog:J}),me=U.calculateShadowPassMatrixFromTile(Y.tileID.toUnwrapped());D.uploadCommonUniforms(D.context,Q,q.toUnwrapped());const ae={u_matrix:me,u_depth_bias:0};Q.draw(D,N.TRIANGLES,U.getShadowPassDepthMode(),vt.disabled,U.getShadowPassColorMode(),_t.disabled,ae,F.id,re.vertexBuffer,re.indexBuffer,re.shadowCasterSegments,F.paint,D.transform.zoom,K)}}(E)},"fill-extrusion":function(l,t,n,c){const d=n.paint.get("fill-extrusion-opacity"),p=l.context,m=p.gl,y=l.terrain,x=y&&y.renderingToTexture;if(d===0)return;const T=l.conflationActive&&l.style.isLayerClipped(n,t.getSource()),S=l.style.order.indexOf(n.fqid);if(T&&function(C,E,M,D,z){for(const F of D){const L=E.getTile(F).getBucket(M);L&&(L.updateReplacement(F,C.replacementSource,z),L.uploadCentroid(C.context))}}(l,t,n,c,S),y||T)for(const C of c){const E=t.getTile(C).getBucket(n);E&&yt(l.context,t,C,E,n,y,T)}if(l.renderPass==="shadow"&&l.shadowRenderer){const C=l.shadowRenderer;if(y&&d<.65&&n._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof s.ab)return;const E=C.getShadowPassDepthMode(),M=C.getShadowPassColorMode();Dl(l,t,n,c,E,vt.disabled,M,T)}else if(l.renderPass==="translucent"){const C=!n.paint.get("fill-extrusion-pattern").constantOr(1),E=n.paint.get("fill-extrusion-color").constantOr(s.am.white);if(!x&&E.a!==0){const M=new rt(l.context.gl.LEQUAL,rt.ReadWrite,l.depthRangeFor3D);d===1&&C?Dl(l,t,n,c,M,vt.disabled,Rt.unblended,T):(Dl(l,t,n,c,M,vt.disabled,Rt.disabled,T),Dl(l,t,n,c,M,l.stencilModeFor3D(),l.colorModeForRenderPass(),T),l.resetStencilClippingMasks())}if(l.style.enable3dLights()&&C&&(!y&&l.transform.projection.name!=="globe"||x)){const M=n.paint.get("fill-extrusion-opacity"),D=n.paint.get("fill-extrusion-ambient-occlusion-intensity"),z=n.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),F=n.paint.get("fill-extrusion-flood-light-intensity"),L=n.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",N=n.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(L?null:n.lut).toArray01().slice(0,3),U=D>0&&z>0,q=F>0,Y=(K,J,Q)=>(1-Q)*K+Q*J,te=new ko;te.translate=n.paint.get("fill-extrusion-translate"),te.translateAnchor=n.paint.get("fill-extrusion-translate-anchor"),te.edgeRadius=n.layout.get("fill-extrusion-edge-radius"),te.cutoffFadeRange=n.paint.get("fill-extrusion-cutoff-fade-range");const re=K=>{const J=l.depthModeForSublayer(1,rt.ReadOnly,m.LEQUAL,!0),Q=n.paint.get(K?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),me=Y(.1,3,Q),ae=l._showOverdrawInspector;if(!ae){const Ae=new vt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),ve=new Rt([m.ONE,m.ONE,m.ONE,m.ONE],s.am.transparent,[!1,!1,!1,!0],m.MIN);gn(te,l,t,n,c,J,Ae,ve,_t.disabled,K,"sdf",M,D,z,F,N,me,T,!1)}{const Ae=ae?vt.disabled:new vt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),ve=ae?l.colorModeForRenderPass():new Rt([m.ONE_MINUS_DST_ALPHA,m.DST_ALPHA,m.ONE,m.ONE],s.am.transparent,[!0,!0,!0,!0]);gn(te,l,t,n,c,J,Ae,ve,_t.disabled,K,"color",M,D,z,F,N,me,T,!1)}};if(x){const K=(J,Q,me)=>{const ae=l.depthModeForSublayer(1,rt.ReadOnly,m.LEQUAL,!1),Ae=n.paint.get(J?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),ve=Y(.1,3,Ae);{const Me=new Rt([m.ONE,m.ONE,m.ONE,m.ONE],s.am.transparent,[!1,!1,!1,!0]);gn(te,l,t,n,c,ae,vt.disabled,Me,_t.disabled,J,"clear",M,D,z,F,N,ve,T,Q)}{const Me=new vt({func:m.ALWAYS,mask:255},255,255,m.KEEP,m.KEEP,m.REPLACE),Ue=new Rt([m.ONE,m.ONE,m.ONE,m.ONE],s.am.transparent,[!1,!1,!1,!0],m.MIN);gn(te,l,t,n,c,ae,Me,Ue,_t.disabled,J,"sdf",M,D,z,F,N,ve,T,Q)}{const Me=J?m.ZERO:m.ONE_MINUS_DST_ALPHA,Ue=new vt({func:m.EQUAL,mask:255},255,255,m.KEEP,m.DECR,m.DECR),_e=new Rt([Me,m.DST_ALPHA,m.ONE_MINUS_DST_ALPHA,m.ZERO],s.am.transparent,[!0,!0,!0,!0]);gn(te,l,t,n,c,ae,Ue,_e,_t.disabled,J,"color",M,D,z,F,N,ve,T,Q)}{const Me=new Rt([m.ONE,m.ONE,m.ONE,J?m.ZERO:m.ONE],s.am.transparent,[!1,!1,!1,!0],J?m.FUNC_ADD:m.MAX);gn(te,l,t,n,c,ae,vt.disabled,Me,_t.disabled,J,"clear",M,D,z,F,N,ve,T,Q,me)}};if(U||q){let J;if(l.prepareDrawTile(),y){const Q=y.drapeBufferSize[0],me=y.drapeBufferSize[1];J=y.framebufferCopyTexture,J&&(!J||J.size[0]===Q&&J.size[1]===me)||(J&&J.destroy(),J=y.framebufferCopyTexture=new s.T(p,new s.r({width:Q,height:me}),m.RGBA8)),J.bind(m.LINEAR,m.CLAMP_TO_EDGE),m.copyTexSubImage2D(m.TEXTURE_2D,0,0,0,0,0,Q,me)}U&&K(!0,!1,J),q&&K(!1,!0,J)}}else U&&re(!0),q&&re(!1),(U||q)&&l.resetStencilClippingMasks()}}},building:function(l,t,n,c){l.currentLayer<l.firstLightBeamLayer&&(l.firstLightBeamLayer=l.currentLayer);const d=n.paint.get("building-ambient-occlusion-ground-intensity"),p=n.paint.get("building-ambient-occlusion-ground-radius"),m=n.paint.get("building-ambient-occlusion-ground-attenuation");let y=d>0&&p>0,x=!0;const T=n.paint.get("building-vertical-scale");T<1&&(x=!1);const S=l.conflationActive&&l.style.isLayerClipped(n,t.getSource()),C=l.style.order.indexOf(n.fqid);if(function(E,M,D,z,F,L){for(const N of L){const U=M.getTile(N).getBucket(D);U&&(F&&U.updateReplacement(N,E.replacementSource,z),U.uploadUpdatedIndexBuffer(E.context))}}(l,t,n,C,S,c),function(E,M,D,z){for(const F of z){const L=M.getTile(F).getBucket(D);L&&L.needsEvaluation(E,D)&&(L.evaluate(D),L.uploadUpdatedColorBuffer(E.context))}}(l,t,n,c),n.resetLayerRenderingStats(l),l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!0),l.renderPass==="shadow"&&l.shadowRenderer){const E=l.shadowRenderer,M=[],D=E.getShadowPassDepthMode();Uc({painter:l,source:t,layer:n,coords:c,defines:M,blendMode:E.getShadowPassColorMode(),depthMode:D,verticalScale:T})}else if(l.renderPass==="translucent"){y&&function(z,F,L,N,U,q,Y,te,re,K,J,Q,me){const ae=z.context.gl,Ae=z.depthModeForSublayer(1,rt.ReadOnly,ae.LEQUAL,!0),ve=.1*(1-(Me=J))+3*Me;var Me;const Ue=z._showOverdrawInspector,_e=Q,se=new ko;Ue||gn(se,z,F,L,N,Ae,new vt({func:ae.ALWAYS,mask:255},255,255,ae.KEEP,ae.KEEP,ae.REPLACE),new Rt([ae.ONE,ae.ONE,ae.ONE,ae.ONE],s.am.transparent,[!1,!1,!1,!0],ae.MIN),_t.disabled,U,"sdf",1,Y,te,0,K,ve,_e,!1);{const Te=Ue?vt.disabled:new vt({func:ae.EQUAL,mask:255},255,255,ae.KEEP,ae.DECR,ae.DECR),ge=Ue?z.colorModeForRenderPass():new Rt([ae.ONE_MINUS_DST_ALPHA,ae.DST_ALPHA,ae.ONE,ae.ONE],s.am.transparent,[!0,!0,!0,!0]);gn(se,z,F,L,N,Ae,Te,ge,_t.disabled,U,"color",1,Y,te,0,K,ve,_e,!1)}}(l,t,n,c,!0,0,d,p,0,[0,0,0],m,S);let E=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];x&&(E=E.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),l.shadowRenderer.useNormalOffset&&(E=E.concat("NORMAL_OFFSET"));const M=new rt(l.context.gl.LEQUAL,rt.ReadWrite,l.depthRangeFor3D),D=l.colorModeForRenderPass();Uc({painter:l,source:t,layer:n,coords:c,defines:E,blendMode:D,depthMode:M,verticalScale:T})}else if(l.renderPass==="light-beam"){const E=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],M=new rt(l.context.gl.LEQUAL,rt.ReadOnly,l.depthRangeFor3D);Uc({painter:l,source:t,layer:n,coords:c,defines:E,blendMode:Rt.alphaBlended,depthMode:M,verticalScale:T})}l.shadowRenderer&&(l.shadowRenderer.useNormalOffset=!1),l.resetStencilClippingMasks()},hillshade:function(l,t,n,c){if(l.renderPass!=="offscreen"&&l.renderPass!=="translucent"||l.style.disableElevatedTerrain)return;const d=l.context,p=l.terrain&&l.terrain.renderingToTexture,[m,y]=l.renderPass!=="translucent"||p?[{},c]:l.stencilConfigForOverlap(c);for(const x of y){const T=t.getTile(x);
2765if(T.needsHillshadePrepare&&l.renderPass==="offscreen")Bd(l,T,n);else if(l.renderPass==="translucent"){const S=l.depthModeForSublayer(0,rt.ReadOnly),C=n.paint.get("hillshade-emissive-strength"),E=l.colorModeForDrapableLayerRenderPass(C),M=p&&l.terrain?l.terrain.stencilModeForRTTOverlap(x):m[x.overscaledZ];Of(l,x,T,n,S,M,E)}}d.viewport.set([0,0,l.width,l.height]),l.resetStencilClippingMasks()},raster:function(l,t,n,c,d,p){if(l.renderPass!=="translucent"||n.paint.get("raster-opacity")===0)return;const m=l.transform.projection.name==="globe",y=n.paint.get("raster-elevation")!==0,x=y&&m;if(l.renderElevatedRasterBackface&&!x)return;const T=l.context,S=T.gl,C=t.getSource(),E=function(te,re,K,J){const Q=re.paint.get("raster-color"),me=te.type==="raster-array",ae=[],Ae=re.paint.get("raster-resampling"),ve=re.paint.get("raster-color-mix");let Me=re.paint.get("raster-color-range");const Ue=[ve[0],ve[1],ve[2],0],_e=ve[3];let se=Ae==="nearest"?J.NEAREST:J.LINEAR;if(me&&(ae.push("RASTER_ARRAY"),Q||ae.push("RASTER_COLOR"),Ae==="linear"&&ae.push("RASTER_ARRAY_LINEAR"),se=J.NEAREST,!Me&&te.rasterLayers)){const Te=te.rasterLayers.find(({id:ge})=>ge===re.sourceLayer);Te&&Te.fields&&Te.fields.range&&(Me=Te.fields.range)}if(Me=Me||[0,1],Q){ae.push("RASTER_COLOR"),K.activeTexture.set(J.TEXTURE2),re.updateColorRamp(Me);let Te=re.colorRampTexture;Te||(Te=re.colorRampTexture=new s.T(K,re.colorRamp,J.RGBA8)),Te.bind(J.LINEAR,J.CLAMP_TO_EDGE)}return{mix:Ue,range:Me,offset:_e,defines:ae,resampling:se}}(C,n,T,S);if(C instanceof s.aP&&!c.length&&!m)return;const M=n.paint.get("raster-emissive-strength"),D=l.colorModeForDrapableLayerRenderPass(M),z=l.terrain&&l.terrain.renderingToTexture,F=!l.options.moving,L=n.paint.get("raster-resampling")==="nearest"?S.NEAREST:S.LINEAR;if(C instanceof s.aP&&!c.length&&(C.onNorthPole||C.onSouthPole)){const te=y?l.stencilModeFor3D():vt.disabled;return void Gc(!!C.onNorthPole,null,l,t,n,M,E,_t.disabled,te)}if(!c.length)return;const[N,U]=C instanceof s.aP||z?[{},c]:l.stencilConfigForOverlap(c),q=U[U.length-1].overscaledZ;x&&E.defines.push("PROJECTION_GLOBE_VIEW"),y&&E.defines.push("RENDER_CUTOFF");const Y=(te,re,K)=>{for(const J of te){const Q=J.toUnwrapped(),me=t.getTile(J);if(z&&(!me||!me.hasData()))continue;T.activeTexture.set(S.TEXTURE0);const ae=Yf(me,C,n,E);if(!ae||!ae.texture)continue;const{texture:Ae,mix:ve,offset:Me,tileSize:Ue,buffer:_e}=ae;let se,Te;z?(se=rt.disabled,Te=J.projMatrix):y?(se=new rt(S.LEQUAL,rt.ReadWrite,l.depthRangeFor3D),Te=m?Float32Array.from(l.transform.expandedFarZProjMatrix):l.transform.calculateProjMatrix(Q,F)):(se=l.depthModeForSublayer(J.overscaledZ-q,n.paint.get("raster-opacity")===1?rt.ReadWrite:rt.ReadOnly,S.LESS),Te=l.transform.calculateProjMatrix(Q,F));const ge=l.terrain&&z?l.terrain.stencilModeForRTTOverlap(J):N[J.overscaledZ],Re=p?0:n.paint.get("raster-fade-duration");me.registerFadeDuration(Re);const De=t.findLoadedParent(J,0),Fe=_n(me,De,t,l.transform,Re);let We,lt;l.terrain&&l.terrain.prepareDrawTile(),T.activeTexture.set(S.TEXTURE0),Ae.bind(L,S.CLAMP_TO_EDGE),T.activeTexture.set(S.TEXTURE1),De?(De.texture&&De.texture.bind(L,S.CLAMP_TO_EDGE),We=Math.pow(2,De.tileID.overscaledZ-me.tileID.overscaledZ),lt=[me.tileID.canonical.x*We%1,me.tileID.canonical.y*We%1]):Ae.bind(L,S.CLAMP_TO_EDGE),"useMipmap"in Ae&&T.extTextureFilterAnisotropic&&l.transform.pitch>20&&S.texParameterf(S.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);const pt=l.transform;let et;const ut=y?Xf(pt):[0,0,0,0];let ct,Tt,Mt,Bt,Jt,At=0;if(x&&C instanceof s.aP&&C.coordinates.length>3)ct=Float32Array.from(s.bh(s.dD(new s.cA(0,0,0)))),Tt=Float32Array.from(pt.globeMatrix),Mt=Float32Array.from(s.dz(pt)),Bt=[s.aD(pt.center.lng),s.aH(pt.center.lat)],et=C.elevatedGlobePerspectiveTransform,Jt=C.elevatedGlobeGridMatrix||new Float32Array(9);else if(x){const Ft=s.dA(J.canonical);At=s.dB(Ft.getCenter().lat),ct=Float32Array.from(s.bh(s.dD(J.canonical))),Tt=Float32Array.from(pt.globeMatrix),Mt=Float32Array.from(s.dz(pt)),Bt=[s.aD(pt.center.lng),s.aH(pt.center.lat)],et=[0,0],Jt=Float32Array.from(s.dC(J.canonical,Ft,At,pt.
2765worldSize/pt._pixelsPerMercatorPixel))}else et=C instanceof s.aP?C.perspectiveTransform:[0,0],ct=new Float32Array(16),Tt=new Float32Array(9),Mt=new Float32Array(16),Bt=[0,0],Jt=new Float32Array(9);const Qt=ru(Te,ct,Tt,Mt,Jt,lt||[0,0],s.ah(l.transform.zoom),Bt,ut,We||1,Fe,n,et,y?n.paint.get("raster-elevation"):0,2,ve,Me,E.range,Ue,_e,M),ri=l.isTileAffectedByFog(J),Si=l.getOrCreateProgram("raster",{defines:E.defines,overrideFog:ri});if(l.uploadCommonUniforms(T,Si,Q),C instanceof s.aP){const Ft=C.elevatedGlobeVertexBuffer,ei=C.elevatedGlobeIndexBuffer;if(z||!m)C.boundsBuffer&&C.boundsSegments&&Si.draw(l,S.TRIANGLES,se,vt.disabled,D,_t.disabled,Qt,n.id,C.boundsBuffer,l.quadTriangleIndexBuffer,C.boundsSegments);else if(Ft&&ei){const ti=pt.zoom<=s.cX?C.elevatedGlobeSegments:C.getSegmentsForLongitude(pt.center.lng);ti&&Si.draw(l,S.TRIANGLES,se,vt.disabled,D,re,Qt,n.id,Ft,ei,ti)}}else if(x){se=new rt(S.LEQUAL,rt.ReadOnly,l.depthRangeFor3D);const Ft=l.globeSharedBuffers;if(Ft){const[ei,ti,si]=Ft.getGridBuffers(At,!1);Si.draw(l,S.TRIANGLES,se,K||ge,l.colorModeForRenderPass(),re,Qt,n.id,ei,ti,si)}}else{const{tileBoundsBuffer:Ft,tileBoundsIndexBuffer:ei,tileBoundsSegments:ti}=l.getTileBoundsBuffers(me);Si.draw(l,S.TRIANGLES,se,ge,D,_t.disabled,Qt,n.id,Ft,ei,ti)}}if(!(C instanceof s.aP)&&x)for(const J of te){const Q=J.canonical.y===(1<<J.canonical.z)-1;J.canonical.y===0&&Gc(!0,J,l,t,n,M,E,re,K||vt.disabled),Q&&Gc(!1,J,l,t,n,M,E,re===_t.frontCW?_t.backCW:_t.frontCW,K||vt.disabled)}};x?Y(U,l.renderElevatedRasterBackface?_t.backCW:_t.frontCW,l.stencilModeFor3D()):Y(U,_t.disabled,void 0),l.resetStencilClippingMasks()},"raster-particle":function(l,t,n,c,d,p){l.renderPass==="offscreen"&&function(m,y,x,T){if(!T.length)return;const S=m.context,C=S.gl,E=y.getSource();if(!(E instanceof Qo))return;const M=Math.ceil(Math.sqrt(x.paint.get("raster-particle-count")));let D=x.particlePositionRGBAImage;if(!D||D.width!==M){const U=function(q){const Y=q*q,te=new Uint8Array(4*Y),re=function(J){return J|=0,J=Math.imul(2747636419^J,2654435769),J=Math.imul(J^J>>>16,2654435769),((J=Math.imul(J^J>>>16,2654435769))>>>0)/4294967296},K=1/1.1;for(let J=0;J<Y;J++){const Q=K*(re(2*J+0)+hs),me=K*(re(2*J+1)+hs),ae=255*Q%1,Ae=255*me%1,ve=ae,Me=me-Ae/255,Ue=Ae;te[4*J+0]=255*(Q-ae/255),te[4*J+1]=255*ve,te[4*J+2]=255*Me,te[4*J+3]=255*Ue}return te}(M);D=x.particlePositionRGBAImage=new s.r({width:M,height:M},U)}let z=x.particleFramebuffer;z?z.width!==M&&(z.destroy(),z=x.particleFramebuffer=S.createFramebuffer(M,M,!0,null)):z=x.particleFramebuffer=S.createFramebuffer(M,M,!0,null);const F=[];for(const U of T){const q=y.getTile(U);if(!(q instanceof na))continue;const Y=sn(q,E,x);if(!Y)continue;const te=[q.tileSize,q.tileSize];let re=x.tileFramebuffer;re||(re=x.tileFramebuffer=S.createFramebuffer(te[0],te[1],!0,null));let K=q.rasterParticleState;K||(K=q.rasterParticleState=new du(S,U,te,D));const J=K.update(x.lastInvalidatedAt);K.particleTextureDimension!==M&&K.updateParticleTexture(U,D);const Q=K.targetColorTexture;K.targetColorTexture=K.backgroundColorTexture,K.backgroundColorTexture=Q;const me=K.particleTexture0;K.particleTexture0=K.particleTexture1,K.particleTexture1=me,F.push([U,Y,K,J])}if(F.length===0)return;const L=s.q.now(),N=x.previousDrawTimestamp?.001*(L-x.previousDrawTimestamp):.0167;if(x.previousDrawTimestamp=L,x.hasColorMap()){S.activeTexture.set(C.TEXTURE0+2);let U=x.colorRampTexture;U||(U=x.colorRampTexture=new s.T(S,x.colorRamp,C.RGBA8)),U.bind(C.LINEAR,C.CLAMP_TO_EDGE)}S.bindFramebuffer.set(x.tileFramebuffer.framebuffer),function(U,q,Y){const te=U.context,re=te.gl,K=q.tileFramebuffer;te.activeTexture.set(re.TEXTURE0);const J={u_texture:0,u_opacity:1.05*(me=q.paint.get("raster-particle-fade-opacity-factor"))/(me+.05)},Q=U.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var me;
vendor: 4,893 bytes, line 2765
2765for(const ae of Y){const[,,Ae,ve]=ae;K.colorAttachment.set(Ae.targetColorTexture.texture),te.viewport.set([0,0,K.width,K.height]),te.clear({color:s.am.transparent}),ve&&(Ae.backgroundColorTexture.bind(re.NEAREST,re.CLAMP_TO_EDGE),Q.draw(U,re.TRIANGLES,rt.disabled,vt.disabled,Rt.alphaBlended,_t.disabled,J,q.id,U.viewportBuffer,U.quadTriangleIndexBuffer,U.viewportSegments))}}(m,x,F),function(U,q,Y,te){const re=U.context,K=re.gl,J=Y.tileFramebuffer,Q=U.transform.projection.name==="globe",me=Y.paint.get("raster-particle-max-speed");for(const ae of te){const[Ae,ve,Me]=ae;re.activeTexture.set(K.TEXTURE0+0),ve.texture.bind(K.LINEAR,K.CLAMP_TO_EDGE),J.colorAttachment.set(Me.targetColorTexture.texture);const Ue=U.getOrCreateProgram("rasterParticleDraw",{defines:ve.defines,overrideFog:!1});re.activeTexture.set(K.TEXTURE0+1);const _e=ve.scalarData?[]:[0,1,2,3].map(ge=>s.e3[ge](Ae));_e.push(Ae);const se=Ae.canonical.x,Te=Ae.canonical.y;for(const ge of _e){const Re=q.getTile(Q?ge.wrapped():ge);if(!Re)continue;const De=Re.rasterParticleState;if(!De)continue;const Fe=ge.canonical.x+(1<<ge.canonical.z)*(ge.wrap-Ae.wrap),We=ge.canonical.y;De.particleTexture0.bind(K.NEAREST,K.CLAMP_TO_EDGE);const lt=tp(1,De.particleTexture0.size[0],[Fe-se,We-Te],0,ve.texture.size,2,me,ve.textureOffset,ve.scale,ve.offset);Ue.draw(U,K.POINTS,rt.disabled,vt.disabled,Rt.alphaBlended,_t.disabled,lt,Y.id,De.particleIndexBuffer,void 0,De.particleSegment)}}}(m,y,x,F),S.bindFramebuffer.set(x.particleFramebuffer.framebuffer),function(U,q,Y,te){const re=U.context,K=re.gl,J=q.paint.get("raster-particle-max-speed"),Q=te*q.paint.get("raster-particle-speed-factor")*.15,me=function(Ae){return Math.pow(Ae,6)}(.01+1*q.paint.get("raster-particle-reset-rate-factor")),ae=q.particleFramebuffer;re.viewport.set([0,0,ae.width,ae.height]);for(const Ae of Y){const[,ve,Me]=Ae;re.activeTexture.set(K.TEXTURE0+0),ve.texture.bind(K.LINEAR,K.CLAMP_TO_EDGE),re.activeTexture.set(K.TEXTURE0+1);const Ue=Me.particleTexture0;Ue.bind(K.NEAREST,K.CLAMP_TO_EDGE);const _e=ip(1,Ue.size[0],0,ve.texture.size,J,Q,me,ve.textureOffset,ve.scale,ve.offset);ae.colorAttachment.set(Me.particleTexture1.texture),re.clear({color:s.am.transparent}),U.getOrCreateProgram("rasterParticleUpdate",{defines:ve.defines}).draw(U,K.TRIANGLES,rt.disabled,vt.disabled,Rt.unblended,_t.disabled,_e,q.id,U.viewportBuffer,U.quadTriangleIndexBuffer,U.viewportSegments)}}(m,x,F,N)}(l,t,n,c),l.renderPass==="translucent"&&(function(m,y,x,T,S){const C=m.context,E=C.gl,M=y.getSource().tileSize,D=5*(1-s.af(s.cI,s.cI+1,m.transform.zoom))*M+x.paint.get("raster-particle-elevation"),z=!m.options.moving,F=m.transform.projection.name==="globe";if(!T.length)return;const[L,N]=m.stencilConfigForOverlap(T),U=[];F&&U.push("PROJECTION_GLOBE_VIEW");const q=m.stencilModeFor3D();for(const Y of N){const te=Y.toUnwrapped(),re=y.getTile(Y);if(!re.rasterParticleState)continue;const K=re.rasterParticleState,J=100;re.registerFadeDuration(J);const Q=y.findLoadedParent(Y,0),me=_n(re,Q,y,m.transform,J);let ae,Ae;m.terrain&&m.terrain.prepareDrawTile(),C.activeTexture.set(E.TEXTURE0),K.targetColorTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),C.activeTexture.set(E.TEXTURE1),Q&&Q.rasterParticleState?(Q.rasterParticleState.targetColorTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE),ae=Math.pow(2,Q.tileID.overscaledZ-re.tileID.overscaledZ),Ae=[re.tileID.canonical.x*ae%1,re.tileID.canonical.y*ae%1]):K.targetColorTexture.bind(E.LINEAR,E.CLAMP_TO_EDGE);const ve=F?Float32Array.from(m.transform.expandedFarZProjMatrix):m.transform.calculateProjMatrix(te,z),Me=m.transform,Ue=fs(Me),_e=s.dA(Y.canonical),se=s.dB(_e.getCenter().lat);let Te,ge,Re,De,Fe;F?(Te=Float32Array.from(s.bh(s.dD(Y.canonical))),ge=Float32Array.from(Me.globeMatrix),Re=Float32Array.from(s.dz(Me)),De=[s.aD(Me.center.lng),s.aH(Me.center.lat)],Fe=Float32Array.from(s.dC(Y.canonical,_e,se,Me.worldSize/Me._pixelsPerMercatorPixel))):(Te=new Float32Array(16),ge=new Float32Array(9),Re=new Float32Array(16),De=[0,0],Fe=new Float32Array(9));const We=Oc(ve,Te,ge,Re,Fe,Ae||[0,0],s.ah(m.transform.zoom),De,Ue,ae||1,me,D),lt=m.isTileAffectedByFog(Y),pt=m.getOrCreateProgram("rasterParticle",{defines:U,overrideFog:lt});if(m.uploadCommonUniforms(C,pt,te),F){const et=new rt(E.LEQUAL,rt.ReadOnly,m.depthRangeFor3D),ut=0,ct=m.globeSharedBuffers;if(ct){const[Tt,Mt,Bt]=ct.getGridBuffers(se,ut!==0);pt.draw(m,E.TRIANGLES,et,q,Rt.alphaBlended,m.renderElevatedRasterBackface?_t.frontCCW:_t.backCCW,We,x.id,Tt,Mt,Bt)}}else{const et=m.depthModeForSublayer(0,rt.ReadOnly),ut=L[Y.overscaledZ],{tileBoundsBuffer:ct,tileBoundsIndexBuffer:Tt,tileBoundsSegments:Mt}=m.getTileBoundsBuffers(re);pt.draw(m,E.TRIANGLES,et,ut,Rt.alphaBlended,_t.disabled,We,x.id,ct,Tt,Mt)}}m.resetStencilClippingMasks()}(l,t,n,c),l.style.map.triggerRepaint())},background:function(l,t,n,c){const d=n.paint.get("background-color"),p=n.paint.get("background-color-use-theme").
2765constantOr("default")==="none",m=n.paint.get("background-opacity"),y=n.paint.get("background-emissive-strength"),x=n.paint.get("background-pitch-alignment")==="viewport";if(m===0)return;const T=l.context,S=T.gl,C=l.transform,E=C.tileSize,M=n.paint.get("background-pattern");let D;if(M!==void 0&&(M===null||(D=l.imageManager.getPattern(s.I.from(M.toString()),n.scope,l.style.getLut(n.scope)),!D)))return;const z=!M&&d.a===1&&m===1&&l.opaquePassEnabledForLayer()?"opaque":"translucent";if(l.renderPass!==z)return;const F=vt.disabled,L=l.depthModeForSublayer(0,z==="opaque"?rt.ReadWrite:rt.ReadOnly),N=l.colorModeForDrapableLayerRenderPass(y),U=M?"backgroundPattern":"background";let q,Y=c;if(Y||(q=l.getBackgroundTiles(),Y=Object.values(q).map(te=>te.tileID)),M&&(T.activeTexture.set(S.TEXTURE0),l.imageManager.bind(l.context,n.scope)),x){const te=l.getOrCreateProgram(U,{overrideFog:!1,overrideRtt:!0}),re=new Float32Array(s.bx([])),K=new s.aM(0,0,0,0,0),J=M?nu(re,y,m,l,0,n.scope,D,x,{tileID:K,tileSize:E}):rp(re,y,m,d.toPremultipliedRenderColor(p?null:n.lut));te.draw(l,S.TRIANGLES,L,F,N,_t.disabled,J,n.id,l.viewportBuffer,l.quadTriangleIndexBuffer,l.viewportSegments)}else for(const te of Y){const re=l.isTileAffectedByFog(te),K=l.getOrCreateProgram(U,{overrideFog:re}),J=te.toUnwrapped(),Q=c?te.projMatrix:l.transform.calculateProjMatrix(J);l.prepareDrawTile();const me=t?t.getTile(te):q?q[te.key]:new Is(te,E,C.zoom,l),ae=M?nu(Q,y,m,l,0,n.scope,D,x,{tileID:te,tileSize:E}):rp(Q,y,m,d.toPremultipliedRenderColor(p?null:n.lut));l.uploadCommonUniforms(T,K,J);const{tileBoundsBuffer:Ae,tileBoundsIndexBuffer:ve,tileBoundsSegments:Me}=l.getTileBoundsBuffers(me);K.draw(l,S.TRIANGLES,L,F,N,_t.disabled,ae,n.id,Ae,ve,Me)}},sky:function(l,t,n){const c=l._atmosphere?s.ah(l.transform.zoom):1,d=n.paint.get("sky-opacity")*c;if(d===0)return;const p=l.context,m=n.paint.get("sky-type"),y=new rt(p.gl.LEQUAL,rt.ReadOnly,[0,1]),x=l.frameCounter/1e3%1;m==="atmosphere"?l.renderPass==="offscreen"?n.needsSkyboxCapture(l)&&(function(T,S,C,E){const M=T.context,D=M.gl;let z=S.skyboxFbo;if(!z){z=S.skyboxFbo=M.createFramebuffer(32,32,!0,null),S.skyboxGeometry=new js(M),S.skyboxTexture=M.gl.createTexture(),D.bindTexture(D.TEXTURE_CUBE_MAP,S.skyboxTexture),D.texParameteri(D.TEXTURE_CUBE_MAP,D.TEXTURE_WRAP_S,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_CUBE_MAP,D.TEXTURE_WRAP_T,D.CLAMP_TO_EDGE),D.texParameteri(D.TEXTURE_CUBE_MAP,D.TEXTURE_MIN_FILTER,D.LINEAR),D.texParameteri(D.TEXTURE_CUBE_MAP,D.TEXTURE_MAG_FILTER,D.LINEAR);for(let U=0;U<6;++U)D.texImage2D(D.TEXTURE_CUBE_MAP_POSITIVE_X+U,0,D.RGBA,32,32,0,D.RGBA,D.UNSIGNED_BYTE,null)}M.bindFramebuffer.set(z.framebuffer),M.viewport.set([0,0,32,32]);const F=S.getCenter(T,!0),L=T.getOrCreateProgram("skyboxCapture"),N=new Float64Array(16);s.bx(N),s.eh(N,N,.5*-Math.PI),so(T,S,L,N,F,0),s.bx(N),s.eh(N,N,.5*Math.PI),so(T,S,L,N,F,1),s.bx(N),s.cR(N,N,.5*-Math.PI),so(T,S,L,N,F,2),s.bx(N),s.cR(N,N,.5*Math.PI),so(T,S,L,N,F,3),s.bx(N),so(T,S,L,N,F,4),s.bx(N),s.eh(N,N,Math.PI),so(T,S,L,N,F,5),M.viewport.set([0,0,T.width,T.height])}(l,n),n.markSkyboxValid(l)):l.renderPass==="sky"&&function(T,S,C,E,M){const D=T.context,z
vendor: 4,831 bytes, line 2765
2765=D.gl,F=T.transform,L=T.getOrCreateProgram("skybox");D.activeTexture.set(z.TEXTURE0),z.bindTexture(z.TEXTURE_CUBE_MAP,S.skyboxTexture);const N=((U,q,Y,te,re)=>({u_matrix:U,u_sun_direction:q,u_cubemap:0,u_opacity:te,u_temporal_offset:re}))(F.skyboxMatrix,S.getCenter(T,!1),0,E,M);T.uploadCommonUniforms(D,L),L.draw(T,z.TRIANGLES,C,vt.disabled,T.colorModeForRenderPass(),_t.backCW,N,"skybox",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(l,n,y,d,x):m==="gradient"&&l.renderPass==="sky"&&function(T,S,C,E,M){const D=T.context,z=D.gl,F=T.transform,L=T.getOrCreateProgram("skyboxGradient");S.skyboxGeometry||(S.skyboxGeometry=new js(D)),D.activeTexture.set(z.TEXTURE0);let N=S.colorRampTexture;N||(N=S.colorRampTexture=new s.T(D,S.colorRamp,z.RGBA8)),N.bind(z.LINEAR,z.CLAMP_TO_EDGE);const U=((q,Y,te,re,K)=>({u_matrix:q,u_color_ramp:0,u_center_direction:Y,u_radius:s.al(te),u_opacity:re,u_temporal_offset:K}))(F.skyboxMatrix,S.getCenter(T,!1),S.paint.get("sky-gradient-radius"),E,M);T.uploadCommonUniforms(D,L),L.draw(T,z.TRIANGLES,C,vt.disabled,T.colorModeForRenderPass(),_t.backCW,U,"skyboxGradient",S.skyboxGeometry.vertexBuffer,S.skyboxGeometry.indexBuffer,S.skyboxGeometry.segment)}(l,n,y,d,x)},custom:function(l,t,n,c){const d=l.context,p=n.implementation;if(!l.transform.projection.unsupportedLayers||!l.transform.projection.unsupportedLayers.includes("custom")||l.terrain&&(l.terrain.renderingToTexture||l.renderPass==="offscreen")&&n.isDraped(t)){if(l.renderPass==="offscreen"){const m=p.prerender;if(m){if(l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;m.call(p,d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),s.ah(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else m.call(p,d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState()}}else if(l.renderPass==="translucent"){if(l.terrain&&l.terrain.renderingToTexture){const y=p.renderToTile;if(y){const x=c[0].canonical,T={x:x.x+c[0].wrap*(p.wrapTileId?0:1<<x.z),y:x.y,z:x.z};d.setDepthMode(rt.disabled),d.setStencilMode(vt.disabled),d.setColorMode(l.colorModeForRenderPass()),l.setCustomLayerDefaults(),y.call(p,d.gl,T),d.setDirty(),l.setBaseState()}return}l.setCustomLayerDefaults(),d.setColorMode(l.colorModeForRenderPass()),d.setStencilMode(vt.disabled);const m=p.renderingMode==="3d"?new rt(l.context.gl.LEQUAL,rt.ReadWrite,l.depthRangeFor3D):l.depthModeForSublayer(0,rt.ReadOnly);if(d.setDepthMode(m),l.transform.projection.name==="globe"){const y=l.transform.pointMerc;p.render(d.gl,l.transform.customLayerMatrix(),l.transform.getProjection(),l.transform.globeToMercatorMatrix(),s.ah(l.transform.zoom),[y.x,y.y],l.transform.pixelsPerMeterRatio)}else p.render(d.gl,l.transform.customLayerMatrix());d.setDirty(),l.setBaseState(),d.bindFramebuffer.set(null)}}else s.w("Custom layers are not yet supported with this projection. Use mercator or globe to enable usage of custom layers.")},model:function(l,t,n,c){if(l.renderPass==="opaque")return;const d=n.paint.get("model-opacity").constantOr(1);if(d===0)return;const p=n.paint.get("model-cast-shadows");if(l.renderPass==="shadow"&&(!p||l.terrain&&d<.65&&n._transitionablePaint._values["model-opacity"].value.expression instanceof s.ab))return;const m=l.shadowRenderer,y=n.paint.get("model-receive-shadows");m&&(m.useNormalOffset=!0,y||(m.enabled=!1));const x=()=>{m&&(m.useNormalOffset=!0,y||(m.enabled=!0))},T=t.getSource();if(l.renderPass==="light-beam"&&T.type!=="batched-model")return;if(T.type==="vector"||T.type==="geojson")return function(L,N,U,q,Y){const te=L.transform;if(te.projection.name!=="mercator")return void s.w(`Drawing 3D models for ${te.projection.name} projection is not yet implemented`);const re=te.getFreeCameraOptions().position;if(!L.modelManager)return;const K=L.modelManager;U.modelManager=K;const J=L.shadowRenderer;if(!U._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const Q=U._unevaluatedLayout._values["model-id"],me=Object.assign({},U.layout.get("model-id").parameters),ae=L.style.order.indexOf(U.fqid);for(const Ae of q){const ve=N.getTile(Ae).getBucket(U);if(!ve||ve.projection.name!==te.projection.name)continue;const Me=ve.getModelUris();Me&&!ve.modelsRequested&&(K.addModelsFromBucket(Me,Y),ve.modelsRequested=!0);const Ue=Kf(Ae,te);me.zoom=Ue;const _e=Q.possiblyEvaluate(me);if(Aa(L,ve,Ae),fo.shadowUniformsInitialized=!1,fo.useSingleShadowCascade=!!J&&J.getMaxCascadeForTile(Ae.toUnwrapped())===0,L.renderPass==="shadow"&&J){if(L.currentShadowCascade===1&&ve.isInsideFirstShadowMapFrustum)continue;const ge=te.calculatePosMatrix(Ae.toUnwrapped(),te.worldSize);if(fo.tileMatrix.set(ge),fo.shadowTileMatrix=Float32Array.from(J.calculateShadowPassMatrixFromMatr
2765ix(ge)),fo.aabb.min.fill(0),fo.aabb.max[0]=fo.aabb.max[1]=s.aj,fo.aabb.max[2]=0,yu(ve,fo,L,U.scope))continue}const se=1<<Ae.canonical.z,Te=[((re.x-Ae.wrap)*se-Ae.canonical.x)*s.aj,(re.y*se-Ae.canonical.y)*s.aj,re.z*se*s.aj];L.conflationActive&&Object.keys(ve.instancesPerModel).length>0&&L.style.isLayerClipped(U,N.getSource())&&ve.updateReplacement(Ae,L.replacementSource,ae,Y)&&(ve.uploaded=!1,ve.upload(L.context));for(let ge in ve.instancesPerModel){const Re=ve.instancesPerModel[ge];Re.features.length>0&&(ge=_e.evaluate(Re.features[0].feature,{}));const De=K.getModel(ge,Y);if(De||K.hasURLBeenRequested(ge)||ve.modelUris.includes(ge)||(ve.modelUris.push(ge),ve.modelsRequested=!1),De&&De.uploaded)for(const Fe of De.nodes)gu(L,U,Fe,Re,Te,Ae,fo)}}}(l,t,n,c,T.type==="vector"?n.scope:""),void x();if(!T.loaded())return;if(T.type==="batched-model")return function(L,N,U,q){U.resetLayerRenderingStats(L);const Y=L.context,te=L.transform,re=L.style.fog,K=L.shadowRenderer;if(te.projection.name!=="mercator")return void s.w(`Drawing 3D landmark models for ${te.projection.name} projection is not yet implemented`);const J=L.transform.getFreeCameraOptions().position,Q=s.c1([],[J.x,J.y,J.z],L.transform.worldSize),me=s.eq([],Q),ae=s.bx([]),Ae=s.e9(te.center.lat,te.zoom),ve=s.bn([],[1,1,1/Ae]);s.bo(ae,ae,me);const Me=U.paint.get("model-opacity").constantOr(1),Ue=new rt(Y.gl.LEQUAL,rt.ReadWrite,L.depthRangeFor3D),_e=new rt(Y.gl.LEQUAL,rt.ReadOnly,L.depthRangeFor3D),se=new s.d6([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),Te=L.renderPass==="shadow",ge=Te&&K?K.getCurrentCascadeFrustum():te.getFrustum(te.scaleZoom(te.worldSize)),Re=U.paint.get("model-front-cutoff"),De=Re[2]<1,Fe=uo(L,U.paint.get("model-cutoff-fade-range")),We=U.getLayerRenderingStats();(function(lt,pt,et,ut){const ct=lt.terrain?lt.terrain.exaggeration():0,Tt=lt.transform.zoom;for(const Mt of ut){const Bt=pt.getTile(Mt).getBucket(et);Bt&&(Bt.setFilter(et.filter),lt.conflationActive&&Bt.updateReplacement(Mt,lt.replacementSource),Bt.evaluateTransform(lt,et),lt.terrain&&ct>0&&Bt.elevationUpdate(lt.terrain,ct,Mt,et.source),Bt.needsReEvaluation(lt,Tt,et)&&Bt.evaluate(et))}})(L,N,U,q),function(){let lt,pt,et;De?(lt=q.length-1,pt=-1,et=-1):(lt=0,pt=q.length,et=1);const ut=new Float64Array(16),ct=s.cx(),Tt=new s.P(0,0);for(let Mt=lt;Mt!==pt;Mt+=et){const Bt=q[Mt],Jt=N.getTile(Bt).getBucket(U);if(!Jt||!Jt.uploaded)continue;let At=!1;K&&(At=K.getMaxCascadeForTile(Bt.toUnwrapped())===0);const Qt=te.calculatePosMatrix(Bt.toUnwrapped(),te.worldSize),ri=Jt.modelTraits;!Te&&De&&(s.bi(ut,Qt),s.ad(ct,Q,ut),Tt.x=ct[0],Tt.y=ct[1]);const Si=[];Jt.setFilter(U.filter);for(const Ft of Jt.getNodesInfo()){if(Ft.hiddenByReplacement||!Ft.node.meshes)continue;const ei=Ft.node;let ti=0;L.terrain&&ei.elevation&&(ti=ei.elevation*L.terrain.exaggeration());const si=(()=>{const Fr=Ft.aabb;return se.min=[...Fr.min],se.max=[...Fr.max],se.min[2]+=ti,se.max[2]+=ti,s.ad(se.min,se.min,Qt),s.ad(se.max,se.max,Qt),se})(),Nt=Ft.evaluatedScale;if(Nt[0]<=1&&Nt[1]<=1&&Nt[2]<=1&&si.intersects(ge)===0)continue;if(!Te&&De){const Fr=.16666666666666666;Ft.cameraCollisionOpacity=Q[0]>si.min[0]&&Q[0]<si.max[0]&&Q[1]>si.min[1]&&Q[1]<si.max[1]&&Q[2]*Ae<si.max[2]&&ei.footprint&&s.bY(Tt,ei.footprint)?Math.max(Ft.cameraCollisionOpacity-Fr,0):Math.min(1,Ft.cameraCollisionOpacity+Fr)}const mi=[...Qt],ni=1/s.d4(Bt.canonical),Hi=ei.anchor?ei.anchor[0]:0,Yt=ei.anchor?ei.anchor[1]:0;s.bo(mi,mi,[Hi*(Nt[0]-1)+Ft.evaluatedTranslation[0]*ni,Yt*(Nt[1]-1)+Ft.evaluatedTranslation[1]*ni,ti+Ft.evaluatedTranslation[2]]),s.cn(Nt,s.es)||s.cP(mi,mi,Nt);const ai=s.az([],mi,ei.matrix),wi=s.az([],te.expandedFarZProjMatrix,ai),pr=s.az([],te.expandedFarZProjMatrix,mi),hr=s.aA([],[Hi,Yt,ti,1],wi)[2];ei.hidden=!1;let mr=Me;Te||(De&&(mr*=Ft.cameraCollisionOpacity,mr*=fp(mi,te,Ft.aabb,Re)),mr*=pp(Fe,hr)),mr!==0?Si.push({nodeInfo:Ft,depth:hr,opacity:mr,wvpForNode:wi,wvpForTile:pr,nodeModelMatrix:ai,tileModelMatrix:mi}):ei.hidden=!0}Te||Si.sort((Ft,ei)=>!De||Ft.opacity===1&&ei.opacity===1?Ft.depth<ei.depth?-1:1:Ft.opacity===1?-1:ei.opacity===1?1:Ft.depth>ei.depth?-1:1);for(const Ft of Si){const ei=Ft.nodeInfo,ti=ei.node;let si=s.az([],ve,Ft.tileModelMatrix);s.az(si,ae,si);const Nt=s.bi([],si);s.ea(Nt,Nt),s.cP(Nt,Nt,$c),si=s.az(si,si,ti.matrix);const mi=L.renderPass==="light-beam",ni=U.paint.get("model-color-use-theme").
2765constantOr("default")==="none",Hi=ri&s.ex.HasMapboxMeshFeatures,Yt=Hi?0:ei.evaluatedRMEA[0][2];for(let ai=0;ai<ti.meshes.length;++ai){const wi=ti.meshes[ai],pr=ai===ti.lightMeshIndex;let hr=Ft.wvpForNode;if(pr){if(!mi&&!L.terrain&&L.shadowRenderer){L.currentLayer<L.firstLightBeamLayer&&(L.firstLightBeamLayer=L.currentLayer);continue}hr=Ft.wvpForTile}else if(mi)continue;const mr={defines:[]},Fr=[];if(!Te&&K&&(K.useNormalOffset=!!wi.normalBuffer),kl(mr.defines,Fr,wi,L,ni?null:U.lut),Hi||mr.defines.push("DIFFUSE_SHADED"),At&&mr.defines.push("SHADOWS_SINGLE_CASCADE"),We&&(Te?We.numRenderedVerticesInShadowPass+=wi.vertexArray.length:We.numRenderedVerticesInTransparentPass+=wi.vertexArray.length),Te){Hc(wi,Ft.nodeModelMatrix,L,U);continue}let ao=null;if(re){const Gr=Ol(Ft.nodeModelMatrix,L.transform);if(ao=new Float32Array(Gr),te.projection.name!=="globe"){const nr=wi.aabb.min,Ki=wi.aabb.max,[Ii,Tr]=re.getOpacityForBounds(Gr,nr[0],nr[1],Ki[0],Ki[1]);mr.overrideFog=Ii>=ze||Tr>=ze}}const ln=wi.material;let Sn;ln.occlusionTexture&&ln.occlusionTexture.offsetScale&&(Sn=ln.occlusionTexture.offsetScale,mr.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const Ur=L.getOrCreateProgram("model",mr);!Te&&K&&K.setupShadowsFromMatrix(Ft.tileModelMatrix,Ur,K.useNormalOffset),L.uploadCommonUniforms(Y,Ur,null,ao);const Bn=ln.pbrMetallicRoughness;Bn.metallicFactor=.9,Bn.roughnessFactor=.5;const eo=ou(new Float32Array(hr),new Float32Array(si),new Float32Array(Nt),new Float32Array(ti.matrix),L,Ft.opacity,Bn.baseColorFactor,ln.emissiveFactor,Bn.metallicFactor,Bn.roughnessFactor,ln,Yt,U,[0,0,0],Sn);!pr&&(ei.hasTranslucentParts||Ft.opacity<1)&&Ur.draw(L,Y.gl.TRIANGLES,Ue,vt.disabled,Rt.disabled,_t.backCCW,eo,U.id,wi.vertexBuffer,wi.indexBuffer,wi.segments,U.paint,L.transform.zoom,void 0,Fr),Ur.draw(L,Y.gl.TRIANGLES,pr?_e:Ue,vt.disabled,pr||Ft.opacity<1||ei.hasTranslucentParts?Rt.alphaBlended:Rt.unblended,_t.backCCW,eo,U.id,wi.vertexBuffer,wi.indexBuffer,wi.segments,U.paint,L.transform.zoom,void 0,Fr)}}}}()}(l,t,n,c),void x();if(T.type!=="model")return;const S=T.getModels(),C=[],E=l.transform.getFreeCameraOptions().position,M=s.c1([],[E.x,E.y,E.z],l.transform.worldSize);s.eq(M,M);const D=[],z=[];let F=0;for(const L of S){const N=n.paint.get("model-rotation").constantOr(null),U=n.paint.get("model-scale").constantOr(null),q=n.paint.get("model-translation").constantOr(null);L.computeModelMatrix(l,N,U,q,!0,!0,!1);const Y=s.bx([]),te=s.e9(L.position.lat,l.transform.zoom),re=s.bn([],[1,1,1/te]);s.bo(Y,Y,M),C.push({zScaleMatrix:re,negCameraPosMatrix:Y});for(const K of L.nodes)_u(l.transform,K,L.matrix,l.transform.expandedFarZProjMatrix,F,D,z);F++}if(D.sort((L,N)=>N.depth-L.depth),l.renderPass!=="shadow"){if(d===1)for(const L of z)Ia(L,l,n,C[L.modelIndex],vt.disabled,l.colorModeForRenderPass());else{for(const L of z)Ia(L,l,n,C[L.modelIndex],vt.disabled,Rt.disabled);for(const L of z)Ia(L,l,n,C[L.modelIndex],l.stencilModeFor3D(),l.colorModeForRenderPass());l.resetStencilClippingMasks()}for(const L of D)Ia(L,l,n,C[L.modelIndex],vt.disabled,l.colorModeForRenderPass());x()}else{for(const L of z)Hc(L.mesh,L.nodeModelMatrix,l,n);for(const L of D)Hc(L.mesh,L.nodeModelMatrix,l,n);x()}}},Wc={line:function(l,t,n){if(l.hasElevatedBuckets=!1,l.hasNonElevatedBuckets=!1,l._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||l._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(t){const c=t.getVisibleCoordinates();for(const d of c){const p=t.getTile(d).getBucket(l);if(p&&(p.elevationType!=="none"?l.hasElevatedBuckets=!0:l.hasNonElevatedBuckets=!0,l.hasElevatedBuckets&&l.hasNonElevatedBuckets))break}}}else l.hasNonElevatedBuckets=!0},model:function(l,t,n){const c=t.getSource();if(!c.loaded())return;if(c.type==="vector"||c.type==="geojson")return void(n.modelManager&&n.modelManager.upload(n,c.type==="vector"?l.scope:""));if(c.type==="batched-model"||c.type!=="model")return;const d=c.getModels();for(const p of d)p.upload(n.context)},raster:function(l,t,n){const c=t.getSource();if(!(c instanceof Qo&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map(y=>t.getTileByID(y));for(const y of m)y.updateNeeded(l.id,p)&&c.prepareTile(y,d,l.id,p)},"raster-particle":function(l,t,n){const c=t.getSource();if(!(c instanceof Qo&&c.loaded()))return;const d=l.sourceLayer||c.rasterLayerIds&&c.rasterLayerIds[0];if(!d)return;const p=l.paint.get("raster-particle-array-band")||c.getInitialBand(d);if(p==null)return;const m=t.getIds().map(y=>t.getTileByID(y));for(const y of m)y.updateNeeded(l.id,p)&&c.prepareTile(y,d,l.id,p)}},Xc={fill:nt},Fn={fill:function(l,t,n,c){if(!n.layout||n.layout.get("fill-elevation-reference")==="none")return;const d=l.context.gl,p=new rt(d.LEQUAL,rt.ReadOnly,l.depthRangeFor3D),m=new vt({func:d.ALWAYS,mask:255},255,255,d.KEEP,d.KEEP,d.REPLACE),y=l.transform.getFreeCameraOptions().position,x=l.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const T of c){const S=t.getTile(T),C=S.getBucket(n);if(!C)continue;const E=C.elevatedStructures;if(!E||E.depthSegments.segments[0].primitiveLength===0)continue;const M=Rl(T.toUnwrapped(),y),D=l.translatePosMatrix(T.projMatrix,S,n.paint.get("fill-translate"),n.paint.get("fill-translate-anchor")),z=Lc(D,M,0,1,0);x.draw(l,d.TRIANGLES,p,m,Rt.disabled,_t.disabled,z,n.id,E.vertexBuffer,E.indexBuffer,E.depthSegments,n.paint,l.transform.zoom)}}};class _s{constructor(t,n,c,d,p,m){this.context=new Nc(t,n),this.transform=c,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=p,this._timeStamp=s.q.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const y=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const T of y)this._debugParams.enabledLayers[T]=!0;p.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),p.registerParameter(this._debugParams,["Precipitation"],"forceEnablePrecipitation"),p.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),p.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),p.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),p.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const T of y)p.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],T);this.occlusionParams=new Ca(p),this.setup(),this.numSublayers=fn.maxUnderzooming+fn.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.deferredRenderGpuTimeQueries=[],this.gpuTimers={},this.frameCounter=0,this._backgroundTiles={},this.conflationActive=!1,this.replacementSource=new s.eE,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Rf(this),this._wireframeDebugCache=new Bl,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const x=new s.r({width:1,height:1},Uint8Array.of(0,0,0,0));
vendor: 5,145 bytes, line 2765
2765this.emptyDepthTexture=new s.T(this.context,x,t.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=d,this.worldview=m}updateTerrain(t,n){const c=!!t&&!!t.terrain&&this.transform.projection.supportsTerrain;if(!(c||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Pc(this,t));const d=this._terrain;this.transform.elevation=c?d:null,d.update(t,this.transform,n),this.transform.elevation&&!d.enabled&&(this.transform.elevation=null)}_updateFog(t){const n=t.fog;if(!n||this.transform.projection.name==="globe"||n.getOpacity(this.transform.pitch)<1||n.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[c,d]=n.getFovAdjustedRange(this.transform._fov);if(c>d)return void(this.transform.fogCullDistSq=null);const p=c+.78*(d-c);this.transform.fogCullDistSq=p*p}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(t){t&&!this._terrain&&(this._terrain=new Pc(this,this.style)),this._forceTerrainMode=t}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(t,n){if(this.width=t*s.q.devicePixelRatio,this.height=n*s.q.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const c of this.style.order)this.style._mergedLayers[c].resize()}setup(){const t=this.context,n=new s.ba;n.emplaceBack(0,0),n.emplaceBack(s.aj,0),n.emplaceBack(0,s.aj),n.emplaceBack(s.aj,s.aj),this.tileExtentBuffer=t.createVertexBuffer(n,s.bc.members),this.tileExtentSegments=s.bd.simpleSegment(0,0,4,2);const c=new s.ba;c.emplaceBack(0,0),c.emplaceBack(s.aj,0),c.emplaceBack(0,s.aj),c.emplaceBack(s.aj,s.aj),this.debugBuffer=t.createVertexBuffer(c,s.bc.members),this.debugSegments=s.bd.simpleSegment(0,0,4,5);const d=new s.ba;d.emplaceBack(-1,-1),d.emplaceBack(1,-1),d.emplaceBack(-1,1),d.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(d,s.bc.members),this.viewportSegments=s.bd.simpleSegment(0,0,4,2);const p=new s.aZ;p.emplaceBack(0,0,0,0),p.emplaceBack(s.aj,0,s.aj,0),p.emplaceBack(0,s.aj,0,s.aj),p.emplaceBack(s.aj,s.aj,s.aj,s.aj),this.mercatorBoundsBuffer=t.createVertexBuffer(p,s.bf.members),this.mercatorBoundsSegments=s.bd.simpleSegment(0,0,4,2);const m=new s.a_;m.emplaceBack(0,1,2),m.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(m);const y=new s.bb;for(const T of[0,1,3,2,0])y.emplaceBack(T);this.debugIndexBuffer=t.createIndexBuffer(y),this.emptyTexture=new s.T(t,new s.r({width:1,height:1},Uint8Array.of(0,0,0,0)),t.gl.RGBA8),this.identityMat=s.bz();const x=this.context.gl;this.stencilClearMode=new vt({func:x.ALWAYS,mask:0},0,255,x.ZERO,x.ZERO,x.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(t){return t._makeTileBoundsBuffers(this.context,this.transform.projection),t._tileBoundsBuffer?{tileBoundsBuffer:t._tileBoundsBuffer,tileBoundsIndexBuffer:t._tileBoundsIndexBuffer,tileBoundsSegments:t._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const t=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,t.TRIANGLES,rt.disabled,this.stencilClearMode,Rt.disabled,_t.disabled,Cc(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(t,n,c){if(!n||this.currentStencilSource===n.id||!t.isTileClipped()||!c||c.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let y=!1;for(const x of c)if(this._tileClippingMaskIDs[x.key]===void 0){y=!0;break}if(!y)return}this.currentStencilSource=n.id;const d=this.context,p=d.gl;this.nextStencilID+c.length>256&&this.clearStencil(),d.setColorMode(Rt.disabled),d.setDepthMode(rt.disabled);const m=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const y of c){const x=n.getTile(y),T=this._tileClippingMaskIDs[y.key]=this.nextStencilID++,{tileBoundsBuffer:S,tileBoundsIndexBuffer:C,tileBoundsSegments:E}=this.getTileBoundsBuffers(x);m.draw(this,p.TRIANGLES,rt.disabled,new vt({func:p.ALWAYS,mask:0},T,255,p.KEEP,p.KEEP,p.REPLACE),Rt.disabled,_t.disabled,Cc(y.projMatrix),"$clipping",S,C,E)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,n=this.context.gl;return new vt({func:n.NOTEQUAL,mask:255},t,255,n.KEEP,n.KEEP,n.REPLACE)}stencilModeForClipping(t){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(t);const n=this.context.gl;return new vt({func:n.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,n.KEEP,n.KEEP,n.REPLACE)}stencilConfigForOverlap(t){const n=this.context.gl,c=t.sort((m,y)=>
2765y.overscaledZ-m.overscaledZ),d=c[c.length-1].overscaledZ,p=c[0].overscaledZ-d+1;if(p>1){this.currentStencilSource=void 0,this.nextStencilID+p>256&&this.clearStencil();const m={};for(let y=0;y<p;y++)m[y+d]=new vt({func:n.GEQUAL,mask:255},y+this.nextStencilID,255,n.KEEP,n.KEEP,n.REPLACE);return this.nextStencilID+=p,[m,c]}return[{[d]:vt.disabled},c]}colorModeForRenderPass(){const t=this.context.gl;return this._showOverdrawInspector?new Rt([t.CONSTANT_COLOR,t.ONE,t.CONSTANT_COLOR,t.ONE],new s.am(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Rt.unblended:Rt.alphaBlended}colorModeForDrapableLayerRenderPass(t){const n=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?new Rt([n.ONE,n.ONE_MINUS_SRC_ALPHA,n.CONSTANT_ALPHA,n.ONE_MINUS_SRC_ALPHA],new s.am(0,0,0,t===void 0?0:t),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(t,n,c,d=!1){if(this.depthOcclusion)return new rt(this.context.gl.GREATER,rt.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!d)return rt.disabled;const p=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new rt(c||this.context.gl.LEQUAL,n,[p,p])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const t=this.context.gl,n=Math.ceil(this.width),c=Math.ceil(this.height),d=this.context.bindFramebuffer.get(),p=t.getParameter(t.TEXTURE_BINDING_2D);this.depthFBO&&this.depthFBO.width===n&&this.depthFBO.height===c||(this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),n!==0&&c!==0&&(this.depthFBO=new Ns(this.context,n,c,!1,"texture"),this.depthTexture=new s.T(this.context,{width:n,height:c,data:null},t.DEPTH24_STENCIL8),this.depthFBO.depthAttachment.set(this.depthTexture.texture))),this.context.bindFramebuffer.set(d),t.bindTexture(t.TEXTURE_2D,p),this.depthFBO&&(t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,this.depthFBO.framebuffer),t.blitFramebuffer(0,0,n,c,0,0,n,c,t.DEPTH_BUFFER_BIT,t.NEAREST),t.bindFramebuffer(t.FRAMEBUFFER,this.context.bindFramebuffer.current))}updateAverageFPS(){this._fpsHistory.push(this._dt===0?0:1e3/this._dt),this._fpsHistory.length>this._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((t,n)=>t+n/this._fpsHistory.length,0))}render(t,n){const c=s.q.now();this._dt=c-this._timeStamp,this._timeStamp=c,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=t.map.repaint,this.style=t,this.options=n;const d=this.style._mergedLayers,p=!(!this.terrain||!this.terrain.enabled),m=()=>this.style._getOrder(p).filter(_e=>{const se=d[_e];return!(se.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[se.type]});let y=m(),x=!1,T=!1,S=null;for(const _e of y){const se=d[_e];se.type==="circle"?x=!0:se.type==="building"?S=se:se.type==="symbol"&&(se.hasInitialOcclusionOpacityProperties?T=!0:x=!0)}let C=y.map(_e=>d[_e]);const E=this.style._mergedSourceCaches;this.imageManager=t.imageManager,this.modelManager=t.modelManager,this.symbolFadeChange=t.placement.symbolFadeChange(s.q.now()),this.imageManager.beginFrame();let M=0,D=!1;for(const _e in E){const se=E[_e];se.used&&(se.prepare(this.context),se.getSource().usedInConflation&&++M)}let z=!1;for(const _e of C)_e.isHidden(this.transform.zoom)||(_e.type==="clip"&&(z=!0),this.prepareLayer(_e));const F={},L={},N={},U={},q={};for(const _e in E){const se=E[_e];F[_e]=se.getVisibleCoordinates(),L[_e]=F[_e].slice().reverse(),N[_e]=se.getVisibleCoordinates(!0).reverse(),U[_e]=se.getShadowCasterCoordinates(),q[_e]=se.sortCoordinatesByDistance(F[_e])}const Y=_e=>{const se=this.style.getLayerSourceCache(_e);return se&&se.used?se.getSource():null};if(M||z||this._clippingActiveLastFrame){const _e=[],se=[];let Te=0;for(const ge of C)this.isSourceForClippingOrConflation(ge,Y(ge))&&(_e.push(ge),se.push(Te)),Te++;if(_e&&(z||_e.length>1)||this._clippingActiveLastFrame){z=!1;const ge=[];for(let Re=0;Re<_e.length;Re++){const De=_e[Re],Fe=se[Re],We=this.style.getLayerSourceCache(De);
vendor: 71,035 bytes, line 2765
2765if(!We||!We.used||!We.getSource().usedInConflation&&De.type!=="clip"&&De.type!=="building")continue;let lt=s.eF,pt=s.bW.None;const et=[];let ut=!0;if(De.type==="building")lt=s.eH;else if(De.type==="clip"){lt=Fe;for(const ct of De.layout.get("clip-layer-types"))pt|=ct==="model"?s.bW.Model:ct==="symbol"?s.bW.Symbol:s.bW.FillExtrusion;for(const ct of De.layout.get("clip-layer-scope"))et.push(ct);De.isHidden(this.transform.zoom)?ut=!1:z=!0}ut&&ge.push({layer:De.fqid,cache:We,order:lt,clipMask:pt,clipScope:et})}this.replacementSource.setSources(ge),D=!0}}this._clippingActiveLastFrame=z,D||this.replacementSource.clear(),this.conflationActive=D,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let _e=0;_e<C.length;_e++){const se=C[_e],Te=se.cutoffRange();if(this.longestCutoffRange=Math.max(Te,this.longestCutoffRange),Te>0){const ge=Y(se);ge&&(this.minCutoffZoom=Math.max(ge.minzoom,this.minCutoffZoom)),se.minzoom&&(this.minCutoffZoom=Math.max(se.minzoom,this.minCutoffZoom))}se.is3D(p)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=_e),this._lastOcclusionLayer=_e)}const te=this.style&&this.style.fog;te?(this._fogVisible=te.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=te.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(N),this.opaquePassCutoff=0,y=m(),C=y.map(_e=>d[_e]));const re=this._shadowRenderer;if(re){re.updateShadowParameters(this.transform,this.style.directionalLight);for(const _e in E)for(const se of F[_e]){let Te={min:0,max:0};this.terrain&&(Te=this.terrain.getMinMaxForTile(se)||Te),re.addShadowReceiver(se.toUnwrapped(),Te.min,Te.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new s.eG(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new de(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const K=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),J=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(K&&!this._snow&&(this._snow=new vu(this)),!K&&this._snow&&(this._snow.destroy(),delete this._snow),J&&!this._rain&&(this._rain=new Pa(this)),!J&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),S){this.buildingTileBorderManager||(this.buildingTileBorderManager=new dp);const _e=this.style.getLayerSourceCache(S);this.buildingTileBorderManager.updateBorders(_e,S)}if(!Zo.has(this.context.gl))return;this.renderPass="offscreen";for(const _e of C){const se=t.getLayerSourceCache(_e);if(!_e.hasOffscreenPass()||_e.isHidden(this.transform.zoom))continue;const Te=se?L[se.id]:void 0;(_e.type==="custom"||_e.type==="raster"||_e.type==="raster-particle"||_e.isSky()||Te&&Te.length)&&this.renderLayer(this,se,_e,Te)}this.depthRangeFor3D=[0,1-(C.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,U)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const Q=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),me=(()=>{if(n.showOverdrawInspector)return s.am.black;const _e=this.style.fog;if(_e&&this.transform.projection.supportsFog){const se=this.style.getLut(_e.scope);if(!Q){const Te=_e.properties.get("color-use-theme")==="none",ge=_e.properties.get("color").toNonPremultipliedRenderColor(Te?null:se).toArray01();return new s.am(...ge)}if(Q){const Te=_e.properties.get("space-color-use-theme")==="none",ge=_e.properties.get("space-color").toNonPremultipliedRenderColor(Te?null:se).toArray01();return new s.am(...ge)}}return s.am.transparent})();if(this.context.clear({color:me,depth:1}),this.clearStencil(),this._showOverdrawInspector=n.showOverdrawInspector,this.renderPass="opaque",this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&Q&&this._atmosphere.drawStars(this,this.style.fog),!this.terrain)for(this.currentLayer=y.length-1;this.currentLayer>=0;this.currentLayer--){const _e=C[this.currentLayer],se=t.getLayerSourceCache(_e);if(_e.isSky())continue;const Te=se?(_e.is3D(p)?q:L)[se.id]:void 0;this._renderTileClippingMasks(_e,se,Te),this.renderLayer(this,se,_e,Te)}if(this.style.fog&&this.transform.projection.supportsFog&&this._atmosphere&&!this._showOverdrawInspector&&Q&&this._atmosphere.drawAtmosphereGlow(this,this.style.fog),this.renderPass="sky",(!this._atmosphere||s.ah(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<y.length;this.currentLayer++){const _e=C[this.currentLayer],se=t.getLayerSourceCache(_e);_e.isSky()&&this.renderLayer(this,se,_e,se?L[se.id]:void 0)}function ae(_e,se){let Te;return se&&(Te=(_e.type==="symbol"?N:_e.is3D(p)?q:L)[se.id]),Te}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<y.length;){const _e=C[this.currentLayer];if(_e.type==="raster"||_e.type==="raster-particle"){const se=t.getLayerSourceCache(_e);this.renderLayer(this,se,_e,ae(_e,se))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let Ae=0;re&&(Ae=re.getShadowCastingLayerCount());let ve=!1,Me=-1;for(let _e=0;_e<y.length;++_e){const se=C[_e];se.isHidden(this.transform.zoom)||se.is3D(p)&&(Me=_e)}T&&Me===-1&&(x=!0);let Ue=!1;for(;this.currentLayer<y.length;){const _e=C[this.currentLayer],se=t.getLayerSourceCache(_e);if(_e.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(_e)){if(_e.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(!Ue&&_e.is3D(p)&&!p){const Te=this.currentLayer,ge=Re=>{for(this.currentLayer=0;this.currentLayer<C.length;this.currentLayer++){const De=C[this.currentLayer];if(Xc[De.type]){const Fe=this.style.getLayerSourceCache(De);Xc[De.type](this,Fe,De,ae(De,Fe),Re)}}};ge("initialize"),ge("reset"),this.currentLayer=Te,Ue=!0}if(x&&!ve&&this.terrain&&!this.transform.isOrthographic&&(ve=!0,this.blitDepth()),T&&Me!==-1&&this.currentLayer===Me+1&&!this.transform.isOrthographic&&this.blitDepth(),this.terrain||this._renderTileClippingMasks(_e,se,se?F[se.id]:void 0),this.renderLayer(this,se,_e,ae(_e,se)),!this.terrain&&re&&Ae>0&&_e.hasShadowPass()&&--Ae==0){{this.clearStencil(),this.resetStencilClippingMasks();const Te=this.currentLayer;for(this.currentLayer=0;this.currentLayer<C.length;this.currentLayer++){const ge=C[this.currentLayer];if(Fn[ge.type]){const Re=this.style.getLayerSourceCache(ge);Fn[ge.type](this,Re,ge,ae(ge,Re))}}this.currentLayer=Te}if(re.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer){const Te=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=Te;this.currentLayer++){const ge=C[this.currentLayer];if(!ge.hasLightBeamPass())continue;const Re=t.getLayerSourceCache(ge);this.renderLayer(this,Re,ge,Re?L[Re.id]:void 0)}this.currentLayer=Te,this.renderPass="translucent"}}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Te=this.currentLayer;this.depthOcclusion=!0;for(const ge of this.layersWithOcclusionOpacity){this.currentLayer=ge;const Re=C[this.currentLayer],De=t.getLayerSourceCache(Re),Fe=De?L[De.id]:void 0;this.terrain||this._renderTileClippingMasks(Re,De,De?F[De.id]:void 0),this.renderLayer(this,De,Re,Fe)}this.depthOcclusion=!1,this.currentLayer=Te,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let _e=null;C.forEach(se=>{const Te=t.getLayerSourceCache(se);Te&&!se.isHidden(this.transform.zoom)&&Te.getVisibleCoordinates().length&&(!_e||_e.getSource().maxzoom<Te.getSource().maxzoom)&&(_e=Te)}),_e&&this.options.showTileBoundaries&&po(this,_e,_e.getVisibleCoordinates(),s.am.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&po(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new s.am(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(_e){const se=_e.transform.padding;Ll(_e,_e.transform.height-(se.top||0),3,lp),Ll(_e,se.bottom||0,3,pu),qc(_e,se.left||0,3,fu),qc(_e,_e.transform.width-(se.right||0),3,mu);const Te=_e.transform.centerPoint;(function(ge,Re,De,Fe){Fl(ge,Re-1,De-10,2,20,Fe),Fl(ge,Re-10,De-1,20,2,Fe)})(_e,Te.x,_e.transform.height-Te.y,cp)}(this),this.context.setDefault(),this.frameCounter=(this.frameCounter+1)%Number.MAX_SAFE_INTEGER,this.tileLoaded&&this.options.speedIndexTiming&&(this.loadTimeStamps.push(performance.now()),this.saveCanvasCopy()),D||(this.conflationActive=!1)}prepareLayer(t){this.gpuTimingStart(t);const{unsupportedLayers:n}=this.transform.projection,c=!n||!n.includes(t.type);if(Wc[t.type]&&(c||this.terrain&&t.type==="custom")){const d=this.style.getLayerSourceCache(t);Wc[t.type](t,d,this)}this.gpuTimingEnd()}renderLayer(t,n,c,d){c.isHidden(this.transform.zoom)||(c.type==="background"||c.type==="sky"||c.type==="custom"||c.type==="model"||c.type==="raster"||c.type==="raster-particle"||d&&d.length)&&(this.id=c.id,this.gpuTimingStart(c),t.transform.projection.unsupportedLayers&&t.transform.projection.unsupportedLayers.includes(c.type)&&(!t.terrain||c.type!=="custom")||c.type==="clip"||bu[c.type](t,n,c,d,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(t){if(!this.options.gpuTiming)return;const n=this.context.extTimerQuery,c=this.context.gl;let d=this.gpuTimers[t.id];d||(d=this.gpuTimers[t.id]={calls:0,cpuTime:0,query:c.createQuery()}),d.calls++,c.beginQuery(n.TIME_ELAPSED_EXT,d.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const t=this.context.extTimerQuery,n=this.context.gl,c=n.createQuery();this.deferredRenderGpuTimeQueries.push(c),n.beginQuery(t.TIME_ELAPSED_EXT,c)}}gpuTimingDeferredRenderEnd(){this.options.gpuTimingDeferredRender&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}gpuTimingEnd(){this.options.gpuTiming&&this.context.gl.endQuery(this.context.extTimerQuery.TIME_ELAPSED_EXT)}collectGpuTimers(){const t=this.gpuTimers;return this.gpuTimers={},t}collectDeferredRenderGpuQueries(){const t=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],t}queryGpuTimers(t){const n={};for(const c in t){const d=t[c],p=this.context.extTimerQuery,m=p.getQueryParameter(d.query,this.context.gl.QUERY_RESULT)/1e6;p.deleteQueryEXT(d.query),n[c]=m}return n}queryGpuTimeDeferredRender(t){if(!this.options.gpuTimingDeferredRender)return 0;const n=this.context.gl;let c=0;for(const d of t)c+=n.getQueryParameter(d,n.QUERY_RESULT)/1e6,n.deleteQuery(d);return c}translatePosMatrix(t,n,c,d,p){if(!c[0]&&!c[1])return t;const m=p?d==="map"?this.transform.angle:0:d==="viewport"?-this.transform.angle:0;if(m){const T=Math.sin(m),S=Math.cos(m);c=[c[0]*S-c[1]*T,c[0]*T+c[1]*S]}const y=[p?c[0]:s.aw(n,c[0],this.transform.zoom),p?c[1]:s.aw(n,c[1],this.transform.zoom),0],x=new Float32Array(16);return s.bo(x,t,y),x}saveTileTexture(t){if(t.context!==this.context)return;const n=t.size[0],c=this._tileTextures[n];c?c.push(t):this._tileTextures[n]=[t]}getTileTexture(t){const n=this._tileTextures[t];return n&&n.length>0?n.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(t,n,c){const d=c===void 0?this.terrain&&this.terrain.renderingToTexture:c,p=[];return this.style&&this.style.enable3dLights()&&(t==="globeRaster"||t==="terrainRaster"?(p.push("LIGHTING_3D_MODE"),p.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):d||p.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||p.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(p.push("TERRAIN"),this.linearFloatFilteringSupported()&&p.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&p.push("GLOBE"),!this._fogVisible||d||n!==void 0&&!n||p.push("FOG","FOG_DITHERING"),d&&p.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&p.push("OVERDRAW_INSPECTOR"),p}getOrCreateProgram(t,n){this.cache=this.cache||{};const c=n&&n.defines||[],d=n&&n.config,p=this.currentGlobalDefines(t,n&&n.overrideFog,n&&n.overrideRtt).concat(c),m=Rc.cacheKey(Al[t],t,p,d);return this.cache[m]||(this.cache[m]=new Rc(this.context,t,Al[t],d,op[t],p)),this.cache[m]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new s.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(t,n){if(this.style.enable3dLights()){const c=this.style.directionalLight,d=this.style.ambientLight;if(c&&d){const p=((m,y,x)=>{const T=m.properties.get("direction"),S=m.properties.get("color-use-theme")==="none",C=m.properties.get("color").toNonPremultipliedRenderColor(S?null:x.getLut(m.scope)).toArray01(),E=m.properties.get("intensity"),M=y.properties.get("color-use-theme")==="none",D=y.properties.get("color").toNonPremultipliedRenderColor(M?null:x.getLut(y.scope)).toArray01(),z=y.properties.get("intensity"),F=[T.x,T.y,T.z],L=s.dI(D,z),N=s.dI(C,E);return{u_lighting_ambient_color:L,u_lighting_directional_dir:F,u_lighting_directional_color:N,u_ground_radiance:Yh(F,N,L)}})(c,d,this.style);n.setLightsUniformValues(t,p)}}}uploadCommonUniforms(t,n,c,d,p){if(this.uploadCommonLightUniforms(t,n),this.terrain&&this.terrain.renderingToTexture)return;const m=this.style.fog;if(m){const y=m.getOpacity(this.transform.pitch),x=((T,S,C,E,M,D,z,F,L,N,U,q)=>{const Y=T.transform,te=S.properties.get("color-use-theme")==="none",re=S.properties.get("color").toNonPremultipliedRenderColor(te?null:T.style.getLut(S.scope)).toArray01();re[3]=E;const K=T.frameCounter/1e3%1,[J,Q]=S.properties.get("vertical-range");return{u_fog_matrix:C?Y.calculateFogTileMatrix(C):q||T.identityMat,u_fog_range:S.getFovAdjustedRange(Y._fov),u_fog_color:re,u_fog_horizon_blend:S.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(J,Q),Q],u_fog_temporal_offset:K,u_frustum_tl:M,u_frustum_tr:D,u_frustum_br:z,u_frustum_bl:F,u_globe_pos:L,u_globe_radius:N,u_viewport:U,u_globe_transition:s.ah(Y.zoom),u_is_globe:+(Y.projection.name==="globe")}})(this,m,c,y,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*s.q.devicePixelRatio,this.transform.height*s.q.devicePixelRatio],d);n.setFogUniformValues(t,x)}p&&n.setCutoffUniformValues(t,p.uniformValues)}setTileLoadedFlag(t){this.tileLoaded=t}saveCanvasCopy(){const t=this.canvasCopy();t&&(this.frameCopies.push(t),this.tileLoaded=!1)}canvasCopy(){const t=this.context.gl,n=t.createTexture();return t.bindTexture(t.TEXTURE_2D,n),t.copyTexImage2D(t.TEXTURE_2D,0,t.RGBA,0,0,t.drawingBufferWidth,t.drawingBufferHeight,0),n}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const t=this.style&&this.style.fog;return!!t&&t.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const t=this._backgroundTiles,n=this._backgroundTiles={},c=this.transform.coveringTiles({tileSize:512});for(const d of c)n[d.key]=t[d.key]||new Is(d,512,this.transform.tileZoom,this,void 0,this.worldview);return n}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(t,n){return!(!t.is3D(!(!this.terrain||!this.terrain.enabled))||t.type!=="clip"&&t.type!=="building"&&(t.minzoom&&t.minzoom>this.transform.zoom||(this.style._clipLayerPresent||t.sourceLayer!=="building"&&t.sourceLayer!=="procedural_buildings")&&(!n||n.type!=="batched-model")))}isTileAffectedByFog(t){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let n=this._cachedTileFogOpacities[t.key];return n||(this._cachedTileFogOpacities[t.key]=n=this.style.fog.getOpacityForTile(t)),n[0]>=ze||n[1]>=ze}setupDepthForOcclusion(t,n,c){const d=this.context,p=d.gl,m=!!c;var y;c||(c={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),d.activeTexture.set(p.TEXTURE3),t&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),c.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],c.u_depth_range_unpack=[2/((y=this.depthRangeFor3D)[1]-y[0]),-1-2*y[0]/(y[1]-y[0])],c.u_occluder_half_size=.5*this.occlusionParams.occluderSize,c.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(p.NEAREST,p.CLAMP_TO_EDGE),d.activeTexture.set(p.TEXTURE0),m||n.setTerrainUniformValues(d,c)}}function za(l,t){let n=!1,c=null;const d=()=>{c=null,n&&(l(),c=setTimeout(d,t),n=!1)};return()=>(n=!0,c||d(),c)}class Yc{constructor(t){this._hashName=t&&encodeURIComponent(t),s.aV(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=za(this._updateHashUnthrottled.bind(this),300)}addTo(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),t.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const t=this._map;if(!t)return"";const n=Kc(t);if(this._hashName){const c=this._hashName;let d=!1;const p=location.hash.slice(1).split("&").map(m=>{const y=m.split("=")[0];return y===c?(d=!0,`${y}=${n}`):m}).filter(m=>m);return d||p.push(`${c}=${n}`),`#${p.join("&")}`}return`#${n}`}_getCurrentHash(){const t=location.hash.replace("#","");if(this._hashName){let n;return t.split("&").map(c=>c.split("=")).forEach(c=>{c[0]===this._hashName&&(n=c)}),(n&&n[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._map;if(!t)return!1;const n=this._getCurrentHash();if(n.length>=3&&!n.some(c=>isNaN(Number(c)))){const c=t.dragRotate.isEnabled()&&t.touchZoomRotate.isEnabled()?+(n[3]||0):t.getBearing();return t.jumpTo({center:[+n[2],+n[1]],zoom:+n[0],bearing:c,pitch:+(n[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Kc(l,t){const n=l.getCenter(),c=Math.round(100*l.getZoom())/100,d=Math.ceil((c*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,d),m=Math.round(n.lng*p)/p,y=Math.round(n.lat*p)/p,x=l.getBearing(),T=l.getPitch();let S=t?`/${m}/${y}/${c}`:`${c}/${y}/${m}`;return(x||T)&&(S+="/"+Math.round(10*x)/10),T&&(S+=`/${Math.round(T)}`),S}const Ra={linearity:.3,easing:s.eI(0,0,.3,1)},gs=s.h({deceleration:2500,maxSpeed:1400},Ra),wu=s.h({deceleration:20,maxSpeed:1400},Ra),mo=s.h({deceleration:1e3,maxSpeed:360},Ra),Tu=s.h({deceleration:1e3,maxSpeed:90},Ra);class Jc{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.q.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,n=s.q.now();for(;t.length>0&&n-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const n={zoom:0,bearing:0,pitch:0,pan:new s.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:p}of this._inertiaBuffer)n.zoom+=p.zoomDelta||0,n.bearing+=p.bearingDelta||0,n.pitch+=p.pitchDelta||0,p.panDelta&&n.pan._add(p.panDelta),p.around&&(n.around=p.around),p.pinchAround&&(n.pinchAround=p.pinchAround);const c=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,d={};if(n.pan.mag()){const p=La(n.pan.mag(),c,s.h({},gs,t||{}));d.offset=n.pan.mult(p.amount/n.pan.mag()),d.center=this._map.transform.center,Da(d,p)}if(n.zoom){const p=La(n.zoom,c,wu);d.zoom=this._map.transform.zoom+p.amount,Da(d,p)}if(n.bearing){const p=La(n.bearing,c,mo);d.bearing=this._map.transform.bearing+s.ay(p.amount,-179,179),Da(d,p)}if(n.pitch){const p=La(n.pitch,c,Tu);d.pitch=this._map.transform.pitch+p.amount,Da(d,p)}if(d.zoom||d.bearing){const p=n.pinchAround===void 0?n.around:n.pinchAround;d.around=p?this._map.unproject(p):this._map.getCenter()}return this.clear(),d.noMoveStart=!0,d}}function Da(l,t){(!l.duration||l.duration<t.duration)&&(l.duration=t.duration,l.easing=t.easing)}function La(l,t,n){const{maxSpeed:c,linearity:d,deceleration:p}=n,m=s.ay(l*d/(t/1e3),-c,c),y=Math.abs(m)/(p*d);return{easing:n.easing,duration:1e3*y,amount:m*(y/2)}}class Ni extends s.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,c,d={}){const p=io(n.getCanvasContainer(),c),m=n.unproject(p);super(t,s.h({point:p,lngLat:m,originalEvent:c},d)),this._defaultPrevented=!1,this.target=n}}class Fa extends s.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n,c){const d=t==="touchend"?c.changedTouches:c.touches,p=Ho(n.getCanvasContainer(),d),m=p.map(x=>n.unproject(x)),y=p.reduce((x,T,S,C)=>x.add(T.div(C.length)),new s.P(0,0));super(t,{points:p,point:y,lngLats:m,lngLat:n.unproject(y),originalEvent:c}),this._defaultPrevented=!1}}class Su extends s.A{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(t,n){super("wheel",{originalEvent:n}),this._defaultPrevented=!1}}class Eu{constructor(t,n){this._map=t,this._clickTolerance=n.clickTolerance}reset(){this._mousedownPos=void 0}wheel(t){return this._firePreventable(new Su(this._map,t))}mousedown(t,n){return this._mousedownPos=n,this._firePreventable(new Ni(t.type,this._map,t))}mouseup(t){this._map.fire(new Ni(t.type,this._map,t))}preclick(t){const n=s.h({},t);n.type="preclick",this._map.fire(new Ni(n.type,this._map,n))}click(t,n){this._mousedownPos&&this._mousedownPos.dist(n)>=this._clickTolerance||(this.preclick(t),this._map.fire(new Ni(t.type,this._map,t)))}dblclick(t){return this._firePreventable(new Ni(t.type,this._map,t))}mouseover(t){this._map.fire(new Ni(t.type,this._map,t))}mouseout(t){this._map.fire(new Ni(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Fa(t.type,this._map,t))}touchmove(t){this._map.fire(new Fa(t.type,this._map,t))}touchend(t){this._map.fire(new Fa(t.type,this._map,t))}touchcancel(t){this._map.fire(new Fa(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Gs{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(t){this._map.fire(new Ni(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ni("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._map.fire(new Ni(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Iu{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=n.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,n){this.isEnabled()&&t.shiftKey&&t.button===0&&(Go(),this._startPos=this._lastPos=n,this._active=!0)}mousemoveWindow(t,n){if(!this._active)return;const c=n,d=this._startPos,p=this._lastPos;if(!d||!p||p.equals(c)||!this._box&&c.dist(d)<this._clickTolerance)return;this._lastPos=c,this._box||(this._box=It("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));const m=Math.min(d.x,c.x),y=Math.max(d.x,c.x),x=Math.min(d.y,c.y),T=Math.max(d.y,c.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${m}px,${x}px)`,this._box.style.width=y-m+"px",this._box.style.height=T-x+"px")})}mouseupWindow(t,n){if(!this._active)return;const c=this._startPos,d=n;if(c&&t.button===0){if(this.reset(),Ks(),c.x!==d.x||c.y!==d.y)return this._map.fire(new s.A("boxzoomend",{originalEvent:t})),{cameraAnimation:p=>p.fitScreenCoordinates(c,d,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",t)}}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),So(),delete this._startPos,delete this._lastPos}_fireEvent(t,n){return this._map.fire(new s.A(t,{originalEvent:n}))}}function Vl(l,t){const n={};for(let c=0;c<l.length;c++)n[l[c].identifier]=t[c];return n}class Au{constructor(t){this.reset(),this.numTouches=t.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(t,n,c){(this.centroid||c.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=t.timeStamp),c.length===this.numTouches&&(this.centroid=function(d){const p=new s.P(0,0);for(const m of d)p._add(m);return p.div(d.length)}(n),this.touches=Vl(c,n)))}touchmove(t,n,c){if(this.aborted||!this.centroid)return;const d=Vl(c,n);for(const p in this.touches){const m=d[p];(!m||m.dist(this.touches[p])>30)&&(this.aborted=!0)}}touchend(t,n,c){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),c.length===0){const d=!this.aborted&&this.centroid;if(this.reset(),d)return d}}}class ys{constructor(t){this.singleTap=new Au(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(t,n,c){this.singleTap.touchstart(t,n,c)}touchmove(t,n,c){this.singleTap.touchmove(t,n,c)}touchend(t,n,c){const d=this.singleTap.touchend(t,n,c);if(d){const p=t.timeStamp-this.lastTime<500,m=!this.lastTap||this.lastTap.dist(d)<30;if(p&&m||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=d,this.count===this.numTaps)return this.reset(),d}}}class Cu{constructor(){this._zoomIn=new ys({numTouches:1,numTaps:2}),this._zoomOut=new ys({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,n,c){this._zoomIn.touchstart(t,n,c),this._zoomOut.touchstart(t,n,c)}touchmove(t,n,c){this._zoomIn.touchmove(t,n,c),this._zoomOut.touchmove(t,n,c)}touchend(t,n,c){const d=this._zoomIn.touchend(t,n,c),p=this._zoomOut.touchend(t,n,c);return d?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()+1,around:m.unproject(d)},{originalEvent:t})}):p?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:m=>m.easeTo({duration:300,zoom:m.getZoom()-1,around:m.unproject(p)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Mu={0:1,2:2},Qc={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class Oa{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(t,n){return!1}_move(t,n){return{}}mousedown(t,n){if(this._lastPoint)return;const c=tc(t);this._correctButton(t,c)&&(this._lastPoint=n,this._eventButton=c)}mousemoveWindow(t,n){const c=this._lastPoint;if(c){if(t.preventDefault(),this._eventButton!=null&&function(d,p){const m=Mu[p];return d.buttons===void 0||(d.buttons&m)!==m}(t,this._eventButton))this.reset();else if(this._moved||!(n.dist(c)<this._clickTolerance))return this._moved=!0,this._lastPoint=n,this._move(c,n)}}mouseupWindow(t){this._lastPoint&&tc(t)===this._eventButton&&(this._moved&&Ks(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Pu extends Oa{mousedown(t,n){super.mousedown(t,n),this._lastPoint&&(this._active=!0)}_correctButton(t,n){return n===0&&!t.ctrlKey}_move(t,n){return{around:n,panDelta:n.sub(t)}}}class eh extends Oa{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?Qc[t.pitchRotateKey]:void 0}_correctButton(t,n){return this._pitchRotateKey?n===0&&t[this._pitchRotateKey]:n===0&&t.ctrlKey||n===2}_move(t,n){const c=.8*(n.x-t.x);if(c)return this._active=!0,{bearingDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class zu extends Oa{constructor(t){super(t),this._pitchRotateKey=t.pitchRotateKey?Qc[t.pitchRotateKey]:void 0}_correctButton(t,n){return this._pitchRotateKey?n===0&&t[this._pitchRotateKey]:n===0&&t.ctrlKey||n===2}_move(t,n){const c=-.5*(n.y-t.y);if(c)return this._active=!0,{pitchDelta:c}}contextmenu(t){this._pitchRotateKey||t.preventDefault()}}class _p{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._minTouches=1,this._clickTolerance=n.clickTolerance||1,this.reset(),s.aV(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new s.P(0,0)}touchstart(t,n,c){return this._calculateTransform(t,n,c)}touchmove(t,n,c){if(this._active&&!(c.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(c.length===1&&!s.eJ())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return t.cancelable&&t.preventDefault(),this._calculateTransform(t,n,c)}}touchend(t,n,c){this._calculateTransform(t,n,c),this._active&&c.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(t,n,c){c.length>0&&(this._active=!0);const d=Vl(c,n),p=new s.P(0,0),m=new s.P(0,0);let y=0;for(const T in d){const S=d[T],C=this._touches[T];C&&(p._add(S),m._add(S.sub(C)),y++,d[T]=S)}if(this._touches=d,y<this._minTouches||!m.mag())return;const x=m.div(y);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:p.div(y),panDelta:x}}enable(){this._enabled=!0,this._map._cooperativeGestures&&(this._addTouchPanBlocker(),this._el.classList.add("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page"))}disable(){this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove(),this._el.classList.remove("mapboxgl-touch-pan-blocker-override","mapboxgl-scrollable-page")),this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}_addTouchPanBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=It("div","mapboxgl-touch-pan-blocker",this._map._container),this._alertContainer.textContent=this._map._getUIString("TouchPanBlocker.Message"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showTouchPanBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-touch-pan-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class th{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(t){}_move(t,n,c){return{}}touchstart(t,n,c){this._firstTwoTouches||c.length<2||(this._firstTwoTouches=[c[0].identifier,c[1].identifier],this._start([n[0],n[1]]))}touchmove(t,n,c){const d=this._firstTwoTouches;if(!d)return;t.preventDefault();const[p,m]=d,y=jl(c,n,p),x=jl(c,n,m);if(!y||!x)return;const T=this._aroundCenter?null:y.add(x).div(2);return this._move([y,x],T,t)}touchend(t,n,c){if(!this._firstTwoTouches)return;const[d,p]=this._firstTwoTouches,m=jl(c,n,d),y=jl(c,n,p);m&&y||(this._active&&Ks(),this.reset())}touchcancel(){this.reset()}enable(t){this._enabled=!0,this._aroundCenter=!!t&&t.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function jl(l,t,n){for(let c=0;c<l.length;c++)if(l[c].identifier===n)return t[c]}function Ru(l,t){return Math.log(l/t)/Math.LN2}class gp extends th{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(t){this._startDistance=this._distance=t[0].dist(t[1])}_move(t,n){const c=this._distance;if(this._distance=t[0].dist(t[1]),this._active||!(Math.abs(Ru(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:Ru(this._distance,c),pinchAround:n}}}function Du(l,t){return 180*l.angleWith(t)/Math.PI}class yp extends th{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(t){this._startVector=this._vector=t[0].sub(t[1]),this._minDiameter=t[0].dist(t[1])}_move(t,n){const c=this._vector;if(this._vector=t[0].sub(t[1]),c&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:Du(this._vector,c),pinchAround:n}}_isBelowThreshold(t){this._minDiameter=Math.min(this._minDiameter,t.mag());const n=25/(Math.PI*this._minDiameter)*360,c=this._startVector;if(!c)return!1;const d=Du(t,c);return Math.abs(d)<n}}function ih(l){return Math.abs(l.y)>Math.abs(l.x)}class xp extends th{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(t){this._lastPoints=t,ih(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,n,c){const d=this._lastPoints;if(!d)return;const p=t[0].sub(d[0]),m=t[1].sub(d[1]);return this._map._cooperativeGestures&&!s.eJ()&&c.touches.length<3||(this._valid=this.gestureBeginsVertically(p,m,c.timeStamp),!this._valid)?void 0:(this._lastPoints=t,this._active=!0,{pitchDelta:(p.y+m.y)/2*-.5})}gestureBeginsVertically(t,n,c){if(this._valid!==void 0)return this._valid;const d=t.mag()>=2,p=n.mag()>=2;if(!d&&!p)return;if(!d||!p)return this._firstMove==null&&(this._firstMove=c),c-this._firstMove<100&&void 0;const m=t.y>0==n.y>0;return ih(t)&&ih(n)&&m}}const vp={panStep:100,bearingStep:15,pitchStep:10};class bp{constructor(){const t=vp;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let n=0,c=0,d=0,p=0,m=0;switch(t.keyCode){case 61:case 107:case 171:case 187:n=1;break;case 189:case 109:case 173:n=-1;break;case 37:t.shiftKey?c=-1:(t.preventDefault(),p=-1);break;case 39:t.shiftKey?c=1:(t.preventDefault(),p=1);break;case 38:t.shiftKey?d=1:(t.preventDefault(),m=-1);break;case 40:t.shiftKey?d=-1:(t.preventDefault(),m=1);break;default:return}return this._rotationDisabled&&(c=0,d=0),{cameraAnimation:y=>{const x=y.getZoom();y.easeTo({duration:300,easeId:"keyboardHandler",easing:wp,zoom:n?Math.round(x)+n*(t.shiftKey?2:1):x,bearing:y.getBearing()+c*this._bearingStep,pitch:y.getPitch()+d*this._pitchStep,offset:[-p*this._panStep,-m*this._panStep],center:y.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function wp(l){return l*(2-l)}const Tp=4.000244140625,em=1/450;class tm{constructor(t,n){this._map=t,this._el=t.getCanvasContainer(),this._handler=n,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=em,s.aV(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!t&&t.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(t.ctrlKey||t.metaKey||this.isZooming()||s.eJ()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let n=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const c=s.q.now(),d=c-(this._lastWheelEventTime||0);this._lastWheelEventTime=c,n!==0&&n%Tp==0?this._type="wheel":n!==0&&Math.abs(n)<4?this._type="trackpad":d>400?(this._type=null,this._lastValue=n,this._timeout=window.setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(d*n)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,n+=this._lastValue)),t.shiftKey&&n&&(n/=4),this._type&&(this._lastWheelEvent=t,this._delta-=n,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const n=io(this._el,t);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:n,this._aroundCoord=this._map.transform.pointCoordinate3D(this._aroundPoint),this._targetZoom=void 0,this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;this._type==="wheel"&&t.projection.wrap&&(t._center.lng>=180||t._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const n=()=>t._terrainEnabled()&&this._aroundCoord?t.computeZoomRelativeTo(this._aroundCoord):t.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>Tp?this._wheelZoomRate:this._defaultZoomRate;let S=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&S!==0&&(S=1/S);const C=n(),E=Math.pow(2,C),M=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):E;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(M*S))),this._type==="wheel"&&(this._startZoom=C,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const c=typeof this._targetZoom=="number"?this._targetZoom:n(),d=this._startZoom,p=this._easing;let m,y=!1;if(this._type==="wheel"&&d&&p){const T=Math.min((s.q.now()-this._lastWheelEventTime)/200,1),S=p(T);m=s.ai(d,c,S),T<1?this._frameId||(this._frameId=!0):y=!0}else m=c,y=!0;this._active=!0,y&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let x=m-n();return x*this._lastDelta<0&&(x=0),{noInertia:!0,needsRenderFrame:!y,zoomDelta:x,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let n=s.eK;if(this._prevEase){const c=this._prevEase,d=(s.q.now()-c.start)/c.duration,p=c.easing(d+.01)-c.easing(d),m=.27/Math.sqrt(p*p+1e-4)*.01,y=Math.sqrt(.0729-m*m);n=s.eI(m,y,.25,1)}return this._prevEase={start:s.q.now(),duration:t,easing:n},n}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=It("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class qi{constructor(t,n){this._clickZoom=t,this._tapZoom=n}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Sp{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(t,n){return t.preventDefault(),{cameraAnimation:c=>{c.easeTo({duration:300,zoom:c.getZoom()+(t.shiftKey?-1:1),around:c.unproject(n)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class im{constructor(){this._tap=new ys({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(t,n,c){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?c.length>0&&(this._swipePoint=n[0],this._swipeTouch=c[0].identifier):this._tap.touchstart(t,n,c))}touchmove(t,n,c){if(this._tapTime){if(this._swipePoint){if(c[0].identifier!==this._swipeTouch)return;const d=n[0],p=d.y-this._swipePoint.y;return this._swipePoint=d,t.preventDefault(),this._active=!0,{zoomDelta:p/128}}}else this._tap.touchmove(t,n,c)}touchend(t,n,c){this._tapTime?this._swipePoint&&c.length===0&&this.reset():this._tap.touchend(t,n,c)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Lu{constructor(t,n,c){this._el=t,this._mousePan=n,this._touchPan=c}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class rm{constructor(t,n,c){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=n,this._mousePitch=c}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Ul{constructor(t,n,c,d){this._el=t,this._touchZoom=n,this._touchRotate=c,this._tapDragZoom=d,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Gl=l=>l.zoom||l.drag||l.pitch||l.rotate;class Fu extends s.A{}class rh{constructor(){this.constants=[1,1,.01],this.radius=0}setup(t,n){const c=s.at([],n,t);this.radius=s.ae(c[2]<0?s.eM([],c,this.constants):[c[0],c[1],0])}projectRay(t){s.eM(t,t,this.constants),s.au(t,t),s.eN(t,t,this.constants);const n=s.c1([],t,this.radius);if(n[2]>0){const c=s.c1([],[0,0,1],s.bG(n,[0,0,1])),d=s.c1([],s.au([],[n[0],n[1],0]),this.radius),p=s.d5([],n,s.c1([],s.at([],s.d5([],d,c),n),2));n[0]=p[0],n[1]=p[1]}return n}}function Jn(l){return l.panDelta&&l.panDelta.mag()||l.zoomDelta||l.bearingDelta||l.pitchDelta}class nh{constructor(t,n){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Jc(t),this._bearingSnap=n.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new rh,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(n),s.aV(["handleEvent","handleWindowEvent"],this);const c=this._el;this._listeners=[[c,"touchstart",{passive:!0}],[c,"touchmove",{passive:!1}],[c,"touchend",void 0],[c,"touchcancel",void 0],[c,"mousedown",void 0],[c,"mousemove",void 0],[c,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[c,"mouseover",void 0],[c,"mouseout",void 0],[c,"dblclick",void 0],[c,"click",void 0],[c,"keydown",{capture:!1}],[c,"keyup",void 0],[c,"wheel",{passive:!1}],[c,"contextmenu",void 0],[window,"blur",void 0]];for(const[d,p,m]of this._listeners){const y=d===document?this.handleWindowEvent:this.handleEvent;d.addEventListener(p,y,m)}}destroy(){for(const[t,n,c]of this._listeners){const d=t===document?this.handleWindowEvent:this.handleEvent;t.removeEventListener(n,d,c)}}_addDefaultHandlers(t){const n=this._map,c=n.getCanvasContainer();this._add("mapEvent",new Eu(n,t));const d=n.boxZoom=new Iu(n,t);this._add("boxZoom",d);const p=new Cu,m=new Sp;n.doubleClickZoom=new qi(m,p),this._add("tapZoom",p),this._add("clickZoom",m);const y=new im;this._add("tapDragZoom",y);const x=n.touchPitch=new xp(n);this._add("touchPitch",x);const T=new eh(t),S=new zu(t);n.dragRotate=new rm(t,T,S),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",S,["mouseRotate"]);const C=new Pu(t),E=new _p(n,t);n.dragPan=new Lu(c,C,E),this._add("mousePan",C),this._add("touchPan",E,["touchZoom","touchRotate"]);const M=new yp,D=new gp;n.touchZoomRotate=new Ul(c,D,M,y),this._add("touchRotate",M,["touchPan","touchZoom"]),this._add("touchZoom",D,["touchPan","touchRotate"]),this._add("blockableMapEvent",new Gs(n));const z=n.scrollZoom=new tm(n,this);this._add("scrollZoom",z,["mousePan"]);const F=n.keyboard=new bp;this._add("keyboard",F);for(const L of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[L]&&n[L].enable(t[L])}_add(t,n,c){this._handlers.push({handlerName:t,handler:n,allowed:c}),this._handlersById[t]=n}stop(t){if(!this._updatingCamera){for(const{handler:n}of this._handlers)n.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Gl(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(t,n,c){for(const d in t)if(d!==c&&(!n||n.indexOf(d)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const n=[];for(const c of t)this._el.contains(c.target)&&n.push(c);return n}handleEvent(t,n){this._updatingCamera=!0;const c=t.type==="renderFrame",d=c?void 0:t,p={needsRenderFrame:!1},m={},y={},x=t.touches?this._getMapTouches(t.touches):void 0,T=x?Ho(this._el,x):c?void 0:io(this._el,t);for(const{handlerName:E,handler:M,allowed:D}of this._handlers){if(!M.isEnabled())continue;let z;this._blockedByActive(y,D,E)?M.reset():M[n||t.type]&&(z=M[n||t.type](t,T,x),this.mergeHandlerResult(p,m,z,E,d),z&&z.needsRenderFrame&&this._triggerRenderFrame()),(z||M.isActive())&&(y[E]=M)}const S={};for(const E in this._previousActiveHandlers)y[E]||(S[E]=d);this._previousActiveHandlers=y,(Object.keys(S).length||Jn(p))&&(this._changes.push([p,m,S]),this._triggerRenderFrame()),(Object.keys(y).length||Jn(p))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:C}=p;C&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],C(this._map))}mergeHandlerResult(t,n,c,d,p){if(!c)return;s.h(t,c);const m={handlerName:d,originalEvent:c.originalEvent||p};c.zoomDelta!==void 0&&(n.zoom=m),c.panDelta!==void 0&&(n.drag=m),c.pitchDelta!==void 0&&(n.pitch=m),c.bearingDelta!==void 0&&(n.rotate=m)}_applyChanges(){const t={},n={},c={};for(const[d,p,m]of this._changes)d.panDelta&&(t.panDelta=(t.panDelta||new s.P(0,0))._add(d.panDelta)),d.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+d.zoomDelta),d.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+d.bearingDelta),d.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+d.pitchDelta),d.around!==void 0&&(t.around=d.around),d.aroundCoord!==void 0&&(t.aroundCoord=d.aroundCoord),d.pinchAround!==void 0&&(t.pinchAround=d.pinchAround),d.noInertia&&(t.noInertia=d.noInertia),s.h(n,p),s.h(c,m);this._updateMapTransform(t,n,c),this._changes=[]}_updateMapTransform(t,n,c){const d=this._map,p=d.transform,m=N=>[N.x,N.y,N.z];if((N=>{const U=this._eventsInProgress.drag;return U&&!this._handlersById[U.handlerName].isActive()})()&&!Jn(t)){const N=p.zoom;p.cameraElevationReference="sea",this._originalZoom!=null&&p._orthographicProjectionAtLowPitch&&p.projection.name!=="globe"&&p.pitch===0?(p.cameraElevationReference="ground",p.zoom=this._originalZoom):(p.recenterOnTerrain(),p.cameraElevationReference="ground"),N!==p.zoom&&this._map._update(!0)}if(p._isCameraConstrained&&d._stop(!0),!Jn(t))return void this._fireEvents(n,c,!0);let{panDelta:y,zoomDelta:x,bearingDelta:T,pitchDelta:S,around:C,aroundCoord:E,pinchAround:M}=t;p._isCameraConstrained&&(x>0&&(x=0),p._isCameraConstrained=!1),M!==void 0&&(C=M),(x||(N=>n[N]&&!this._eventsInProgress[N])("drag"))&&C&&(this._dragOrigin=m(p.pointCoordinate3D(C)),this._originalZoom=p.zoom,this._trackingEllipsoid.setup(p._camera.position,this._dragOrigin)),p.cameraElevationReference="sea",d._stop(!0),C=C||d.transform.centerPoint,T&&(p.bearing+=T),S&&(p.pitch+=S),p._updateCameraState();const D=[0,0,0];if(y)if(p.projection.name==="mercator"){const N=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(C).dir),U=this._trackingEllipsoid.projectRay(p.screenPointToMercatorRay(C.sub(y)).dir);D[0]=U[0]-N[0],D[1]=U[1]-N[1]}else{const N=p.pointCoordinate(C);if(p.projection.name==="globe"){y=y.rotate(-p.angle);const U=p._pixelsPerMercatorPixel/p.worldSize;D[0]=-y.x*s.eL(s.aY(N.y))*U,D[1]=-y.y*s.eL(p.center.lat)*U}else{const U=p.pointCoordinate(C.sub(y));N&&U&&(D[0]=U.x-N.x,D[1]=U.y-N.y)}}const z=p.zoom,F=[0,0,0];if(x){const N=m(E||p.pointCoordinate3D(C)),U={dir:s.au([],s.at([],N,p._camera.position))};if(U.dir[2]<0){const q=p.zoomDeltaToMovement(N,x);s.c1(F,U.dir,q)}}const L=s.d5(D,D,F);p._translateCameraConstrained(L),x&&Math.abs(p.zoom-z)>1e-4&&p.recenterOnTerrain(),p.cameraElevationReference="ground",this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(n,c,!0)}_fireEvents(t,n,c){const d=Gl(this._eventsInProgress),p=Gl(t),m={};for(const S in t){const{originalEvent:C}=t[S];this._eventsInProgress[S]||(m[`${S}start`]=C),this._eventsInProgress[S]=t[S]}!d&&p&&this._fireEvent("movestart",p.originalEvent);for(const S in m)this._fireEvent(S,m[S]);p&&this._fireEvent("move",p.originalEvent);for(const S in t){const{originalEvent:C}=t[S];this._fireEvent(S,C)}const y={};let x;for(const S in this._eventsInProgress){const{handlerName:C,originalEvent:E}=this._eventsInProgress[S];this._handlersById[C].isActive()||(delete this._eventsInProgress[S],x=n[C]||E,y[`${S}end`]=x)}for(const S in y)this._fireEvent(S,y[S]);const T=Gl(this._eventsInProgress);if(c&&(d||p)&&!T){this._updatingCamera=!0;const S=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),C=E=>E!==0&&-this._bearingSnap<E&&E<this._bearingSnap;S?(C(S.bearing||this._map.getBearing())&&(S.bearing=0),this._map.easeTo(S,{originalEvent:x})):(this._map.fire(new s.A("moveend",{originalEvent:x})),C(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,n){this._map.fire(new s.A(t,n?{originalEvent:n}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{this._frameId=void 0,this.handleEvent(new Fu("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const dr="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class _o extends s.E{constructor(t,n){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=n.bearingSnap,this._respectPrefersReducedMotion=n.respectPrefersReducedMotion!==!1,s.aV(["_renderFrameCallback"],this)}getCenter(){return new s.ci(this.transform.center.lng,this.transform.center.lat)}setCenter(t,n){return this.jumpTo({center:t},n)}panBy(t,n,c){return t=s.P.convert(t).mult(-1),this.panTo(this.transform.center,s.h({offset:t},n),c)}panTo(t,n,c){return this.easeTo(s.h({center:t},n),c)}getZoom(){return this.transform.zoom}setZoom(t,n){return this.jumpTo({zoom:t},n),this}zoomTo(t,n,c){return this.easeTo(s.h({zoom:t},n),c)}zoomIn(t,n){return this.zoomTo(this.getZoom()+1,t,n),this}zoomOut(t,n){return this.zoomTo(this.getZoom()-1,t,n),this}getBearing(){return this.transform.bearing}setBearing(t,n){return this.jumpTo({bearing:t},n),this}getPadding(){return this.transform.padding}setPadding(t,n){return this.jumpTo({padding:t},n),this}rotateTo(t,n,c){return this.easeTo(s.h({bearing:t},n),c)}resetNorth(t,n){return this.rotateTo(0,s.h({duration:1e3},t),n),this}resetNorthPitch(t,n){return this.easeTo(s.h({bearing:0,pitch:0,duration:1e3},t),n),this}snapToNorth(t,n){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,n):this}getPitch(){return this.transform.pitch}setPitch(t,n){return this.jumpTo({pitch:t},n),this}cameraForBounds(t,n){t=s.aG.convert(t);const c=n&&n.bearing||0,d=n&&n.pitch||0,p=t.getNorthWest(),m=t.getSouthEast();return this._cameraForBounds(this.transform,p,m,c,d,n)}_extendPadding(t){const n={top:0,right:0,bottom:0,left:0};return t==null?s.h({},n,this.transform.padding):typeof t=="number"?{top:t,bottom:t,right:t,left:t}:s.h({},n,t)}_extendCameraOptions(t){return(t=s.h({offset:[0,0],maxZoom:this.transform.maxZoom},t)).padding=this._extendPadding(t.padding),t}_minimumAABBFrustumDistance(t,n){const c=n.max[0]-n.min[0],d=n.max[1]-n.min[1];return c/d>t.aspect?c/(2*Math.tan(.5*t.fovX)*t.aspect):d/(2*Math.tan(.5*t.fovY)*t.aspect)}_cameraForBoundsOnGlobe(t,n,c,d,p,m){const y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=p;const T=s.ci.convert(n),S=s.ci.convert(c),C=.5*(T.lat+S.lat),E=.5*(T.lng+S.lng),M=s.eO(C,E),D=s.au([],M),z=s.au([],s.bF([],D,[0,1,0])),F=s.bF([],z,D),L=[z[0],z[1],z[2],0,F[0],F[1],F[2],0,D[0],D[1],D[2],0,0,0,0,1],N=[M,s.eO(T.lat,T.lng),s.eO(S.lat,T.lng),s.eO(S.lat,S.lng),s.eO(T.lat,S.lng),s.eO(C,T.lng),s.eO(C,S.lng),s.eO(T.lat,E),s.eO(S.lat,E)];let U=s.d6.fromPoints(N.map(ge=>[s.bG(z,ge),s.bG(F,ge),s.bG(D,ge)]));const q=s.ad([],U.center,L);s.eP(q)===0&&s.eQ(q,0,0,1),s.au(q,q),s.c1(q,q,s.aB),y.center=s.eR(q);const Y=y.getWorldToCameraMatrix(),te=s.bi(new Float64Array(16),Y);U=s.d6.applyTransform(U,s.az([],Y,L));const re=this._extendAABB(U,y,x,d);if(!re)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");U=re,s.ad(q,q,Y);const K=.5*(U.max[2]-U.min[2]),J=this._minimumAABBFrustumDistance(y,U),Q=s.c1([],[0,0,1],K),me=s.d5(Q,q,Q),ae=J+(y.pitch===0?0:s.bD(q,me)),Ae=y.globeCenterInViewSpace,ve=s.at([],q,[Ae[0],Ae[1],Ae[2]]);s.au(ve,ve),s.c1(ve,ve,ae);const Me=s.d5([],q,ve);s.ad(Me,Me,te);const Ue=s.eB/s.aB,_e=s.ae(Me),se=s.cb(Math.max(_e*Ue-s.eB,Number.EPSILON),0),Te=Math.min(y.zoomFromMercatorZAdjusted(se),x.maxZoom);return Te>.5*(s.cX+s.cI)?(y.setProjection({name:"mercator"}),y.zoom=Te,this._cameraForBounds(y,n,c,d,p,m)):{center:y.center,zoom:Te,bearing:d,pitch:p}}_extendAABB(t,n,c,d){const p=.5*((c.padding.left||0)+(c.padding.right||0)),m=.5*((c.padding.top||0)+(c.padding.bottom||0)),y=m,x=p,T=p,S=m,C=n.width-(x+T),E=n.height-(y+S),M=s.at([],t.max,t.min),D=Math.min(C/M[0],E/M[1]),z=Math.min(n.scaleZoom(n.scale*D),c.maxZoom);if(isNaN(z))return null;const F=n.scale/n.zoomScale(z),L=new s.d6([t.min[0]-x*F,t.min[1]-S*F,t.min[2]],[t.max[0]+T*F,t.max[1]+y*F,t.max[2]]),N=(typeof c.offset.x=="number"&&typeof c.offset.y=="number"?new s.P(c.offset.x,c.offset.y):s.P.convert(c.offset)).rotate(-s.al(d));return L.center[0]-=N.x*F,L.center[1]+=N.y*F,L}queryTerrainElevation(t,n){const c=this.transform.elevation;return c?(n=s.h({},{exaggerated:!0},n),c.getAtPoint(s.ac.fromLngLat(t),null,n.exaggerated)):null}_cameraForBounds(t,n,c,d,p,m){if(t.projection.name==="globe")return this._cameraForBoundsOnGlobe(t,n,c,d,p,m);const y=t.clone(),x=this._extendCameraOptions(m);y.bearing=d,y.pitch=p;const T=s.ci.convert(n),S=s.ci.convert(c),C=new s.ci(T.lng,S.lat),E=new s.ci(S.lng,T.lat),M=y.project(T),D=y.project(S),z=this.queryTerrainElevation(T),F=this.queryTerrainElevation(S),L=this.queryTerrainElevation(C),N=this.queryTerrainElevation(E),U=[[M.x,M.y,Math.min(z||0,F||0,L||0,N||0)],[D.x,D.y,Math.max(z||0,F||0,L||0,N||0)]];let q=s.d6.fromPoints(U);const Y=y.getWorldToCameraMatrix(),te=s.bi(new Float64Array(16),Y);q=s.d6.applyTransform(q,Y);const re=this._extendAABB(q,y,x,d);if(!re)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");q=re;const K=.5*s.at([],q.max,q.min)[2],J=this._minimumAABBFrustumDistance(y,q),Q=[0,0,1,0];s.aA(Q,Q,Y),s.eS(Q,Q);const me=s.c1([],Q,J+K),ae=s.d5([],q.center,me);s.ad(q.center,q.center,te),s.ad(ae,ae,te);const Ae=y.unproject(new s.P(q.center[0],q.center[1])),ve=s.eT(y.projection,Ae),Me=Math.pow(2,ve),Ue=Math.min(y._zoomFromMercatorZ(ae[2]*y.pixelsPerMeter*Me/y.worldSize),x.maxZoom);return y.mercatorFromTransition&&Ue<.5*(s.cX+s.cI)?(y.setProjection({name:"globe"}),y.zoom=Ue,this._cameraForBounds(y,n,c,d,p,m)):{center:Ae,zoom:Ue,bearing:d,pitch:p}}fitBounds(t,n,c){const d=this.cameraForBounds(t,n);return this._fitInternal(d,n,c)}fitScreenCoordinates(t,n,c,d,p){const m=s.P.convert(t),y=s.P.convert(n),x=new s.P(Math.min(m.x,y.x),Math.min(m.y,y.y)),T=new s.P(Math.max(m.x,y.x),Math.max(m.y,y.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(m,y))return this;const S=this.transform.pointLocation3D(x),C=this.transform.pointLocation3D(T),E=this.transform.pointLocation3D(new s.P(x.x,T.y)),M=this.transform.pointLocation3D(new s.P(T.x,x.y)),D=[Math.min(S.lng,C.lng,E.lng,M.lng),Math.min(S.lat,C.lat,E.lat,M.lat)],z=[Math.max(S.lng,C.lng,E.lng,M.lng),Math.max(S.lat,C.lat,E.lat,M.lat)],F=d&&d.pitch?d.pitch:this.getPitch(),L=this._cameraForBounds(this.transform,D,z,c,F,d);return this._fitInternal(L,d,p)}_fitInternal(t,n,c){return t?(n=s.h(t,n)).linear?this.easeTo(n,c):this.flyTo(n,c):this}jumpTo(t,n){this.stop();const c=t.preloadOnly?this.transform.clone():this.transform;let d=!1,p=!1,m=!1;"zoom"in t&&c.zoom!==+t.zoom&&(d=!0,c.zoom=+t.zoom),t.center!==void 0&&(c.center=s.ci.convert(t.center)),"bearing"in t&&c.bearing!==+t.bearing&&(p=!0,c.bearing=+t.bearing),"pitch"in t&&c.pitch!==+t.pitch&&(m=!0,c.pitch=+t.pitch);const y=typeof t.padding=="number"?this._extendPadding(t.padding):t.padding;if(t.padding!=null&&!c.isPaddingEqual(y))if(t.retainPadding===!1){const x=c.clone();x.padding=y,c.setLocationAtPoint(c.center,x.centerPoint)}else c.padding=y;return t.preloadOnly?(this._preloadTiles(c),this):(this.fire(new s.A("movestart",n)).fire(new s.A("move",n)),d&&this.fire(new s.A("zoomstart",n)).fire(new s.A("zoom",n)).fire(new s.A("zoomend",n)),p&&this.fire(new s.A("rotatestart",n)).fire(new s.A("rotate",n)).fire(new s.A("rotateend",n)),m&&this.fire(new s.A("pitchstart",n)).fire(new s.A("pitch",n)).fire(new s.A("pitchend",n)),this.fire(new s.A("moveend",n)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||s.w(dr),this.transform.getFreeCameraOptions()}setFreeCameraOptions(t,n){const c=this.transform;if(!c.projection.supportsFreeCamera)return s.w(dr),this;this.stop();const d=c.zoom,p=c.pitch,m=c.bearing;c.setFreeCameraOptions(t);const y=d!==c.zoom,x=p!==c.pitch,T=m!==c.bearing;return this.fire(new s.A("movestart",n)).fire(new s.A("move",n)),y&&this.fire(new s.A("zoomstart",n)).fire(new s.A("zoom",n)).fire(new s.A("zoomend",n)),T&&this.fire(new s.A("rotatestart",n)).fire(new s.A("rotate",n)).fire(new s.A("rotateend",n)),x&&this.fire(new s.A("pitchstart",n)).fire(new s.A("pitch",n)).fire(new s.A("pitchend",n)),this.fire(new s.A("moveend",n)),this}easeTo(t,n){this._stop(!1,t.easeId),((t=s.h({offset:[0,0],duration:500,easing:s.eK},t)).animate===!1||this._prefersReducedMotion(t))&&(t.duration=0);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?+t.zoom:d,T="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,C=this._extendPadding(t.padding),E=s.P.convert(t.offset);let M,D,z;if(c.projection.name==="globe"){const Q=s.ac.fromLngLat(c.center),me=E.rotate(-c.angle);Q.x+=me.x/c.worldSize,Q.y+=me.y/c.worldSize;const ae=Q.toLngLat(),Ae=s.ci.convert(t.center||ae);this._normalizeCenter(Ae),M=c.centerPoint.add(me),D=new s.P(Q.x,Q.y).mult(c.worldSize),z=new s.P(s.aD(Ae.lng),s.aH(Ae.lat)).mult(c.worldSize).sub(D)}else{M=c.centerPoint.add(E);const Q=c.pointLocation(M),me=s.ci.convert(t.center||Q);this._normalizeCenter(me),D=c.project(Q),z=c.project(me).sub(D)}const F=c.zoomScale(x-d);let L,N;t.around&&(L=s.ci.convert(t.around),N=c.locationPoint(L));const U=this._zooming||x!==d,q=this._rotating||p!==T,Y=this._pitching||S!==m,te=!c.isPaddingEqual(C),re=t.retainPadding===!1?c.clone():c,K=Q=>me=>{if(U&&(Q.zoom=s.ai(d,x,me)),q&&(Q.bearing=s.ai(p,T,me)),Y&&(Q.pitch=s.ai(m,S,me)),te&&(re.interpolatePadding(y,C,me),M=re.centerPoint.add(E)),L)Q.setLocationAtPoint(L,N);else{const ae=Q.zoomScale(Q.zoom-d),Ae=x>d?Math.min(2,F):Math.max(.5,F),ve=Math.pow(Ae,1-me),Me=Q.unproject(D.add(z.mult(me*ve)).mult(ae));Q.setLocationAtPoint(Q.renderWorldCopies?Me.wrap():Me,M)}return t.preloadOnly||this._fireMoveEvents(n),Q};if(t.preloadOnly){const Q=this._emulate(K,t.duration,c);return this._preloadTiles(Q),this}const J={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=U,this._rotating=q,this._pitching=Y,this._padding=te,this._easeId=t.easeId,this._prepareEase(n,t.noMoveStart,J),this._ease(K(c),Q=>{c.cameraElevationReference==="sea"&&c.recenterOnTerrain(),this._afterEase(n,Q)},t),this}_prepareEase(t,n,c={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),n||c.moving||this.fire(new s.A("movestart",t)),this._zooming&&!c.zooming&&this.fire(new s.A("zoomstart",t)),this._rotating&&!c.rotating&&this.fire(new s.A("rotatestart",t)),this._pitching&&!c.pitching&&this.fire(new s.A("pitchstart",t))}_fireMoveEvents(t){this.fire(new s.A("move",t)),this._zooming&&this.fire(new s.A("zoom",t)),this._rotating&&this.fire(new s.A("rotate",t)),this._pitching&&this.fire(new s.A("pitch",t))}_afterEase(t,n){if(this._easeId&&n&&this._easeId===n)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const c=this._zooming,d=this._rotating,p=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,c&&this.fire(new s.A("zoomend",t)),d&&this.fire(new s.A("rotateend",t)),p&&this.fire(new s.A("pitchend",t)),this.fire(new s.A("moveend",t))}flyTo(t,n){if(this._prefersReducedMotion(t)){const ge=s.aF(t,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(ge,n)}this.stop(),t=s.h({offset:[0,0],speed:1.2,curve:1.42,easing:s.eK},t);const c=this.transform,d=this.getZoom(),p=this.getBearing(),m=this.getPitch(),y=this.getPadding(),x="zoom"in t?s.ay(+t.zoom,c.minZoom,c.maxZoom):d,T="bearing"in t?this._normalizeBearing(t.bearing,p):p,S="pitch"in t?+t.pitch:m,C=this._extendPadding(t.padding),E=c.zoomScale(x-d),M=s.P.convert(t.offset);let D=c.centerPoint.add(M);const z=c.pointLocation(D),F=s.ci.convert(t.center||z);this._normalizeCenter(F);const L=c.project(z),N=c.project(F).sub(L);let U=t.curve;const q=Math.max(c.width,c.height),Y=q/E,te=N.mag();if("minZoom"in t){const ge=s.ay(Math.min(t.minZoom,d,x),c.minZoom,c.maxZoom),Re=q/c.zoomScale(ge-d);U=Math.sqrt(Re/te*2)}const re=U*U;function K(ge){const Re=(Y*Y-q*q+(ge?-1:1)*re*re*te*te)/(2*(ge?Y:q)*re*te);return Math.log(Math.sqrt(Re*Re+1)-Re)}function J(ge){return(Math.exp(ge)-Math.exp(-ge))/2}function Q(ge){return(Math.exp(ge)+Math.exp(-ge))/2}const me=K(0);let ae=function(ge){return Q(me)/Q(me+U*ge)},Ae=function(ge){return q*((Q(me)*(J(Re=me+U*ge)/Q(Re))-J(me))/re)/te;var Re},ve=(K(1)-me)/U;if(Math.abs(te)<1e-6||!isFinite(ve)){if(Math.abs(q-Y)<1e-6)return this.easeTo(t,n);const ge=Y<q?-1:1;ve=Math.abs(Math.log(Y/q))/U,Ae=function(){return 0},ae=function(Re){return Math.exp(ge*U*Re)}}t.duration="duration"in t?+t.duration:1e3*ve/("screenSpeed"in t?+t.screenSpeed/U:+t.speed),t.maxDuration&&t.duration>t.maxDuration&&(t.duration=0);const Me=p!==T,Ue=S!==m,_e=!c.isPaddingEqual(C),se=t.retainPadding===!1?c.clone():c,Te=ge=>Re=>{const De=Re*ve,Fe=1/ae(De);ge.zoom=Re===1?x:d+ge.scaleZoom(Fe),Me&&(ge.bearing=s.ai(p,T,Re)),Ue&&(ge.pitch=s.ai(m,S,Re)),_e&&(se.interpolatePadding(y,C,Re),D=se.centerPoint.add(M));const We=Re===1?F:ge.unproject(L.add(N.mult(Ae(De))).mult(Fe));return ge.setLocationAtPoint(ge.renderWorldCopies?We.wrap():We,D),ge._updateCameraOnTerrain(),t.preloadOnly||this._fireMoveEvents(n),ge};if(t.preloadOnly){const ge=this._emulate(Te,t.duration,c);return this._preloadTiles(ge),this}return this._zooming=!0,this._rotating=Me,this._pitching=Ue,this._padding=_e,this._prepareEase(n,!1),this._ease(Te(c),()=>this._afterEase(n),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(t){}_cancelRenderFrame(t){}_stop(t,n){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const c=this._onEaseEnd;this._onEaseEnd=void 0,c.call(this,n)}if(!t){const c=this.handlers;c&&c.stop(!1)}return this}_ease(t,n,c){c.animate===!1||c.duration===0?(t(1),n()):(this._easeStart=s.q.now(),this._easeOptions=c,this._onEaseFrame=t,this._onEaseEnd=n,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((s.q.now()-this._easeStart)/this._easeOptions.duration,1),n=this._onEaseFrame;n&&n(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,n){t=s.bQ(t,-180,180);const c=Math.abs(t-n);return Math.abs(t-360-n)<c&&(t-=360),Math.abs(t+360-n)<c&&(t+=360),t}_normalizeCenter(t){const n=this.transform;if(n.maxBounds||n.projection.name!=="globe"&&!n.renderWorldCopies)return;const c=t.lng-n.center.lng;t.lng+=c>180?-360:c<-180?360:0}_prefersReducedMotion(t){return this._respectPrefersReducedMotion&&s.q.prefersReducedMotion&&!(t&&t.essential)}_emulate(t,n,c){const d=Math.ceil(15*n/1e3),p=[],m=t(c.clone());for(let y=0;y<=d;y++){const x=m(y/d);p.push(x.clone())}return p}_preloadTiles(t,n){}}class ka{constructor(t={}){this.options=t,s.aV(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){const n=this.options&&this.options.compact,c=t._getUIString("AttributionControl.ToggleAttribution");this._map=t,this._container=It("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=It("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",c);const d=It("span","mapboxgl-ctrl-icon",this._compactButton);return d.setAttribute("aria-hidden","true"),d.setAttribute("title",c),this._innerContainer=It("div","mapboxgl-ctrl-attrib-inner",this._container),n&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),n===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","fal
2765se")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));const n=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||s.e.ACCESS_TOKEN}];if(t){const c=n.reduce((d,p,m)=>(p.value&&(d+=`${p.key}=${p.value}${m<n.length-1?"&":""}`),d),"?");t.href=`${s.e.FEEDBACK_URL}/${c}#${Kc(this._map,!0)}`,t.rel="noopener nofollow"}}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let t=[];if(this._map.style.stylesheet){const d=this._map.style.stylesheet;this.styleOwner=d.owner,this.styleId=d.id}const n=this._map.style._mergedSourceCaches;for(const d in n){const p=n[d];if(p.used){const m=p.getSource();m.attribution&&t.indexOf(m.attribution)<0&&t.push(m.attribution)}}t.sort((d,p)=>d.length-p.length),t=t.filter((d,p)=>{for(let m=p+1;m<t.length;m++)if(t[m].indexOf(d)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=[...this.options.customAttribution,...t]:t.unshift(this.options.customAttribution));const c=t.join(" | ");c!==this._attribHTML&&(this._attribHTML=c,t.length?(this._innerContainer.innerHTML=c,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class ql{constructor(){s.aV(["_updateLogo","_updateCompact"],this)}onAdd(t){this._map=t,this._container=It("div","mapboxgl-ctrl");const n=It("a","mapboxgl-ctrl-logo");return n.target="_blank",n.rel="noopener nofollow",n.href="https://www.mapbox.com/",n.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),n.setAttribute("rel","noopener nofollow"),this._container.appendChild(n),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(t){t&&t.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const t=this._map.style._sourceCaches;if(Object.entries(t).length===0)return!0;for(const n in t){const c=t[n].getSource();if(c.hasOwnProperty("mapbox_logo")&&!c.mapbox_logo)return!1}return!0}_updateCompact(){const t=this._container.children;if(t.length){const n=t[0];this._map.getCanvasContainer().offsetWidth<250?n.classList.add("mapboxgl-compact"):n.classList.remove("mapboxgl-compact")}}}class Ou{constructor(){s.aV(["_onIndoorUpdate"],this)}onAdd(t){return this._map=t,this._container=It("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("indoorupdate",n=>this._onIndoorUpdate({selectedFloorId:n.selectedFloorId,floors:n.floors})),this._container}_createButton(t,n){const c=It("button",t,this._container);return c.type="button",c.addEventListener("click",n),c}_setButtonTitle(t,n){this._map&&(t.setAttribute("aria-label",n),t.innerHTML=`<strong>${n}</strong>`,t.firstElementChild&&t.firstElementChild.setAttribute("title",n))}onRemove(){this._container&&this._container.remove(),this._map&&this._map.indoor&&(this._map.indoor.off("indoorupdate",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(t){if(!t||!t.floors)return void(this._container.style.display="none");const n=this._model;this._model=t,this._container.style.display="inline-block";const c=t.floors.sort((d,p)=>d.levelOrder-p.levelOrder);
vendor: 9,454 bytes, line 2765
2765n?(Array.from(this._container.children).forEach(d=>d.remove()),this.addCurrentFloors(c)):this.addCurrentFloors(c)}addCurrentFloors(t){for(const n of t){const c=this._createButton("mapboxgl-ctrl-level-button",()=>{this._map._selectIndoorFloor(n.id),Array.from(this._container.children).forEach(d=>{d.classList.remove("mapboxgl-ctrl-level-button-selected")}),c.classList.add("mapboxgl-ctrl-level-button-selected")});this._setButtonTitle(c,n.shortName),this._model&&n.id===this._model.selectedFloorId&&(this._map._selectIndoorFloor(n.id),c.classList.add("mapboxgl-ctrl-level-button-selected")),this._container.append(c)}}}class Ep{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const n=++this._id;return this._queue.push({callback:t,id:n,cancelled:!1}),n}remove(t){const n=this._currentlyRunning,c=n?this._queue.concat(n):this._queue;for(const d of c)if(d.id===t)return void(d.cancelled=!0)}run(t=0){const n=this._currentlyRunning=this._queue;this._queue=[];for(const c of n)if(!c.cancelled&&(c.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}class Hl{constructor(t){this.jumpTo(t)}getValue(t){if(t<=this._startTime)return this._start;if(t>=this._endTime)return this._end;const n=s.dx((t-this._startTime)/(this._endTime-this._startTime));return this._start*(1-n)+this._end*n}isEasing(t){return t>=this._startTime&&t<=this._endTime}jumpTo(t){this._startTime=-1/0,this._endTime=-1/0,this._start=t,this._end=t}easeTo(t,n,c){this._start=this.getValue(n),this._end=t,this._startTime=n,this._endTime=n+c}}const nm={"AttributionControl.ToggleAttribution":"Toggle attribution","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox homepage","Map.Title":"Map","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScrollZoomBlocker.CtrlMessage":"Use ctrl + scroll to zoom the map","ScrollZoomBlocker.CmdMessage":"Use ⌘ + scroll to zoom the map","TouchPanBlocker.Message":"Use two fingers to move the map"};class Ip extends s.A{constructor(t,n,c,d){const{point:p,lngLat:m,originalEvent:y,target:x}=t;super(t.type,{point:p,lngLat:m,originalEvent:y,target:x}),this.preventDefault=()=>{t.preventDefault()},this.id=n,this.interaction=c,this.feature=d}}class ku{constructor(t){this.map=t,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(t,n){if(this.typeById.has(t))throw new Error(`Interaction id "${t}" already exists.`);const c=n.filter;let d=n.type;c&&this.filters.set(t,s.b3(c)),d==="mouseover"&&(d="mouseenter"),d==="mouseout"&&(d="mouseleave");const p=this.interactionsByType.get(d)||new Map;d==="mouseenter"||d==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(t,n)):p.size===0&&this.map.on(d,this.handleType),p.size===0&&this.interactionsByType.set(d,p),p.set(t,n),this.typeById.set(t,d)}get(t){const n=this.typeById.get(t);if(!n)return;const c=this.interactionsByType.get(n);return c?c.get(t):void 0}remove(t){const n=this.typeById.get(t);if(!n)return;this.typeById.delete(t),this.filters.delete(t);const c=this.interactionsByType.get(n);c&&(c.delete(t),n==="mouseenter"||n==="mouseleave"?(this.delegatedInteractions.delete(t),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):c.size===0&&this.map.off(n,this.handleType))}queryTargets(t,n){const c=[];for(const[d,p]of n)p.target&&c.push({targetId:d,target:p.target,filter:this.filters.get(d)});return this.map.style.queryRenderedTargets(t,c,this.map.transform)}handleMove(t){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const n=this.queryTargets(t.point,Array.from(this.delegatedInteractions).reverse());n.length&&(t.type="mouseenter",this.handleType(t,n));const c=new Map;for(const[d,{feature:p}]of this.prevHoveredFeatures)this.hoveredFeatures.has(d)||c.set(p.id,p);c.size&&(t.type="mouseleave",this.handleType(t,Array.from(c.values())))}handleOut(t){const n=Array.from(this.hoveredFeatures.values()).map(({feature:c})=>c);n.length&&(t.type="mouseleave",this.handleType(t,n)),this.hoveredFeatures.clear()}handleType(t,n){const c=t.type==="mouseenter";if(c&&!this.interactionsByType.has(t.type))return void s.w("mouseenter interaction required for mouseleave to work.");const d=Array.from(this.interactionsByType.get(t.type)).reverse(),p=!!n;n=n||this.queryTargets(t.point,d);let m=!1;const y=new Set;for(const x of n){for(const[T,S]of d){if(!S.target)continue;const C=x.variants?x.variants[T]:null;if(C){for(const E of C){if(nc(E,x,y,T))continue;const M=new s.dr(x,E),D=sl(E,x,T);p&&(M.state=this.map.getFeatureState(M));const z=c?this.prevHoveredFeatures.get(D):null,F=new Ip(t,T,S,M),L=z?z.stop:S.handler(F);if(c&&this.hoveredFeatures.set(D,{feature:x,stop:L}),L!==!1){m=!0;break}}if(m)break}}if(m)break}if(!m)for(const[x,T]of d){const{handler:S,target:C}=T;if(!C&&S(new Ip(t,x,T,null))!==!1)break}}}function Bu(l,t){if(Array.isArray(l)&&Array.isArray(t)){const n=new Set(l),c=new Set(t);return n.size===c.size&&l.every(d=>c.has(d))}return s.bv(l,t)}const $l={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},Ba={showCompass:!0,showZoom:!0,visualizePitch:!1};class Bo{constructor(t,n,c=!1){this._clickTolerance=10,this.element=n,this.mouseRotate=new eh({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,c&&(this.mousePitch=new zu({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),s.aV(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),n.addEventListener("mousedown",this.mousedown),n.addEventListener("touchstart",this.touchstart,{passive:!1}),n.addEventListener("touchmove",this.touchmove),n.addEventListener("touchend",this.touchend),n.addEventListener("touchcancel",this.reset)}down(t,n){this.mouseRotate.mousedown(t,n),this.mousePitch&&this.mousePitch.mousedown(t,n),Go()}move(t,n){const c=this.map,d=this.mouseRotate.mousemoveWindow(t,n),p=d&&d.bearingDelta;if(p&&c.setBearing(c.getBearing()+p),this.mousePitch){const m=this.mousePitch.mousemoveWindow(t,n),y=m&&m.pitchDelta;y&&c.setPitch(c.getPitch()+y)}}off(){const t=this.element;t.removeEventListener("mousedown",this.mousedown),t.removeEventListener("touchstart",this.touchstart),t.removeEventListener("touchmove",this.touchmove),t.removeEventListener("touchend",this.touchend),t.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){So(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(t){this.down(s.h({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),io(this.element,t)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(t){this.move(t,io(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=Ho(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=Ho(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),this.reset()}reset(){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()}}function Qn(l,t,n){if(l=new s.ci(l.lng,l.lat),t){const c=new s.ci(l.lng-360,l.lat),d=new s.ci(l.lng+360,l.lat),p=360*Math.ceil(Math.abs(l.lng-n.center.lng)/360),m=n.locationPoint3D(l).distSqr(t),y=t.x<0||t.y<0||t.x>n.width||t.y>n.height;n.locationPoint3D(c).distSqr(t)<m&&(y||Math.abs(c.lng-n.center.lng)<p)?l=c:n.locationPoint3D(d).distSqr(t)<m&&(y||Math.abs(d.lng-n.center.lng)<p)&&(l=d)}for(;Math.abs(l.lng-n.center.lng)>180;){const c=n.locationPoint3D(l);if(c.x>=0&&c.y>=0&&c.x<=n.width&&c.y<=n.height)break;l.lng>n.center.lng?l.lng-=360:l.lng+=360}return l}
2765const On={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},an={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class kn extends s.E{constructor(t,n){super(),(t instanceof HTMLElement||n)&&(t=s.h({element:t},n)),s.aV(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:c="center",color:d="#3FB1CE",scale:p=1,draggable:m=!1,clickTolerance:y=0,rotation:x=an.rotation,rotationAlignment:T=an.rotationAlignment,pitchAlignment:S=an.pitchAlignment,occludedOpacity:C=an.occludedOpacity,altitude:E=an.altitude}=t||{};this._anchor=c,this._color=d,this._scale=p,this._draggable=m,this._clickTolerance=y,this._rotation=x,this._rotationAlignment=T,this._pitchAlignment=S,this._occludedOpacity=C,this._altitude=E,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),t&&t.element?(this._element=t.element,this._offset=s.P.convert(t&&t.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=s.P.convert(t&&t.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",z=>{z.preventDefault()}),this._element.addEventListener("mousedown",z=>{z.preventDefault()});const M=this._element.classList;for(const z in On)M.remove(`mapboxgl-marker-anchor-${z}`);M.add(`mapboxgl-marker-anchor-${this._anchor}`);const D=t&&t.className?t.className.trim().split(/\s+/):[];M.add(...D),this._popup=null}_createDefaultMarker(){const t=It("div"),n=fr("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},t);if(this._altitude===0){const c=fr("radialGradient",{id:"shadowGradient"},fr("defs",{},n));fr("stop",{offset:"10%","stop-opacity":.4},c),fr("stop",{offset:"100%","stop-opacity":.05},c),fr("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},n)}return fr("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},n),fr("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},n),fr("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},n),t}addTo(t){return t===this._map||(this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._updateMoving),t.on("moveend",this._update),t.on("remove",this._clearFadeTimer),t._addMarker(this),this.setDraggable(this._draggable),this._update(),t.on("click",this._onMapClick)),this}remove(){const t=this._map;return t&&(t.off("click",this._onMapClick),t.off("move",this._updateMoving),t.off("moveend",this._update),t.off("mousedown",this._addDragHandler),t.off("touchstart",this._addDragHandler),t.off("mouseup",this._onUp),t.off("touchend",this._onUp),t.off("mousemove",this._onMove),t.off("touchmove",this._onMove),t.off("remove",this._clearFadeTimer),t._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=s.ci.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(t){return t===this._altitude||(this._defaultMarker&&(this._altitude===0&&t!==0||this._altitude!==0&&t===0)&&(this._element=this._createDefaultMarker()),this._altitude=t||an.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const d=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
vendor: 7,438 bytes, lines 2765-2770
27650,-38.1],"bottom-left":[d,-1*(38.1-13.5+d)],"bottom-right":[-d,-1*(38.1-13.5+d)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,t._marker=this,t._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(t){const n=t.code,c=t.charCode||t.keyCode;n!=="Space"&&n!=="Enter"&&c!==32&&c!==13||this.togglePopup()}_onMapClick(t){const n=t.originalEvent.target,c=this._element;this._popup&&(n===c||c.contains(n))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?(t.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(t.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const t=this._map,n=this._pos;if(!t||!n)return!1;const c=t.unproject(n,this._altitude),d=t.getFreeCameraOptions();if(!d.position)return!1;const p=d.position.toLngLat();return p.distanceTo(c)<.9*p.distanceTo(this._lngLat)}_evaluateOpacity(){const t=this._map;if(!t)return;const n=this._pos;if(!n||n.x<0||n.x>t.transform.width||n.y<0||n.y>t.transform.height)return void this._clearFadeTimer();const c=t.unproject(n,this._altitude);let d;t._showingGlobe()&&s.eW(t.transform,this._lngLat)?d=0:(d=1-t._queryFogOpacity(c),t.transform._terrainEnabled()&&t.getTerrain()&&this._behindTerrain()&&(d*=this._occludedOpacity)),this._element.style.opacity=`${d}`,this._element.style.pointerEvents=d>0?"auto":"none",this._popup&&this._popup._setOpacity(d),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const t=this._pos;if(!t||!this._map)return;const n=this._offset.mult(this._scale);this._element.style.transform=`
2766            translate(${t.x}px,${t.y}px)
2767            ${On[this._anchor]}
2768            ${this._calculateXYTransform()} ${this._calculateZTransform()}
2769            translate(${n.x}px,${n.y}px)
2770        `}_calculateXYTransform(){const t=this._pos,n=this._map,c=this.getPitchAlignment();if(!n||!t||c!=="map")return"";if(!n._showingGlobe()){const x=n.getPitch();return x?`rotateX(${x}deg)`:""}const d=s.cU(s.eX(n.transform,this._lngLat)),p=t.sub(s.eY(n.transform)),m=Math.abs(p.x)+Math.abs(p.y);if(m===0)return"";const y=d/m;return`rotateX(${-p.y*y}deg) rotateY(${p.x*y}deg)`}_calculateZTransform(){const t=this._pos,n=this._map;if(!n||!t)return"";let c=0;const d=this.getRotationAlignment();if(d==="map")if(n._showingGlobe()){const p=n.project(new s.ci(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),m=n.project(new s.ci(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(p);c=s.cU(Math.atan2(m.y,m.x))-90}else c=-n.getBearing();else if(d==="horizon"){const p=s.af(4,6,n.getZoom()),m=s.eY(n.transform);m.y+=p*n.transform.height;const y=t.sub(m),x=s.cU(Math.atan2(y.y,y.x));c=(x>90?x-270:x+90)*(1-p)}return c+=this._rotation,c?`rotateZ(${c}deg)`:""}_update(t){cancelAnimationFrame(this._updateFrameId);const n=this._map;n&&(n.transform.renderWorldCopies&&(this._lngLat=Qn(this._lngLat,this._pos,n.transform)),this._pos=n.project(this._lngLat,this._altitude),t===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),n._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(n._showingGlobe()||n.getTerrain()||n.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(t){return this._offset=s.P.convert(t),this._update(),this}addClassName(t){return this._element.classList.add(t),this}removeClassName(t){return this._element.classList.remove(t),this}toggleClassName(t){return this._element.classList.toggle(t)}_onMove(t){const n=this._map;if(!n)return;const c=this._pointerdownPos,d=this._positionDelta;if(c&&d){if(!this._isDragging){const p=this._clickTolerance||n._clickTolerance;if(t.point.dist(c)<p)return;this._isDragging=!0}this._pos=t.point.sub(d),this._lngLat=n.unproject(this._pos,this._altitude),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new s.A("dragstart"))),this.fire(new s.A("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const t=this._map;t&&(t.off("mousemove",this._onMove),t.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new s.A("dragend")),this._state="inactive"}_addDragHandler(t){const n=this._map,c=this._pos;n&&c&&this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(c),this._pointerdownPos=t.point,this._state="pending",n.on("mousemove",this._onMove),n.on("touchmove",this._onMove),n.once("mouseup",this._onUp),n.once("touchend",this._onUp))}setDraggable(t){this._draggable=!!t;const n=this._map;return n&&(t?(n.on("mousedown",this._addDragHandler),n.on("touchstart",this._addDragHandler)):(n.off("mousedown",this._addDragHandler),n.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||an.rotation,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||an.rotationAlignment,this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t||an.pitchAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(t){return this._occludedOpacity=t||an.occludedOpacity,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const om={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},sm={maxWidth:100,unit:"metric"},am={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"},lm={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",altitude:0},Ap=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Qr(l=new s.P(0,0),t="bottom"){if(typeof l=="number"){const n=Math.round(Math.sqrt(.5*Math.pow(l,2)));switch(t){case"top":return new s.P(0,l);case"top-left":return new s.P(n,n);case"top-right":return new s.P(-n,n);case"bottom":return new s.P(0,-l);case"bottom-left":return new s.P(n,-n);case"bottom-right":return new s.P(-n,-n);case"left":return new s.P(l,0);case"right":return new s.P(-l,0)}return new s.P(0,0)}return l instanceof s.P||Array.isArray(l)?s.P.convert(l):s.P.convert(l[t]||[0,0])}return{version:li,supported:To.supported,setRTLTextPlugin:s.f0,getRTLTextPluginStatus:s.e$,Map:class extends _o{constructor(l){Di.mark(Vt.create);const t=l;if((l=s.h({}
2770,$l,l)).minZoom!=null&&l.maxZoom!=null&&l.minZoom>l.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(l.minPitch!=null&&l.maxPitch!=null&&l.minPitch>l.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(l.minPitch!=null&&l.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(l.maxPitch!=null&&l.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(l.antialias&&s.eU(window)&&(l.antialias=!1,s.w("Antialiasing is disabled for this WebGL context to avoid browser bug: https://github.com/mapbox/mapbox-gl-js/issues/11609")),super(new Rh(l.minZoom,l.maxZoom,l.minPitch,l.maxPitch,l.renderWorldCopies,null,null),l),this._repaint=!!l.repaint,this._interactive=l.interactive,this._minTileCacheSize=l.minTileCacheSize,this._maxTileCacheSize=l.maxTileCacheSize,this._failIfMajorPerformanceCaveat=l.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=l.preserveDrawingBuffer,this._antialias=l.antialias,this._trackResize=l.trackResize,this._bearingSnap=l.bearingSnap,this._refreshExpiredTiles=l.refreshExpiredTiles,this._fadeDuration=l.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=l.crossSourceCollisions,this._collectResourceTiming=l.collectResourceTiming,this._language=this._parseLanguage(l.language),this._worldview=l.worldview,this._renderTaskQueue=new Ep,this._domRenderTaskQueue=new Ep,this._controls=[],this._markers=[],this._popups=[],this._mapId=s.a$(),this._locale=s.h({},nm,l.locale),this._clickTolerance=l.clickTolerance,this._cooperativeGestures=l.cooperativeGestures,this._performanceMetricsCollection=l.performanceMetricsCollection,this._tessellationStep=l.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=l.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Hl(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=l.scaleFactor,this._requestManager=new gr(l.transformRequest,l.accessToken,l.testMode),this._silenceAuthErrors=!!l.testMode,this._contextCreateOptions=l.contextCreateOptions?Object.assign({},l.contextCreateOptions):{},typeof l.container=="string"){const n=document.getElementById(l.container);if(!n)throw new Error(`Container '${l.container.toString()}' not found.`);this._container=n}else{if(!(l.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=l.container}if(this._container.childNodes.length>0&&s.w("The map container element should be empty, otherwise the map's interactivity will be negatively impacted. If you want to display a message when WebGL is not supported, use the Mapbox GL Supported plugin instead."),l.maxBounds&&this.setMaxBounds(l.maxBounds),this._spriteFormat=l.spriteFormat,s.aV(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new Jf),this._tp.registerParameter(this,["Debug"],"showOverdrawInspector"),this._tp.registerParameter(this,["Debug"],"showTileBoundaries"),this._tp.registerParameter(this,["Debug"],"showParseStatus"),this._tp.registerParameter(this,["Debug"],"repaint"),this._tp.registerParameter(this,["Debug"],"showTileAABBs"),this._tp.registerParameter(this,["Debug"],"showPadding"),this._tp.registerParameter(this,["Debug"],"showCollisionBoxes",{noSave:!0}),this._tp.registerParameter(this.transform,["Debug"],"freezeTileCoverage",{noSave:!0},()=>{this._update()}),this._tp.registerParameter(this,["Debug","Wireframe"],"showTerrainWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers2DWireframe"),this._tp.registerParameter(this,["Debug","Wireframe"],"showLayers3DWireframe"),this._tp.registerParameter(this,["Scaling"],"_scaleFactor",{min:.1,max:10,step:.1},()=>{this.setScaleFactor(this._scaleFactor)}),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new nh(this,l),this._localFontFamily=l.localFontFamily,this._localIdeographFontFamily=l.localIdeographFontFamily,(l.style||!l.testMode)&&this.setStyle(l.style||s.e.DEFAULT_STYLE,{config:l.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),l.projection&&this.setProjection(l.projection),this.indoor=new Lf(this),l.hash&&(this._hash=new Yc(typeof l.hash=="string"&&l.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){t.center==null&&t.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch});const n=l.bounds;n&&(this.resize(),this.fitBounds(n,s.h({},l.fitBoundsOptions,{duration:0})))}this.resize(),l.attributionControl&&this.addControl(new ka({customAttribution:l.customAttribution}
vendor: 10,879 bytes, line 2770
2770)),this._logoControl=new ql,this.addControl(this._logoControl,l.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",n=>{this._update(n.dataType==="style"),this.fire(new s.A(`${n.dataType}data`,n))}),this.on("dataloading",n=>{this.fire(new s.A(`${n.dataType}dataloading`,n))}),this._interactions=new ku(this)}_getMapId(){return this._mapId}addControl(l,t){if(t===void 0&&(t=l.getDefaultPosition?l.getDefaultPosition():"top-right"),!l||!l.onAdd)return this.fire(new s.z(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const n=l.onAdd(this);this._controls.push(l);const c=this._controlPositions[t];return t.indexOf("bottom")!==-1?c.insertBefore(n,c.firstChild):c.appendChild(n),this}removeControl(l){if(!l||!l.onRemove)return this.fire(new s.z(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(l);return t>-1&&this._controls.splice(t,1),l.onRemove(this),this}hasControl(l){return this._controls.indexOf(l)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(l){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const t=!this._moving;return t&&this.fire(new s.A("movestart",l)).fire(new s.A("move",l)),this.fire(new s.A("resize",l)),t&&this.fire(new s.A("moveend",l)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(l){return this.transform.setMaxBounds(s.aG.convert(l)),this._update()}setMinZoom(l){if((l=l??-2)>=-2&&l<=this.transform.maxZoom)return this.transform.minZoom=l,this._update(),this.getZoom()<l?this.setZoom(l):this.fire(new s.A("zoomstart")).fire(new s.A("zoom")).fire(new s.A("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(l){if((l=l??22)>=this.transform.minZoom)return this.transform.maxZoom=l,this._update(),this.getZoom()>l?this.setZoom(l):this.fire(new s.A("zoomstart")).fire(new s.A("zoom")).fire(new s.A("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(l){if((l=l??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(l>=0&&l<=this.transform.maxPitch)return this.transform.minPitch=l,this._update(),this.getPitch()<l?this.setPitch(l):this.fire(new s.A("pitchstart")).fire(new s.A("pitch")).fire(new s.A("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(l){if((l=l??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(l>=this.transform.minPitch)return this.transform.maxPitch=l,this._update(),this.getPitch()>l?this.setPitch(l):this.fire(new s.A("pitchstart")).fire(new s.A("pitch")).fire(new s.A("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getScaleFactor(){return this._scaleFactor}setScaleFactor(l){return this._scaleFactor=l,this.painter.scaleFactor=l,this._tp.refreshUI(),this._scaleFactorChanged=!0,this.style._updateFilteredLayers(t=>t.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(l){return this.transform.renderWorldCopies=l,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(l){return l==="auto"?navigator.language:Array.isArray(l)?l.length===0?void 0:l.map(t=>t==="auto"?navigator.language:t):l}setLanguage(l){const t=this._parseLanguage(l);if(!this.style||t===this._language)return this;this._language=t,this.style.reloadSources();for(const n of this._controls)n._setLanguage&&n._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(l){return this.style&&l!==this._worldview?(this._worldview=l,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(l){return this._lazyInitEmptyStyle(),l?typeof l=="string"&&(l={name:l}):l=null,this._useExplicitProjection=!!l,this._prioritizeAndUpdateProjection(l,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const l=this.transform,t=l.projection.name;let n;t==="globe"&&l.zoom>=s.cI?(l.setMercatorFromTransition(),n=!0):t==="mercator"&&l.zoom<s.cI&&(l.setProjection({name:"globe"}),n=!0),n&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate(),this._update(!0))}_prioritizeAndUpdateProjection(l,t){return this._updateProjection(l||t||{name:"mercator"})}_updateProjection(l){let t;return t=l.name==="globe"&&this.transform.zoom>=s.cI?this.transform.setMercatorFromTransition():this.transform.setProjection(l),this.style.applyProjectionUpdate(),t&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(l,t){return this.transform.locationPoint3D(s.ci.convert(l),t)}unproject(l,t){return this.transform.pointLocation3D(s.P.convert(l),t)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(l,t,n){const c=d=>{let p=[];if(Array.isArray(t)){const m=t.filter(y=>this.getLayer(y));p=m.length?this.queryRenderedFeatures(d,{layers:m}):[]}else p=this.queryRenderedFeatures(d,{target:t});return p};if(l==="mouseenter"||l==="mouseover"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:m=>{const y=c(m.point);y.length?d||(d=!0,n.call(this,new Ni(l,this,m.originalEvent,{features:y}))):d=!1},mouseout:()=>{d=!1}}}}if(l==="mouseleave"||l==="mouseout"){let d=!1;return{listener:n,targets:t,delegates:{mousemove:y=>{c(y.point).length?d=!0:d&&(d=!1,n.call(this,new Ni(l,this,y.originalEvent)))},mouseout:y=>{d&&(d=!1,n.call(this,new Ni(l,this,y.originalEvent)))}}}}{const d=p=>{const m=c(p.point);m.length&&(p.features=m,n.call(this,p),delete p.features)};return{listener:n,targets:t,delegates:{[l]:d}}}}on(l,t,n){if(typeof t=="function"||n===void 0)return super.on(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,n);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[l]=this._delegatedListeners[l]||[],this._delegatedListeners[l].push(c);for(const d in c.delegates)this.on(d,c.delegates[d]);return this}once(l,t,n){if(typeof t=="function"||n===void 0)return super.once(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._createDelegatedListener(l,t,n);for(const d in c.delegates)this.once(d,c.delegates[d]);return this}off(l,t,n){if(typeof t=="function"||n===void 0)return super.off(l,t);if(typeof t=="string"&&(t=[t]),!this._areTargetsValid(t))return this;const c=this._delegatedListeners?this._delegatedListeners[l]:void 0;return c&&(d=>{for(let p=0;p<d.length;p++){const m=d[p];if(m.listener===n&&Bu(m.targets,t)){for(const y in m.delegates)this.off(y,m.delegates[y]);return d.splice(p,1),this}}})(c),this}queryRenderedFeatures(l,t){if(!this.style)return[];if(l===void 0||l instanceof s.P||Array.isArray(l)||t!==void 0||(t=l,l=void 0),l=l||[[0,0],[this.transform.width,this.transform.height]],!t){const p=this.style.queryRenderedFeatures(l,void 0,this.transform),m=this.style.queryRenderedFeatureset(l,void 0,this.transform);return p.concat(m)}let n=!0;if(t.target&&(n=this._isTargetValid(t.target),n&&!t.layers))return this.style.queryRenderedFeatureset(l,t,this.transform);let c=!0;if(t.layers&&Array.isArray(t.layers)){for(const p of t.layers)if(!this._isValidId(p)){c=!1;break}if(c&&!t.target)return this.style.queryRenderedFeatures(l,t,this.transform)}let d=[];return c&&(d=d.concat(this.style.queryRenderedFeatures(l,t,this.transform))),n&&(d=d.concat(this.style.queryRenderedFeatureset(l,t,this.transform))),d}querySourceFeatures(l,t){return!l||typeof l=="string"&&!this._isValidId(l)?[]:this.style.querySourceFeatures(l,t)}isPointOnSurface(l){const{name:t}=this.transform.projection;return t!=="globe"&&t!=="mercator"&&s.w(`${t} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(s.P.convert(l))}addInteraction(l,t){return this._interactions.add(l,t),this}removeInteraction(l){return this._interactions.remove(l),this}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(l){return this._cooperativeGestures=l,this}setStyle(l,t){return t=s.h({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},t),this.style&&l&&t.diff!==!1&&t.localFontFamily===this._localFontFamily&&t.localIdeographFontFamily===this._localIdeographFontFamily&&!t.config?(this.style._diffStyle(l,(n,c)=>{if(n){const d=typeof n=="string"?n:n instanceof Error?n.message:n.error;s.w(`Unable to perform style diff: ${d}. Rebuilding the style from scratch.`),this._updateStyle(l,t)}else c&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=t.localIdeographFontFamily,this._localFontFamily=t.localFontFamily,this._updateStyle(l,t))}_getUIString(l){const t=this._locale[l];if(t==null)throw new Error(`Missing UI string '${l}'`);return t}_updateStyle(l,t){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),l){const n=s.h({},t);t&&t.config&&(n.initialConfig=t.config,delete n.config),this.style=new Yn(this,n).load(l),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Yn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():(s.w("There is no style added to the map."),!1)}_isValidId(l){return l==null?(this.fire(new s.z(new Error("IDs can't be empty."))),!1):!s.dk(l)||(this.fire(new s.z(new Error(`IDs can't 
2770contain special symbols: "${l}".`))),!1)}_isTargetValid(l){return"featuresetId"in l?this._isValidId("importId"in l?l.importId:l.featuresetId):"layerId"in l&&this._isValidId(l.layerId)}_areTargetsValid(l){if(Array.isArray(l)){for(const t of l)if(!this._isValidId(t))return!1;return!0}return this._isTargetValid(l)}addSource(l,t){return this._isValidId(l)?(this._lazyInitEmptyStyle(),this.style.addSource(l,t),this._update(!0)):this}isSourceLoaded(l){return!!this._isValidId(l)&&!!this.style&&this.style._isSourceCacheLoaded(l)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(l,t,n){this._lazyInitEmptyStyle(),this.style.addSourceType(l,t,n)}removeSource(l){return this._isValidId(l)?(this.style.removeSource(l),this._updateTerrain(),this._update(!0)):this}getSource(l){return this._isValidId(l)?this.style.getOwnSource(l):null}addImage(l,t,{pixelRatio:n=1,sdf:c=!1,stretchX:d,stretchY:p,content:m}={}){this._lazyInitEmptyStyle();const y=s.I.from(l);if(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap){const{width:x,height:T,data:S}=s.q.getImageData(t);this.style.addImage(y,{data:new s.r({width:x,height:T},S),pixelRatio:n,stretchX:d,stretchY:p,content:m,sdf:c,version:0,usvg:!1})}else if(t.width===void 0||t.height===void 0)this.fire(new s.z(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:x,height:T}=t,S=t;this.style.addImage(y,{data:new s.r({width:x,height:T},new Uint8Array(S.data)),pixelRatio:n,stretchX:d,stretchY:p,content:m,sdf:c,usvg:!1,version:0,userImage:S}),S.onAdd&&S.onAdd(this,l)}}updateImage(l,t){this._lazyInitEmptyStyle();const n=s.I.from(l),c=this.style.getImage(n);if(!c)return void this.fire(new s.z(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const d=t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap?s.q.getImageData(t):t,{width:p,height:m,data:y}=d;if(p===void 0||m===void 0)return void this.fire(new s.z(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(p!==(c.usvg?c.icon.usvg_tree.width:c.data.width)||m!==(c.usvg?c.icon.usvg_tree.height:c.data.height))return void this.fire(new s.z(new Error(`The width and height of the updated image (${p}, ${m})
2771                must be that same as the previous version of the image
2772                (${c.data.width}, ${c.data.height})`)));const x=!(t instanceof HTMLImageElement||ImageBitmap&&t instanceof ImageBitmap);let T=!1;c.usvg?(c.data=new s.r({width:p,height:m},new Uint8Array(y)),c.usvg=!1,c.icon=void 0,T=!0):c.data.replace(y,x),this.style.updateImage(n,c,T)}hasImage(l){return l?!!this.style&&!!this.style.getImage(s.I.from(l)):(this.fire(new s.z(new Error("Missing required image id"))),!1)}removeImage(l){this.style.removeImage(s.I.from(l))}loadImage(l,t){s.o(this._requestManager.transformRequest(l,s.R.Image),(n,c)=>{t(n,c instanceof HTMLImageElement?s.q.getImageData(c):c)})}listImages(){return this.style.listImages().map(l=>l.name)}addModel(l,t){this._lazyInitEmptyStyle(),this.style.addModel(l,t)}hasModel(l){return l?this.style.hasModel(l):(this.fire(new s.z(new Error("Missing required model id"))),!1)}removeModel(l){this.style.removeModel(l)}listModels(){return this.style.listModels()}addLayer(l,t){return this._isValidId(l.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(l,t),this._update(!0)):this}getSlot(l){const t=this.getLayer(l);return t&&t.slot||null}setSlot(l,t){return this.style.setSlot(l,t),this.style.mergeLayers(),this._update(!0)}addImport(l,t){return this.style.addImport(l,t).catch(n=>this.fire(new s.z(new Error("Failed to add import",n)))),this}updateImport(l,t){return typeof t!="string"&&t.id!==l?(this.removeImport(l),this.addImport(t)):(this.style.updateImport(l,t),this._update(!0))}removeImport(l){return this.style.removeImport(l),this}moveImport(l,t){return this.style.moveImport(l,t),this._update(!0)}moveLayer(l,t){return this._isValidId(l)?(this.style.moveLayer(l,t),this._update(!0)):this}removeLayer(l){return this._isValidId(l)?(this.style.removeLayer(l),this._update(!0)):this}getLayer(l){if(!this._isValidId(l))return null;const t=this.style.getOwnLayer(l);return t?t.type==="custom"?t.implementation:t.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(l,t,n){return this._isValidId(l)?(this.style.setLayerZoomRange(l,t,n),this._update(!0)):this}setFilter(l,t,n={}){return this._isValidId(l)?(this.style.setFilter(l,t,n),this._update(!0)):this}getFilter(l){return this._isValidId(l)?this.style.getFilter(l):null}setPaintProperty(l,t,n,c={}){return this._isValidId(l)?(this.style.setPaintProperty(l,t,n,c),this._update(!0)):this}getPaintProperty(l,t){return this._isValidId(l)?this.style.getPaintProperty(l,t):null}setLayoutProperty(l,t,n,c={}){return this._isValidId(l)?(this.style.setLayoutProperty(l,t,n,c),this._update(!0)):this}getLayoutProperty(l,t){return this._isValidId(l)?this.style.getLayoutProperty(l,t):null}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(l){return this.style.setGlyphsUrl(l),this._update(!0)}getSchema(l){return this.style.getSchema(l)}setSchema(l,t){return this.style.setSchema(l,t),this._update(!0)}getConfig(l){return this.style.getConfig(l)}setConfig(l,t){return this.style.setConfig(l,t),this._update(!0)}getConfigProperty(l,t){return this.style.getConfigProperty(l,t)}setConfigProperty(l,t,n){return this.style.setConfigProperty(l,t,n),this._update(!0)}getFeaturesetDescriptors(l){return this.style.getFeaturesetDescriptors(l)}setLights(l){if(this._lazyInitEmptyStyle(),l&&l.length===1&&l[0].type==="flat"){const t=l[0];t.properties?this.style.setFlatLight(t.properties,t.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(l),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const l=this.style.getLights()||[];return l.length===0&&l.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),l}setLight(l,t={}
vendor: 22,969 bytes, line 2772
2772){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:l}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(l){return this._lazyInitEmptyStyle(),!l&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(l),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(l){return this._lazyInitEmptyStyle(),this.style.setFog(l),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(l){return this._lazyInitEmptyStyle(),this.style.setSnow(l),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(l){return this._lazyInitEmptyStyle(),this.style.setRain(l),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(l){return this._lazyInitEmptyStyle(),this.style.setColorTheme(l),this._update(!0)}setImportColorTheme(l,t){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(l,t),this._update(!0)}setCamera(l){return this.style.setCamera(l),this._triggerCameraUpdate(l)}_triggerCameraUpdate(l){return this._update(this.transform.setOrthographicProjectionAtLowPitch(l["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(l){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(s.ci.convert(l),this.transform):0}setFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.setFeatureState(l,t),this._update())}removeFeatureState(l,t){return l.source&&!this._isValidId(l.source)?this:(this.style.removeFeatureState(l,t),this._update())}getFeatureState(l){return l.source&&!this._isValidId(l.source)?null:this.style.getFeatureState(l)}_selectIndoorFloor(l){this.indoor.selectFloor(l)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new Ou),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const l=this._container.getBoundingClientRect().width||400,t=this._container.getBoundingClientRect().height||300;let n,c,d,p=this._container;for(;p&&(!c||!d);){const m=window.getComputedStyle(p).transform;m&&m!=="none"&&(n=m.match(/matrix.*\((.+)\)/)[1].split(", "),n[0]&&n[0]!=="0"&&n[0]!=="1"&&(c=n[0]),n[3]&&n[3]!=="0"&&n[3]!=="1"&&(d=n[3])),p=p.parentElement}this._containerWidth=c?Math.abs(l/c):l,this._containerHeight=d?Math.abs(t/d):t}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&s.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupContainer(){const l=this._container;l.classList.add("mapboxgl-map"),(this._missingCSSCanary=It("div","mapboxgl-canary",l)).style.visibility="hidden",this._detectMissingCSS();const t=this._canvasContainer=It("div","mapboxgl-canvas-container",l);this._canvas=It("canvas","mapboxgl-canvas",t),this._interactive&&(t.classList.add("mapboxgl-interactive"),this._canvas.setAttribute("tabindex","0")),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region"),this._updateContainerDimensions(),this._resizeCanvas(this._containerWidth,this._containerHeight);const n=this._controlContainer=It("div","mapboxgl-control-container",l),c=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(d=>{c[d]=It("div",`mapboxgl-ctrl-${d}`,n)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(l,t){const n=s.q.devicePixelRatio||1;this._canvas.width=n*Math.ceil(l),this._canvas.height=n*Math.ceil(t),this._canvas.style.width=`${l}px`,this._canvas.style.height=`${t}px`}_addMarker(l){this._markers.push(l)}_removeMarker(l){const t=this._markers.indexOf(l);t!==-1&&this._markers.splice(t,1)}_addPopup(l){this._popups.push(l)}_removePopup(l){const t=this._popups.indexOf(l);t!==-1&&this._popups.splice(t,1)}_setupPainter(){const l=s.h({},To.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl2",l);t?(Wo(t,!0),this.painter=new _s(t,this._contextCreateOptions,this.transform,this._scaleFactor,this._tp,this._worldview),this.on("data",n=>{n.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),s.l.testSupport(t)):this.fire(new s.z(new Error("Failed to initialize WebGL")))}_contextLost(l){l.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.A("webglcontextlost",{originalEvent:l}))}_contextRestored(l){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new s.A("webglcontextrestored",{originalEvent:l}))}_onMapScroll(l){if(l.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(l){return this.style?(this._styleDirty=this._styleDirty||l,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(l){return this._update(),this._renderTaskQueue.add(l)}_cancelRenderFrame(l){this._renderTaskQueue.remove(l)}_requestDomTask(l){!this.loaded()||this.loaded()&&!this.isMoving()?l():this._domRenderTaskQueue.add(l)}_render(l){let t;this.fire(new s.A("renderstart")),++this._frameId;const n=this.painter.context.extTimerQuery,c=s.q.now(),d=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(t=d.createQuery(),d.beginQuery(n.TIME_ELAPSED_EXT,t)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(l),this._domRenderTaskQueue.run(l),this._removed)return;this._updateProjectionTransition();const p=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const T=this.transform.zoom,S=this.transform.pitch,C=s.q.now(),E=new s.aa(T,{now:C,fadeDuration:p,pitch:S,transition:this.style.transition,worldview:this._worldview});this.style.update(E)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let m=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),m=this._updateAverageElevation(c),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):m=this._updateAverageElevation(c);const y=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,p,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),y&&(this._placementDirty=y.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:p,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new s.A("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,Di.mark(Vt.load),this.fire(new s.A("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),t){const T=s.q.now()-c;d.endQuery(n.TIME_ELAPSED_EXT),setTimeout(()=>{const S=d.getQueryParameter(t,d.QUERY_RESULT)/1e6;d.deleteQuery(t),this.fire(new s.A("gpu-timing-frame",{cpuTime:T,gpuTime:S}))},50)}if(this.listens("gpu-timing-layer")){const T=this.painter.collectGpuTimers();setTimeout(()=>{const S=this.painter.queryGpuTimers(T);this.fire(new s.A("gpu-timing-layer",{layerTimes:S}))},50)}if(this.listens("gpu-timing-deferred-render")){const T=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const S=this.painter.queryGpuTimeDeferredRender(T);this.fire(new s.A("gpu-timing-deferred-render",{gpuTime:S}))},50)}const x=this._sourcesDirty||this._styleDirty||this._placementDirty||m;if(x||this._repaint)this.triggerRepaint();else{const T=this.idle();if(T&&(m=this._updateAverageElevation(c,!0)),m)this.triggerRepaint();else if(this._triggerFrame(!1),T&&(this.fire(new s.A("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const S=this._calculateSpeedIndex();this.fire(new s.A("speedindexcompleted",{speedIndex:S})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||x||(this._fullyLoaded=!0,Di.mark(Vt.fullLoad),this._performanceMetricsCollection&&yr(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(l){for(const t of this._markers)l&&!this.getRenderWorldCopies()&&(t._lngLat=t._lngLat.wrap()),t._update();for(const t of this._popups)!l||this.getRenderWorldCopies()||t._trackPointer||(t._lngLat=t._lngLat.wrap()),t._update()}_updateAverageElevation(l,t=!1){const n=d=>(this.transform.averageElevation=d,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&n(0);const c=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(c||(t||l-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(l)){const d=this.transform.averageElevation;let p=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(p)?p=0:this._averageElevationLastSampledAt=l;const m=Math.abs(d-p);if(m>1){if(this._isInitialLoad||c)return this._averageElevation.jumpTo(p),n(p);this._averageElevation.easeTo(p,l,300)}else if(m>1e-4)return this._averageElevation.jumpTo(p),n(p)}return!!this._averageElevation.isEasing(l)&&n(this._averageElevation.getValue(l))}_authenticate(){lr(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,l=>{if(l&&(l.message===jr||l.status===401)){const t=this.painter.context.gl;Wo(t,!1),this._logoControl instanceof ql&&this._logoControl._updateLogo(),t&&t.clear(t.DEPTH_BUFFER_BIT|t.COLOR_BUFFER_BIT|t.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new s.z(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),ic(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&ki(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const l=this._isDragging();this.painter.updateTerrain(this.style,l)}_calculateSpeedIndex(){const l=this.painter.canvasCopy(),t=this.painter.getCanvasCopiesAndTimestamps();t.timeStamps.push(performance.now());const n=this.painter.context.gl,c=n.createFramebuffer();function d(p){n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.TEXTURE_2D,p,0);const m=new Uint8Array(n.drawingBufferWidth*n.drawingBufferHeight*4);return n.readPixels(0,0,n.drawingBufferWidth,n.drawingBufferHeight,n.RGBA,n.UNSIGNED_BYTE,m),m}return n.bindFramebuffer(n.FRAMEBUFFER,c),this._canvasPixelComparison(d(l),t.canvasCopies.map(d),t.timeStamps)}_canvasPixelComparison(l,t,n){let c=n[1]-n[0];const d=l.length/4;for(let p=0;p<t.length;p++){const m=t[p];let y=0;for(let x=0;x<m.length;x+=4)m[x]===l[x]&&m[x+1]===l[x+1]&&m[x+2]===l[x+2]&&m[x+3]===l[x+3]&&(y+=1);c+=(n[p+2]-n[p+1])*(1-y/d)}return c}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.destroy(),this.indoor.destroy(),this.painter.destroy(),this.handlers&&this.handlers.destroy(),this.handlers=void 0,this.setStyle(null),window.removeEventListener("resize",this._onWindowResize,!1),window.removeEventListener("orientationchange",this._onWindowResize,!1),window.removeEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.removeEventListener("online",this._onWindowOnline,!1),window.removeEventListener("visibilitychange",this._onVisibilityChange,!1);const l=this.painter.context.gl.getExtension("WEBGL_lose_context");l&&l.loseContext(),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvasContainer.remove(),this._controlContainer.remove(),this._missingCSSCanary.remove(),this._canvas=void 0,this._canvasContainer=void 0,this._controlContainer=void 0,this._missingCSSCanary=void 0,this._container.classList.remove("mapboxgl-map"),this._container.removeEventListener("scroll",this._onMapScroll,!1),Zo.delete(this.painter.context.gl),hn.remove(),Qs.remove(),this._removed=!0,this.fire(new s.A("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(l){this._renderNextFrame=this._renderNextFrame||l,this.style&&!this._frame&&(this._frame=s.q.frame(t=>{const n=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,n&&this._render(t)}))}_preloadTiles(l){const t=this.style?this.style.getSourceCaches():[];return s.bt(t,(n,c)=>n._preloadTiles(l,c),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(l){this._trackResize&&this.resize({originalEvent:l})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(l){this._showTileBoundaries!==l&&(this._showTileBoundaries=l,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(l){this._showParseStatus!==l&&(this._showParseStatus=l,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(l){this._showTerrainWireframe!==l&&(this._showTerrainWireframe=l,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(l){this._showLayers2DWireframe!==l&&(this._showLayers2DWireframe=l,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(l){this._showLayers3DWireframe!==l&&(this._showLayers3DWireframe=l,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(l){this._speedIndexTiming!==l&&(this._speedIndexTiming=l,this._update())}get showPadding(){return!!this._showPadding}set showPadding(l){this._showPadding!==l&&(this._showPadding=l,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(l){this._showCollisionBoxes!==l&&(this._showCollisionBoxes=l,this._tp.refreshUI(),l?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(l){this._showOverdrawInspector!==l&&(this._showOverdrawInspector=l,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(l){this._repaint!==l&&(this._repaint=l,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(l){this._vertices=l,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(l){this._showTileAABBs!==l&&(this._showTileAABBs=l,this._tp.refreshUI(),l&&this._update())}_setCacheLimits(l,t){s.eV(l,t)}get version(){return li}},NavigationControl:class{constructor(l={}){this.options=s.h({},Ba,l),this._container=It("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(s.aV(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",t=>{this._map&&this._map.zoomIn({},{originalEvent:t})}),It("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",t=>{this._map&&this._map.zoomOut({},{originalEvent:t})}),It("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.aV(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",t=>{const n=this._map;n&&(this.options.visualizePitch?n.resetNorthPitch({},{originalEvent:t}):n.resetNorth({},{originalEvent:t}))}),this._compassIcon=It("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const l=this._map;if(!l)return;const t=l.getZoom(),n=t===l.getMaxZoom(),c=t===l.getMinZoom();this._zoomInButton.disabled=n,this._zoomOutButton.disabled=c,this._zoomInButton.setAttribute("aria-disabled",n.toString()),this._zoomOutButton.setAttribute("aria-disabled",c.toString())}_rotateCompassArrow(){const l=this._map;if(!l)return;const t=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(l.transform.pitch*(Math.PI/180)),.5)}) rotateX(${l.transform.pitch}deg) rotateZ(${l.transform.angle*(180/Math.PI)}deg)`:`rotate(${l.transform.angle*(180/Math.PI)}deg)`;l._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=t)})}onAdd(l){return this._map=l,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),l.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&l.on("pitch",this._rotateCompassArrow),l.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Bo(l,this._compass,this.options.visualizePitch)),this._container}onRemove(){const l=this._map;l&&(this._container.remove(),this.options.showZoom&&l.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&l.off("pitch",this._rotateCompassArrow),l.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(l,t){const n=It("button",l,this._container);return n.type="button",n.addEventListener("click",t),n}_setButtonTitle(l,t){if(!this._map)return;const n=this._map._getUIString(`NavigationControl.${t}`);l.setAttribute("aria-label",n),l.firstElementChild&&l.firstElementChild.setAttribute("title",n)}},GeolocateControl:class extends s.E{constructor(l={}){super();const t=navigator.geolocation;this.options=s.h({geolocation:t},om,l),s.aV(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=za(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(l){return this._map=l,this._container=It("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkGeolocationSupport(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(this.options.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),this._container.remove(),this._map.off("zoom",this._onZoom),this._map=void 0,this._numberOfWatches=0,this._noTimeout=!1}_checkGeolocationSupport(l){const t=(n=!!this.options.geolocation)=>{this._supportsGeolocation=n,l(n)};this._supportsGeolocation!==void 0?l(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(n=>t(n.state!=="denied")).catch(()=>t()):t()}_isOutOfMapMaxBounds(l){const t=this._map.getMaxBounds(),n=l.coords;return!!t&&(n.longitude<t.getWest()||n.longitude>t.getEast()||n.latitude<t.getSouth()||n.latitude>t.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}}_onSuccess(l){if(this._map){if(this._isOutOfMapMaxBounds(l))return this._setErrorState(),this.fire(new s.A("outofmaxbounds",l)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=l,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
2772RROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(l),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(l),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.A("geolocate",l)),this._finish()}}_updateCamera(l){const t=new s.ci(l.coords.longitude,l.coords.latitude),n=l.coords.accuracy,c=this._map.getBearing(),d=s.h({bearing:c},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(n),d,{geolocateSource:!0})}_updateMarker(l){if(l){const t=new s.ci(l.coords.longitude,l.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=l.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const l=this._map.transform,t=s.cb(1,l._center.lat)*l.worldSize,n=Math.ceil(2*this._accuracy*t);this._circleElement.style.width=`${n}px`,this._circleElement.style.height=`${n}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&typeof this._heading=="number"?(this._userLocationDotMarker.setRotation(this._heading),this._userLocationDotMarker.addClassName("mapboxgl-user-location-show-heading")):(this._userLocationDotMarker.removeClassName("mapboxgl-user-location-show-heading"),this._userLocationDotMarker.setRotation(0))}_onError(l){if(this._map){if(this.options.trackUserLocation)if(l.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(l.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.A("error",l)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(l){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=It("button","mapboxgl-ctrl-geolocate",this._container),It("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",l===!1){s.w("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",t),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2772se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=It("div","mapboxgl-user-location"),this._dotElement.appendChild(It("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(It("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new kn({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=It("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new kn({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this.fire(new s.A("trackuserlocationend")))})}}_onDeviceOrientation(l){this._userLocationDotMarker&&(l.webkitCompassHeading?this._heading=l.webkitCompassHeading:l.absolute===!0&&(this._heading=-1*l.alpha),this._updateMarkerRotationThrottled())}trigger(){if(!this._setup)return s.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new s.A("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._numberOfWatches--,this._noTimeout=!1,this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire(new s.A("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new s.A("trackuserlocationstart"))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let l;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(l={maximumAge:6e5,timeout:0},this._noTimeout=!0):(l=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,l),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const l=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(t=>{t==="granted"&&l()}).catch(console.error):l()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","fal
2772se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:ka,ScaleControl:class{constructor(l={}){this.options=s.h({},sm,l),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),s.aV(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const l=this.options.maxWidth||100,t=this._map,n=t._containerHeight/2,c=t._containerWidth/2-l/2,d=t.unproject([c,n]),p=t.unproject([c+l,n]),m=d.distanceTo(p);if(this.options.unit==="imperial"){const y=3.2808*m;y>5280?this._setScale(l,y/5280,"mile"):this._setScale(l,y,"foot")}else this.options.unit==="nautical"?this._setScale(l,m/1852,"nautical-mile"):m>=1e3?this._setScale(l,m/1e3,"kilometer"):this._setScale(l,m,"meter")}_setScale(l,t,n){this._map._requestDomTask(()=>{const c=function(p){const m=Math.pow(10,`${Math.floor(p)}`.length-1);let y=p/m;return y=y>=10?10:y>=5?5:y>=3?3:y>=2?2:y>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(y),m*y}(t),d=c/t;this._container.innerHTML=this._isNumberFormatSupported&&n!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:n}).format(c):`${c}&nbsp;${am[n]}`,this._container.style.width=l*d+"px"})}onAdd(l){return this._map=l,this._language=l.getLanguage(),this._container=It("div","mapboxgl-ctrl mapboxgl-ctrl-scale",l.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(l){this._language=l,this._update()}setUnit(l){this.options.unit=l,this._update()}},FullscreenControl:class{constructor(l={}){this._fullscreen=!1,l&&l.container&&(l.container instanceof HTMLElement?this._container=l.container:s.w("Full screen control 'container' must be a DOM element.")),s.aV(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(l){return this._map=l,this._container||(this._container=this._map.getContainer()),this._controlContainer=It("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",s.w("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){this._controlContainer.remove(),this._map=null,document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!(!document.fullscreenEnabled&&!document.webkitFullscreenEnabled)}_setupUI(){const l=this._fullscreenButton=It("button","mapboxgl-ctrl-fullscreen",this._controlContainer);It("span","mapboxgl-ctrl-icon",l).setAttribute("aria-hidden","true"),l.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const l=this._getTitle();this._fullscreenButton.setAttribute("aria-label",l),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",l)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:Ou,Popup:class extends s.E{constructor(l){super(),this.options=s.h(Object.create(lm),l),this._altitude=this.options.altitude,s.aV(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(l&&l.className?l.className.trim().split(/\s+/):[])}addTo(l){return this._map&&this.remove(),this._map=l,this.options.closeOnClick&&l.on("preclick",this._onClose),this.options.closeOnMove&&l.on("move",this._onClose),l.on("remove",this.remove),this._update(),l._addPopup(this),this._focusFirstElement(),this._trackPointer?(l.on("mousemove",this._onMouseEvent),l.on("mouseup",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")):l.on("move",this._update),this.fire(new s.A("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const l=this._map;return l&&(l.off("move",this._update),l.off("move",this._onClose),l.off("preclick",this._onClose),l.off("click",this._onClose),l.off("remove",this.remove),l.off("mousemove",this._onMouseEvent),l.off("mouseup",this._onMouseEvent),l.off("drag",this._onMouseEvent),l._canvasContainer&&l._canvasContainer.classList.remove("mapboxgl-track-pointer"),l._removePopup(this),this._map=void 0),this.fire(new s.A("close")),this}getLngLat(){return this._lngLat}setLngLat(l){this._lngLat=s.ci.convert(l),this._pos=null,this._trackPointer=!1,this._update();const t=this._map;return t&&(t.on("move",this._update),t.off("mousemove",this._onMouseEvent),t._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(l){return this._altitude=l,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const l=this._map;return l&&(l.off("move",this._update),l.on("mousemove",this._onMouseEvent),l.on("drag",this._onMouseEvent),l._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(l){return this.setDOMContent(document.createTextNode(l))}setHTML(l){const t=document.createDocumentFragment(),n=document.createElement("body");let c;for(n.innerHTML=l;c=n.firstChild,c;
vendor: 5,552 bytes, line 2772
2772)t.appendChild(c);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(l){return this.options.maxWidth=l,this._update(),this}setDOMContent(l){let t=this._content;if(t)for(;t.hasChildNodes();)t.firstChild&&t.removeChild(t.firstChild);else t=this._content=It("div","mapboxgl-popup-content",this._container||void 0);if(t.appendChild(l),this.options.closeButton){const n=this._closeButton=It("button","mapboxgl-popup-close-button",t);n.type="button",n.setAttribute("aria-label","Close popup"),n.innerHTML='<span aria-hidden="true">&#215;</span>',n.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(l){return this._classList.add(l),this._updateClassList(),this}removeClassName(l){return this._classList.delete(l),this._updateClassList(),this}setOffset(l){return this.options.offset=l,this._update(),this}toggleClassName(l){let t;return this._classList.delete(l)?t=!1:(this._classList.add(l),t=!0),this._updateClassList(),t}_onMouseEvent(l){this._update(l.point)}_getAnchor(l){if(this.options.anchor)return this.options.anchor;const t=this._map,n=this._container,c=this._pos;if(!t||!n||!c)return"bottom";const d=n.offsetWidth,p=n.offsetHeight,m=c.x<d/2,y=c.x>t.transform.width-d/2;if(c.y+l<p)return m?"top-left":y?"top-right":"top";if(c.y>t.transform.height-p){if(m)return"bottom-left";if(y)return"bottom-right"}return m?"left":y?"right":"bottom"}_updateClassList(){const l=this._container;if(!l)return;const t=[...this._classList];t.push("mapboxgl-popup"),this._anchor&&t.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&t.push("mapboxgl-popup-track-pointer"),l.className=t.join(" ")}_update(l){const t=this._map,n=this._content;if(!t||!this._lngLat&&!this._trackPointer||!n)return;let c=this._container;if(c||(c=this._container=It("div","mapboxgl-popup",t.getContainer()),this._tip=It("div","mapboxgl-popup-tip",c),c.appendChild(n)),this.options.maxWidth&&c.style.maxWidth!==this.options.maxWidth&&(c.style.maxWidth=this.options.maxWidth),t.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Qn(this._lngLat,this._pos,t.transform)),!this._trackPointer||l){const d=this._pos=this._trackPointer&&l instanceof s.P?l:t.project(this._lngLat,this._altitude),p=Qr(this.options.offset),m=this._anchor=this._getAnchor(p.y),y=Qr(this.options.offset,m),x=d.add(y).round();t._requestDomTask(()=>{this._container&&m&&(this._container.style.transform=`${On[m]} translate(${x.x}px,${x.y}px)`)})}if(!this._marker&&t._showingGlobe()){const d=s.eW(t.transform,this._lngLat)?0:1;this._setOpacity(d)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const l=this._container.querySelector(Ap);l&&l.focus()}_onClose(){this.remove()}_setOpacity(l){this._container&&(this._container.style.opacity=`${l}`),this._content&&(this._content.style.pointerEvents=l?"auto":"none")}},Marker:kn,Style:Yn,LngLat:s.ci,LngLatBounds:s.aG,Point:s.P,MercatorCoordinate:s.ac,FreeCameraOptions:zd,Evented:s.E,config:s.e,prewarm:s.e_,clearPrewarmedResources:s.eZ,get accessToken(){return s.e.ACCESS_TOKEN},set accessToken(l){s.e.ACCESS_TOKEN=l},get baseApiUrl(){return s.e.API_URL},set baseApiUrl(l){s.e.API_URL=l},get workerCount(){return s.f7.workerCount},set workerCount(l){s.f7.workerCount=l},get maxParallelImageRequests(){return s.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(l){s.e.MAX_PARALLEL_IMAGE_REQUESTS=l},clearStorage(l){s.f6(l)},get workerUrl(){return s.f5.workerUrl},set workerUrl(l){s.f5.workerUrl=l},get workerClass(){return s.f5.workerClass},set workerClass(l){s.f5.workerClass=l},get workerParams(){return s.f5.workerParams},set workerParams(l){s.f5.workerParams=l},get dracoUrl(){return s.f4()},set dracoUrl(l){s.f3(l)},get meshoptUrl(){return s.f2()},set meshoptUrl(l){s.f1(l)},setNow:s.q.setNow,restoreNow:s.q.restoreNow}});var Ar=Vr;return Ar})})(P0);var Pw=P0.exports;const Td=dw(Pw),E0=[{nome:"Fortaleza",coordenadas:[-38.5434,-3.7319],tipo:"capital",descricao:"Capital do Ceará, ponto de partida da rota das praias do oeste"},{nome:"Caucaia",coordenadas:[-38.6531,-3.7263],tipo:"praia",descricao:"Praias de Cumbuco e Icaraí, famosas pelo kitesurf"},{nome:"São Gonçalo do Amarante",coordenadas:[-38.9687,-3.7891],tipo:"praia",descricao:"Pecém e Taíba, praias selvagens e autênticas"},{nome:"Paracuru",coordenadas:[-39.0667,-3.4],tipo:"sede_cedro",descricao:"Sede da Cachaça Cedro - O coração da cachaça artesanal do litoral oeste",destaque:!0},{nome:"Paraipaba",coordenadas:[-39.1456,-3.2889],tipo:"praia",descricao:"Lagoinha, uma das praias mais belas do Ceará"},{nome:"Trairi",coordenadas:[-39.2689,-3.2781],tipo:"praia",descricao:"Mundaú e Flecheiras, praias paradisíacas"},{nome:"Itapipoca",coordenadas:[-39.5789,-3.4944],tipo:"praia",descricao:"Baleia e Almofala, rica em cultura e história"},{nome:"Amontada",coordenadas:[-39.8267,-3.3578],tipo:"praia",descricao:"Icaraizinho, paraíso dos kitesurfistas"},{nome:"Itarema",coordenadas:[-39.9189,-2.9244],tipo:"praia",descricao:"Guajiru, beleza natural preservada"},{nome:"Acaraú",coordenadas:[-40.12,-2.8856],tipo:"praia",descricao:"Barra Grande, encontro do rio com o mar"},{nome:"Cruz",coordenadas:[-40.1711,-2.9178],tipo:"praia",descricao:"Jericoacoara e Preá, famosas mundialmente"},{nome:"Jijoca de Jericoacoara",coordenadas:[-40.3844,-2.7947],tipo:"praia",descricao:"Portal de acesso ao paraíso"},{nome:"Jericoacoara",coordenadas:[-40.4644,-2.7947],tipo:"destino",descricao:"Destino f
2772inal: Um dos destinos mais desejados do mundo"}],I0={capital:"#E11D48",sede_cedro:"#D97706",praia:"#0EA5E9",destino:"#7C3AED"},zw={capital:M0,sede_cedro:Af,praia:P_,destino:If},Rw=()=>{const gi=vo.useRef(null),Qi=vo.useRef(null),[ir,_r]=vo.useState(""),[Vr,Pr]=vo.useState(""),[Ar,s]=vo.useState(!0);return vo.useEffect(()=>{(async()=>{try{const{data:Vt,error:Di}=await co.functions.invoke("mapbox-token");if(Di)throw Di;_r(Vt.token)}catch(Vt){console.error("Erro ao buscar token Mapbox:",Vt),Pr("Erro ao carregar o mapa")}finally{s(!1)}})()},[]),vo.useEffect(()=>{if(!(!gi.current||!ir||Qi.current)){try{Td.accessToken=ir,Qi.current=new Td.Map({container:gi.current,style:"mapbox://styles/mapbox/satellite-streets-v12",center:[-39.5,-3.2],zoom:8.5,pitch:45,bearing:0}),Qi.current.addControl(new Td.NavigationControl,"top-right"),Qi.current.on("load",()=>{if(!Qi.current)return;const li=E0.map(Vt=>Vt.coordenadas);Qi.current.addSource("route",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:li}}}),Qi.current.addLayer({id:"route",type:"line",source:"route",layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":"#D97706","line-width":4,"line-opacity":.8}}),E0.forEach(Vt=>{const Di=document.createElement("div");Di.className="custom-marker",Di.style.backgroundColor=I0[Vt.tipo],Di.style.width=Vt.destaque?"16px":"12px",Di.style.height=Vt.destaque?"16px":"12px",Di.style.borderRadius="50%",Di.style.border="2px solid white",Di.style.cursor="pointer",Di.style.boxShadow="0 2px 4px rgba(0,0,0,0.3)",Vt.destaque&&(Di.style.animation="pulse 2s infinite",Di.style.boxShadow="0 0 20px rgba(217, 119, 6, 0.6)");const sr=new Td.Popup({offset:25,className:"custom-popup"}).setHTML(`
2773            <div class="p-3">
2774              <h3 class="font-bold text-sm mb-1 text-foreground">${Vt.nome}</h3>
2775              <p class="text-xs text-muted-foreground">${Vt.descricao}</p>
2776              ${Vt.destaque?'<div class="mt-2"><span class="inline-flex items-center px-2 py-1 text-xs bg-amber-100 text-amber-800 rounded-full">⭐ Sede da Cedro</span></div>':""}
2777            </div>
2778          `);new Td.Marker(Di).setLngLat(Vt.coordenadas).setPopup(sr).addTo(Qi.current)})})}catch(li){console.error("Erro ao inicializar mapa:",li),Pr("Erro ao carregar o mapa")}return()=>{var li;(li=Qi.current)==null||li.remove(),Qi.current=null}}},[ir]),Ar?X.jsx(bo,{className:"w-full",children:X.jsx(wo,{className:"flex items-center justify-center h-96",children:X.jsxs("div",{className:"text-center",children:[X.jsx(P_,{className:"h-8 w-8 animate-spin mx-auto mb-2 text-primary"}),X.jsx("p",{className:"text-muted-foreground",children:"Carregando mapa das praias..."})]})})}):Vr?X.jsx(bo,{className:"w-full",children:X.jsx(wo,{className:"flex items-center justify-center h-96",children:X.jsxs("div",{className:"text-center",children:[X.jsx(If,{className:"h-8 w-8 mx-auto mb-2 text-destructive"}),X.jsx("p",{className:"text-destructive",children:Vr})]})})}):X.jsxs("section",{className:"py-16 bg-gradient-to-br from-primary/5 to-secondary/5",children:[X.jsxs("div",{className:"container mx-auto px-6",children:[X.jsxs("div",{className:"text-center mb-12",children:[X.jsxs(M_,{variant:"outline",className:"mb-4",children:[X.jsx(P_,{className:"h-4 w-4 mr-2"}),"Litoral Oeste do Ceará"]}),X.jsx("h2",{className:"text-4xl font-bold mb-4",children:"Cachaça Artesanal do Litoral Oeste do Ceará"}),X.jsx("p",{className:"text-xl text-muted-foreground max-w-3xl mx-auto",children:"Da capital ao paraíso, nossa cachaça acompanha a mais bela costa brasileira. De Fortaleza até Jericoacoara, cada gole traz o sabor autêntico do litoral cearense."})]}),X.jsxs("div",{className:"grid lg:grid-cols-4 gap-8",children:[X.jsx("div",{className:"lg:col-span-3",children:X.jsxs(bo,{className:"overflow-hidden",children:[X.jsx(Xs,{children:X.jsxs(Ys,{className:"flex items-center gap-2",children:[X.jsx(M0,{className:"h-5 w-5"}),"Rota das Praias - Fortaleza → Jericoacoara"]})}),X.jsx(wo,{className:"p-0",children:X.jsx("div",{ref:gi,className:"w-full h-96 relative",style:{background:"linear-gradient(45deg, hsl(var(--primary)/0.1), hsl(var(--secondary)/0.1))"}})})]})}),X.jsxs("div",{className:"space-y-6",children:[X.jsxs(bo,{children:[X.jsx(Xs,{children:X.jsx(Ys,{className:"text-lg",children:"Legenda"})}),X.jsx(wo,{className:"space-y-3",children:Object.entries(I0).map(([li,Vt])=>{const Di=zw[li],sr={capital:"Capital",sede_cedro:"Sede da Cedro",praia:"Praias",destino:"Destino Final"};return X.jsxs("div",{className:"flex items-center gap-3",children:[X.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-white shadow-sm",style:{backgroundColor:Vt}}),X.jsx(Di,{className:"h-4 w-4",style:{color:Vt}}),X.jsx("span",{className:"text-sm",children:sr[li]})]},li)})})]}),X.jsxs(bo,{children:[X.jsx(Xs,{children:X.jsx(Ys,{className:"text-lg",children:"Nossa História"})}),X.jsx(wo,{children:X.jsxs("p",{className:"text-sm text-muted-foreground leading-relaxed",children:["Nascida em ",X.jsx("strong",{children:"Paracuru"}),", a Cachaça Cedro é fruto da tradição e do terroir único do litoral oeste cearense. Nossa localização estratég
2778ica nos conecta a toda esta costa paradisíaca, de onde extraímos a essência que torna nossa cachaça verdadeiramente especial."]})})]}),X.jsxs(bo,{className:"bg-gradient-to-br from-amber-50 to-orange-50 border-amber-200",children:[X.jsx(Xs,{children:X.jsxs(Ys,{className:"text-lg text-amber-800 flex items-center gap-2",children:[X.jsx(Af,{className:"h-5 w-5"}),"Paracuru"]})}),X.jsx(wo,{children:X.jsxs("p",{className:"text-sm text-amber-700 leading-relaxed",children:[X.jsx("strong",{children:"Sede da Cachaça Cedro"})," - No coração do litoral oeste, onde tradição e inovação se encontram para criar a melhor cachaça artesanal da região."]})})]})]})]})]}),X.jsx("style",{children:`
2779        @keyframes pulse {
2780          0%, 100% {
2781            transform: scale(1);
2782            opacity: 1;
2783          }
2784          50% {
2785            transform: scale(1.2);
2786            opacity: 0.8;
2787          }
2788        }
2789      `})]})},z_="https://api.fazendalibanus.com/storage/v1/object/public/cachaca/cachaca-alambique.png",R_="https://api.fazendalibanus.com/storage/v1/object/public/cachaca/cachaca-carvalho.png",R0="https://api.fazendalibanus.com/storage/v1/object/public/cachaca/cachaca-castanheira.png",Vw=()=>{const gi=pw(),[Qi,ir]=vo.useState(""),[_r,Vr]=vo.useState("distribuidor"),[Pr,Ar]=vo.useState(""),[s,li]=vo.useState(!1),{data:Vt}=Ew(),{data:Di}=Aw(),{data:sr}=Mw(Pr),to=Cw(),qn=It=>It.replace(/\D/g,"").replace(/^(\d{2})(\d{3})(\d{3})(\d{4})(\d{2})$/,"$1.$2.$3/$4-$5"),To=It=>{It.preventDefault();const fr=new FormData(It.currentTarget);to.mutate({razao_social:fr.get("razao_social"),nome_fantasia:fr.get("nome_fantasia"),cnpj:fr.get("cnpj").replace(/\D/g,""),email:fr.get("email"),telefone:fr.get("telefone"),endereco:fr.get("endereco"),cidade:fr.get("
2789cidade"),estado:fr.get("estado"),cep:fr.get("cep").replace(/\D/g,"")})};return X.jsxs(X.Fragment,{children:[X.jsx(fw,{config:mw.cachacaAtacado}),X.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-farm-brown-light to-background",children:[X.jsx("header",{className:"bg-white shadow-sm sticky top-0 z-50",children:X.jsx("div",{className:"container mx-auto px-4 py-4",children:X.jsxs("div",{className:"flex items-center justify-between",children:[X.jsxs(wh,{variant:"ghost",size:"sm",onClick:()=>gi("/"),className:"flex items-center gap-2",children:[X.jsx(_w,{size:20}),"Voltar"]}),X.jsx("img",{src:"https://api.fazendalibanus.com/storage/v1/object/public/fazenda/logo-libanus.png",alt:"Fazenda Libanus",className:"h-8 w-auto object-contain",loading:"eager"})]})})}),X.jsxs("div",{className:"relative overflow-hidden",children:[X.jsx("div",{className:"absolute inset-0 bg-cover bg-center bg-no-repeat",style:{backgroundImage:"url(https://api.fazendalibanus.com/storage/v1/object/public/cachaca/hero-cachacas.png)",backgroundPosition:"center center"}}),X.jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-black/90 via-black/75 to-black/90"}),X.jsxs("div",{className:"relative container mx-auto px-6 py-20 text-center",children:[X.jsx("div",{className:"flex justify-center mb-6",children:X.jsx("div",{className:"p-4 rounded-full bg-farm-brown/90 backdrop-blur text-white",children:X.jsx(S_,{className:"h-12 w-12"})})}),X.jsx("h1",{className:"text-5xl font-bold mb-4 text-white",children:"Cachaça Cedro do Líbano"}),X.jsx("p",{className:"text-xl text-white/90 mb-8 max-w-2xl mx-auto",children:"Distribua a mais pura cachaça artesanal do Ceará. Produtos premium para supermercados, bares, restaurantes e hotéis."}),X.jsxs(wh,{size:"lg",onClick:()=>gi("/cachaca-degustacao"),className:"bg-gradient-to-r from-emerald-500 to-primary hover:from-emerald-600 hover:to-primary/90 text-white mb-8",children:[X.jsx(gw,{className:"h-5 w-5 mr-2"}),"Degustação Assistida por IA"]}),X.jsxs("div",{className:"bg-white/10 backdrop-blur rounded-lg p-6 max-w-md mx-auto",children:[X.jsx("p",{className:"text-white font-medium",children:"3 Produtos Premium"}),X.jsx("p",{className:"text-white/80 text-sm",children:"Cristalina • Premium • Extra-Premium"})]})]})]}),X.jsxs("div",{className:"container mx-auto px-6 py-16",children:[X.jsxs("section",{className:"mb-20",children:[X.jsxs("div",{className:"text-center mb-12",children:[X.jsx("h2",{className:"text-4xl font-bold mb-4 text-foreground",children:"Conheça Nossos Produtos"}),X.jsx("p",{className:"text-xl text-muted-foreground max-w-3xl mx-auto",children:"Três expressões únicas da tradição cearense, cada uma com sua personalidade e história. Do frescor da cristalina ao refinamento da extra-premium envelhecida."})]}),X.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 mb-16",children:[X.jsxs("div",{className:"group relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary/10 to-cyan-50 border border-primary/10 hover:shadow-2xl transition-all duration-500",children:[X.jsx("div",{className:"absolute top-4 right-4 z-10",children:X.jsx("span",{className:"bg-primary text-white px-3 py-1 rounded-full text-sm font-medium",children:"Cristalina"})}),X.jsxs("div",{className:"p-8",children:[X.jsx("div",{className:"flex justify-center mb-6",children:X.jsxs("div",{className:"relative",children:[X.jsx("img",{src:z_,alt:"Cachaça Cedro do Líbano Alambique",className:"w-32 h-32 object-contain group-hover:scale-110 transition-transform duration-500"}),X.jsx("div",{className:"absolute -inset-4 bg-gradient-to-r from-primary/40/20 to-cyan-400/20 rounded-full blur-xl opacity-0 group-hover:opacity-100 transition-opacity duration-500"})]})}),X.jsx("h3",{className:"text-2xl font-bold mb-3 text-center",children:"Cedro do Líbano Alambique"}),X.jsx("p",{className:"text-gray-600 text-center mb-6 leading-relaxed",children:"A essência pura da tradição. Nossa cachaça cristalina preserva toda a vivacidade da cana-de-açúcar, com notas frescas que remetem aos canaviais do Ceará."}),X.jsxs("div",{className:"space-y-3",children:[X.jsxs("div",{className:"flex items-center gap-2",children:[X.jsx("div",{className:"w-2 h-2 bg-primary rounded-full"}),X.jsxs("span",{className:"text-sm",children:[X.jsx("strong",{children:"Aroma:"})," Frutas cítricas e banana"]})]}),X.jsxs("div",{className:"flex items-center gap-2",children:[X.jsx("div",{className:"w-2 h-2 bg-primary rounded-full"}),X.jsxs("span",{className:"text-sm",children:[X.jsx("strong",{children:"Sabor:"})," Seco, frutado e vegetal"]})]}),X.jsxs("div",{className:"flex items-center gap-2",children:[X.jsx("div",{className:"w-2 h-2 bg-primary rounded-full"}),X.jsxs("span",{className:"text-sm",children:[X.jsx("strong",{children:"Perfeita para:"}
2789)," Caipirinhas e coquetéis refrescantes"]})]})]})]})]}),X.jsxs("div",{className:"group relative overflow-hidden rounded-2xl bg-gradient-to-br from-accent/10 to-accent/10 border border-accent/10 hover:shadow-2xl transition-all duration-500",children:[X.jsx("div",{className:"absolute top-4 right-4 z-10",children:X.jsx("span",{className:"bg-accent/90 text-white px-3 py-1 rounded-full text-sm font-medium",children:"Premium"})}),X.jsxs("div",{className:"p-8",children:[X.jsx("div",{className:"flex justify-center mb-6",children:X.jsxs("div",{className:"relative",children:[X.jsx("img",{src:R_,alt:"Cachaça Cedro do Líbano Carvalho Premium",className:"w-32 h-32 object-contain group-hover:scale-110 transition-transform duration-500"}),X.jsx("div",{className:"absolute -inset-4 bg-gradient-to-r from-accent/40/20 to-accent/40/20 rounded-full blur-xl opacity-0 group-hover:opacity-100 transition-opacity duration-500"})]})}),X.jsx("h3",{className:"text-2xl font-bold mb-3 text-center",children:"Cedro do Líbano Carvalho"}),X.jsx("p",{className:"text-gray-600 text-center mb-6 leading-relaxed",children:"Sofisticação e elegância em cada gole. Um ano descansando em barris de carvalho americano conferiu complexidade e suavidade únicos."}),X.jsxs("div",{className:"space-y-3",children:[X.jsxs("div",{className:"flex items-center gap-2",children:[X.jsx("div",{className:"w-2 h-2 bg-accent rounded-full"}),X.jsxs("span",{className:"text-sm",children:[X.jsx("strong",{children:"Aroma:"})," Baunilha, coco e especiarias"]})]}),X.jsxs("div",{className:"flex items-center gap-2",children:[X.jsx("div",{className:"w-2 h-2 bg-accent rounded-full"}),X.jsxs("span",{className:"text-sm",children:[X.jsx("strong",{children:"Sabor:"})," Suave, aveludado e persistente"]})]}),X.jsxs("div",{className:"flex items-center gap-2",children:[X.jsx("div",{className:"w-2 h-2 bg-accent rounded-full"}),X.jsxs("span",{className:"text-sm",children:[X.jsx("strong",{children:"Perfeita para:"})," Drinks autorais e harmonizações"]})]})]})]})]}),X.jsxs("div",{className:"group relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary/10 to-violet-50 border border-primary/10 hover:shadow-2xl transition-all duration-500",children:[X.jsx("div",{className:"absolute top-4 right-4 z-10",children:X.jsx("span",{className:"bg-primary text-white px-3 py-1 rounded-full text-sm font-medium",children:"Extra-Premium"})}),X.jsxs("div",{className:"p-8",children:[X.jsx("div",{className:"flex justify-center mb-6",children:X.jsxs("div",{className:"relative",children:[X.jsx("img",{src:R0,alt:"Cachaça Cedro do Líbano Castanheira Extra-Premium",className:"w-32 h-32 object-contain group-hover:scale-110 transition-transform duration-500"}),X.jsx("div",{className:"absolute -inset-4 bg-gradient-to-r from-primary/40/20 to-violet-400/20 rounded-full blur-xl opacity-0 group-hover:opacity-100 transition-opacity duration-500"})]})}),X.jsx("h3",{className:"text-2xl font-bold mb-3 text-center",children:"Cedro do Líbano Castanheira"}),X.jsx("p",{className:"text-gray-600 text-center mb-6 leading-relaxed",children:"Nossa joia mais preciosa. Três anos de paciência em barris de castanheira resultaram em uma cachaça de complexidade incomparável."}),X.jsxs("div",{className:"space-y-3",children:[X.jsxs("div",{className:"flex items-center gap-2",children:[X.jsx("div",{className:"w-2 h-2 bg-primary rounded-full"}),X.jsxs("span",{className:"text-sm",children:[X.jsx("strong",{children:"Aroma:"})," Frutas secas, nozes e madeira suave"]})]}),X.jsxs("div",{className:"flex items-center gap-2",children:[X.jsx("div",{className:"w-2 h-2 bg-primary rounded-full"}),X.jsxs("span",{className:"text-sm",children:[X.jsx("strong",{children:"Sabor:"})," Adocicado, equilibrado e memorável"]})]}),X.jsxs("div",{className:"flex items-center gap-2",children:[X.jsx("div",{className:"w-2 h-2 bg-primary rounded-full"}),X.jsxs("span",{className:"text-sm",children:[X.jsx("strong",{children:"Perfeita para:"})," Alta gastronomia e degustações especiais"]})]})]})]})]})]}),X.jsxs("div",{className:"bg-gradient-to-r from-farm-brown/5 to-farm-brown-light/10 rounded-2xl p-8 md:p-12",children:[X.jsxs("div",{className:"text-center mb-8",children:[X.jsx("h3",{className:"text-3xl font-bold mb-4",children:"Por que escolher Cedro do Líbano?"}),X.jsx("p",{className:"text-lg text-muted-foreground",children:"A tradição que conquista paladares há gerações"})]}),X.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6",children:[X.jsxs("div",{className:"text-center",children:[X.jsx("div",{className:"w-16 h-16 bg-farm-brown/10 rounded-full flex items-center justify-center mx-auto mb-4",children:X.jsx(A0,{className:"h-8 w-8 text-farm-brown"})}),X.jsx("h4",{className:"font-semibold mb-2",children:"Tradição Familiar"}),X.jsx("p",{className:"text-sm text-muted-foreground",children:"Desde 2006 aperfeiçoando a arte da cachaça artesanal, conquistando o paladar cearense com dedicação e paixão"})]}),X.jsxs("div",{className:"text-center",children:[X.jsx("div",{className:"w-16 h-16 bg-farm-brown/10 rounded-full flex items-center justify-center mx-auto mb-4",children:X.jsx(S_,{className:"h-8 w-8 text-farm-brown"})}),X.jsx("h4",{className:"font-semibold mb-2",children:"Processo Artesanal"}),X.jsx("p",{className:"text-sm text-muted-foreground",children:"Cada gota é cuidadosamente destilada em alambiques de cobre, preservando toda a pureza"})]}),X.jsxs("div",{className:"text-center",children:[X.jsx("div",{className:"w-16 h-16 bg-farm-brown/10 rounded-full flex items-center justify-center mx-auto mb-4",children:X.jsx(Af,{className:"h-8 w-8 text-farm-brown"})}),X.jsx("h4",{className:"font-semibold mb-2",children:"Qualidade Premium"}),X.jsx("p",{className:"text-sm text-muted-foreground",children:"Rigoroso controle de qualidade des
2789de o plantio da cana até o engarrafamento final"})]}),X.jsxs("div",{className:"text-center",children:[X.jsx("div",{className:"w-16 h-16 bg-farm-brown/10 rounded-full flex items-center justify-center mx-auto mb-4",children:X.jsx(If,{className:"h-8 w-8 text-farm-brown"})}),X.jsx("h4",{className:"font-semibold mb-2",children:"Origem Cearense"}),X.jsx("p",{className:"text-sm text-muted-foreground",children:"Produto genuinamente cearense, com todo o sabor e identidade do nosso território"})]})]})]})]}),X.jsx("section",{className:"mb-20",children:X.jsx(bo,{className:"max-w-4xl mx-auto overflow-hidden",children:X.jsxs("div",{className:"bg-gradient-to-r from-accent/10 via-accent/10 to-accent/10",children:[X.jsxs(Xs,{className:"text-center pb-6",children:[X.jsx("div",{className:"flex justify-center mb-4",children:X.jsx("div",{className:"p-4 rounded-full bg-gradient-to-r from-accent to-accent/90 text-white",children:X.jsx(w0,{className:"h-8 w-8"})})}),X.jsx(Ys,{className:"text-3xl font-bold mb-4",children:"Experimente Nossos Produtos"}),X.jsx(Ef,{className:"text-lg max-w-2xl mx-auto",children:"Descubra os aromas, sabores e histórias de cada cachaça através de nossa jornada de degustação guiada por IA. Uma experiência imersiva para conhecer profundamente nossos produtos."})]}),X.jsxs(wo,{className:"text-center pb-8",children:[X.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6 mb-8",children:[X.jsxs("div",{className:"flex flex-col items-center",children:[X.jsx("div",{className:"w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mb-3",children:X.jsx(C0,{className:"h-6 w-6 text-primary"})}),X.jsx("h4",{className:"font-semibold mb-2",children:"Análise Visual"}),X.jsx("p",{className:"text-sm text-muted-foreground",children:"Observe cor, transparência e densidade"})]}),X.jsxs("div",{className:"flex flex-col items-center",children:[X.jsx("div",{className:"w-12 h-12 bg-primary/10 rounded-full flex items-center justify-center mb-3",children:X.jsx(S_,{className:"h-6 w-6 text-primary"})}),X.jsx("h4",{className:"font-semibold mb-2",children:"Degustação Guiada"}),X.jsx("p",{className:"text-sm text-muted-foreground",children:"Explore aromas e sabores únicos"})]}),X.jsxs("div",{className:"flex flex-col items-center",children:[X.jsx("div",{className:"w-12 h-12 bg-accent/10 rounded-full flex items-center justify-center mb-3",children:X.jsx(Af,{className:"h-6 w-6 text-accent/90"})}),X.jsx("h4",{className:"font-semibold mb-2",children:"Perfil Completo"}),X.jsx("p",{className:"text-sm text-muted-foreground",children:"Conheça história e características"})]})]}),X.jsxs(wh,{size:"lg",onClick:()=>gi("/cachaca-degustacao"),className:"bg-gradient-to-r from-accent to-accent/90 hover:from-accent/90 hover:to-accent/90 text-white",children:[X.jsx(w0,{className:"h-5 w-5 mr-2"}),"Iniciar Degustação Guiada"]}),X.jsx("p",{className:"text-sm text-muted-foreground mt-4",children:"Ideal para distribuidores que desejam conhecer profundamente os produtos"})]})]})})}),X.jsx(Rw,{}),X.jsxs(bo,{className:"mb-12 max-w-4xl mx-auto",children:[X.jsxs(Xs,{children:[X.jsxs(Ys,{className:"flex items-center gap-2",children:[X.jsx(Tw,{className:"h-5 w-5"}),"Calculadora de Preços"]}),X.jsx(Ef,{children:"Consulte os preços baseados na sua localização e tipo de estabelecimento"})]}),X.jsxs(wo,{className:"space-y-6",children:[X.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[X.jsxs("div",{children:[X.jsx(xo,{htmlFor:"cidade",children:"Cidade"}),X.jsxs(E_,{value:Qi,onValueChange:ir,children:[X.jsx(I_,{children:X.jsx(A_,{placeholder:"Selecione sua cidade"})}),X.jsx(C_,{children:Di==null?void 0:Di.map(It=>X.jsxs(Sf,{value:It.cidade,children:[It.cidade," - ",It.estado]},It.id))})]})]}),X.jsxs("div",{children:[X.jsx(xo,{htmlFor:"tipo",children:"Tipo de Estabelecimento"}),X.jsxs(E_,{value:_r,onValueChange:Vr,children:[X.jsx(I_,{children:X.jsx(A_,{})}),X.jsxs(C_,{children:[X.jsx(Sf,{value:"distribuidor",children:"Supermercado/Distribuidor"}),X.jsx(Sf,{value:"bar_restaurante_hotel",children:"Bar/Restaurante/Hotel"})]})]})]})]}),Qi&&X.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:Vt==null?void 0:Vt.map(It=>X.jsx(Dw,{sku:It,cidade:Qi,tipoCliente:_r},It.id))})]})]}),X.jsxs(bo,{className:"max-w-2xl mx-auto",children:[X.jsx(Xs,{children:X.jsxs(Ys,{className:"flex items-center gap-2",children:[X.jsx(yw,{className:"h-5 w-5"}),"Área do Distribuidor"]})}),X.jsxs(wo,{className:"space-y-6",children:[X.jsxs("div",{children:[X.jsx(xo,{htmlFor:"cnpj",children:"Consultar CNPJ"}),X.jsx(Ws,{id:"cnpj",value:Pr,onChange:It=>Ar(qn(It.target.value)),placeholder:"00.000.000/0000-00",maxLength:18})]}),sr&&X.jsx(bo,{className:"bg-green-50 border-green-200",children:X.jsxs(wo,{className:"pt-4",children:[X.jsx("p",{className:"text-green-800 font-medium",children:"✓ Distribuidor Cadastrado"}),X.jsxs("p",{className:"text-green-700",children:["Status: ",sr.status]}
2789),X.jsx("p",{className:"text-green-700",children:sr.nome_fantasia||sr.razao_social})]})}),Pr&&!sr&&Pr.replace(/\D/g,"").length===14&&X.jsxs("div",{children:[X.jsx("p",{className:"text-accent/90 mb-4",children:"CNPJ não encontrado. Cadastre-se como distribuidor:"}),X.jsx(wh,{onClick:()=>li(!s),children:s?"Ocultar Formulário":"Cadastrar como Distribuidor"})]}),s&&X.jsxs("form",{onSubmit:To,className:"space-y-4",children:[X.jsx(ww,{}),X.jsx("h3",{className:"font-semibold",children:"Cadastro de Novo Distribuidor"}),X.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[X.jsxs("div",{children:[X.jsx(xo,{htmlFor:"razao_social",children:"Razão Social *"}),X.jsx(Ws,{name:"razao_social",required:!0})]}),X.jsxs("div",{children:[X.jsx(xo,{htmlFor:"nome_fantasia",children:"Nome Fantasia"}),X.jsx(Ws,{name:"nome_fantasia"})]})]}),X.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[X.jsxs("div",{children:[X.jsx(xo,{htmlFor:"cnpj",children:"CNPJ *"}),X.jsx(Ws,{name:"cnpj",value:Pr,readOnly:!0})]}),X.jsxs("div",{children:[X.jsx(xo,{htmlFor:"email",children:"E-mail *"}),X.jsx(Ws,{name:"email",type:"email",required:!0})]})]}),X.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[X.jsxs("div",{children:[X.jsx(xo,{htmlFor:"telefone",children:"Telefone"}),X.jsx(Ws,{name:"telefone"})]}),X.jsxs("div",{children:[X.jsx(xo,{htmlFor:"cep",children:"CEP *"}),X.jsx(Ws,{name:"cep",required:!0})]})]}),X.jsxs("div",{children:[X.jsx(xo,{htmlFor:"endereco",children:"Endereço Completo *"}),X.jsx(Ws,{name:"endereco",required:!0})]}),X.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[X.jsxs("div",{children:[X.jsx(xo,{htmlFor:"cidade",children:"Cidade *"}),X.jsx(Ws,{name:"cidade",required:!0})]}),X.jsxs("div",{children:[X.jsx(xo,{htmlFor:"estado",children:"Estado *"}),X.jsxs(E_,{name:"estado",defaultValue:"CE",children:[X.jsx(I_,{children:X.jsx(A_,{})}),X.jsx(C_,{children:X.jsx(Sf,{value:"CE",children:"Ceará"})})]})]})]}),X.jsx(wh,{type:"submit",className:"w-full",disabled:to.isPending,children:to.isPending?"Cadastrando...":"Enviar Cadastro"})]})]})]}),X.jsxs(bo,{className:"mt-12 max-w-2xl mx-auto bg-gradient-to-br from-farm-brown/5 to-farm-brown-light/10 border-farm-brown/20",children:[X.jsxs(Xs,{className:"text-center",children:[X.jsxs(Ys,{className:"flex items-center justify-center gap-2 text-2xl",children:[X.jsx(T0,{className:"h-6 w-6 text-farm-brown"}),"Contato Comercial"]}),X.jsx(Ef,{className:"text-lg",children:"Entre em contato conosco para informações comerciais"})]}),X.jsxs(wo,{className:"space-y-6",children:[X.jsxs("div",{className:"text-center bg-white/50 rounded-lg p-4",children:[X.jsx("h3",{className:"font-semibold text-lg mb-2",children:"Josimar"}),X.jsx("p",{className:"text-muted-foreground",children:"Representante comercial especializado em B2B"})]}),X.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[X.jsxs("a",{href:"https://wa.me/5585999850136?text=Olá,%20gostaria%20de%20informações%20sobre%20a%20distribuição%20da%20Cachaça%20Cedro%20do%20Líbano",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-4 bg-white rounded-lg hover:bg-green-50 transition-colors border border-green-200 hover:border-green-300",children:[X.jsx(T0,{className:"h-5 w-5 text-green-600"}),X.jsxs("div",{children:[X.jsx("p",{className:"font-medium",children:"(85) 99985-0136"}),X.jsx("p",{className:"text-sm text-green-600",children:"Clique para WhatsApp"})]})]}),X.jsxs("a",{href:"mailto:[email protected]?subject=Interesse%20em%20distribuir%20Cachaça%20Cedro%20do%20Líbano",className:"flex items-center gap-3 p-4 bg-white rounded-lg hover:bg-primary/10 transition-colors border border-blue-200 hover:border-blue-300",children:[X.jsx(xw,{className:"h-5 w-5 text-primary"}),X.jsxs("div",{children:[X.jsx("p",{className:"font-medium text-sm",children:"[email protected]"}),X.jsx("p",{className:"text-sm text-primary",children:"Clique para enviar email"})]})]})]}),X.jsxs("a",{href:"https://maps.google.com/?q=Fazenda+Libanus,+São+Gonçalo+do+Amarante,+Ceará",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-4 bg-white rounded-lg hover:bg-accent/10 transition-colors border border-amber-200 hover:border-amber-300 w-full",children:[X.jsx(If,{className:"h-5 w-5 text-accent/90 flex-shrink-0"}),X.jsxs("div",{className:"text-left",children:[X.jsx("p",{className:"font-medium",children:"Fazenda Libanus"}),X.jsx("p",{className:"text-sm text-muted-foreground",children:"São Gonçalo do Amarante, Ceará"}),X.jsx("p",{className:"text-sm text-accent/90",children:"Clique para ver no mapa"})]})]}),X.jsx("div",{className:"text-center p-4 bg-farm-brown/5 rounded-lg",children:X.jsx("p",{className:"text-sm text-muted-foreground",children:"Atendimento personalizado para distribuidores • Produtos premium para seu estabelecimento"})})]})]})]}),X.jsx(vw,{variant:"public"})]})]})},Dw=({sku:gi,cidade:Qi,tipoCliente:ir})=>{var Di;const{data:_r}=Iw(gi.codigo,Qi,ir),[Vr,Pr]=vo.useState(!1),Ar=gi.unidade_medida==="CX",li=(sr=>{if(sr.includes("CRV"))return{nome:"Cedro do Líbano Carvalho Premium",desc:Ar?"Caixa com 12 garrafas de cachaça premium envelhecida em barr
2789is de carvalho francês":"Cachaça premium envelhecida em barris de carvalho francês com notas amadeiradas",perfilSensorial:"Aromas de baunilha, coco, caramelo e especiarias",sabor:"Paladar suave e aveludado, com persistência longa",aparencia:"Dourada e encorpada",processo:"Envelhecida em barris de carvalho americano",idealPara:Ar?"Estabelecimentos que buscam uma cachaça diferenciada com volume":"Drinks autorais, harmonizações e consumo puro",envelhecimento:"1 ano",tipo:"Premium",imagem:R_};if(sr.includes("CST"))return{nome:"Cedro do Líbano Castanheira Extra-Premium",desc:Ar?"Caixa com 12 garrafas da nossa linha mais exclusiva, envelhecida em castanheira":"Nossa linha mais exclusiva, envelhecida em barris de castanheira brasileira",perfilSensorial:"Notas de frutas secas, nozes, amêndoas e madeira suave",sabor:"Sabor adocicado e equilibrado, com final longo",aparencia:"Âmbar elegante e sofisticada",processo:"Envelhecida em barris de castanheira",idealPara:Ar?"Clientes que valorizam produtos premium em quantidade":"Alta gastronomia e degustações especiais",envelhecimento:"3 anos",tipo:"Extra-Premium",imagem:R0};if(sr.includes("ALB")||sr.includes("ALAB"))return{nome:"Cedro do Líbano Alambique",desc:Ar?"Caixa com 12 garrafas de cachaça pura de alambique, cristalina e refrescante":"Cachaça pura de alambique, sem envelhecimento, preservando o sabor original",perfilSensorial:"Notas frescas de cana-de-açúcar, frutas cítricas e banana",sabor:"Sabor seco, frutado e vegetal",aparencia:"Transparente, com brilho e leveza",processo:"Não passa por madeira - é a base pura da tradição artesanal",idealPara:Ar?"Estabelecimentos com alto volume de caipirinhas e drinks":"Caipirinhas e coquetéis refrescantes",envelhecimento:"Sem envelhecimento",tipo:"Cristalina",imagem:z_};switch(sr){case"CX-CARV-500-12":case"CCL-CRV-500-CX12":return{nome:"Cedro do Líbano Carvalho Premium",desc:"Caixa com 12 garrafas de cachaça premium envelhecida em carvalho",perfilSensorial:"Aromas de baunilha, coco, caramelo e especiarias",sabor:"Paladar suave e aveludado, com persistência longa",aparencia:"Dourada e encorpada",processo:"Envelhecida em barris de carvalho americano",idealPara:"Estabelecimentos que buscam diferenciação com volume",envelhecimento:"1 ano",tipo:"Premium",imagem:R_};default:return{nome:gi.nome||"Produto",desc:gi.descricao||"",perfilSensorial:"",sabor:"",aparencia:"",processo:"",idealPara:"",envelhecimento:"",tipo:gi.categoria||"",imagem:z_}}})(gi.codigo),Vt=sr=>{switch(sr){case"Cristalina":return"text-primary bg-primary/10";case"Premium":return"text-accent/90 bg-accent/10";case"Extra-Premium":return"text-primary bg-primary/10";default:return"text-gray-600 bg-gray-50"}};return X.jsxs(bo,{className:"h-full flex flex-col hover:shadow-lg transition-all duration-300 group",children:[X.jsxs(Xs,{className:"pb-3",children:[X.jsxs("div",{className:"flex items-start gap-4",children:[X.jsx("div",{className:"flex-shrink-0",children:X.jsx("img",{src:li.imagem,alt:li.nome,className:"w-20 h-20 object-cover rounded-lg group-hover:scale-105 transition-transform duration-300"})}),X.jsxs("div",{className:"flex-1 min-w-0",children:[X.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[X.jsx(M_,{variant:Ar?"default":"secondary",className:"text-xs",children:Ar?"CAIXA":"GARRAFA"}),X.jsx(M_,{variant:"outline",className:`text-xs ${Vt(li.tipo)}`,children:li.tipo})]}),X.jsx(Ys,{className:"text-lg leading-tight",children:li.nome})]})]}),X.jsx(Ef,{className:"text-sm line-clamp-2 mt-2",children:li.desc})]}),X.jsxs(wo,{className:"flex-1 space-y-4",children:[X.jsxs("div",{className:"space-y-3",children:[X.jsxs("div",{className:"bg-muted/30 p-3 rounded-lg",children:[X.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[X.jsx(A0,{className:"h-4 w-4 text-farm-brown"}),X.jsx("span",{className:"font-medium text-sm",children:"Envelhecimento"})]}),X.jsx("p",{className:"text-sm",children:li.envelhecimento})]}),X.jsxs("div",{className:"bg-muted/30 p-3 rounded-lg",children:[X.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[X.jsx(bw,{className:"h-4 w-4 text-farm-brown"}),X.jsx("span",{className:"font-medium text-sm",children:"Ideal para"})]}),X.jsx("p",{className:"text-sm",children:li.idealPara})]}),Ar&&X.jsxs("div",{className:"bg-muted/30 p-3 rounded-lg",children:[X.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[X.jsx(Sw,{className:"h-4 w-4 text-green-600"}),X.jsx("span",{className:"font-medium text-sm",children:"Conteúdo"})]}),X.jsx("p",{className:"text-sm",children:"12 garrafas de 500ml = 6 litros total"})]})]}),X.jsxs("div",{className:"border-t pt-3",children:[X.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:Ar?`Caixa com 12 unidades de ${gi.volume_ml}ml`:`Garrafa individual de ${gi.volume_ml}ml • 41% vol`}),X.jsxs("div",{className:"space-y-2",children:[X.jsxs("p",{className:"text-2xl font-bold text-farm-brown",children:["R$ ",(Di=gi.preco_venda)==null?void 0:Di.toFixed(2)]}),_r&&_r.preco_final!==gi.preco_venda&&X.jsxs("p",{className:"text-lg font-semibold text-accent/90",children:["Atacado: R$ ",_r.preco_final.toFixed(2)]}),Ar&&X.jsxs("p",{className:"text-sm text-muted-foreground",children:["R$ ",(gi.preco_venda/12).toFixed(2),"/garrafa"]}),_r&&_r.percentual_markup>0&&X.jsxs("p",{className:"text-sm text-accent/90",children:["+",_r.percentual_markup,"% markup territorial"]}),_r&&X.jsx("p",{className:"text-sm text-muted-foreground",children:_r.tem_frete?"Frete a calcular":"Frete grátis"})]})]}),X.jsxs(wh,{variant:"outline",size:"sm",onClick:()=>Pr(!Vr),className:"w-full mt-auto",children:[X.jsx(C0,{className:"h-4 w-4 mr-2"}),Vr?"Ocultar":"Ver"," Detalhes"]}),Vr&&X.jsxs("div",{className:"border-t pt-4 space-y-3 text-sm",children:[X.jsxs("div",{children:[X.jsx("span",{className:"font-medium",children:"Código SKU:"}),X.jsx("p",{className:"text-muted-foreground mt-1",children:gi.codigo})]}),X.jsxs("div",{children:[X.jsx("span",{className:"font-medium",children:"Teor Alcoólico:"}),X.jsx("p",{className:"text-muted-foreground mt-1",children:"41% vol"})]}),X.jsxs("div",{children:[X.jsx("span",{className:"font-medium",children:"Perfil Sensorial:"}),X.jsx("p",{className:"text-muted-foreground mt-1",children:li.perfilSensorial})]}),X.jsxs("div",{children:[X.jsx("span",{className:"font-medium",children:"Sabor:"}),X.jsx("p",{className:"text-muted-foreground mt-1",children:li.sabor})]}),X.jsxs("div",{children:[X.jsx("span",{className:"font-medium",children:"Aparência:"}),X.jsx("p",{className:"text-muted-foreground mt-1",children:li.aparencia})]}),X.jsxs("div",{children:[X.jsx("span",{className:"font-medium",children:"Processo:"}),X.jsx("p",{className:"text-muted-foreground mt-1",children:li.processo})]}),X.jsxs("div",{className:"pt-2 border-t",children:[X.jsx("span",{className:"font-medium",children:"Armazenamento:"}),X.jsx("p",{className:"text-muted-foreground mt-1",children:"Manter em local seco, ao abrigo da luz solar direta"})]})]})]})]})};export{Vw as default};

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