PageSourceSearch

https://oeappcoffsbypass.net/assets/mapbox-B6s0-6YF.js

js oeappcoffsbypass.net collected 2026-10-04 23:07:03 UTC 1,404,924 bytes, 2,230 lines download raw bytes

1import{g as ub}from"./bootstrap-_mmicx7t.js";var Ap={exports:{}},hb=Ap.exports,p0;function db(){return p0||(p0=1,function(m0,fb){var Om={};(function(yc,xc){m0.exports=xc()})(hb,function(){var yc,xc,Cp;function Pp(s,xt){if(!yc)yc=xt;else if(!xc)xc=xt;else{var Ir="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 = {}; ("+yc+")(sharedChunk); ("+xc+")(sharedChunk); self.onerror = null;",mt={};yc(mt),Cp=xt(mt),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(Cp.workerUrl=window.URL.createObjectURL(new Blob([Ir],{type:"text/javascript"})))}}Pp(["exports"],function(s){var xt="3.5.2";let Ir;const mt={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){if(Ir==null){const t=/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i;try{Ir=Om.API_URL_REGEX!=null?new RegExp(Om.API_URL_REGEX):t}catch{Ir=t}}return Ir},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(!mt.API_URL)return null;try{const t=new URL(mt.API_URL);return t.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":t.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",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Tn(t){return mt.API_URL_REGEX.test(t)}function Dt(t){return t.indexOf("mapbox:")===0}function ur(t){return mt.API_CDN_URL_REGEX.test(t)}function Ur(t){return mt.API_SPRITE_REGEX.test(t)}function jr(t){return mt.API_STYLE_REGEX.test(t)&&!Ur(t)}const En={create:"create",load:"load",fullLoad:"fullLoad"},$a={mark(t){performance.mark(t)},measure(t,e,i){performance.measure(t,e,i)}};function Wa(t){const e=t.name.split("?")[0];return ur(e)&&e.includes("mapbox-gl.js")?"javascript":ur(e)&&e.includes("mapbox-gl.css")?"css":function(i){return mt.API_FONTS_REGEX.test(i)}(e)?"fontRange":Ur(e)?"sprite":jr(e)?"style":function(i){return mt.API_TILEJSON_REGEX.test(i)}(e)?"tilejson":"other"}function Gr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var xi={},mi={};Object.defineProperty(mi,"__esModule",{value:!0}),mi.setMatrixArrayType=function(t){mi.ARRAY_TYPE=Bs=t},mi.toRadian=function(t){return t*vc},mi.equals=function(t,e){return Math.abs(t-e)<=qr*Math.max(1,Math.abs(t),Math.abs(e))},mi.RANDOM=mi.ARRAY_TYPE=mi.EPSILON=void 0;var qr=1e-6;mi.EPSILON=qr;var Bs=typeof Float32Array<"u"?Float32Array:Array;mi.ARRAY_TYPE=Bs;var Fs=Math.random;mi.RANDOM=Fs;var vc=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});var Qt={};function Co(t){return Co=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Co(t)}Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.create=function(){var t=new Ft.ARRAY_TYPE(4);return Ft.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0),t[0]=1,t[3]=1,t},Qt.clone=function(t){var e=new Ft.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},Qt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},Qt.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t}
1,Qt.fromValues=function(t,e,i,n){var o=new Ft.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o},Qt.set=function(t,e,i,n,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t},Qt.transpose=function(t,e){if(t===e){var i=e[1];t[1]=e[2],t[2]=i}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},Qt.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=i*l-o*n;return c?(t[0]=l*(c=1/c),t[1]=-n*c,t[2]=-o*c,t[3]=i*c,t):null},Qt.adjoint=function(t,e){var i=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=i,t},Qt.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},Qt.multiply=Ns,Qt.rotate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=Math.sin(i),p=Math.cos(i);return t[0]=n*p+l*d,t[1]=o*p+c*d,t[2]=n*-d+l*p,t[3]=o*-d+c*p,t},Qt.scale=function(t,e,i){var n=e[1],o=e[2],l=e[3],c=i[0],d=i[1];return t[0]=e[0]*c,t[1]=n*c,t[2]=o*d,t[3]=l*d,t},Qt.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t},Qt.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},Qt.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},Qt.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3])},Qt.LDU=function(t,e,i,n){return t[2]=n[2]/n[0],i[0]=n[0],i[1]=n[1],i[3]=n[3]-t[2]*i[1],[t,e,i]},Qt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t},Qt.subtract=Xa,Qt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},Qt.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=e[0],d=e[1],p=e[2],_=e[3];return Math.abs(i-c)<=Ft.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(n-d)<=Ft.EPSILON*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(o-p)<=Ft.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(l-_)<=Ft.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))},Qt.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},Qt.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t},Qt.sub=Qt.mul=void 0;var Ft=function(t,e){if(t&&t.__esModule)return t;if(t===null||Co(t)!=="object"&&typeof t!="function")return{default:t};var i=Ha(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(mi);function Ha(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Ha=function(n){return n?i:e})(t)}function Ns(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=i[0],p=i[1],_=i[2],y=i[3];return t[0]=n*d+l*p,t[1]=o*d+c*p,t[2]=n*_+l*y,t[3]=o*_+c*y,t}function Xa(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}Qt.mul=Ns,Qt.sub=Xa;var Kt={};function Vs(t){return Vs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Vs(t)}Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.create=function(){var t=new gr.ARRAY_TYPE(6);return gr.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[4]=0,t[5]=0),t[0]=1,t[3]=1,t},Kt.clone=function(t){var e=new gr.ARRAY_TYPE(6);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e},Kt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},Kt.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},Kt.fromValues=function(t,e,i,n,o,l){var c=new gr.ARRAY_TYPE(6);return c[0]=t,c[1]=e,c[2]=i,c[3]=n,c[4]=o,c[5]=l,c},Kt.set=function(t,e,i,n,o,l,c){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t[4]=l,t[5]=c,t},Kt.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],p=i*l-n*o;return p?(t[0]=l*(p=1/p),t[1]=-n*p,t[2]=-o*p,t[3]=i*p,t[4]=(o*d-l*c)*p,t[5]=(n*c-i*d)*p,t):null},Kt.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},Kt.multiply=Us,Kt.rotate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],p=e[5],_=Math.sin(i),y=Math.cos(i);return t[0]=n*y+l*_,t[1]=o*y+c*_,t[2]=n*-_+l*y,t[3]=o*-_+c*y,t[4]=d,t[5]=p,t}
1,Kt.scale=function(t,e,i){var n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],p=i[0],_=i[1];return t[0]=e[0]*p,t[1]=n*p,t[2]=o*_,t[3]=l*_,t[4]=c,t[5]=d,t},Kt.translate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],p=e[5],_=i[0],y=i[1];return t[0]=n,t[1]=o,t[2]=l,t[3]=c,t[4]=n*_+l*y+d,t[5]=o*_+c*y+p,t},Kt.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=-i,t[3]=n,t[4]=0,t[5]=0,t},Kt.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},Kt.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},Kt.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},Kt.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],1)},Kt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t},Kt.subtract=Zn,Kt.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t},Kt.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t},Kt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},Kt.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=t[4],d=t[5],p=e[0],_=e[1],y=e[2],v=e[3],b=e[4],E=e[5];return Math.abs(i-p)<=gr.EPSILON*Math.max(1,Math.abs(i),Math.abs(p))&&Math.abs(n-_)<=gr.EPSILON*Math.max(1,Math.abs(n),Math.abs(_))&&Math.abs(o-y)<=gr.EPSILON*Math.max(1,Math.abs(o),Math.abs(y))&&Math.abs(l-v)<=gr.EPSILON*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(c-b)<=gr.EPSILON*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(d-E)<=gr.EPSILON*Math.max(1,Math.abs(d),Math.abs(E))},Kt.sub=Kt.mul=void 0;var gr=function(t,e){if(t&&t.__esModule)return t;if(t===null||Vs(t)!=="object"&&typeof t!="function")return{default:t};var i=Ya(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(mi);function Ya(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Ya=function(n){return n?i:e})(t)}function Us(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],p=e[5],_=i[0],y=i[1],v=i[2],b=i[3],E=i[4],S=i[5];return t[0]=n*_+l*y,t[1]=o*_+c*y,t[2]=n*v+l*b,t[3]=o*v+c*b,t[4]=n*E+l*S+d,t[5]=o*E+c*S+p,t}function Zn(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t}Kt.mul=Us,Kt.sub=Zn;var $t={};function Po(t){return Po=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Po(t)}Object.defineProperty($t,"__esModule",{value:!0}),$t.create=function(){var t=new Ui.ARRAY_TYPE(9);return Ui.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[5]=0,t[6]=0,t[7]=0),t[0]=1,t[4]=1,t[8]=1,t},$t.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},$t.clone=function(t){var e=new Ui.ARRAY_TYPE(9);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e},$t.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},$t.fromValues=function(t,e,i,n,o,l,c,d,p){var _=new Ui.ARRAY_TYPE(9);return _[0]=t,_[1]=e,_[2]=i,_[3]=n,_[4]=o,_[5]=l,_[6]=c,_[7]=d,_[8]=p,_},$t.set=function(t,e,i,n,o,l,c,d,p,_){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t[4]=l,t[5]=c,t[6]=d,t[7]=p,t[8]=_,t},$t.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},$t.transpose=function(t,e){if(t===e){var i=e[1],n=e[2],o=e[5];t[1]=e[3],t[2]=e[6],t[3]=i,t[5]=e[7],t[6]=n,t[7]=o}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},$t.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],p=e[6],_=e[7],y=e[8],v=y*c-d*_,b=-y*l+d*p,E=_*l-c*p,S=i*v+n*b+o*E;return S?(t[0]=v*(S=1/S),t[1]=(-y*n+o*_)*S,t[2]=(d*n-o*c)*S,t[3]=b*S,t[4]=(y*i-o*p)*S,t[5]=(-d*i+o*l)*S,t[6]=E*S,t[7]=(-_*i+n*p)*S,t[8]=(c*i-n*l)*S,t):null},$t.adjoint=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],p=e[6],_=e[7],y=e[8];return t[0]=c*y-d*_,t[1]=o*_-n*y,t[2]=n*d-o*c,t[3]=d*p-l*y,t[4]=i*y-o*p,t[5]=o*l-i*d,t[6]=l*_-c*p,t[7]=n*p-i*_,t[8]=i*c-n*l,t},$t.determinant=function(t){var e=t[3],i=t[4],n=t[5],o=t[6],l=t[7],c=t[8];return t[0]*(c*i-n*l)+t[1]*(-c*e+n*o)+t[2]*(l*e-i*o)}
1,$t.multiply=Ja,$t.translate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],p=e[5],_=e[6],y=e[7],v=e[8],b=i[0],E=i[1];return t[0]=n,t[1]=o,t[2]=l,t[3]=c,t[4]=d,t[5]=p,t[6]=b*n+E*c+_,t[7]=b*o+E*d+y,t[8]=b*l+E*p+v,t},$t.rotate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],p=e[5],_=e[6],y=e[7],v=e[8],b=Math.sin(i),E=Math.cos(i);return t[0]=E*n+b*c,t[1]=E*o+b*d,t[2]=E*l+b*p,t[3]=E*c-b*n,t[4]=E*d-b*o,t[5]=E*p-b*l,t[6]=_,t[7]=y,t[8]=v,t},$t.scale=function(t,e,i){var n=i[0],o=i[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=o*e[3],t[4]=o*e[4],t[5]=o*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},$t.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},$t.fromRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=0,t[3]=-i,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},$t.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},$t.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},$t.fromQuat=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=i+i,d=n+n,p=o+o,_=i*c,y=n*c,v=n*d,b=o*c,E=o*d,S=o*p,I=l*c,C=l*d,D=l*p;return t[0]=1-v-S,t[3]=y-D,t[6]=b+C,t[1]=y+D,t[4]=1-_-S,t[7]=E-I,t[2]=b-C,t[5]=E+I,t[8]=1-_-v,t},$t.normalFromMat4=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],p=e[6],_=e[7],y=e[8],v=e[9],b=e[10],E=e[11],S=e[12],I=e[13],C=e[14],D=e[15],V=i*d-n*c,U=i*p-o*c,j=i*_-l*c,X=n*p-o*d,H=n*_-l*d,ie=o*_-l*p,ne=y*I-v*S,ue=y*C-b*S,ye=y*D-E*S,pe=v*C-b*I,Te=v*D-E*I,ze=b*D-E*C,be=V*ze-U*Te+j*pe+X*ye-H*ue+ie*ne;return be?(t[0]=(d*ze-p*Te+_*pe)*(be=1/be),t[1]=(p*ye-c*ze-_*ue)*be,t[2]=(c*Te-d*ye+_*ne)*be,t[3]=(o*Te-n*ze-l*pe)*be,t[4]=(i*ze-o*ye+l*ue)*be,t[5]=(n*ye-i*Te-l*ne)*be,t[6]=(I*ie-C*H+D*X)*be,t[7]=(C*j-S*ie-D*U)*be,t[8]=(S*H-I*j+D*V)*be,t):null},$t.projection=function(t,e,i){return t[0]=2/e,t[1]=0,t[2]=0,t[3]=0,t[4]=-2/i,t[5]=0,t[6]=-1,t[7]=1,t[8]=1,t},$t.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},$t.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8])},$t.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t},$t.subtract=Qa,$t.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t},$t.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t[6]=e[6]+i[6]*n,t[7]=e[7]+i[7]*n,t[8]=e[8]+i[8]*n,t},$t.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},$t.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=t[4],d=t[5],p=t[6],_=t[7],y=t[8],v=e[0],b=e[1],E=e[2],S=e[3],I=e[4],C=e[5],D=e[6],V=e[7],U=e[8];return Math.abs(i-v)<=Ui.EPSILON*Math.max(1,Math.abs(i),Math.abs(v))&&Math.abs(n-b)<=Ui.EPSILON*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(o-E)<=Ui.EPSILON*Math.max(1,Math.abs(o),Math.abs(E))&&Math.abs(l-S)<=Ui.EPSILON*Math.max(1,Math.abs(l),Math.abs(S))&&Math.abs(c-I)<=Ui.EPSILON*Math.max(1,Math.abs(c),Math.abs(I))&&Math.abs(d-C)<=Ui.EPSILON*Math.max(1,Math.abs(d),Math.abs(C))&&Math.abs(p-D)<=Ui.EPSILON*Math.max(1,Math.abs(p),Math.abs(D))&&Math.abs(_-V)<=Ui.EPSILON*Math.max(1,Math.abs(_),Math.abs(V))&&Math.abs(y-U)<=Ui.EPSILON*Math.max(1,Math.abs(y),Math.abs(U))},$t.sub=$t.mul=void 0;var Ui=function(t,e){if(t&&t.__esModule)return t;if(t===null||Po(t)!=="object"&&typeof t!="function")return{default:t};var i=Ka(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(mi);function Ka(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Ka=function(n){return n?i:e})(t)}
1function Ja(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],p=e[5],_=e[6],y=e[7],v=e[8],b=i[0],E=i[1],S=i[2],I=i[3],C=i[4],D=i[5],V=i[6],U=i[7],j=i[8];return t[0]=b*n+E*c+S*_,t[1]=b*o+E*d+S*y,t[2]=b*l+E*p+S*v,t[3]=I*n+C*c+D*_,t[4]=I*o+C*d+D*y,t[5]=I*l+C*p+D*v,t[6]=V*n+U*c+j*_,t[7]=V*o+U*d+j*y,t[8]=V*l+U*p+j*v,t}function Qa(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t}$t.mul=Ja,$t.sub=Qa;var lt={};function zo(t){return zo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zo(t)}Object.defineProperty(lt,"__esModule",{value:!0}),lt.create=function(){var t=new si.ARRAY_TYPE(16);return si.ARRAY_TYPE!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},lt.clone=function(t){var e=new si.ARRAY_TYPE(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},lt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},lt.fromValues=function(t,e,i,n,o,l,c,d,p,_,y,v,b,E,S,I){var C=new si.ARRAY_TYPE(16);return C[0]=t,C[1]=e,C[2]=i,C[3]=n,C[4]=o,C[5]=l,C[6]=c,C[7]=d,C[8]=p,C[9]=_,C[10]=y,C[11]=v,C[12]=b,C[13]=E,C[14]=S,C[15]=I,C},lt.set=function(t,e,i,n,o,l,c,d,p,_,y,v,b,E,S,I,C){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t[4]=l,t[5]=c,t[6]=d,t[7]=p,t[8]=_,t[9]=y,t[10]=v,t[11]=b,t[12]=E,t[13]=S,t[14]=I,t[15]=C,t},lt.identity=tl,lt.transpose=function(t,e){if(t===e){var i=e[1],n=e[2],o=e[3],l=e[6],c=e[7],d=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=i,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=l,t[11]=e[14],t[12]=o,t[13]=c,t[14]=d}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},lt.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],p=e[6],_=e[7],y=e[8],v=e[9],b=e[10],E=e[11],S=e[12],I=e[13],C=e[14],D=e[15],V=i*d-n*c,U=i*p-o*c,j=i*_-l*c,X=n*p-o*d,H=n*_-l*d,ie=o*_-l*p,ne=y*I-v*S,ue=y*C-b*S,ye=y*D-E*S,pe=v*C-b*I,Te=v*D-E*I,ze=b*D-E*C,be=V*ze-U*Te+j*pe+X*ye-H*ue+ie*ne;return be?(t[0]=(d*ze-p*Te+_*pe)*(be=1/be),t[1]=(o*Te-n*ze-l*pe)*be,t[2]=(I*ie-C*H+D*X)*be,t[3]=(b*H-v*ie-E*X)*be,t[4]=(p*ye-c*ze-_*ue)*be,t[5]=(i*ze-o*ye+l*ue)*be,t[6]=(C*j-S*ie-D*U)*be,t[7]=(y*ie-b*j+E*U)*be,t[8]=(c*Te-d*ye+_*ne)*be,t[9]=(n*ye-i*Te-l*ne)*be,t[10]=(S*H-I*j+D*V)*be,t[11]=(v*j-y*H-E*V)*be,t[12]=(d*ue-c*pe-p*ne)*be,t[13]=(i*pe-n*ue+o*ne)*be,t[14]=(I*U-S*X-C*V)*be,t[15]=(y*X-v*U+b*V)*be,t):null},lt.adjoint=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=e[4],d=e[5],p=e[6],_=e[7],y=e[8],v=e[9],b=e[10],E=e[11],S=e[12],I=e[13],C=e[14],D=e[15];return t[0]=d*(b*D-E*C)-v*(p*D-_*C)+I*(p*E-_*b),t[1]=-(n*(b*D-E*C)-v*(o*D-l*C)+I*(o*E-l*b)),t[2]=n*(p*D-_*C)-d*(o*D-l*C)+I*(o*_-l*p),t[3]=-(n*(p*E-_*b)-d*(o*E-l*b)+v*(o*_-l*p)),t[4]=-(c*(b*D-E*C)-y*(p*D-_*C)+S*(p*E-_*b)),t[5]=i*(b*D-E*C)-y*(o*D-l*C)+S*(o*E-l*b),t[6]=-(i*(p*D-_*C)-c*(o*D-l*C)+S*(o*_-l*p)),t[7]=i*(p*E-_*b)-c*(o*E-l*b)+y*(o*_-l*p),t[8]=c*(v*D-E*I)-y*(d*D-_*I)+S*(d*E-_*v),t[9]=-(i*(v*D-E*I)-y*(n*D-l*I)+S*(n*E-l*v)),t[10]=i*(d*D-_*I)-c*(n*D-l*I)+S*(n*_-l*d),t[11]=-(i*(d*E-_*v)-c*(n*E-l*v)+y*(n*_-l*d)),t[12]=-(c*(v*C-b*I)-y*(d*C-p*I)+S*(d*b-p*v)),t[13]=i*(v*C-b*I)-y*(n*C-o*I)+S*(n*b-o*v),t[14]=-(i*(d*C-p*I)-c*(n*C-o*I)+S*(n*p-o*d)),t[15]=i*(d*b-p*v)-c*(n*b-o*v)+y*(n*p-o*d),t},lt.determinant=function(t){var e=t[0],i=t[1],n=t[2],o=t[3],l=t[4],c=t[5],d=t[6],p=t[7],_=t[8],y=t[9],v=t[10],b=t[11],E=t[12],S=t[13],I=t[14],C=t[15];return(e*c-i*l)*(v*C-b*I)-(e*d-n*l)*(y*C-b*S)+(e*p-o*l)*(y*I-v*S)+(i*d-n*c)*(_*C-b*E)-(i*p-o*c)*(_*I-v*E)+(n*p-o*d)*(_*S-y*E)}
1,lt.multiply=il,lt.translate=function(t,e,i){var n,o,l,c,d,p,_,y,v,b,E,S,I=i[0],C=i[1],D=i[2];return e===t?(t[12]=e[0]*I+e[4]*C+e[8]*D+e[12],t[13]=e[1]*I+e[5]*C+e[9]*D+e[13],t[14]=e[2]*I+e[6]*C+e[10]*D+e[14],t[15]=e[3]*I+e[7]*C+e[11]*D+e[15]):(o=e[1],l=e[2],c=e[3],d=e[4],p=e[5],_=e[6],y=e[7],v=e[8],b=e[9],E=e[10],S=e[11],t[0]=n=e[0],t[1]=o,t[2]=l,t[3]=c,t[4]=d,t[5]=p,t[6]=_,t[7]=y,t[8]=v,t[9]=b,t[10]=E,t[11]=S,t[12]=n*I+d*C+v*D+e[12],t[13]=o*I+p*C+b*D+e[13],t[14]=l*I+_*C+E*D+e[14],t[15]=c*I+y*C+S*D+e[15]),t},lt.scale=function(t,e,i){var n=i[0],o=i[1],l=i[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*o,t[5]=e[5]*o,t[6]=e[6]*o,t[7]=e[7]*o,t[8]=e[8]*l,t[9]=e[9]*l,t[10]=e[10]*l,t[11]=e[11]*l,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},lt.rotate=function(t,e,i,n){var o,l,c,d,p,_,y,v,b,E,S,I,C,D,V,U,j,X,H,ie,ne,ue,ye,pe,Te=n[0],ze=n[1],be=n[2],Ae=Math.hypot(Te,ze,be);return Ae<si.EPSILON?null:(Te*=Ae=1/Ae,ze*=Ae,be*=Ae,o=Math.sin(i),l=Math.cos(i),p=e[1],_=e[2],y=e[3],b=e[5],E=e[6],S=e[7],C=e[9],D=e[10],V=e[11],U=Te*Te*(c=1-l)+l,H=Te*ze*c-be*o,ie=ze*ze*c+l,ne=be*ze*c+Te*o,ue=Te*be*c+ze*o,ye=ze*be*c-Te*o,pe=be*be*c+l,t[0]=(d=e[0])*U+(v=e[4])*(j=ze*Te*c+be*o)+(I=e[8])*(X=be*Te*c-ze*o),t[1]=p*U+b*j+C*X,t[2]=_*U+E*j+D*X,t[3]=y*U+S*j+V*X,t[4]=d*H+v*ie+I*ne,t[5]=p*H+b*ie+C*ne,t[6]=_*H+E*ie+D*ne,t[7]=y*H+S*ie+V*ne,t[8]=d*ue+v*ye+I*pe,t[9]=p*ue+b*ye+C*pe,t[10]=_*ue+E*ye+D*pe,t[11]=y*ue+S*ye+V*pe,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},lt.rotateX=function(t,e,i){var n=Math.sin(i),o=Math.cos(i),l=e[4],c=e[5],d=e[6],p=e[7],_=e[8],y=e[9],v=e[10],b=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=l*o+_*n,t[5]=c*o+y*n,t[6]=d*o+v*n,t[7]=p*o+b*n,t[8]=_*o-l*n,t[9]=y*o-c*n,t[10]=v*o-d*n,t[11]=b*o-p*n,t},lt.rotateY=function(t,e,i){var n=Math.sin(i),o=Math.cos(i),l=e[0],c=e[1],d=e[2],p=e[3],_=e[8],y=e[9],v=e[10],b=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=l*o-_*n,t[1]=c*o-y*n,t[2]=d*o-v*n,t[3]=p*o-b*n,t[8]=l*n+_*o,t[9]=c*n+y*o,t[10]=d*n+v*o,t[11]=p*n+b*o,t},lt.rotateZ=function(t,e,i){var n=Math.sin(i),o=Math.cos(i),l=e[0],c=e[1],d=e[2],p=e[3],_=e[4],y=e[5],v=e[6],b=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=l*o+_*n,t[1]=c*o+y*n,t[2]=d*o+v*n,t[3]=p*o+b*n,t[4]=_*o-l*n,t[5]=y*o-c*n,t[6]=v*o-d*n,t[7]=b*o-p*n,t},lt.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},lt.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},lt.fromRotation=function(t,e,i){var n,o,l,c=i[0],d=i[1],p=i[2],_=Math.hypot(c,d,p);return _<si.EPSILON?null:(c*=_=1/_,d*=_,p*=_,n=Math.sin(e),o=Math.cos(e),t[0]=c*c*(l=1-o)+o,t[1]=d*c*l+p*n,t[2]=p*c*l-d*n,t[3]=0,t[4]=c*d*l-p*n,t[5]=d*d*l+o,t[6]=p*d*l+c*n,t[7]=0,t[8]=c*p*l+d*n,t[9]=d*p*l-c*n,t[10]=p*p*l+o,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},lt.fromXRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=i,t[7]=0,t[8]=0,t[9]=-i,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},lt.fromYRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-i,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=i,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},lt.fromZRotation=function(t,e){var i=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=i,t[2]=0,t[3]=0,t[4]=-i,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},lt.fromRotationTranslation=js,lt.fromQuat2=function(t,e){var i=new si.ARRAY_TYPE(3),n=-e[0],o=-e[1],l=-e[2],c=e[3],d=e[4],p=e[5],_=e[6],y=e[7],v=n*n+o*o+l*l+c*c;return v>0?(i[0]=2*(d*c+y*n+p*l-_*o)/v,i[1]=2*(p*c+y*o+_*n-d*l)/v,i[2]=2*(_*c+y*l+d*o-p*n)/v):(i[0]=2*(d*c+y*n+p*l-_*o),i[1]=2*(p*c+y*o+_*n-d*l),i[2]=2*(_*c+y*l+d*o-p*n)),js(t,e,i),t},lt.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},lt.getScaling=Do,lt.getRotation=function(t,e){var i=new si.ARRAY_TYPE(3);Do(i,e);var n=1/i[0],o=1/i[1],l=1/i[2],c=e[0]*n,d=e[1]*o,p=e[2]*l,_=e[4]*n,y=e[5]*o,v=e[6]*l,b=e[8]*n,E=e[9]*o,S=e[10]*l,I=c+y+S,C=0;return I>0?(C=2*Math.sqrt(I+1),t[3]=.25*C,t[0]=(v-E)/C,t[1]=(b-p)/C,t[2]=(d-_)/C):c>y&&c>S?(C=2*Math.sqrt(1+c-y-S),t[3]=(v-E)/C,t[0]=.25*C,t[1]=(d+_)/C,t[2]=(b+p)/C):y>S?(C=2*Math.sqrt(1+y-c-S),t[3]=(b-p)/C,t[0]=(d+_)/C,t[1]=.25*C,t[2]=(v+E)/C):(C=2*Math.sqrt(1+S-c-y),t[3]=(d-_)/C,t[0]=(b+p)/C,t[1]=(v+E)/C,t[2]=.25*C),t}
1,lt.fromRotationTranslationScale=function(t,e,i,n){var o=e[0],l=e[1],c=e[2],d=e[3],p=o+o,_=l+l,y=c+c,v=o*p,b=o*_,E=o*y,S=l*_,I=l*y,C=c*y,D=d*p,V=d*_,U=d*y,j=n[0],X=n[1],H=n[2];return t[0]=(1-(S+C))*j,t[1]=(b+U)*j,t[2]=(E-V)*j,t[3]=0,t[4]=(b-U)*X,t[5]=(1-(v+C))*X,t[6]=(I+D)*X,t[7]=0,t[8]=(E+V)*H,t[9]=(I-D)*H,t[10]=(1-(v+S))*H,t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t},lt.fromRotationTranslationScaleOrigin=function(t,e,i,n,o){var l=e[0],c=e[1],d=e[2],p=e[3],_=l+l,y=c+c,v=d+d,b=l*_,E=l*y,S=l*v,I=c*y,C=c*v,D=d*v,V=p*_,U=p*y,j=p*v,X=n[0],H=n[1],ie=n[2],ne=o[0],ue=o[1],ye=o[2],pe=(1-(I+D))*X,Te=(E+j)*X,ze=(S-U)*X,be=(E-j)*H,Ae=(1-(b+D))*H,xe=(C+V)*H,Ce=(S+U)*ie,Re=(C-V)*ie,Pe=(1-(b+I))*ie;return t[0]=pe,t[1]=Te,t[2]=ze,t[3]=0,t[4]=be,t[5]=Ae,t[6]=xe,t[7]=0,t[8]=Ce,t[9]=Re,t[10]=Pe,t[11]=0,t[12]=i[0]+ne-(pe*ne+be*ue+Ce*ye),t[13]=i[1]+ue-(Te*ne+Ae*ue+Re*ye),t[14]=i[2]+ye-(ze*ne+xe*ue+Pe*ye),t[15]=1,t},lt.fromQuat=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=i+i,d=n+n,p=o+o,_=i*c,y=n*c,v=n*d,b=o*c,E=o*d,S=o*p,I=l*c,C=l*d,D=l*p;return t[0]=1-v-S,t[1]=y+D,t[2]=b-C,t[3]=0,t[4]=y-D,t[5]=1-_-S,t[6]=E+I,t[7]=0,t[8]=b+C,t[9]=E-I,t[10]=1-_-v,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},lt.frustum=function(t,e,i,n,o,l,c){var d=1/(i-e),p=1/(o-n),_=1/(l-c);return t[0]=2*l*d,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*l*p,t[6]=0,t[7]=0,t[8]=(i+e)*d,t[9]=(o+n)*p,t[10]=(c+l)*_,t[11]=-1,t[12]=0,t[13]=0,t[14]=c*l*2*_,t[15]=0,t},lt.perspectiveNO=Ar,lt.perspectiveZO=function(t,e,i,n,o){var l,c=1/Math.tan(e/2);return t[0]=c/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,o!=null&&o!==1/0?(t[10]=o*(l=1/(n-o)),t[14]=o*n*l):(t[10]=-1,t[14]=-n),t},lt.perspectiveFromFieldOfView=function(t,e,i,n){var o=Math.tan(e.upDegrees*Math.PI/180),l=Math.tan(e.downDegrees*Math.PI/180),c=Math.tan(e.leftDegrees*Math.PI/180),d=Math.tan(e.rightDegrees*Math.PI/180),p=2/(c+d),_=2/(o+l);return t[0]=p,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=_,t[6]=0,t[7]=0,t[8]=-(c-d)*p*.5,t[9]=(o-l)*_*.5,t[10]=n/(i-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*i/(i-n),t[15]=0,t},lt.orthoNO=Cr,lt.orthoZO=function(t,e,i,n,o,l,c){var d=1/(e-i),p=1/(n-o),_=1/(l-c);return t[0]=-2*d,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*p,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=_,t[11]=0,t[12]=(e+i)*d,t[13]=(o+n)*p,t[14]=l*_,t[15]=1,t},lt.lookAt=function(t,e,i,n){var o,l,c,d,p,_,y,v,b,E,S=e[0],I=e[1],C=e[2],D=n[0],V=n[1],U=n[2],j=i[0],X=i[1],H=i[2];return Math.abs(S-j)<si.EPSILON&&Math.abs(I-X)<si.EPSILON&&Math.abs(C-H)<si.EPSILON?tl(t):(y=S-j,v=I-X,b=C-H,o=V*(b*=E=1/Math.hypot(y,v,b))-U*(v*=E),l=U*(y*=E)-D*b,c=D*v-V*y,(E=Math.hypot(o,l,c))?(o*=E=1/E,l*=E,c*=E):(o=0,l=0,c=0),d=v*c-b*l,p=b*o-y*c,_=y*l-v*o,(E=Math.hypot(d,p,_))?(d*=E=1/E,p*=E,_*=E):(d=0,p=0,_=0),t[0]=o,t[1]=d,t[2]=y,t[3]=0,t[4]=l,t[5]=p,t[6]=v,t[7]=0,t[8]=c,t[9]=_,t[10]=b,t[11]=0,t[12]=-(o*S+l*I+c*C),t[13]=-(d*S+p*I+_*C),t[14]=-(y*S+v*I+b*C),t[15]=1,t)},lt.targetTo=function(t,e,i,n){var o=e[0],l=e[1],c=e[2],d=n[0],p=n[1],_=n[2],y=o-i[0],v=l-i[1],b=c-i[2],E=y*y+v*v+b*b;E>0&&(y*=E=1/Math.sqrt(E),v*=E,b*=E);var S=p*b-_*v,I=_*y-d*b,C=d*v-p*y;return(E=S*S+I*I+C*C)>0&&(S*=E=1/Math.sqrt(E),I*=E,C*=E),t[0]=S,t[1]=I,t[2]=C,t[3]=0,t[4]=v*C-b*I,t[5]=b*S-y*C,t[6]=y*I-v*S,t[7]=0,t[8]=y,t[9]=v,t[10]=b,t[11]=0,t[12]=o,t[13]=l,t[14]=c,t[15]=1,t},lt.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},lt.frob=function(t){return Math.hypot(t[0],t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],t[11],t[12],t[13],t[14],t[15])},lt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t[8]=e[8]+i[8],t[9]=e[9]+i[9],t[10]=e[10]+i[10],t[11]=e[11]+i[11],t[12]=e[12]+i[12],t[13]=e[13]+i[13],t[14]=e[14]+i[14],t[15]=e[15]+i[15],t},lt.subtract=Gs,lt.multiplyScalar=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*i,t[9]=e[9]*i,t[10]=e[10]*i,t[11]=e[11]*i,t[12]=e[12]*i,t[13]=e[13]*i,t[14]=e[14]*i,t[15]=e[15]*i,t}
1,lt.multiplyScalarAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t[4]=e[4]+i[4]*n,t[5]=e[5]+i[5]*n,t[6]=e[6]+i[6]*n,t[7]=e[7]+i[7]*n,t[8]=e[8]+i[8]*n,t[9]=e[9]+i[9]*n,t[10]=e[10]+i[10]*n,t[11]=e[11]+i[11]*n,t[12]=e[12]+i[12]*n,t[13]=e[13]+i[13]*n,t[14]=e[14]+i[14]*n,t[15]=e[15]+i[15]*n,t},lt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},lt.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=t[4],d=t[5],p=t[6],_=t[7],y=t[8],v=t[9],b=t[10],E=t[11],S=t[12],I=t[13],C=t[14],D=t[15],V=e[0],U=e[1],j=e[2],X=e[3],H=e[4],ie=e[5],ne=e[6],ue=e[7],ye=e[8],pe=e[9],Te=e[10],ze=e[11],be=e[12],Ae=e[13],xe=e[14],Ce=e[15];return Math.abs(i-V)<=si.EPSILON*Math.max(1,Math.abs(i),Math.abs(V))&&Math.abs(n-U)<=si.EPSILON*Math.max(1,Math.abs(n),Math.abs(U))&&Math.abs(o-j)<=si.EPSILON*Math.max(1,Math.abs(o),Math.abs(j))&&Math.abs(l-X)<=si.EPSILON*Math.max(1,Math.abs(l),Math.abs(X))&&Math.abs(c-H)<=si.EPSILON*Math.max(1,Math.abs(c),Math.abs(H))&&Math.abs(d-ie)<=si.EPSILON*Math.max(1,Math.abs(d),Math.abs(ie))&&Math.abs(p-ne)<=si.EPSILON*Math.max(1,Math.abs(p),Math.abs(ne))&&Math.abs(_-ue)<=si.EPSILON*Math.max(1,Math.abs(_),Math.abs(ue))&&Math.abs(y-ye)<=si.EPSILON*Math.max(1,Math.abs(y),Math.abs(ye))&&Math.abs(v-pe)<=si.EPSILON*Math.max(1,Math.abs(v),Math.abs(pe))&&Math.abs(b-Te)<=si.EPSILON*Math.max(1,Math.abs(b),Math.abs(Te))&&Math.abs(E-ze)<=si.EPSILON*Math.max(1,Math.abs(E),Math.abs(ze))&&Math.abs(S-be)<=si.EPSILON*Math.max(1,Math.abs(S),Math.abs(be))&&Math.abs(I-Ae)<=si.EPSILON*Math.max(1,Math.abs(I),Math.abs(Ae))&&Math.abs(C-xe)<=si.EPSILON*Math.max(1,Math.abs(C),Math.abs(xe))&&Math.abs(D-Ce)<=si.EPSILON*Math.max(1,Math.abs(D),Math.abs(Ce))},lt.sub=lt.mul=lt.ortho=lt.perspective=void 0;var si=function(t,e){if(t&&t.__esModule)return t;if(t===null||zo(t)!=="object"&&typeof t!="function")return{default:t};var i=el(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(mi);function el(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(el=function(n){return n?i:e})(t)}function tl(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function il(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=e[4],p=e[5],_=e[6],y=e[7],v=e[8],b=e[9],E=e[10],S=e[11],I=e[12],C=e[13],D=e[14],V=e[15],U=i[0],j=i[1],X=i[2],H=i[3];return t[0]=U*n+j*d+X*v+H*I,t[1]=U*o+j*p+X*b+H*C,t[2]=U*l+j*_+X*E+H*D,t[3]=U*c+j*y+X*S+H*V,t[4]=(U=i[4])*n+(j=i[5])*d+(X=i[6])*v+(H=i[7])*I,t[5]=U*o+j*p+X*b+H*C,t[6]=U*l+j*_+X*E+H*D,t[7]=U*c+j*y+X*S+H*V,t[8]=(U=i[8])*n+(j=i[9])*d+(X=i[10])*v+(H=i[11])*I,t[9]=U*o+j*p+X*b+H*C,t[10]=U*l+j*_+X*E+H*D,t[11]=U*c+j*y+X*S+H*V,t[12]=(U=i[12])*n+(j=i[13])*d+(X=i[14])*v+(H=i[15])*I,t[13]=U*o+j*p+X*b+H*C,t[14]=U*l+j*_+X*E+H*D,t[15]=U*c+j*y+X*S+H*V,t}function js(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=n+n,p=o+o,_=l+l,y=n*d,v=n*p,b=n*_,E=o*p,S=o*_,I=l*_,C=c*d,D=c*p,V=c*_;return t[0]=1-(E+I),t[1]=v+V,t[2]=b-D,t[3]=0,t[4]=v-V,t[5]=1-(y+I),t[6]=S+C,t[7]=0,t[8]=b+D,t[9]=S-C,t[10]=1-(y+E),t[11]=0,t[12]=i[0],t[13]=i[1],t[14]=i[2],t[15]=1,t}function Do(t,e){var i=e[4],n=e[5],o=e[6],l=e[8],c=e[9],d=e[10];return t[0]=Math.hypot(e[0],e[1],e[2]),t[1]=Math.hypot(i,n,o),t[2]=Math.hypot(l,c,d),t}function Ar(t,e,i,n,o){var l,c=1/Math.tan(e/2);return t[0]=c/i,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,o!=null&&o!==1/0?(t[10]=(o+n)*(l=1/(n-o)),t[14]=2*o*n*l):(t[10]=-1,t[14]=-2*n),t}function Cr(t,e,i,n,o,l,c){var d=1/(e-i),p=1/(n-o),_=1/(l-c);return t[0]=-2*d,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*p,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*_,t[11]=0,t[12]=(e+i)*d,t[13]=(o+n)*p,t[14]=(c+l)*_,t[15]=1,t}function Gs(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t[4]=e[4]-i[4],t[5]=e[5]-i[5],t[6]=e[6]-i[6],t[7]=e[7]-i[7],t[8]=e[8]-i[8],t[9]=e[9]-i[9],t[10]=e[10]-i[10],t[11]=e[11]-i[11],t[12]=e[12]-i[12],t[13]=e[13]-i[13],t[14]=e[14]-i[14],t[15]=e[15]-i[15],t}lt.perspective=Ar,lt.ortho=Cr,lt.mul=il,lt.sub=Gs;var at={},ct={};function Lo(t){return Lo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Lo(t)}
1Object.defineProperty(ct,"__esModule",{value:!0}),ct.create=Ro,ct.clone=function(t){var e=new tr.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},ct.length=ko,ct.fromValues=function(t,e,i){var n=new tr.ARRAY_TYPE(3);return n[0]=t,n[1]=e,n[2]=i,n},ct.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},ct.set=function(t,e,i,n){return t[0]=e,t[1]=i,t[2]=n,t},ct.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t},ct.subtract=qs,ct.multiply=Sn,ct.divide=Wn,ct.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},ct.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},ct.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t},ct.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t},ct.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},ct.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t},ct.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t},ct.distance=Hn,ct.squaredDistance=Zs,ct.squaredLength=Oo,ct.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},ct.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},ct.normalize=function(t,e){var i=e[0],n=e[1],o=e[2],l=i*i+n*n+o*o;return l>0&&(l=1/Math.sqrt(l)),t[0]=e[0]*l,t[1]=e[1]*l,t[2]=e[2]*l,t},ct.dot=Bo,ct.cross=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=i[0],d=i[1],p=i[2];return t[0]=o*p-l*d,t[1]=l*c-n*p,t[2]=n*d-o*c,t},ct.lerp=function(t,e,i,n){var o=e[0],l=e[1],c=e[2];return t[0]=o+n*(i[0]-o),t[1]=l+n*(i[1]-l),t[2]=c+n*(i[2]-c),t},ct.hermite=function(t,e,i,n,o,l){var c=l*l,d=c*(2*l-3)+1,p=c*(l-2)+l,_=c*(l-1),y=c*(3-2*l);return t[0]=e[0]*d+i[0]*p+n[0]*_+o[0]*y,t[1]=e[1]*d+i[1]*p+n[1]*_+o[1]*y,t[2]=e[2]*d+i[2]*p+n[2]*_+o[2]*y,t},ct.bezier=function(t,e,i,n,o,l){var c=1-l,d=c*c,p=l*l,_=d*c,y=3*l*d,v=3*p*c,b=p*l;return t[0]=e[0]*_+i[0]*y+n[0]*v+o[0]*b,t[1]=e[1]*_+i[1]*y+n[1]*v+o[1]*b,t[2]=e[2]*_+i[2]*y+n[2]*v+o[2]*b,t},ct.random=function(t,e){e=e||1;var i=2*tr.RANDOM()*Math.PI,n=2*tr.RANDOM()-1,o=Math.sqrt(1-n*n)*e;return t[0]=Math.cos(i)*o,t[1]=Math.sin(i)*o,t[2]=n*e,t},ct.transformMat4=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=i[3]*n+i[7]*o+i[11]*l+i[15];return t[0]=(i[0]*n+i[4]*o+i[8]*l+i[12])/(c=c||1),t[1]=(i[1]*n+i[5]*o+i[9]*l+i[13])/c,t[2]=(i[2]*n+i[6]*o+i[10]*l+i[14])/c,t},ct.transformMat3=function(t,e,i){var n=e[0],o=e[1],l=e[2];return t[0]=n*i[0]+o*i[3]+l*i[6],t[1]=n*i[1]+o*i[4]+l*i[7],t[2]=n*i[2]+o*i[5]+l*i[8],t},ct.transformQuat=function(t,e,i){var n=i[0],o=i[1],l=i[2],c=e[0],d=e[1],p=e[2],_=o*p-l*d,y=l*c-n*p,v=n*d-o*c,b=o*v-l*y,E=l*_-n*v,S=n*y-o*_,I=2*i[3];return y*=I,v*=I,E*=2,S*=2,t[0]=c+(_*=I)+(b*=2),t[1]=d+y+E,t[2]=p+v+S,t},ct.rotateX=function(t,e,i,n){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[0],l[1]=o[1]*Math.cos(n)-o[2]*Math.sin(n),l[2]=o[1]*Math.sin(n)+o[2]*Math.cos(n),t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},ct.rotateY=function(t,e,i,n){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[2]*Math.sin(n)+o[0]*Math.cos(n),l[1]=o[1],l[2]=o[2]*Math.cos(n)-o[0]*Math.sin(n),t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},ct.rotateZ=function(t,e,i,n){var o=[],l=[];return o[0]=e[0]-i[0],o[1]=e[1]-i[1],o[2]=e[2]-i[2],l[0]=o[0]*Math.cos(n)-o[1]*Math.sin(n),l[1]=o[0]*Math.sin(n)+o[1]*Math.cos(n),l[2]=o[2],t[0]=l[0]+i[0],t[1]=l[1]+i[1],t[2]=l[2]+i[2],t},ct.angle=function(t,e){var i=t[0],n=t[1],o=t[2],l=e[0],c=e[1],d=e[2],p=Math.sqrt(i*i+n*n+o*o)*Math.sqrt(l*l+c*c+d*d),_=p&&Bo(t,e)/p;return Math.acos(Math.min(Math.max(_,-1),1))},ct.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t},ct.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},ct.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},ct.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=e[0],c=e[1],d=e[2];return Math.abs(i-l)<=tr.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(n-c)<=tr.EPSILON*Math.max(1,Math.abs(n),Math.abs(c))&&Math.abs(o-d)<=tr.EPSILON*Math.max(1,Math.abs(o),Math.abs(d))},ct.forEach=ct.sqrLen=ct.len=ct.sqrDist=ct.dist=ct.div=ct.mul=ct.sub=void 0;var tr=function(t,e){if(t&&t.__esModule)return t;if(t===null||Lo(t)!=="object"&&typeof t!="function")return{default:t};var i=$n(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(mi);function $n(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return($n=function(n){return n?i:e})(t)}function Ro(){var t=new tr.ARRAY_TYPE(3);return tr.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function ko(t){return Math.hypot(t[0],t[1],t[2])}function qs(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t}
1function Sn(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t}function Wn(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t}function Hn(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])}function Zs(t,e){var i=e[0]-t[0],n=e[1]-t[1],o=e[2]-t[2];return i*i+n*n+o*o}function Oo(t){var e=t[0],i=t[1],n=t[2];return e*e+i*i+n*n}function Bo(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}ct.sub=qs,ct.mul=Sn,ct.div=Wn,ct.dist=Hn,ct.sqrDist=Zs,ct.len=ko,ct.sqrLen=Oo;var yr,rl=(yr=Ro(),function(t,e,i,n,o,l){var c,d;for(e||(e=3),i||(i=0),d=n?Math.min(n*e+i,t.length):t.length,c=i;c<d;c+=e)yr[0]=t[c],yr[1]=t[c+1],yr[2]=t[c+2],o(yr,yr,l),t[c]=yr[0],t[c+1]=yr[1],t[c+2]=yr[2];return t});ct.forEach=rl;var ut={};function $s(t){return $s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$s(t)}Object.defineProperty(ut,"__esModule",{value:!0}),ut.create=Xn,ut.clone=function(t){var e=new gi.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},ut.fromValues=function(t,e,i,n){var o=new gi.ARRAY_TYPE(4);return o[0]=t,o[1]=e,o[2]=i,o[3]=n,o},ut.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},ut.set=function(t,e,i,n,o){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t},ut.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t},ut.subtract=Zr,ut.multiply=$r,ut.divide=Ws,ut.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},ut.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},ut.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t[2]=Math.min(e[2],i[2]),t[3]=Math.min(e[3],i[3]),t},ut.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t[2]=Math.max(e[2],i[2]),t[3]=Math.max(e[3],i[3]),t},ut.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},ut.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t},ut.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t[2]=e[2]+i[2]*n,t[3]=e[3]+i[3]*n,t},ut.distance=Mn,ut.squaredDistance=In,ut.length=No,ut.squaredLength=Vo,ut.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},ut.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t[3]=1/e[3],t},ut.normalize=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=i*i+n*n+o*o+l*l;return c>0&&(c=1/Math.sqrt(c)),t[0]=i*c,t[1]=n*c,t[2]=o*c,t[3]=l*c,t},ut.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},ut.cross=function(t,e,i,n){var o=i[0]*n[1]-i[1]*n[0],l=i[0]*n[2]-i[2]*n[0],c=i[0]*n[3]-i[3]*n[0],d=i[1]*n[2]-i[2]*n[1],p=i[1]*n[3]-i[3]*n[1],_=i[2]*n[3]-i[3]*n[2],y=e[0],v=e[1],b=e[2],E=e[3];return t[0]=v*_-b*p+E*d,t[1]=-y*_+b*c-E*l,t[2]=y*p-v*c+E*o,t[3]=-y*d+v*l-b*o,t},ut.lerp=function(t,e,i,n){var o=e[0],l=e[1],c=e[2],d=e[3];return t[0]=o+n*(i[0]-o),t[1]=l+n*(i[1]-l),t[2]=c+n*(i[2]-c),t[3]=d+n*(i[3]-d),t},ut.random=function(t,e){var i,n,o,l,c,d;e=e||1;do c=(i=2*gi.RANDOM()-1)*i+(n=2*gi.RANDOM()-1)*n;while(c>=1);do d=(o=2*gi.RANDOM()-1)*o+(l=2*gi.RANDOM()-1)*l;while(d>=1);var p=Math.sqrt((1-c)/d);return t[0]=e*i,t[1]=e*n,t[2]=e*o*p,t[3]=e*l*p,t},ut.transformMat4=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3];return t[0]=i[0]*n+i[4]*o+i[8]*l+i[12]*c,t[1]=i[1]*n+i[5]*o+i[9]*l+i[13]*c,t[2]=i[2]*n+i[6]*o+i[10]*l+i[14]*c,t[3]=i[3]*n+i[7]*o+i[11]*l+i[15]*c,t},ut.transformQuat=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=i[0],d=i[1],p=i[2],_=i[3],y=_*n+d*l-p*o,v=_*o+p*n-c*l,b=_*l+c*o-d*n,E=-c*n-d*o-p*l;return t[0]=y*_+E*-c+v*-p-b*-d,t[1]=v*_+E*-d+b*-c-y*-p,t[2]=b*_+E*-p+y*-d-v*-c,t[3]=e[3],t},ut.zero=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},ut.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},ut.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},ut.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=e[0],d=e[1],p=e[2],_=e[3];return Math.abs(i-c)<=gi.EPSILON*Math.max(1,Math.abs(i),Math.abs(c))&&Math.abs(n-d)<=gi.EPSILON*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(o-p)<=gi.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(l-_)<=gi.EPSILON*Math.max(1,Math.abs(l),Math.abs(_))},ut.forEach=ut.sqrLen=ut.len=ut.sqrDist=ut.dist=ut.div=ut.mul=ut.sub=void 0;var gi=function(t,e){if(t&&t.__esModule)return t;if(t===null||$s(t)!=="object"&&typeof t!="function")return{default:t};var i=Fo(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(mi);function Fo(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Fo=function(n){return n?i:e})(t)}function Xn(){var t=new gi.ARRAY_TYPE(4);return gi.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[3]=0),t}function Zr(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t[2]=e[2]-i[2],t[3]=e[3]-i[3],t}function $r(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t[2]=e[2]*i[2],t[3]=e[3]*i[3],t}function Ws(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t[2]=e[2]/i[2],t[3]=e[3]/i[3],t}function Mn(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2],e[3]-t[3])}function In(t,e){var i=e[0]-t[0],n=e[1]-t[1],o=e[2]-t[2],l=e[3]-t[3];return i*i+n*n+o*o+l*l}function No(t){return Math.hypot(t[0],t[1],t[2],t[3])}function Vo(t){var e=t[0],i=t[1],n=t[2],o=t[3];return e*e+i*i+n*n+o*o}ut.sub=Zr,ut.mul=$r,ut.div=Ws,ut.dist=Mn,ut.sqrDist=In,ut.len=No,ut.sqrLen=Vo;var nl=function(){var t=Xn();return function(e,i,n,o,l,c){var d,p;for(i||(i=4),n||(n=0),p=o?Math.min(o*i+n,e.length):e.length,d=n;d<p;d+=i)t[0]=e[d],t[1]=e[d+1],t[2]=e[d+2],t[3]=e[d+3],l(t,t,c),e[d]=t[0],e[d+1]=t[1],e[d+2]=t[2],e[d+3]=t[3];return e}}();function Uo(t){return Uo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uo(t)}
1ut.forEach=nl,Object.defineProperty(at,"__esModule",{value:!0}),at.create=jo,at.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},at.setAxisAngle=Hs,at.getAxisAngle=function(t,e){var i=2*Math.acos(e[3]),n=Math.sin(i/2);return n>xr.EPSILON?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),i},at.getAngle=function(t,e){var i=ee(t,e);return Math.acos(2*i*i-1)},at.multiply=Go,at.rotateX=function(t,e,i){i*=.5;var n=e[0],o=e[1],l=e[2],c=e[3],d=Math.sin(i),p=Math.cos(i);return t[0]=n*p+c*d,t[1]=o*p+l*d,t[2]=l*p-o*d,t[3]=c*p-n*d,t},at.rotateY=function(t,e,i){i*=.5;var n=e[0],o=e[1],l=e[2],c=e[3],d=Math.sin(i),p=Math.cos(i);return t[0]=n*p-l*d,t[1]=o*p+c*d,t[2]=l*p+n*d,t[3]=c*p-o*d,t},at.rotateZ=function(t,e,i){i*=.5;var n=e[0],o=e[1],l=e[2],c=e[3],d=Math.sin(i),p=Math.cos(i);return t[0]=n*p+o*d,t[1]=o*p-n*d,t[2]=l*p+c*d,t[3]=c*p-l*d,t},at.calculateW=function(t,e){var i=e[0],n=e[1],o=e[2];return t[0]=i,t[1]=n,t[2]=o,t[3]=Math.sqrt(Math.abs(1-i*i-n*n-o*o)),t},at.exp=oe,at.ln=L,at.pow=function(t,e,i){return L(t,e),J(t,t,i),oe(t,t),t},at.slerp=F,at.random=function(t){var e=xr.RANDOM(),i=xr.RANDOM(),n=xr.RANDOM(),o=Math.sqrt(1-e),l=Math.sqrt(e);return t[0]=o*Math.sin(2*Math.PI*i),t[1]=o*Math.cos(2*Math.PI*i),t[2]=l*Math.sin(2*Math.PI*n),t[3]=l*Math.cos(2*Math.PI*n),t},at.invert=function(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=i*i+n*n+o*o+l*l,d=c?1/c:0;return t[0]=-i*d,t[1]=-n*d,t[2]=-o*d,t[3]=l*d,t},at.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},at.fromMat3=W,at.fromEuler=function(t,e,i,n){var o=.5*Math.PI/180;e*=o,i*=o,n*=o;var l=Math.sin(e),c=Math.cos(e),d=Math.sin(i),p=Math.cos(i),_=Math.sin(n),y=Math.cos(n);return t[0]=l*p*y-c*d*_,t[1]=c*d*y+l*p*_,t[2]=c*p*_-l*d*y,t[3]=c*p*y+l*d*_,t},at.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},at.setAxes=at.sqlerp=at.rotationTo=at.equals=at.exactEquals=at.normalize=at.sqrLen=at.squaredLength=at.len=at.length=at.lerp=at.dot=at.scale=at.mul=at.add=at.set=at.copy=at.fromValues=at.clone=void 0;var xr=Yn(mi),An=Yn($t),vr=Yn(ct),ki=Yn(ut);function ol(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(ol=function(n){return n?i:e})(t)}function Yn(t,e){if(t&&t.__esModule)return t;if(t===null||Uo(t)!=="object"&&typeof t!="function")return{default:t};var i=ol(e);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}function jo(){var t=new xr.ARRAY_TYPE(4);return xr.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t[3]=1,t}function Hs(t,e,i){i*=.5;var n=Math.sin(i);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(i),t}function Go(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=i[0],p=i[1],_=i[2],y=i[3];return t[0]=n*y+c*d+o*_-l*p,t[1]=o*y+c*p+l*d-n*_,t[2]=l*y+c*_+n*p-o*d,t[3]=c*y-n*d-o*p-l*_,t}function oe(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=Math.sqrt(i*i+n*n+o*o),d=Math.exp(l),p=c>0?d*Math.sin(c)/c:0;return t[0]=i*p,t[1]=n*p,t[2]=o*p,t[3]=d*Math.cos(c),t}function L(t,e){var i=e[0],n=e[1],o=e[2],l=e[3],c=Math.sqrt(i*i+n*n+o*o),d=c>0?Math.atan2(c,l)/c:0;return t[0]=i*d,t[1]=n*d,t[2]=o*d,t[3]=.5*Math.log(i*i+n*n+o*o+l*l),t}function F(t,e,i,n){var o,l,c,d,p,_=e[0],y=e[1],v=e[2],b=e[3],E=i[0],S=i[1],I=i[2],C=i[3];return(l=_*E+y*S+v*I+b*C)<0&&(l=-l,E=-E,S=-S,I=-I,C=-C),1-l>xr.EPSILON?(o=Math.acos(l),c=Math.sin(o),d=Math.sin((1-n)*o)/c,p=Math.sin(n*o)/c):(d=1-n,p=n),t[0]=d*_+p*E,t[1]=d*y+p*S,t[2]=d*v+p*I,t[3]=d*b+p*C,t}function W(t,e){var i,n=e[0]+e[4]+e[8];if(n>0)i=Math.sqrt(n+1),t[3]=.5*i,t[0]=(e[5]-e[7])*(i=.5/i),t[1]=(e[6]-e[2])*i,t[2]=(e[1]-e[3])*i;else{var o=0;e[4]>e[0]&&(o=1),e[8]>e[3*o+o]&&(o=2);var l=(o+1)%3,c=(o+2)%3;i=Math.sqrt(e[3*o+o]-e[3*l+l]-e[3*c+c]+1),t[o]=.5*i,t[3]=(e[3*l+c]-e[3*c+l])*(i=.5/i),t[l]=(e[3*l+o]+e[3*o+l])*i,t[c]=(e[3*c+o]+e[3*o+c])*i}return t}at.clone=ki.clone,at.fromValues=ki.fromValues,at.copy=ki.copy,at.set=ki.set,at.add=ki.add,at.mul=Go;var J=ki.scale;at.scale=J;var ee=ki.dot;at.dot=ee,at.lerp=ki.lerp;var ce=ki.length;at.length=ce,at.len=ce;var me=ki.squaredLength;at.squaredLength=me,at.sqrLen=me;var ae=ki.normalize;at.normalize=ae,at.exactEquals=ki.exactEquals,at.equals=ki.equals;var ge,Fe,Le,Ke=(ge=vr.create(),Fe=vr.fromValues(1,0,0),Le=vr.fromValues(0,1,0),function(t,e,
1i){var n=vr.dot(e,i);return n<-.999999?(vr.cross(ge,Fe,e),vr.len(ge)<1e-6&&vr.cross(ge,Le,e),vr.normalize(ge,ge),Hs(t,ge,Math.PI),t):n>.999999?(t[0]=0,t[1]=0,t[2]=0,t[3]=1,t):(vr.cross(ge,e,i),t[0]=ge[0],t[1]=ge[1],t[2]=ge[2],t[3]=1+n,ae(t,t))});at.rotationTo=Ke;var nt,wt,Tt=(nt=jo(),wt=jo(),function(t,e,i,n,o,l){return F(nt,e,o,l),F(wt,i,n,l),F(t,nt,wt,2*l*(1-l)),t});at.sqlerp=Tt;var pt,Lt=(pt=An.create(),function(t,e,i,n){return pt[0]=i[0],pt[3]=i[1],pt[6]=i[2],pt[1]=n[0],pt[4]=n[1],pt[7]=n[2],pt[2]=-e[0],pt[5]=-e[1],pt[8]=-e[2],ae(t,W(t,pt))});at.setAxes=Lt;var Xe={};function ai(t){return ai=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ai(t)}Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.create=function(){var t=new Wt.ARRAY_TYPE(8);return Wt.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0,t[4]=0,t[5]=0,t[6]=0,t[7]=0),t[3]=1,t},Xe.clone=function(t){var e=new Wt.ARRAY_TYPE(8);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e},Xe.fromValues=function(t,e,i,n,o,l,c,d){var p=new Wt.ARRAY_TYPE(8);return p[0]=t,p[1]=e,p[2]=i,p[3]=n,p[4]=o,p[5]=l,p[6]=c,p[7]=d,p},Xe.fromRotationTranslationValues=function(t,e,i,n,o,l,c){var d=new Wt.ARRAY_TYPE(8);d[0]=t,d[1]=e,d[2]=i,d[3]=n;var p=.5*o,_=.5*l,y=.5*c;return d[4]=p*n+_*i-y*e,d[5]=_*n+y*t-p*i,d[6]=y*n+p*e-_*t,d[7]=-p*t-_*e-y*i,d},Xe.fromRotationTranslation=ji,Xe.fromTranslation=function(t,e){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=.5*e[0],t[5]=.5*e[1],t[6]=.5*e[2],t[7]=0,t},Xe.fromRotation=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},Xe.fromMat4=function(t,e){var i=kt.create();wi.getRotation(i,e);var n=new Wt.ARRAY_TYPE(3);return wi.getTranslation(n,e),ji(t,i,n),t},Xe.copy=Gi,Xe.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t[6]=0,t[7]=0,t},Xe.set=function(t,e,i,n,o,l,c,d,p){return t[0]=e,t[1]=i,t[2]=n,t[3]=o,t[4]=l,t[5]=c,t[6]=d,t[7]=p,t},Xe.getDual=function(t,e){return t[0]=e[4],t[1]=e[5],t[2]=e[6],t[3]=e[7],t},Xe.setDual=function(t,e){return t[4]=e[0],t[5]=e[1],t[6]=e[2],t[7]=e[3],t},Xe.getTranslation=function(t,e){var i=e[4],n=e[5],o=e[6],l=e[7],c=-e[0],d=-e[1],p=-e[2],_=e[3];return t[0]=2*(i*_+l*c+n*p-o*d),t[1]=2*(n*_+l*d+o*c-i*p),t[2]=2*(o*_+l*p+i*d-n*c),t},Xe.translate=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=.5*i[0],p=.5*i[1],_=.5*i[2],y=e[4],v=e[5],b=e[6],E=e[7];return t[0]=n,t[1]=o,t[2]=l,t[3]=c,t[4]=c*d+o*_-l*p+y,t[5]=c*p+l*d-n*_+v,t[6]=c*_+n*p-o*d+b,t[7]=-n*d-o*p-l*_+E,t},Xe.rotateX=function(t,e,i){var n=-e[0],o=-e[1],l=-e[2],c=e[3],d=e[4],p=e[5],_=e[6],y=e[7],v=d*c+y*n+p*l-_*o,b=p*c+y*o+_*n-d*l,E=_*c+y*l+d*o-p*n,S=y*c-d*n-p*o-_*l;return kt.rotateX(t,e,i),t[4]=v*(c=t[3])+S*(n=t[0])+b*(l=t[2])-E*(o=t[1]),t[5]=b*c+S*o+E*n-v*l,t[6]=E*c+S*l+v*o-b*n,t[7]=S*c-v*n-b*o-E*l,t},Xe.rotateY=function(t,e,i){var n=-e[0],o=-e[1],l=-e[2],c=e[3],d=e[4],p=e[5],_=e[6],y=e[7],v=d*c+y*n+p*l-_*o,b=p*c+y*o+_*n-d*l,E=_*c+y*l+d*o-p*n,S=y*c-d*n-p*o-_*l;return kt.rotateY(t,e,i),t[4]=v*(c=t[3])+S*(n=t[0])+b*(l=t[2])-E*(o=t[1]),t[5]=b*c+S*o+E*n-v*l,t[6]=E*c+S*l+v*o-b*n,t[7]=S*c-v*n-b*o-E*l,t},Xe.rotateZ=function(t,e,i){var n=-e[0],o=-e[1],l=-e[2],c=e[3],d=e[4],p=e[5],_=e[6],y=e[7],v=d*c+y*n+p*l-_*o,b=p*c+y*o+_*n-d*l,E=_*c+y*l+d*o-p*n,S=y*c-d*n-p*o-_*l;return kt.rotateZ(t,e,i),t[4]=v*(c=t[3])+S*(n=t[0])+b*(l=t[2])-E*(o=t[1]),t[5]=b*c+S*o+E*n-v*l,t[6]=E*c+S*l+v*o-b*n,t[7]=S*c-v*n-b*o-E*l,t},Xe.rotateByQuatAppend=function(t,e,i){var n=i[0],o=i[1],l=i[2],c=i[3],d=e[0],p=e[1],_=e[2],y=e[3];return t[0]=d*c+y*n+p*l-_*o,t[1]=p*c+y*o+_*n-d*l,t[2]=_*c+y*l+d*o-p*n,t[3]=y*c-d*n-p*o-_*l,t[4]=(d=e[4])*c+(y=e[7])*n+(p=e[5])*l-(_=e[6])*o,t[5]=p*c+y*o+_*n-d*l,t[6]=_*c+y*l+d*o-p*n,t[7]=y*c-d*n-p*o-_*l,t},Xe.rotateByQuatPrepend=function(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=i[0],p=i[1],_=i[2],y=i[3];return t[0]=n*y+c*d+o*_-l*p,t[1]=o*y+c*p+l*d-n*_,t[2]=l*y+c*_+n*p-o*d,t[3]=c*y-n*d-o*p-l*_,t[4]=n*(y=i[7])+c*(d=i[4])+o*(_=i[6])-l*(p=i[5]),t[5]=o*y+c*p+l*d-n*_,t[6]=l*y+c*_+n*p-o*d,t[7]=c*y-n*d-o*p-l*_,t}
1,Xe.rotateAroundAxis=function(t,e,i,n){if(Math.abs(n)<Wt.EPSILON)return Gi(t,e);var o=Math.hypot(i[0],i[1],i[2]);n*=.5;var l=Math.sin(n),c=l*i[0]/o,d=l*i[1]/o,p=l*i[2]/o,_=Math.cos(n),y=e[0],v=e[1],b=e[2],E=e[3];t[0]=y*_+E*c+v*p-b*d,t[1]=v*_+E*d+b*c-y*p,t[2]=b*_+E*p+y*d-v*c,t[3]=E*_-y*c-v*d-b*p;var S=e[4],I=e[5],C=e[6],D=e[7];return t[4]=S*_+D*c+I*p-C*d,t[5]=I*_+D*d+C*c-S*p,t[6]=C*_+D*p+S*d-I*c,t[7]=D*_-S*c-I*d-C*p,t},Xe.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t[2]=e[2]+i[2],t[3]=e[3]+i[3],t[4]=e[4]+i[4],t[5]=e[5]+i[5],t[6]=e[6]+i[6],t[7]=e[7]+i[7],t},Xe.multiply=Kn,Xe.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t[2]=e[2]*i,t[3]=e[3]*i,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t},Xe.lerp=function(t,e,i,n){var o=1-n;return bc(e,i)<0&&(n=-n),t[0]=e[0]*o+i[0]*n,t[1]=e[1]*o+i[1]*n,t[2]=e[2]*o+i[2]*n,t[3]=e[3]*o+i[3]*n,t[4]=e[4]*o+i[4]*n,t[5]=e[5]*o+i[5]*n,t[6]=e[6]*o+i[6]*n,t[7]=e[7]*o+i[7]*n,t},Xe.invert=function(t,e){var i=Xs(e);return t[0]=-e[0]/i,t[1]=-e[1]/i,t[2]=-e[2]/i,t[3]=e[3]/i,t[4]=-e[4]/i,t[5]=-e[5]/i,t[6]=-e[6]/i,t[7]=e[7]/i,t},Xe.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=e[7],t},Xe.normalize=function(t,e){var i=Xs(e);if(i>0){i=Math.sqrt(i);var n=e[0]/i,o=e[1]/i,l=e[2]/i,c=e[3]/i,d=e[4],p=e[5],_=e[6],y=e[7],v=n*d+o*p+l*_+c*y;t[0]=n,t[1]=o,t[2]=l,t[3]=c,t[4]=(d-n*v)/i,t[5]=(p-o*v)/i,t[6]=(_-l*v)/i,t[7]=(y-c*v)/i}return t},Xe.str=function(t){return"quat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+")"},Xe.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]},Xe.equals=function(t,e){var i=t[0],n=t[1],o=t[2],l=t[3],c=t[4],d=t[5],p=t[6],_=t[7],y=e[0],v=e[1],b=e[2],E=e[3],S=e[4],I=e[5],C=e[6],D=e[7];return Math.abs(i-y)<=Wt.EPSILON*Math.max(1,Math.abs(i),Math.abs(y))&&Math.abs(n-v)<=Wt.EPSILON*Math.max(1,Math.abs(n),Math.abs(v))&&Math.abs(o-b)<=Wt.EPSILON*Math.max(1,Math.abs(o),Math.abs(b))&&Math.abs(l-E)<=Wt.EPSILON*Math.max(1,Math.abs(l),Math.abs(E))&&Math.abs(c-S)<=Wt.EPSILON*Math.max(1,Math.abs(c),Math.abs(S))&&Math.abs(d-I)<=Wt.EPSILON*Math.max(1,Math.abs(d),Math.abs(I))&&Math.abs(p-C)<=Wt.EPSILON*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(_-D)<=Wt.EPSILON*Math.max(1,Math.abs(_),Math.abs(D))},Xe.sqrLen=Xe.squaredLength=Xe.len=Xe.length=Xe.dot=Xe.mul=Xe.setReal=Xe.getReal=void 0;var Wt=Ii(mi),kt=Ii(at),wi=Ii(lt);function li(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(li=function(n){return n?i:e})(t)}function Ii(t,e){if(t&&t.__esModule)return t;if(t===null||ai(t)!=="object"&&typeof t!="function")return{default:t};var i=li(e);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}function ji(t,e,i){var n=.5*i[0],o=.5*i[1],l=.5*i[2],c=e[0],d=e[1],p=e[2],_=e[3];return t[0]=c,t[1]=d,t[2]=p,t[3]=_,t[4]=n*_+o*p-l*d,t[5]=o*_+l*c-n*p,t[6]=l*_+n*d-o*c,t[7]=-n*c-o*d-l*p,t}function Gi(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t}function Kn(t,e,i){var n=e[0],o=e[1],l=e[2],c=e[3],d=i[4],p=i[5],_=i[6],y=i[7],v=e[4],b=e[5],E=e[6],S=e[7],I=i[0],C=i[1],D=i[2],V=i[3];return t[0]=n*V+c*I+o*D-l*C,t[1]=o*V+c*C+l*I-n*D,t[2]=l*V+c*D+n*C-o*I,t[3]=c*V-n*I-o*C-l*D,t[4]=n*y+c*d+o*_-l*p+v*V+S*I+b*D-E*C,t[5]=o*y+c*p+l*d-n*_+b*V+S*C+E*I-v*D,t[6]=l*y+c*_+n*p-o*d+E*V+S*D+v*C-b*I,t[7]=c*y-n*d-o*p-l*_+S*V-v*I-b*C-E*D,t}Xe.getReal=kt.copy,Xe.setReal=kt.copy,Xe.mul=Kn;var bc=kt.dot;Xe.dot=bc;var wh=kt.length;Xe.length=wh,Xe.len=wh;var Xs=kt.squaredLength;Xe.squaredLength=Xs,Xe.sqrLen=Xs;var vt={};function wc(t){return wc=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wc(t)}
1Object.defineProperty(vt,"__esModule",{value:!0}),vt.create=Ec,vt.clone=function(t){var e=new Cn.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},vt.fromValues=function(t,e){var i=new Cn.ARRAY_TYPE(2);return i[0]=t,i[1]=e,i},vt.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},vt.set=function(t,e,i){return t[0]=e,t[1]=i,t},vt.add=function(t,e,i){return t[0]=e[0]+i[0],t[1]=e[1]+i[1],t},vt.subtract=Sc,vt.multiply=Mc,vt.divide=Ic,vt.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},vt.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},vt.min=function(t,e,i){return t[0]=Math.min(e[0],i[0]),t[1]=Math.min(e[1],i[1]),t},vt.max=function(t,e,i){return t[0]=Math.max(e[0],i[0]),t[1]=Math.max(e[1],i[1]),t},vt.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},vt.scale=function(t,e,i){return t[0]=e[0]*i,t[1]=e[1]*i,t},vt.scaleAndAdd=function(t,e,i,n){return t[0]=e[0]+i[0]*n,t[1]=e[1]+i[1]*n,t},vt.distance=Ac,vt.squaredDistance=Cc,vt.length=Pc,vt.squaredLength=zc,vt.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},vt.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},vt.normalize=function(t,e){var i=e[0],n=e[1],o=i*i+n*n;return o>0&&(o=1/Math.sqrt(o)),t[0]=e[0]*o,t[1]=e[1]*o,t},vt.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},vt.cross=function(t,e,i){var n=e[0]*i[1]-e[1]*i[0];return t[0]=t[1]=0,t[2]=n,t},vt.lerp=function(t,e,i,n){var o=e[0],l=e[1];return t[0]=o+n*(i[0]-o),t[1]=l+n*(i[1]-l),t},vt.random=function(t,e){e=e||1;var i=2*Cn.RANDOM()*Math.PI;return t[0]=Math.cos(i)*e,t[1]=Math.sin(i)*e,t},vt.transformMat2=function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[2]*o,t[1]=i[1]*n+i[3]*o,t},vt.transformMat2d=function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[2]*o+i[4],t[1]=i[1]*n+i[3]*o+i[5],t},vt.transformMat3=function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[3]*o+i[6],t[1]=i[1]*n+i[4]*o+i[7],t},vt.transformMat4=function(t,e,i){var n=e[0],o=e[1];return t[0]=i[0]*n+i[4]*o+i[12],t[1]=i[1]*n+i[5]*o+i[13],t},vt.rotate=function(t,e,i,n){var o=e[0]-i[0],l=e[1]-i[1],c=Math.sin(n),d=Math.cos(n);return t[0]=o*d-l*c+i[0],t[1]=o*c+l*d+i[1],t},vt.angle=function(t,e){var i=t[0],n=t[1],o=e[0],l=e[1],c=Math.sqrt(i*i+n*n)*Math.sqrt(o*o+l*l);return Math.acos(Math.min(Math.max(c&&(i*o+n*l)/c,-1),1))},vt.zero=function(t){return t[0]=0,t[1]=0,t},vt.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},vt.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},vt.equals=function(t,e){var i=t[0],n=t[1],o=e[0],l=e[1];return Math.abs(i-o)<=Cn.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))&&Math.abs(n-l)<=Cn.EPSILON*Math.max(1,Math.abs(n),Math.abs(l))},vt.forEach=vt.sqrLen=vt.sqrDist=vt.dist=vt.div=vt.mul=vt.sub=vt.len=void 0;var Cn=function(t,e){if(t&&t.__esModule)return t;if(t===null||wc(t)!=="object"&&typeof t!="function")return{default:t};var i=Tc(void 0);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}(mi);function Tc(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Tc=function(n){return n?i:e})(t)}function Ec(){var t=new Cn.ARRAY_TYPE(2);return Cn.ARRAY_TYPE!=Float32Array&&(t[0]=0,t[1]=0),t}function Sc(t,e,i){return t[0]=e[0]-i[0],t[1]=e[1]-i[1],t}function Mc(t,e,i){return t[0]=e[0]*i[0],t[1]=e[1]*i[1],t}function Ic(t,e,i){return t[0]=e[0]/i[0],t[1]=e[1]/i[1],t}function Ac(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1])}function Cc(t,e){var i=e[0]-t[0],n=e[1]-t[1];return i*i+n*n}function Pc(t){return Math.hypot(t[0],t[1])}function zc(t){var e=t[0],i=t[1];return e*e+i*i}vt.len=Pc,vt.sub=Sc,vt.mul=Mc,vt.div=Ic,vt.dist=Ac,vt.sqrDist=Cc,vt.sqrLen=zc;var Th=function(){var t=Ec();return function(e,i,n,o,l,c){var d,p;for(i||(i=2),n||(n=0),p=o?Math.min(o*i+n,e.length):e.length,d=n;d<p;d+=i)t[0]=e[d],t[1]=e[d+1],l(t,t,c),e[d]=t[0],e[d+1]=t[1];return e}}();function qo(t){return qo=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qo(t)}vt.forEach=Th,Object.defineProperty(xi,"__esModule",{value:!0}),s.aA=xi.vec4=s._=xi.vec3=xi.vec2=xi.quat2=s.av=xi.quat=s.ad=xi.mat4=s.bC=xi.mat3=
1xi.mat2d=s.aC=xi.mat2=xi.glMatrix=void 0;var sl=Wr(mi);xi.glMatrix=sl;var al=Wr(Qt);s.aC=xi.mat2=al;var Eh=Wr(Kt);xi.mat2d=Eh;var Sh=Wr($t);s.bC=xi.mat3=Sh;var Mh=Wr(lt);s.ad=xi.mat4=Mh;var Zo=Wr(at);s.av=xi.quat=Zo;var Ct=Wr(Xe);xi.quat2=Ct;var zp=Wr(vt);xi.vec2=zp;var Dp=Wr(ct);s._=xi.vec3=Dp;var Lp=Wr(ut);function Dc(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,i=new WeakMap;return(Dc=function(n){return n?i:e})(t)}function Wr(t,e){if(t&&t.__esModule)return t;if(t===null||qo(t)!=="object"&&typeof t!="function")return{default:t};var i=Dc(e);if(i&&i.has(t))return i.get(t);var n={},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var l in t)if(l!=="default"&&Object.prototype.hasOwnProperty.call(t,l)){var c=o?Object.getOwnPropertyDescriptor(t,l):null;c&&(c.get||c.set)?Object.defineProperty(n,l,c):n[l]=t[l]}return n.default=t,i&&i.set(t,n),n}s.aA=xi.vec4=Lp;var Lc=Ys;function Ys(t,e,i,n){this.cx=3*t,this.bx=3*(i-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(n-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=e,this.p2x=i,this.p2y=n}Ys.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,e){if(e===void 0&&(e=1e-6),t<0)return 0;if(t>1)return 1;for(var i=t,n=0;n<8;n++){var o=this.sampleCurveX(i)-t;if(Math.abs(o)<e)return i;var l=this.sampleCurveDerivativeX(i);if(Math.abs(l)<1e-6)break;i-=o/l}var c=0,d=1;for(i=t,n=0;n<20&&(o=this.sampleCurveX(i),!(Math.abs(o-t)<e));n++)t>o?c=i:d=i,i=.5*(d-c)+c;return i},solve:function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}};var Ks=Gr(Lc),ll=$o;function $o(t,e){this.x=t,this.y=e}$o.prototype={clone:function(){return new $o(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,e){return this.clone()._rotateAround(t,e)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var e=t.x-this.x,i=t.y-this.y;return e*e+i*i},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,e){return Math.atan2(this.x*e-this.y*t,this.x*t+this.y*e)},_matMult:function(t){var e=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=e,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var e=Math.cos(t),i=Math.sin(t),n=i*this.x+e*this.y;return this.x=e*this.x-i*this.y,this.y=n,this},_rotateAround:function(t,e){var i=Math.cos(t),n=Math.sin(t),o=e.y+n*(this.x-e.x)+i*(this.y-e.y);return this.x=e.x+i*(this.x-e.x)-n*(this.y-e.y),this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},$o.convert=function(t){return t instanceof $o?t:Array.isArray(t)?new $o(t[0],t[1]):t};var Ge=Gr(ll);const Rc=Math.PI/180,cl=180/Math.PI;function Pt(t){return t*Rc}function Hi(t){return t*cl}const Ih=[[0,0],[1,0],[1,1],[0,1]];function Js(t){if(t<=0)return 0;if(t>=1)return 1;const e=t*t,i=e*t;return 4*(t<.5?i:3*(t-e)+i-.75)}
1function Jn(t,e,i,n){const o=new Ks(t,e,i,n);return function(l){return o.solve(l)}}const Rp=Jn(.25,.1,.25,1);function ft(t,e,i){return Math.min(i,Math.max(e,t))}function Qs(t,e,i){return(i=ft((i-t)/(e-t),0,1))*i*(3-2*i)}function Qn(t,e,i){const n=i-e,o=((t-e)%n+n)%n+e;return o===e?i:o}function ir(t,e,i){if(!t.length)return i(null,[]);let n=t.length;const o=new Array(t.length);let l=null;t.forEach((c,d)=>{e(c,(p,_)=>{p&&(l=p),o[d]=_,--n==0&&i(l,o)})})}function kc(t){const e=[];for(const i in t)e.push(t[i]);return e}function Xi(t,...e){for(const i of e)for(const n in i)t[n]=i[n];return t}let Ah=1;function ul(){return Ah++}function hl(){return function t(e){return e?(e^Math.random()*(16>>e/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,t)}()}function Oc(t){return t<=1?1:Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function Bc(t){return!!t&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(t)}function dl(t,e){t.forEach(i=>{e[i]&&(e[i]=e[i].bind(e))})}function eo(t,e){return t.indexOf(e,t.length-e.length)!==-1}function Pn(t,e,i){const n={};for(const o in t)n[o]=e.call(this,t[o],o,t);return n}function Fc(t,e,i){const n={};for(const o in t)e.call(this,t[o],o,t)&&(n[o]=t[o]);return n}function Hr(t){return Array.isArray(t)?t.map(Hr):typeof t=="object"&&t?Pn(t,Hr):t}const Nc={};function vi(t){Nc[t]||(typeof console<"u"&&console.warn(t),Nc[t]=!0)}function Ei(t,e,i){return(i.y-t.y)*(e.x-t.x)>(e.y-t.y)*(i.x-t.x)}function to(t){let e=0;for(let i,n,o=0,l=t.length,c=l-1;o<l;c=o++)i=t[o],n=t[c],e+=(n.x-i.x)*(i.y+n.y);return e}function Yi([t,e,i]){const n=Pt(e+90),o=Pt(i);return{x:t*Math.cos(n)*Math.sin(o),y:t*Math.sin(n)*Math.sin(o),z:t*Math.cos(o),azimuthal:e,polar:i}}function ea(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Vc(t){const e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(i,n,o,l)=>{const c=o||l;return e[n]=!c||c.toLowerCase(),""}),e["max-age"]){const i=parseInt(e["max-age"],10);isNaN(i)?delete e["max-age"]:e["max-age"]=i}return e}let Uc,io,pl,Wo,ro,Ho,zn=null;function jc(t){try{const e=self[t];return e.setItem("_mapbox_test_",1),e.removeItem("_mapbox_test_"),!0}catch{return!1}}function ta(t,e){return[t[4*e],t[4*e+1],t[4*e+2],t[4*e+3]]}function Ch(t,e,i,n){for(;e<i;){const o=e+i>>1;t[o]<n?e=o+1:i=o}return e}function fl(t,e,i,n){for(;e<i;){const o=e+i>>1;t[o]<=n?e=o+1:i=o}return e}function ml(t){return t>0?1/(1.001-t):1+t}function Xo(t){return t>0?1-1/(1.001-t):-t}function _l(){return Uc==null&&(Uc=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Uc}const Oi={now:()=>Wo!==void 0?Wo:performance.now(),setNow(t){Wo=t},restoreNow(){Wo=void 0},frame(t){const e=requestAnimationFrame(t);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(t,e=0){const{width:i,height:n}=t;ro||(ro=document.createElement("canvas"));const o=ro.getContext("2d",{willReadFrequently:!0});if(!o)throw new Error("failed to create canvas 2d context");return(i>ro.width||n>ro.height)&&(ro.width=i,ro.height=n),o.clearRect(-e,-e,i+2*e,n+2*e),o.drawImage(t,0,0,i,n),o.getImageData(-e,-e,i+2*e,n+2*e)},resolveURL:t=>(io||(io=document.createElement("a")),io.href=t,io.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(pl==null&&(pl=window.matchMedia("(prefers-reduced-motion: reduce)")),pl.matches)},hasCanvasFingerprintNoise(){if(Ho!==void 0)return Ho;if(!_l())return Ho=!1,!1;const t=new OffscreenCanvas(85,1),e=t.getContext("2d",{willReadFrequently:!0});let i=0;for(let o=0;o<t.width;++o)e.fillStyle=`rgba(${i++},${i++},${i++}, 255)`,e.fillRect(o,0,1,1);const n=e.getImageData(0,0,t.width,t.height);i=0;for(let o=0;o<n.data.length;++o)if(o%4!=3&&i++!==n.data[o])return Ho=!0,!0;return Ho=!1,!1}};function Ph(t,e){const i=t.indexOf("?");if(i<0)return`${t}?${new URLSearchParams(e).toString()}`;const n=new URLSearchParams(t.slice(i));for(const o in e)n.set(o,e[o]);return`${t.slice(0,i)}?${n.toString()}`}
1function Gc(t,e={persistentParams:[]}){const i=t.indexOf("?");if(i<0)return t;const n=new URLSearchParams,o=new URLSearchParams(t.slice(i));for(const c of e.persistentParams){const d=o.get(c);d&&n.set(c,d)}const l=n.toString();return`${t.slice(0,i)}${l.length>0?`?${l}`:""}`}const qc="mapbox-tiles";let Zc=500,zh=50,an,gl;function $c(){try{return caches}catch{}}function ia(){const t=$c();t&&!an&&(an=t.open(qc))}let Wc=1/0;const ra={supported:!1,testSupport:function(t){!yl&&Yo&&(Hc?Lh(t):na=t)}};let na,Yo,yl=!1,Hc=!1;const Dh=typeof self<"u"?self:{};function Lh(t){const e=t.createTexture();t.bindTexture(t.TEXTURE_2D,e);try{if(t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,Yo),t.isContextLost())return;ra.supported=!0}catch{}t.deleteTexture(e),yl=!0}Dh.document&&(Yo=Dh.document.createElement("img"),Yo.onload=function(){na&&Lh(na),na=null,Hc=!0},Yo.onerror=function(){yl=!0,na=null},Yo.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const xl={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image",Model:"Model"};typeof Object.freeze=="function"&&Object.freeze(xl);class vl extends Error{constructor(e,i,n){i===401&&Tn(n)&&(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=n}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Xc=ea()?()=>self.worker&&self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,oa=function(t,e){if(!(/^file:/.test(i=t.url)||/^file:/.test(Xc())&&!/^\w+:/.test(i))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(n,o){const l=new AbortController,c=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,referrer:Xc(),referrerPolicy:n.referrerPolicy,signal:l.signal});let d=!1,p=!1;const _=(y=c.url).indexOf("sku=")>0&&Tn(y);var y;n.type==="json"&&c.headers.set("Accept","application/json");const v=(E,S,I)=>{if(p)return;if(E&&E.message!=="SecurityError"&&vi(E.toString()),S&&I)return b(S);const C=Date.now();fetch(c).then(D=>
1{if(D.ok){const V=_?D.clone():null;return b(D,V,C)}return o(new vl(D.statusText,D.status,n.url))}).catch(D=>{D.name!=="AbortError"&&o(new Error(`${D.message} ${n.url}`))})},b=(E,S,I)=>{(n.type==="arrayBuffer"?E.arrayBuffer():n.type==="json"?E.json():E.text()).then(C=>{p||(S&&I&&function(D,V,U){if(ia(),!an)return;const j=Vc(V.headers.get("Cache-Control")||"");if(j["no-store"])return;const X={status:V.status,statusText:V.statusText,headers:new Headers};V.headers.forEach((ne,ue)=>X.headers.set(ue,ne)),j["max-age"]&&X.headers.set("Expires",new Date(U+1e3*j["max-age"]).toUTCString());const H=X.headers.get("Expires");if(!H||new Date(H).getTime()-U<42e4)return;let ie=Gc(D.url,{persistentParams:["language","worldview"]});if(V.status===206){const ne=D.headers.get("Range");if(!ne)return;X.status=200,ie=Ph(ie,{range:ne})}(function(ne,ue){if(gl===void 0)try{new Response(new ReadableStream),gl=!0}catch{gl=!1}gl?ue(ne.body):ne.blob().then(ue)})(V,ne=>{const ue=new Response((ye=V.status)!==200&&ye!==404&&[101,103,204,205,304].includes(ye)?null:ne,X);var ye;ia(),an&&an.then(pe=>pe.put(ie,ue)).catch(pe=>vi(pe.message))})}(c,S,I),d=!0,o(null,C,E.headers.get("Cache-Control"),E.headers.get("Expires")))}).catch(C=>{p||o(new Error(C.message))})};return _?function(E,S){if(ia(),!an)return S(null);an.then(I=>
1{let C=Gc(E.url,{persistentParams:["language","worldview"]});const D=E.headers.get("Range");D&&(C=Ph(C,{range:D})),I.match(C).then(V=>{const U=function(j){if(!j)return!1;const X=new Date(j.headers.get("Expires")||0),H=Vc(j.headers.get("Cache-Control")||"");return X>Date.now()&&!H["no-cache"]}(V);I.delete(C),U&&I.put(C,V.clone()),S(null,V,U)}).catch(S)}).catch(S)}(c,v):v(null,null),{cancel:()=>{p=!0,d||l.abort()}}}(t,e);if(ea()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",t,e,void 0,!0)}var i;return function(n,o){const l=new XMLHttpRequest;l.open(n.method||"GET",n.url,!0),n.type==="arrayBuffer"&&(l.responseType="arraybuffer");for(const c in n.headers)l.setRequestHeader(c,n.headers[c]);return n.type==="json"&&(l.responseType="text",l.setRequestHeader("Accept","application/json")),l.withCredentials=n.credentials==="include",l.onerror=()=>{o(new Error(l.statusText))},l.onload=()=>{if((l.status>=200&&l.status<300||l.status===0)&&l.response!==null){let c=l.response;if(n.type==="json")try{c=JSON.parse(l.response)}catch(d){return o(d)}o(null,c,l.getResponseHeader("Cache-Control"),l.getResponseHeader("Expires"))}else o(new vl(l.statusText,l.status,n.url))},l.send(n.body),{cancel:()=>l.abort()}}(t,e)},Dn=function(t,e){return oa(Xi(t,{type:"arrayBuffer"}),e)};function Rh(t){const e=document.createElement("a");return e.href=t,e.protocol===location.protocol&&e.host===location.host}const Yc="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let bl,Xr;bl=[],Xr=0;const Kc=function(t,e){if(ra.supported&&(t.headers||(t.headers={}),t.headers.accept="image/webp,*/*"),Xr>=mt.MAX_PARALLEL_IMAGE_REQUESTS){const l={requestParameters:t,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return bl.push(l),l}Xr++;let i=!1;const n=()=>
1{if(!i)for(i=!0,Xr--;bl.length&&Xr<mt.MAX_PARALLEL_IMAGE_REQUESTS;){const l=bl.shift(),{requestParameters:c,callback:d,cancelled:p}=l;p||(l.cancel=Kc(c,d).cancel)}},o=Dn(t,(l,c,d,p)=>{n(),l?e(l):c&&(self.createImageBitmap?function(_,y){const v=new Blob([new Uint8Array(_)],{type:"image/png"});createImageBitmap(v).then(b=>{y(null,b)}).catch(b=>{y(new Error(`Could not load image because of ${b.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(c,(_,y)=>e(_,y,d,p)):function(_,y){const v=new Image;v.onload=()=>{y(null,v),URL.revokeObjectURL(v.src),v.onload=null,requestAnimationFrame(()=>{v.src=Yc})},v.onerror=()=>y(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 b=new Blob([new Uint8Array(_)],{type:"image/png"});v.src=_.byteLength?URL.createObjectURL(b):Yc}(c,(_,y)=>e(_,y,d,p)))});return{cancel:()=>{o.cancel(),n()}}},Jc="01",Qc="NO_ACCESS_TOKEN",kh=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function Pr(t){const e=t.match(kh);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function no(t){const e=t.params.length?`?${t.params.join("&")}`:"";return`${t.protocol}://${t.authority}${t.path}${e}`}const Oh="mapbox.eventData";function Bh(t){if(!t)return null;const e=t.split(".");if(!e||e.length!==3)return null;try{return JSON.parse(decodeURIComponent(atob(e[1]).split("").map(i=>"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)).join("")))}catch{return null}}class sa{constructor(e){this.type=e,this.anonId=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(e){const i=Bh(mt.ACCESS_TOKEN);let n="";return n=i&&i.u?btoa(encodeURIComponent(i.u).replace(/%([0-9A-F]{2})/g,(o,l)=>String.fromCharCode(+("0x"+l)))):mt.ACCESS_TOKEN||"",e?`${Oh}.${e}:${n}`:`${Oh}:${n}`}fetchEventData(){const e=jc("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid");if(e)try{const o=localStorage.getItem(i);o&&(this.eventData=JSON.parse(o));const l=localStorage.getItem(n);l&&(this.anonId=l)}catch{vi("Unable to read from LocalStorage")}}saveEventData(){const e=jc("localStorage"),i=this.getStorageKey(),n=this.getStorageKey("uuid"),o=this.anonId;if(e&&o)try{localStorage.setItem(n,o),Object.keys(this.eventData).length>=1&&localStorage.setItem(i,JSON.stringify(this.eventData))}catch{vi("Unable to write to LocalStorage")}}processRequests(e){}postEvent(e,i,n,o){if(!mt.EVENTS_URL)return;const l=Pr(mt.EVENTS_URL);l.params.push(`access_token=${o||mt.ACCESS_TOKEN||""}`);const c={event:this.type,created:new Date(e).toISOString()},d=i?Xi(c,i):c,p={url:no(l),headers:{"Content-Type":"text/plain"},body:JSON.stringify([d])};this.pendingRequest=function(_,y){return oa(Xi(_,{method:"POST"}),y)}(p,_=>{this.pendingRequest=null,n(_),this.saveEventData(),this.processRequests(o)})}queueRequest(e,i){this.queue.push(e),this.processRequests(i)}}const wl=new class extends sa{constructor(t){super("appUserTurnstile"),this._customAccessToken=t}postTurnstileEvent(t,e){mt.EVENTS_URL&&mt.ACCESS_TOKEN&&Array.isArray(t)&&t.some(i=>Dt(i)||Tn(i))&&this.queueRequest(Date.now(),e)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const e=Bh(mt.ACCESS_TOKEN),i=e?e.u:mt.ACCESS_TOKEN;let n=i!==this.eventData.tokenU;Bc(this.anonId)||(this.anonId=hl(),n=!0);const o=this.queue.shift();if(this.eventData.lastSuccess){const l=new Date(this.eventData.lastSuccess),c=new Date(o),d=(o-this.eventData.lastSuccess)/864e5;n=n||d>=1||d<-1||l.getDate()!==c.getDate()}else n=!0;n?this.postEvent(o,{sdkIdentifier:"mapbox-gl-js",sdkVersion:xt,skuId:Jc,"enabled.telemetry":!1,userId:this.anonId},l=>{l||(this.eventData.lastSuccess=o,this.eventData.tokenU=i)},t):this.processRequests()}},eu=wl.postTurnstileEvent.bind(wl),Tl=new class extends sa{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(t,e,i,n){this.skuToken=e,this.errorCb=n,mt.EVENTS_URL&&(i||mt.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(Qc)))}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{id:e,timestamp:i}=this.queue.shift();e&&this.success[e]||(this.anonId||this.fetchEventData(),Bc(this.anonId)||(this.anonId=hl()),this.postEvent(i,{sdkIdentifier:"mapbox-gl-js",sdkVersion:xt,skuId:Jc,skuToken:this.skuToken,userId:this.anonId},n=>{n?this.errorCb(n):e&&(this.success[e]=!0)},t))}remove(){this.errorCb=null}},kp=Tl.postMapLoadEvent.bind(Tl),Fh=new class extends sa{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(t){let e=this.mapInstanceIdMap.get(t);return e||(e=hl(),this.mapInstanceIdMap.set(t,e)),e}getEventId(t){const e=this.eventIdPerMapInstanceMap.get(t)||0;return this.eventIdPerMapInstanceMap.set(t,e+1),e}postStyleLoadEvent(t,e){const{map:i,style:n,importedStyles:o}=e;if(!mt.EVENTS_URL||!t&&!mt.ACCESS_TOKEN)return;const l=this.getMapInstanceId(i),c={mapInstanceId:l,eventId:this.getEventId(l),style:n};o.length&&(c.importedStyles=o),this.queueRequest({timestamp:Date.now(),payload:c},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:e,payload:i}=this.queue.shift();this.postEvent(e,i,()=>{},t)}},tu=Fh.postStyleLoadEvent.bind(Fh),Nh=new class extends sa{constructor(){super("gljs.performance")}postPerformanceEvent(t,e){mt.EVENTS_URL&&(t||mt.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:e},t)}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:e,performanceData:i}=this.queue.shift(),n=function(o){const l=performance.getEntriesByType("resource"),c=performance.getEntriesByType("mark"),d=function(E){const S={};if(E){for(const I in E)if(I!=="other")for(const C of E[I]){const D=`${I}ResolveRangeMin`,V=`${I}ResolveRangeMax`,U=`${I}RequestCount`,j=`${I}RequestCachedCount`;S[D]=Math.min(S[D]||1/0,C.startTime),S[V]=Math.max(S[V]||-1/0,C.responseEnd);const X=H=>{S[H]===void 0&&(S[H]=0),++S[H]};C.transferSize!==void 0&&C.transferSize===0&&X(j),X(U)}}return S}(function(E,S){const I={};if(E)for(const C of E){const D=S(C);I[D]===void 0&&(I[D]=[]),I[D].push(C)}return I}(l,Wa)),p=window.devicePixelRatio,_=navigator.connection||navigator.mozConnection||navigator.webkitConnection,y=_?_.effectiveType:void 0,v={counters:[],metadata:[],attributes:[]},b=(E,S,I)=>
1{I!=null&&E.push({name:S,value:I.toString()})};for(const E in d)b(v.counters,E,d[E]);if(o.interactionRange[0]!==1/0&&o.interactionRange[1]!==-1/0&&(b(v.counters,"interactionRangeMin",o.interactionRange[0]),b(v.counters,"interactionRangeMax",o.interactionRange[1])),c)for(const E of Object.keys(En)){const S=En[E],I=c.find(C=>C.name===S);I&&b(v.counters,S,I.startTime)}return b(v.counters,"visibilityHidden",o.visibilityHidden),b(v.attributes,"style",function(E){if(E)for(const S of E){const I=S.name.split("?")[0];if(jr(I)){const C=I.split("/").slice(-2);if(C.length===2)return`mapbox://styles/${C[0]}/${C[1]}`}}}(l)),b(v.attributes,"terrainEnabled",o.terrainEnabled?"true":"false"),b(v.attributes,"fogEnabled",o.fogEnabled?"true":"false"),b(v.attributes,"projection",o.projection),b(v.attributes,"zoom",o.zoom),b(v.metadata,"devicePixelRatio",p),b(v.metadata,"connectionEffectiveType",y),b(v.metadata,"navigatorUserAgent",navigator.userAgent),b(v.metadata,"screenWidth",window.screen.width),b(v.metadata,"screenHeight",window.screen.height),b(v.metadata,"windowWidth",window.innerWidth),b(v.metadata,"windowHeight",window.innerHeight),b(v.metadata,"mapWidth",o.width/p),b(v.metadata,"mapHeight",o.height/p),b(v.metadata,"webglRenderer",o.renderer),b(v.metadata,"webglVendor",o.vendor),b(v.metadata,"sdkVersion",xt),b(v.metadata,"sdkIdentifier","mapbox-gl-js"),v}(i);for(const o of n.metadata);for(const o of n.counters);for(const o of n.attributes);this.postEvent(e,n,()=>{},t)}},El=Nh.postPerformanceEvent.bind(Nh),Ko=new class extends sa{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(t,e,i,n){if(!mt.API_URL||!mt.SESSION_PATH)return;const o=Pr(mt.API_URL+mt.SESSION_PATH);o.params.push(`sku=${e||""}`),o.params.push(`access_token=${n||mt.ACCESS_TOKEN||""}`);const l={url:no(o),headers:{"Content-Type":"text/plain"}};this.pendingRequest=function(c,d){return oa(Xi(c,{method:"GET"}),d)}(l,c=>{this.pendingRequest=null,i(c),this.saveEventData(),this.processRequests(n)})}getSessionAPI(t,e,i,n){this.skuToken=e,this.errorCb=n,mt.SESSION_PATH&&mt.API_URL&&(i||mt.ACCESS_TOKEN?this.queueRequest({id:t,timestamp:Date.now()},i):this.errorCb(new Error(Qc)))}processRequests(t){if(this.pendingRequest||this.queue.length===0)return;const{id:e,timestamp:i}=this.queue.shift();e&&this.success[e]||this.getSession(i,this.skuToken,n=>{n?this.errorCb(n):e&&(this.success[e]=!0)},t)}remove(){this.errorCb=null}},Vh=Ko.getSessionAPI.bind(Ko),oo=new Set;var aa={exports:{}},Op={exports:function(t,e){var i,n,o,l,c,d,p,_;for(n=t.length-(i=3&t.length),o=e,c=3432918353,d=461845907,_=0;_<n;)p=255&t.charCodeAt(_)|(255&t.charCodeAt(++_))<<8|(255&t.charCodeAt(++_))<<16|(255&t.charCodeAt(++_))<<24,++_,o=27492+(65535&(l=5*(65535&(o=(o^=p=(65535&(p=(p=(65535&p)*c+(((p>>>16)*c&65535)<<16)&4294967295)<<15|p>>>17))*d+(((p>>>16)*d&65535)<<16)&4294967295)<<13|o>>>19))+((5*(o>>>16)&65535)<<16)&4294967295))+((58964+(l>>>16)&65535)<<16);switch(p=0,i){case 3:p^=(255&t.charCodeAt(_+2))<<16;case 2:p^=(255&t.charCodeAt(_+1))<<8;case 1:o^=p=(65535&(p=(p=(65535&(p^=255&t.charCodeAt(_)))*c+(((p>>>16)*c&65535)<<16)&4294967295)<<15|p>>>17))*d+(((p>>>16)*d&65535)<<16)&4294967295}return o^=t.length,o=2246822507*(65535&(o^=o>>>16))+((2246822507*(o>>>16)&65535)<<16)&4294967295,o=3266489909*(65535&(o^=o>>>13))+((3266489909*(o>>>16)&65535)<<16)&4294967295,(o^=o>>>16)>>>0}},Bp={exports:function(t,e){for(var i,n=t.length,o=e^n,l=0;n>=4;)i=1540483477*(65535&(i=255&t.charCodeAt(l)|(255&t.charCodeAt(++l))<<8|(255&t.charCodeAt(++l))<<16|(255&t.charCodeAt(++l))<<24))+((1540483477*(i>>>16)&65535)<<16),o=1540483477*(65535&o)+((1540483477*(o>>>16)&65535)<<16)^(i=1540483477*(65535&(i^=i>>>24))+((1540483477*(i>>>16)&65535)<<16)),n-=4,++l;switch(n){case 3:o^=(255&t.charCodeAt(l+2))<<16;case 2:o^=(255&t.charCodeAt(l+1))<<8;case 1:o=1540483477*(65535&(o^=255&t.charCodeAt(l)))+((1540483477*(o>>>16)&65535)<<16)}return o=1540483477*(65535&(o^=o>>>13))+((1540483477*(o>>>16)&65535)<<16),(o^=o>>>15)>>>0}},Sl=Op.exports,iu=Bp.exports;aa.exports=Sl,aa.exports.murmur3=Sl,aa.exports.murmur2=iu;
1var la=Gr(aa.exports);class hr{constructor(e,...i){Xi(this,i[0]||{}),this.type=e}}class ln extends hr{constructor(e,i={}){super("error",Xi({error:e},i))}}function Uh(t,e,i){i[t]&&i[t].indexOf(e)!==-1||(i[t]=i[t]||[],i[t].push(e))}function ru(t,e,i){if(i&&i[t]){const n=i[t].indexOf(e);n!==-1&&i[t].splice(n,1)}}class so{on(e,i){return this._listeners=this._listeners||{},Uh(e,i,this._listeners),this}off(e,i){return ru(e,i,this._listeners),ru(e,i,this._oneTimeListeners),this}once(e,i){return i?(this._oneTimeListeners=this._oneTimeListeners||{},Uh(e,i,this._oneTimeListeners),this):new Promise(n=>this.once(e,n))}fire(e,i){const n=typeof e=="string"?new hr(e,i):e,o=n.type;if(this.listens(o)){n.target=this;const l=this._listeners&&this._listeners[o]?this._listeners[o].slice():[];for(const p of l)p.call(this,n);const c=this._oneTimeListeners&&this._oneTimeListeners[o]?this._oneTimeListeners[o].slice():[];for(const p of c)ru(o,p,this._oneTimeListeners),p.call(this,n);const d=this._eventedParent;d&&(Xi(n,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),d.fire(n))}else n instanceof ln&&console.error(n.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}}s.F=void 0;var jh={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function Ml(t){return(t=Math.round(t))<0?0:t>255?255:t}function Il(t){return Ml(t[t.length-1]==="%"?parseFloat(t)/100*255:parseInt(t))}function Jo(t){return(e=t[t.length-1]==="%"?parseFloat(t)/100:parseFloat(t))<0?0:e>1?1:e;var e}function nu(t,e,i){return i<0?i+=1:i>1&&(i-=1),6*i<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}try{s.F={}.parseCSSColor=function(t){var e,i=t.replace(/ /g,"").toLowerCase();if(i in jh)return jh[i].slice();if(i[0]==="#")return i.length===4?(e=parseInt(i.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:i.length===7&&(e=parseInt(i.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var n=i.indexOf("("),o=i.indexOf(")");if(n!==-1&&o+1===i.length){var l=i.substr(0,n),c=i.substr(n+1,o-(n+1)).split(","),d=1;switch(l){case"rgba":if(c.length!==4)return null;d=Jo(c.pop());case"rgb":return c.length!==3?null:[Il(c[0]),Il(c[1]),Il(c[2]),d];case"hsla":if(c.length!==4)return null;d=Jo(c.pop());case"hsl":if(c.length!==3)return null;var p=(parseFloat(c[0])%360+360)%360/360,_=Jo(c[1]),y=Jo(c[2]),v=y<=.5?y*(_+1):y+_-y*_,b=2*y-v;return[Ml(255*nu(b,v,p+1/3)),Ml(255*nu(b,v,p)),Ml(255*nu(b,v,p-1/3)),d];default:return null}}return null}}catch{}class Nt{constructor(e,i,n,o=1){this.r=e,this.g=i,this.b=n,this.a=o}static parse(e){if(!e)return;if(e instanceof Nt)return e;if(typeof e!="string")return;const i=s.F(e);return i?new Nt(i[0]/255*i[3],i[1]/255*i[3],i[2]/255*i[3],i[3]):void 0}toString(){const[e,i,n,o]=this.a===0?[0,0,0,0]:[255*this.r/this.a,255*this.g/this.a,255*this.b/this.a,this.a];return`rgba(${Math.round(e)},${Math.round(i)},${Math.round(n)},${o})`}toRenderColor(e){const{r:i,g:n,b:o,a:l}=this;return new Fp(e,i,n,o,l)}}class Fp{constructor(e,i,n,o,l){if(e){const c=e.image.height,d=c*c;i=l===0?0:i/l*(c-1),n=l===0?0:n/l*(c-1),o=l===0?0:o/l*(c-1);const p=Math.floor(i),_=Math.floor(n),y=Math.floor(o),v=Math.ceil(i),b=Math.ceil(n),E=Math.ceil(o),S=i-p,I=n-_,C=o-y,D=e.image.data,V=4*(p+_*d+y*c),U=4*(p+_*d+E*c),j=4*(p+b*d+y*c),X=4*(p+b*d+E*c),H=4*(v+_*d+y*c),ie=4*(v+_*d+E*c),ne=4*(v+b*d+y*c),ue=4*(v+b*d+E*c);if(V<0||ue>=D.length)throw new Error("out of range");this.r=tt(tt(tt(D[V],D[U],C),tt(D[j],D[X],C),I),tt(tt(D[H],D[ie],C),tt(D[ne],D[ue],C),I),S)/255*l,this.g=tt(tt(tt(D[V+1],D[U+1],C),tt(D[j+1],D[X+1],C),I),tt(tt(D[H+1],D[ie+1],C),tt(D[ne+1],D[ue+1],C),I),S)/255*l,this.b=tt(tt(tt(D[V+2],D[U+2],C),tt(D[j+2],D[X+2],C),I),tt(tt(D[H+2],D[ie+2],C),tt(D[ne+2],D[ue+2],C),I),S)/255*l,this.a=l}else this.r=i,this.g=n,this.b=o,this.a=l}toArray(){const{r:e,g:i,b:n,a:o}=this;return o===0?[0,0,0,0]:[255*e/o,255*i/o,255*n/o,o]}toArray01(){const{r:e,g:i,b:n,a:o}=this;return o===0?[0,0,0,0]:[e/o,i/o,n/o,o]}toArray01Scaled(e){const{r:i,g:n,b:o,a:l}=this;return l===0?[0,0,0]:[i/l*e,n/l*e,o/l*e]}toArray01PremultipliedAlpha(){const{r:e,g:i,b:n,a:o}=this;return[e,i,n,o]}toArray01Linear(){const{r:e,g:i,b:n,a:o}=this;return o===0?[0,0,0,0]:[Math.pow(e/o,2.2),Math.pow(i/o,2.2),Math.pow(n/o,2.2),o]}}function tt(t,e,i){return t*(1-i)+e*i}
1function Gh(t,e,i){return t.map((n,o)=>tt(n,e[o],i))}Nt.black=new Nt(0,0,0,1),Nt.white=new Nt(1,1,1,1),Nt.transparent=new Nt(0,0,0,0),Nt.red=new Nt(1,0,0,1),Nt.blue=new Nt(0,0,1,1);var Al=Object.freeze({__proto__:null,array:Gh,color:function(t,e,i){return new Nt(tt(t.r,e.r,i),tt(t.g,e.g,i),tt(t.b,e.b,i),tt(t.a,e.a,i))},number:tt});function ou(t,...e){for(const i of e)for(const n in i)t[n]=i[n];return t}class Yr extends Error{constructor(e,i){super(i),this.message=i,this.key=e}}class su{constructor(e,i=[]){this.parent=e,this.bindings={};for(const[n,o]of i)this.bindings[n]=o}concat(e){return new su(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 zr={kind:"null"},We={kind:"number"},Vt={kind:"string"},Ot={kind:"boolean"},br={kind:"color"},Qo={kind:"object"},Et={kind:"value"},ca={kind:"collator"},Kr={kind:"formatted"},ua={kind:"resolvedImage"};function rr(t,e){return{kind:"array",itemType:t,N:e}}function Ti(t){if(t.kind==="array"){const e=Ti(t.itemType);return typeof t.N=="number"?`array<${e}, ${t.N}>`:t.itemType.kind==="value"?"array":`array<${e}>`}return t.kind}const Np=[zr,We,Vt,Ot,br,Kr,Qo,rr(Et),ua];function ha(t,e){if(e.kind==="error")return null;if(t.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!ha(t.itemType,e.itemType))&&(typeof t.N!="number"||t.N===e.N))return null}else{if(t.kind===e.kind)return null;if(t.kind==="value"){for(const i of Np)if(!ha(i,e))return null}}return`Expected ${Ti(t)} but found ${Ti(e)} instead.`}function Cl(t,e){return e.some(i=>i.kind===t.kind)}function ao(t,e){return e.some(i=>i==="null"?t===null:i==="array"?Array.isArray(t):i==="object"?t&&!Array.isArray(t)&&typeof t=="object":i===typeof t)}class es{constructor(e,i,n){this.sensitivity=e?i?"variant":"case":i?"accent":"base",this.locale=n,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 da{constructor(e,i,n,o,l){this.text=e.normalize?e.normalize():e,this.image=i,this.scale=n,this.fontStack=o,this.textColor=l}}class Bi{constructor(e){this.sections=e}static fromString(e){return new Bi([new da(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.namePrimary.length!==0)}static factory(e){return e instanceof Bi?e:Bi.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){e.push(["image",i.image.namePrimary]);continue}e.push(i.text);const n={};i.fontStack&&(n["text-font"]=["literal",i.fontStack.split(",")]),i.scale&&(n["font-scale"]=i.scale),i.textColor&&(n["text-color"]=["rgba"].concat(i.textColor.toRenderColor(null).toArray())),e.push(n)}return e}}class dr{constructor(e){this.namePrimary=e.namePrimary,e.nameSecondary&&(this.nameSecondary=e.nameSecondary),this.available=e.available}toString(){return this.nameSecondary?`[${this.namePrimary},${this.nameSecondary}]`:this.namePrimary}static fromString(e,i){return e?new dr({namePrimary:e,nameSecondary:i,available:!1}):null}serialize(){return this.nameSecondary?["image",this.namePrimary,this.nameSecondary]:["image",this.namePrimary]}}function Dr(t,e,i,n){return typeof t=="number"&&t>=0&&t<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof i=="number"&&i>=0&&i<=255?n===void 0||typeof n=="number"&&n>=0&&n<=1?null:`Invalid rgba value [${[t,e,i,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof n=="number"?[t,e,i,n]:[t,e,i]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ts(t){if(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number"||t instanceof Nt||t instanceof es||t instanceof Bi||t instanceof dr)return!0;if(Array.isArray(t)){for(const e of t)if(!ts(e))return!1;return!0}if(typeof t=="object"){for(const e in t)if(!ts(t[e]))return!1;return!0}return!1}function Si(t){if(t===null)return zr;if(typeof t=="string")return Vt;if(typeof t=="boolean")return Ot;if(typeof t=="number")return We;if(t instanceof Nt)return br;if(t instanceof es)return ca;if(t instanceof Bi)return Kr;if(t instanceof dr)return ua;if(Array.isArray(t)){const e=t.length;let i;for(const n of t){const o=Si(n);if(i){if(i===o)continue;i=Et;break}i=o}return rr(i||Et,e)}return Qo}function Lr(t){const e=typeof t;return t===null?"":e==="string"||e==="number"||e==="boolean"?String(t):t instanceof Nt||t instanceof Bi||t instanceof dr?t.toString():JSON.stringify(t)}class cn{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(!ts(e[1]))return i.error("invalid value");const n=e[1];let o=Si(n);const l=i.expectedType;return o.kind!=="array"||o.N!==0||!l||l.kind!=="array"||typeof l.N=="number"&&l.N!==0||(o=l),new cn(o,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof Nt?["rgba"].concat(this.value.toRenderColor(null).toArray()):this.value instanceof Bi?this.value.serialize():this.value}}class zi{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}
1const au={string:Vt,number:We,boolean:Ot,object:Qo};class Rr{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 n,o=1;const l=e[0];if(l==="array"){let d,p;if(e.length>2){const _=e[1];if(typeof _!="string"||!(_ in au)||_==="object")return i.error('The item type argument of "array" must be one of string, number, boolean',1);d=au[_],o++}else d=Et;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);p=e[2],o++}n=rr(d,p)}else n=au[l];const c=[];for(;o<e.length;o++){const d=i.parse(e[o],o,Et);if(!d)return null;c.push(d)}return new Rr(n,c)}evaluate(e){for(let i=0;i<this.args.length;i++){const n=this.args[i].evaluate(e);if(!ha(this.type,Si(n)))return n;if(i===this.args.length-1)throw new zi(`Expected value to be of type ${Ti(this.type)}, but found ${Ti(Si(n))} instead.`)}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 n=e.itemType;if(n.kind==="string"||n.kind==="number"||n.kind==="boolean"){i.push(n.kind);const o=e.N;(typeof o=="number"||this.args.length>1)&&i.push(o)}}return i.concat(this.args.map(n=>n.serialize()))}}class pa{constructor(e){this.type=Kr,this.sections=e}static parse(e,i){if(e.length<2)return i.error("Expected at least one argument.");const n=e[1];if(!Array.isArray(n)&&typeof n=="object")return i.error("First argument must be an image or text section.");const o=[];let l=!1;for(let c=1;c<=e.length-1;++c){const d=e[c];if(l&&typeof d=="object"&&!Array.isArray(d)){l=!1;let p=null;if(d["font-scale"]&&(p=i.parse(d["font-scale"],1,We),!p))return null;let _=null;if(d["text-font"]&&(_=i.parse(d["text-font"],1,rr(Vt)),!_))return null;let y=null;if(d["text-color"]&&(y=i.parse(d["text-color"],1,br),!y))return null;const v=o[o.length-1];v.scale=p,v.font=_,v.textColor=y}else{const p=i.parse(e[c],1,Et);if(!p)return null;const _=p.type.kind;if(_!=="string"&&_!=="value"&&_!=="null"&&_!=="resolvedImage")return i.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");l=!0,o.push({content:p,scale:null,font:null,textColor:null})}}return new pa(o)}evaluate(e){return new Bi(this.sections.map(i=>{const n=i.content.evaluate(e);return Si(n)===ua?new da("",n,null,null,null):new da(Lr(n),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 n={};i.scale&&(n["font-scale"]=i.scale.serialize()),i.font&&(n["text-font"]=i.font.serialize()),i.textColor&&(n["text-color"]=i.textColor.serialize()),e.push(n)}return e}}class fa{constructor(e,i){this.type=ua,this.inputPrimary=e,this.inputSecondary=i}static parse(e,i){if(e.length<2)return i.error("Expected two or more arguments.");const n=i.parse(e[1],1,Vt);if(!n)return i.error("No image name provided.");if(e.length===2)return new fa(n);const o=i.parse(e[2],1,Vt);return o?new fa(n,o):i.error("Secondary image variant is not a string.")}evaluate(e){const i=dr.fromString(this.inputPrimary.evaluate(e),this.inputSecondary?this.inputSecondary.evaluate(e):void 0);return i&&e.availableImages&&(i.available=e.availableImages.indexOf(i.namePrimary)>-1,i.nameSecondary&&i.available&&e.availableImages&&(i.available=e.availableImages.indexOf(i.nameSecondary)>-1)),i}eachChild(e){e(this.inputPrimary),this.inputSecondary&&e(this.inputSecondary)}outputDefined(){return!1}serialize(){return this.inputSecondary?["image",this.inputPrimary.serialize(),this.inputSecondary.serialize()]:["image",this.inputPrimary.serialize()]}}function lo(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":t===null?"null":typeof t}const lu={"to-boolean":Ot,"to-color":br,"to-number":We,"to-string":Vt};class Jr{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 n=e[0],o=[];let l=zr;if(n==="to-array"){if(!Array.isArray(e[1]))return null;const c=e[1].length;if(i.expectedType){if(i.expectedType.kind!=="array")return i.error(`Expected ${i.expectedType.kind} but found array.`);l=rr(i.expectedType.itemType,c)}else{if(!(c>0&&ts(e[1][0])))return null;l=rr(Si(e[1][0]),c)}for(let d=0;d<c;d++){const p=e[1][d];let _;if(lo(p)==="array")_=i.parse(p,void 0,l.itemType);else{const y=lo(p);if(y!==l.itemType.kind)return i.error(`Expected ${l.itemType.kind} but found ${y}.`);_=i.registry.literal.parse(["literal",p===void 0?null:p],i)}if(!_)return null;o.push(_)}}else{if((n==="to-boolean"||n==="to-string")&&e.length!==2)return i.error("Expected one argument.");l=lu[n];for(let c=1;c<e.length;c++){const d=i.parse(e[c],c,Et);if(!d)return null;o.push(d)}}return new Jr(l,o)}
vendor: 4,838 bytes, line 1
1evaluate(e){if(this.type.kind==="boolean")return!!this.args[0].evaluate(e);if(this.type.kind==="color"){let i,n;for(const o of this.args){if(i=o.evaluate(e),n=null,i instanceof Nt)return i;if(typeof i=="string"){const l=e.parseColor(i);if(l)return l}else if(Array.isArray(i)&&(n=i.length<3||i.length>4?`Invalid rbga value ${JSON.stringify(i)}: expected an array containing either three or four numeric values.`:Dr(i[0],i[1],i[2],i[3]),!n))return new Nt(i[0]/255,i[1]/255,i[2]/255,i[3])}throw new zi(n||`Could not parse color from value '${typeof i=="string"?i:String(JSON.stringify(i))}'`)}if(this.type.kind==="number"){let i=null;for(const n of this.args){if(i=n.evaluate(e),i===null)return 0;const o=Number(i);if(!isNaN(o))return o}throw new zi(`Could not convert ${JSON.stringify(i)} to number.`)}return this.type.kind==="formatted"?Bi.fromString(Lr(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?dr.fromString(Lr(this.args[0].evaluate(e))):this.type.kind==="array"?this.args.map(i=>i.evaluate(e)):Lr(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if(this.type.kind==="formatted")return new pa([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new fa(this.args[0]).serialize();const e=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(i=>{e.push(i.serialize())}),e}}const Vp=["Unknown","Point","LineString","Polygon"];class Pl{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"?Vp[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:n,y:o}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(n*i-e[0])+this.featureDistanceData.bearing[1]*(o*i-e[1])}return 0}parseColor(e){let i=this._parseColorCache[e];return i||(i=this._parseColorCache[e]=Nt.parse(e)),i}getConfig(e){return this.options?this.options.get(e):null}}class Ki{constructor(e,i,n,o,l){this.name=e,this.type=i,this._evaluate=n,this.args=o,this._overloadIndex=l}evaluate(e){if(!this._evaluate){const i=Ki.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 n=e[0],o=Ki.definitions[n];if(!o)return i.error(`Unknown expression "${n}". If you wanted a literal array, use ["literal", [...]].`,0);const l=Array.isArray(o)?o[0]:o.type,c=Array.isArray(o)?[[o[1],o[2]]]:o.overloads,d=[];let p=null,_=-1;for(const[y,v]of c){if(Array.isArray(y)&&y.length!==e.length-1)continue;d.push(y),_++,p=new Bl(i.registry,i.path,null,i.scope,void 0,i._scope,i.options);const b=[];let E=!1;for(let S=1;S<e.length;S++){const I=e[S],C=Array.isArray(y)?y[S-1]:y.type,D=p.parse(I,1+b.length,C);if(!D){E=!0;break}b.push(D)}if(!E)if(Array.isArray(y)&&y.length!==b.length)p.error(`Expected ${y.length} arguments, but found ${b.length} instead.`);else{for(let S=0;S<b.length;S++){const I=Array.isArray(y)?y[S]:y.type,C=b[S];p.concat(S+1).checkSubtype(I,C.type)}if(p.errors.length===0)return new Ki(n,l,v,b,_)}}if(d.length===1)i.errors.push(...p.errors);else{const y=(d.length?d:c.map(([b])=>b)).map(ma).join(" | "),v=[];for(let b=1;b<e.length;b++){const E=i.parse(e[b],1+v.length);if(!E)return null;v.push(Ti(E.type))}i.error(`Expected arguments of type ${y}, but found (${v.join(", ")}) instead.`)}return null}static register(e,i){Ki.definitions=i;for(const n in i)e[n]=Ki}}function ma(t){return Array.isArray(t)?`(${t.map(Ti).join(", ")})`:`(${Ti(t.type)}...)`}class _a{constructor(e,i,n){this.type=ca,this.locale=n,this.caseSensitive=e,this.diacriticSensitive=i}static parse(e,i){if(e.length!==2)return i.error("Expected one argument.");const n=e[1];if(typeof n!="object"||Array.isArray(n))return i.error("Collator options argument must be an object.");const o=i.parse(n["case-sensitive"]!==void 0&&n["case-sensitive"],1,Ot);if(!o)return null;const l=i.parse(n["diacritic-sensitive"]!==void 0&&n["diacritic-sensitive"],1,Ot);if(!l)return null;
1let c=null;return n.locale&&(c=i.parse(n.locale,1,Vt),!c)?null:new _a(o,l,c)}evaluate(e){return new es(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 qh(t,e,i=0,n=t.length-1,o=Up){for(;n>i;){if(n-i>600){const p=n-i+1,_=e-i+1,y=Math.log(p),v=.5*Math.exp(2*y/3),b=.5*Math.sqrt(y*v*(p-v)/p)*(_-p/2<0?-1:1);qh(t,e,Math.max(i,Math.floor(e-_*v/p+b)),Math.min(n,Math.floor(e+(p-_)*v/p+b)),o)}const l=t[e];let c=i,d=n;for(ga(t,i,e),o(t[n],l)>0&&ga(t,i,n);c<d;){for(ga(t,c,d),c++,d--;o(t[c],l)<0;)c++;for(;o(t[d],l)>0;)d--}o(t[i],l)===0?ga(t,i,d):(d++,ga(t,d,n)),d<=e&&(i=d+1),e<=d&&(n=d-1)}}function ga(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function Up(t,e){return t<e?-1:t>e?1:0}function Zh(t){let e=0;for(let i,n,o=0,l=t.length,c=l-1;o<l;c=o++)i=t[o],n=t[c],e+=(n.x-i.x)*(i.y+n.y);return e}function ya(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}function xa(t,e){return!(t[0]<=e[0]||t[2]>=e[2]||t[1]<=e[1]||t[3]>=e[3])}function $h(t,e,i){const n=t[0]-e[0],o=t[1]-e[1],l=t[0]-i[0],c=t[1]-i[1];return n*c-l*o==0&&n*l<=0&&o*c<=0}function zt(t,e,i=!1){let n=!1;for(let d=0,p=e.length;d<p;d++){const _=e[d];for(let y=0,v=_.length,b=v-1;y<v;b=y++){const E=_[b],S=_[y];if($h(t,E,S))return i;(l=E)[1]>(o=t)[1]!=(c=S)[1]>o[1]&&o[0]<(c[0]-l[0])*(o[1]-l[1])/(c[1]-l[1])+l[0]&&(n=!n)}}var o,l,c;return n}function cu(t,e,i,n){const o=n[0]-i[0],l=n[1]-i[1],c=(t[0]-i[0])*l-o*(t[1]-i[1]),d=(e[0]-i[0])*l-o*(e[1]-i[1]);return c>0&&d<0||c<0&&d>0}function va(t,e,i,n){return(o=[n[0]-i[0],n[1]-i[1]])[0]*(l=[e[0]-t[0],e[1]-t[1]])[1]-o[1]*l[0]!=0&&!(!cu(t,e,i,n)||!cu(i,n,t,e));var o,l}const Ln=8192;function jp(t,e){const i=(180+t[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t[1]*Math.PI/360)))/360,o=Math.pow(2,e.z);return[Math.round(i*o*Ln),Math.round(n*o*Ln)]}function zl(t,e){for(let i=0;i<e.length;i++)if(zt(t,e[i]))return!0;return!1}function Dl(t,e,i){for(const n of i)for(let o=0,l=n.length,c=l-1;o<l;c=o++)if(va(t,e,n[c],n[o]))return!0;return!1}function ba(t,e){for(let i=0;i<t.length;++i)if(!zt(t[i],e))return!1;for(let i=0;i<t.length-1;++i)if(Dl(t[i],t[i+1],e))return!1;return!0}function Gp(t,e){for(let i=0;i<e.length;i++)if(ba(t,e[i]))return!0;return!1}function Ll(t,e,i){const n=[];for(let o=0;o<t.length;o++){const l=[];for(let c=0;c<t[o].length;c++){const d=jp(t[o][c],i);ya(e,d),l.push(d)}n.push(l)}return n}function kr(t,e,i){const n=[];for(let o=0;o<t.length;o++){const l=Ll(t[o],e,i);n.push(l)}return n}function Wh(t,e,i,n){if(t[0]<i[0]||t[0]>i[2]){const o=.5*n;let l=t[0]-i[0]>o?-n:i[0]-t[0]>o?n:0;l===0&&(l=t[0]-i[2]>o?-n:i[2]-t[0]>o?n:0),t[0]+=l}ya(e,t)}function uu(t,e,i,n){const o=Math.pow(2,n.z)*Ln,l=[n.x*Ln,n.y*Ln],c=[];if(!t)return c;for(const d of t)for(const p of d){const _=[p.x+l[0],p.y+l[1]];Wh(_,e,i,o),c.push(_)}return c}function is(t,e,i,n){const o=Math.pow(2,n.z)*Ln,l=[n.x*Ln,n.y*Ln],c=[];if(!t)return c;for(const p of t){const _=[];for(const y of p){const v=[y.x+l[0],y.y+l[1]];ya(e,v),_.push(v)}c.push(_)}if(e[2]-e[0]<=o/2){(d=e)[0]=d[1]=1/0,d[2]=d[3]=-1/0;for(const p of c)for(const _ of p)Wh(_,e,i,o)}var d;return c}class un{constructor(e,i){this.type=Ot,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(ts(e[1])){const n=e[1];if(n.type==="FeatureCollection")for(let o=0;o<n.features.length;++o){const l=n.features[o].geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new un(n,n.features[o].geometry)}else if(n.type==="Feature"){const o=n.geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new un(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new un(n,n)}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,n){const o=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],c=i.canonicalID();if(!c)return!1;if(n.type==="Polygon"){const d=Ll(n.coordinates,l,c),p=uu(i.geometry(),o,l,c);if(!xa(o,l))return!1;for(const _ of p)if(!zt(_,d))return!1}if(n.type==="MultiPolygon"){const d=kr(n.coordinates,l,c),p=uu(i.geometry(),o,l,c);if(!xa(o,l))return!1;for(const _ of p)if(!zl(_,d))return!1}return!0}(e,this.geometries);if(e.geometryType()==="LineString")return function(i,n){const o=[1/0,1/0,-1/0,-1/0],l=[1/0,1/0,-1/0,-1/0],c=i.canonicalID();if(!c)return!1;if(n.type==="Polygon"){const d=Ll(n.coordinates,l,c),p=is(i.geometry(),o,l,c);if(!xa(o,l))return!1;for(const _ of p)if(!ba(_,d))return!1}if(n.type==="MultiPolygon"){const d=kr(n.coordinates,l,c),p=is(i.geometry(),o,l,c);if(!xa(o,l))return!1;for(const _ of p)if(!Gp(_,d))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const Rl={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},Hh=1/298.257223563,Xh=Hh*(2-Hh),rs=Math.PI/180;class co{static fromTile(e,i,n){const o=Math.PI*(1-2*(e+.5)/Math.pow(2,i)),l=Math.atan(.5*(Math.exp(o)-Math.exp(-o)))/rs;return new co(l,n)}static get units(){return Rl}constructor(e,i){if(e===void 0)throw new Error("No latitude given.");if(i&&!Rl[i])throw new Error(`Unknown unit ${i}. Use one of: ${Object.keys(Rl).join(", ")}`);const n=6378.137*rs*(i?Rl[i]:1),o=Math.cos(e*rs),l=1/(1-Xh*(1-o*o)),c=Math.sqrt(l);this.kx=n*c*o,this.ky=n*c*l*(1-Xh)}
1distance(e,i){const n=wr(e[0]-i[0])*this.kx,o=(e[1]-i[1])*this.ky;return Math.sqrt(n*n+o*o)}bearing(e,i){const n=wr(i[0]-e[0])*this.kx;return Math.atan2(n,(i[1]-e[1])*this.ky)/rs}destination(e,i,n){const o=n*rs;return this.offset(e,Math.sin(o)*i,Math.cos(o)*i)}offset(e,i,n){return[e[0]+i/this.kx,e[1]+n/this.ky]}lineDistance(e){let i=0;for(let n=0;n<e.length-1;n++)i+=this.distance(e[n],e[n+1]);return i}area(e){let i=0;for(let n=0;n<e.length;n++){const o=e[n];for(let l=0,c=o.length,d=c-1;l<c;d=l++)i+=wr(o[l][0]-o[d][0])*(o[l][1]+o[d][1])*(n?-1:1)}return Math.abs(i)/2*this.kx*this.ky}along(e,i){let n=0;if(i<=0)return e[0];for(let o=0;o<e.length-1;o++){const l=e[o],c=e[o+1],d=this.distance(l,c);if(n+=d,n>i)return ns(l,c,(i-(n-d))/d)}return e[e.length-1]}pointToSegmentDistance(e,i,n){let[o,l]=i,c=wr(n[0]-o)*this.kx,d=(n[1]-l)*this.ky;if(c!==0||d!==0){const p=(wr(e[0]-o)*this.kx*c+(e[1]-l)*this.ky*d)/(c*c+d*d);p>1?(o=n[0],l=n[1]):p>0&&(o+=c/this.kx*p,l+=d/this.ky*p)}return c=wr(e[0]-o)*this.kx,d=(e[1]-l)*this.ky,Math.sqrt(c*c+d*d)}pointOnLine(e,i){let n=1/0,o=e[0][0],l=e[0][1],c=0,d=0;for(let p=0;p<e.length-1;p++){let _=e[p][0],y=e[p][1],v=wr(e[p+1][0]-_)*this.kx,b=(e[p+1][1]-y)*this.ky,E=0;v===0&&b===0||(E=(wr(i[0]-_)*this.kx*v+(i[1]-y)*this.ky*b)/(v*v+b*b),E>1?(_=e[p+1][0],y=e[p+1][1]):E>0&&(_+=v/this.kx*E,y+=b/this.ky*E)),v=wr(i[0]-_)*this.kx,b=(i[1]-y)*this.ky;const S=v*v+b*b;S<n&&(n=S,o=_,l=y,c=p,d=E)}return{point:[o,l],index:c,t:Math.max(0,Math.min(1,d))}}lineSlice(e,i,n){let o=this.pointOnLine(n,e),l=this.pointOnLine(n,i);if(o.index>l.index||o.index===l.index&&o.t>l.t){const _=o;o=l,l=_}const c=[o.point],d=o.index+1,p=l.index;!Yh(n[d],c[0])&&d<=p&&c.push(n[d]);for(let _=d+1;_<=p;_++)c.push(n[_]);return Yh(n[p],l.point)||c.push(l.point),c}lineSliceAlong(e,i,n){let o=0;const l=[];for(let c=0;c<n.length-1;c++){const d=n[c],p=n[c+1],_=this.distance(d,p);if(o+=_,o>e&&l.length===0&&l.push(ns(d,p,(e-(o-_))/_)),o>=i)return l.push(ns(d,p,(i-(o-_))/_)),l;o>e&&l.push(p)}return l}bufferPoint(e,i){const n=i/this.ky,o=i/this.kx;return[e[0]-o,e[1]-n,e[0]+o,e[1]+n]}bufferBBox(e,i){const n=i/this.ky,o=i/this.kx;return[e[0]-o,e[1]-n,e[2]+o,e[3]+n]}insideBBox(e,i){return wr(e[0]-i[0])>=0&&wr(e[0]-i[2])<=0&&e[1]>=i[1]&&e[1]<=i[3]}}function Yh(t,e){return t[0]===e[0]&&t[1]===e[1]}function ns(t,e,i){const n=wr(e[0]-t[0]);return[t[0]+n*i,t[1]+(e[1]-t[1])*i]}function wr(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}class hu{constructor(e=[],i=(n,o)=>n<o?-1:n>o?1:0){if(this.data=e,this.length=this.data.length,this.compare=i,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}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:n}=this,o=i[e];for(;e>0;){const l=e-1>>1,c=i[l];if(n(o,c)>=0)break;i[e]=c,e=l}i[e]=o}_down(e){const{data:i,compare:n}=this,o=this.length>>1,l=i[e];for(;e<o;){let c=1+(e<<1);const d=c+1;if(d<this.length&&n(i[d],i[c])<0&&(c=d),n(i[c],l)>=0)break;i[e]=i[c],e=c}i[e]=l}}var Ne=8192;function Kh(t,e){return e.dist-t.dist}const du=100,pu=50;function Jh(t){const e=[1/0,1/0,-1/0,-1/0];if(e.length!==t.length)return!1;for(let i=0;i<e.length;i++)if(e[i]!==t[i])return!1;return!0}function wa(t){return t[1]-t[0]+1}function nr(t,e){const i=t[1]>=t[0]&&t[1]<e;return i||console.warn("Distance Expression: Index is out of range"),i}function fu(t,e){if(t[0]>t[1])return[null,null];const i=wa(t);if(e){if(i===2)return[t,null];const n=Math.floor(i/2);return[[t[0],t[0]+n],[t[0]+n,t[1]]]}{if(i===1)return[t,null];const n=Math.floor(i/2)-1;return[[t[0],t[0]+n],[t[0]+n+1,t[1]]]}}function uo(t,e){const i=[1/0,1/0,-1/0,-1/0];if(!nr(e,t.length))return i;for(let n=e[0];n<=e[1];++n)ya(i,t[n]);return i}function os(t){const e=[1/0,1/0,-1/0,-1/0];for(let i=0;i<t.length;++i)for(let n=0;n<t[i].length;++n)ya(e,t[i][n]);return e}
1function ss(t,e,i){if(Jh(t)||Jh(e))return NaN;let n=0,o=0;return t[2]<e[0]&&(n=e[0]-t[2]),t[0]>e[2]&&(n=t[0]-e[2]),t[1]>e[3]&&(o=t[1]-e[3]),t[3]<e[1]&&(o=e[1]-t[3]),i.distance([0,0],[n,o])}function qp(t){return 360*t-180}function Zp(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function mu(t,e){const i=Math.pow(2,e.z),n=(t.y/Ne+e.y)/i;return[qp((t.x/Ne+e.x)/i),Zp(n)]}function $p(t,e){const i=[];for(let n=0;n<t.length;++n)i.push(mu(t[n],e));return i}function Rn(t,e,i){const n=i.pointOnLine(e,t).point;return i.distance(t,n)}function Qh(t,e,i,n,o){const l=i.slice(n[0],n[1]+1);let c=1/0;for(let d=e[0];d<=e[1];++d)if((c=Math.min(c,Rn(t[d],l,o)))===0)return 0;return c}function _u(t,e,i,n,o){const l=Math.min(o.pointToSegmentDistance(t,i,n),o.pointToSegmentDistance(e,i,n)),c=Math.min(o.pointToSegmentDistance(i,t,e),o.pointToSegmentDistance(n,t,e));return Math.min(l,c)}function ed(t,e,i,n,o){if(!nr(e,t.length)||!nr(n,i.length))return NaN;let l=1/0;for(let c=e[0];c<e[1];++c)for(let d=n[0];d<n[1];++d){if(va(t[c],t[c+1],i[d],i[d+1]))return 0;l=Math.min(l,_u(t[c],t[c+1],i[d],i[d+1],o))}return l}function td(t,e,i,n,o){if(!nr(e,t.length)||!nr(n,i.length))return NaN;let l=1/0;for(let c=e[0];c<=e[1];++c)for(let d=n[0];d<=n[1];++d)if((l=Math.min(l,o.distance(t[c],i[d])))===0)return l;return l}function Or(t,e,i){if(zt(t,e,!0))return 0;let n=1/0;for(const o of e){const l=o.length;if(l<2)return console.warn("Distance Expression: Invalid polygon!"),NaN;if(o[0]!==o[l-1]&&(n=Math.min(n,i.pointToSegmentDistance(t,o[l-1],o[0])))===0||(n=Math.min(n,Rn(t,o,i)))===0)return n}return n}function id(t,e,i,n){if(!nr(e,t.length))return NaN;for(let l=e[0];l<=e[1];++l)if(zt(t[l],i,!0))return 0;let o=1/0;for(let l=e[0];l<e[1];++l)for(const c of i)for(let d=0,p=c.length,_=p-1;d<p;_=d++){if(va(t[l],t[l+1],c[_],c[d]))return 0;o=Math.min(o,_u(t[l],t[l+1],c[_],c[d],n))}return o}function rd(t,e){for(const i of t)for(let n=0;n<=i.length-1;++n)if(zt(i[n],e,!0))return!0;return!1}function nd(t,e,i,n=1/0){const o=os(t),l=os(e);if(n!==1/0&&ss(o,l,i)>=n)return n;if(xa(o,l)){if(rd(t,e))return 0}else if(rd(e,t))return 0;let c=n;for(const d of t)for(let p=0,_=d.length,y=_-1;p<_;y=p++)for(const v of e)for(let b=0,E=v.length,S=E-1;b<E;S=b++){if(va(d[y],d[p],v[S],v[b]))return 0;c=Math.min(c,_u(d[y],d[p],v[S],v[b],i))}return c}function ho(t,e,i,n,o,l,c){if(l===null||c===null)return;const d=ss(uo(n,l),uo(o,c),i);d<e&&t.push({dist:d,range1:l,range2:c})}function Wp(t,e,i,n,o=1/0){let l=Math.min(n.distance(t[0],i[0][0]),o);if(l===0)return l;const c=new hu([{dist:0,range1:[0,t.length-1],range2:[0,0]}],Kh),d=e?pu:du,p=os(i);for(;c.length;){const _=c.pop();if(_.dist>=l)continue;const y=_.range1;if(wa(y)<=d){if(!nr(y,t.length))return NaN;if(e){const v=id(t,y,i,n);if((l=Math.min(l,v))===0)return l}else for(let v=y[0];v<=y[1];++v){const b=Or(t[v],i,n);if((l=Math.min(l,b))===0)return l}}else{const v=fu(y,e);if(v[0]!==null){const b=ss(uo(t,v[0]),p,n);b<l&&c.push({dist:b,range1:v[0],range2:[0,0]})}if(v[1]!==null){const b=ss(uo(t,v[1]),p,n);b<l&&c.push({dist:b,range1:v[1],range2:[0,0]})}}}return l}function od(t,e,i,n,o,l=1/0){let c=Math.min(l,o.distance(t[0],i[0]));if(c===0)return c;const d=new hu([{dist:0,range1:[0,t.length-1],range2:[0,i.length-1]}],Kh),p=e?pu:du,_=n?pu:du;for(;d.length;){const y=d.pop();if(y.dist>=c)continue;const v=y.range1,b=y.range2;if(wa(v)<=p&&wa(b)<=_){if(!nr(v,t.length)||!nr(b,i.length))return NaN;if(e&&n?c=Math.min(c,ed(t,v,i,b,o)):e||n?e&&!n?c=Math.min(c,Qh(i,b,t,v,o)):!e&&n&&(c=Math.min(c,Qh(t,v,i,b,o))):c=Math.min(c,td(t,v,i,b,o)),c===0)return c}else{const E=fu(v,e),S=fu(b,n);ho(d,c,o,t,i,E[0],S[0]),ho(d,c,o,t,i,E[0],S[1]),ho(d,c,o,t,i,E[1],S[0]),ho(d,c,o,t,i,E[1],S[1])}}return c}function gu(t,e,i,n,o=1/0){let l=o;const c=uo(t,[0,t.length-1]);for(const d of i)if(!(l!==1/0&&ss(c,uo(d,[0,d.length-1]),n)>=l)&&(l=Math.min(l,od(t,e,d,!0,n,l)),l===0))return l;return l}function kl(t,e,i,n,o=1/0){let l=o;const c=uo(t,[0,t.length-1]);for(const d of i){if(l!==1/0&&ss(c,os(d),n)>=l)continue;const p=Wp(t,e,d,n,l);if(isNaN(p))return p;if((l=Math.min(l,p))===0)return l}return l}function yu(t){return t==="Point"||t==="MultiPoint"||t==="LineString"||t==="MultiLineString"||t==="Polygon"||t==="MultiPolygon"}class Qr{constructor(e,i){this.type=We,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(ts(e[1])){const n=e[1];if(n.type==="FeatureCollection"){for(let o=0;o<n.features.length;++o)if(yu(n.features[o].geometry.type))return new Qr(n,n.features[o].geometry)}else if(n.type==="Feature"){if(yu(n.geometry.type))return new Qr(n,n.geometry)}else if(yu(n.type))return new Qr(n,n)}return i.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const i=e.geometry(),n=e.canonicalID();if(i!=null&&n!=null){if(e.geometryType()==="Point")return function(o,l,c){const d=[];for(const _ of o)for(const y of _)d.push(mu(y,l));const p=new co(d[0][1],"meters");return c.type==="Point"||c.type==="MultiPoint"||c.type==="LineString"?od(d,!1,c.type==="Point"?[c.coordinates]:c.coordinates,c.type==="LineString",p):c.type==="MultiLineString"?gu(d,!1,c.coordinates,p):c.type==="Polygon"||c.type==="MultiPolygon"?kl(d,!1,c.type==="Polygon"?[c.coordinates]:c.coordinates,p):null}(i,n,this.geometries);if(e.geometryType()==="LineString")return function(o,l,c){const d=[];for(const _ of o){const y=[];for(const v of _)y.push(mu(v,l));d.push(y)}const p=new co(d[0][0][1],"meters");if(c.type==="Point"||c.type==="MultiPoint"||c.type==="LineString")return gu(c.type==="Point"?[c.coordinates]:c.coordinates,c.type==="LineString",d,p);if(c.type==="MultiLineString"){let _=1/0;for(let y=0;y<c.coordinates.length;y++){const v=gu(c.coordinates[y],!0,d,p,_);if(isNaN(v))return v;if((_=Math.min(_,v))===0)return _}return _}if(c.type==="Polygon"||c.type==="MultiPolygon"){let _=1/0;for(let y=0;y<d.length;y++){const v=kl(d[y],!0,c.type==="Polygon"?[c.coordinates]:c.coordinates,p,_);if(isNaN(v))return v;if((_=Math.min(_,v))===0)return _}return _}return null}(i,n,this.geometries);if(e.geometryType()==="Polygon")return function(o,l,c){const d=[];for(const _ of function(y,v){const b=y.length;if(b<=1)return[y];const E=[];let S,I;for(let C=0;C<b;C++){const D=Zh(y[C]);D!==0&&(y[C].area=Math.abs(D),I===void 0&&(I=D<0),I===D<0?(S&&E.push(S),S=[y[C]]):S.push(y[C]))}return S&&E.push(S),E}
1(o)){const y=[];for(let v=0;v<_.length;++v)y.push($p(_[v],l));d.push(y)}const p=new co(d[0][0][0][1],"meters");if(c.type==="Point"||c.type==="MultiPoint"||c.type==="LineString")return kl(c.type==="Point"?[c.coordinates]:c.coordinates,c.type==="LineString",d,p);if(c.type==="MultiLineString"){let _=1/0;for(let y=0;y<c.coordinates.length;y++){const v=kl(c.coordinates[y],!0,d,p,_);if(isNaN(v))return v;if((_=Math.min(_,v))===0)return _}return _}return c.type==="Polygon"||c.type==="MultiPolygon"?function(_,y,v){let b=1/0;for(const E of _)for(const S of y){const I=nd(E,S,v,b);if(isNaN(I))return I;if((b=Math.min(b,I))===0)return b}return b}(c.type==="Polygon"?[c.coordinates]:c.coordinates,d,p):null}(i,n,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 as(t,e){switch(t){case"string":return Lr(e);case"number":return+e;case"boolean":return!!e;case"color":return Nt.parse(e);case"formatted":return Bi.fromString(Lr(e));case"resolvedImage":return dr.fromString(Lr(e))}return e}function or(t,e,i,n){return n!==void 0&&(t=n*Math.round(t/n)),e!==void 0&&t<e&&(t=e),i!==void 0&&t>i&&(t=i),t}class hn{constructor(e,i,n){this.type=e,this.key=i,this.scope=n}static parse(e,i){let n=i.expectedType;if(n==null&&(n=Et),e.length<2||e.length>3)return i.error("Invalid number of arguments for 'config' expression.");const o=i.parse(e[1],1);if(!(o instanceof cn))return i.error("Key name of 'config' expression must be a string literal.");if(e.length>=3){const l=i.parse(e[2],2);return l instanceof cn?new hn(n,Lr(o.value),Lr(l.value)):i.error("Scope of 'config' expression must be a string literal.")}return new hn(n,Lr(o.value))}evaluate(e){const i=[this.key,this.scope,e.scope].filter(Boolean).join("�"),n=e.getConfig(i);if(!n)return null;const{type:o,value:l,values:c,minValue:d,maxValue:p,stepValue:_}=n,y=n.default.evaluate(e);let v=y;if(l){const b=e.scope;e.scope=(b||"").split("�").slice(1).join("�"),v=l.evaluate(e),e.scope=b}return o&&(v=as(o,v)),v===void 0||d===void 0&&p===void 0&&_===void 0||(typeof v=="number"?v=or(v,d,p,_):Array.isArray(v)&&(v=v.map(b=>typeof b=="number"?or(b,d,p,_):b))),l!==void 0&&v!==void 0&&c&&!c.includes(v)&&(v=y,o&&(v=as(o,v))),(o&&o!==this.type||v!==void 0&&Si(v)!==this.type)&&(v=as(this.type.kind,v)),v}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.key),e}}function Ta(t){if(t instanceof Ki&&(t.name==="get"&&t.args.length===1||t.name==="feature-state"||t.name==="has"&&t.args.length===1||t.name==="properties"||t.name==="geometry-type"||t.name==="id"||/^filter-/.test(t.name))||t instanceof un||t instanceof Qr)return!1;let e=!0;return t.eachChild(i=>{e&&!Ta(i)&&(e=!1)}),e}function Ol(t){if(t instanceof Ki&&t.name==="feature-state")return!1;let e=!0;return t.eachChild(i=>{e&&!Ol(i)&&(e=!1)}),e}function xu(t){if(t instanceof hn)return!1;let e=!0;return t.eachChild(i=>{e&&!xu(i)&&(e=!1)}),e}function Ea(t,e){if(t instanceof Ki&&e.indexOf(t.name)>=0)return!1;let i=!0;return t.eachChild(n=>{i&&!Ea(n,e)&&(i=!1)}),i}class ls{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 n=e[1];return i.scope.has(n)?new ls(n,i.scope.get(n)):i.error(`Unknown variable "${n}". Make sure "${n}" 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 vu{constructor(e,i=[],n,o=new su,l=[],c,d){this.registry=e,this.path=i,this.key=i.map(p=>`[${p}]`).join(""),this.scope=o,this.errors=l,this.expectedType=n,this._scope=c,this.options=d}parse(e,i,n,o,l={}){return i||n?this.concat(i,n,o)._parse(e,l):this._parse(e,l)}_parse(e,i){function n(o,l,c){return c==="assert"?new Rr(l,[o]):c==="coerce"?new Jr(l,[o]):o}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 o=typeof e[0]=="string"?this.registry[e[0]]:void 0;if(o){let l=o.parse(e,this);if(!l)return null;if(this.expectedType){const c=this.expectedType,d=l.type;
vendor: 8,602 bytes, line 1
1if(c.kind!=="string"&&c.kind!=="number"&&c.kind!=="boolean"&&c.kind!=="object"&&c.kind!=="array"||d.kind!=="value")if(c.kind!=="color"&&c.kind!=="formatted"&&c.kind!=="resolvedImage"||d.kind!=="value"&&d.kind!=="string"){if(this.checkSubtype(c,d))return null}else l=n(l,c,i.typeAnnotation||"coerce");else l=n(l,c,i.typeAnnotation||"assert")}if(!(l instanceof cn)&&l.type.kind!=="resolvedImage"&&bu(l)){const c=new Pl(this._scope,this.options);try{l=new cn(l.type,l.evaluate(c))}catch(d){return this.error(d.message),null}}return l}return Jr.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,n){const o=typeof e=="number"?this.path.concat(e):this.path,l=n?this.scope.concat(n):this.scope;return new vu(this.registry,o,i||null,l,this.errors,this._scope,this.options)}error(e,...i){const n=`${this.key}${i.map(o=>`[${o}]`).join("")}`;this.errors.push(new Yr(n,e))}checkSubtype(e,i){const n=ha(e,i);return n&&this.error(n),n}}var Bl=vu;function bu(t){if(t instanceof ls)return bu(t.boundExpression);if(t instanceof Ki&&t.name==="error"||t instanceof _a||t instanceof un||t instanceof Qr||t instanceof hn)return!1;const e=t instanceof Jr||t instanceof Rr;let i=!0;return t.eachChild(n=>{i=e?i&&bu(n):i&&n instanceof cn}),!!i&&Ta(t)&&Ea(t,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])}function Fl(t,e){const i=t.length-1;let n,o,l=0,c=i,d=0;for(;l<=c;)if(d=Math.floor((l+c)/2),n=t[d],o=t[d+1],n<=e){if(d===i||e<o)return d;l=d+1}else{if(!(n>e))throw new zi("Input is not a number.");c=d-1}return 0}class po{constructor(e,i,n){this.type=e,this.input=i,this.labels=[],this.outputs=[];for(const[o,l]of n)this.labels.push(o),this.outputs.push(l)}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 n=i.parse(e[1],1,We);if(!n)return null;const o=[];let l=null;i.expectedType&&i.expectedType.kind!=="value"&&(l=i.expectedType);for(let c=1;c<e.length;c+=2){const d=c===1?-1/0:e[c],p=e[c+1],_=c,y=c+1;if(typeof d!="number")return i.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',_);if(o.length&&o[o.length-1][0]>=d)return i.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',_);const v=i.parse(p,y,l);if(!v)return null;l=l||v.type,o.push([d,v])}return new po(l,n,o)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return n[0].evaluate(e);const l=i.length;return o>=i[l-1]?n[l-1].evaluate(e):n[Fl(i,o)].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 sd=.95047,wu=1.08883,Tu=4/29,cs=6/29,Nl=3*cs*cs,Vl=cs*cs*cs,ad=Math.PI/180,Hp=180/Math.PI;function Ul(t){return t>Vl?Math.pow(t,1/3):t/Nl+Tu}function Eu(t){return t>cs?t*t*t:Nl*(t-Tu)}function Sa(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function Su(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ld(t){const e=Su(t.r),i=Su(t.g),n=Su(t.b),o=Ul((.4124564*e+.3575761*i+.1804375*n)/sd),l=Ul((.2126729*e+.7151522*i+.072175*n)/1);return{l:116*l-16,a:500*(o-l),b:200*(l-Ul((.0193339*e+.119192*i+.9503041*n)/wu)),alpha:t.a}}function cd(t){let e=(t.l+16)/116,i=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=1*Eu(e),i=sd*Eu(i),n=wu*Eu(n),new Nt(Sa(3.2404542*i-1.5371385*e-.4985314*n),Sa(-.969266*i+1.8760108*e+.041556*n),Sa(.0556434*i-.2040259*e+1.0572252*n),t.alpha)}function Xp(t,e,i){const n=e-t;return t+i*(n>180||n<-180?n-360*Math.round(n/360):n)}const us={forward:ld,reverse:cd,interpolate:function(t,e,i){return{l:tt(t.l,e.l,i),a:tt(t.a,e.a,i),b:tt(t.b,e.b,i),alpha:tt(t.alpha,e.alpha,i)}}},Ma={forward:function(t){const{l:e,a:i,b:n}=ld(t),o=Math.atan2(n,i)*Hp;return{h:o<0?o+360:o,c:Math.sqrt(i*i+n*n),l:e,alpha:t.a}},reverse:function(t){const e=t.h*ad,i=t.c;return cd({l:t.l,a:Math.cos(e)*i,b:Math.sin(e)*i,alpha:t.alpha})},interpolate:function(t,e,i){return{h:Xp(t.h,e.h,i),c:tt(t.c,e.c,i),l:tt(t.l,e.l,i),alpha:tt(t.alpha,e.alpha,i)}}};var ud=Object.freeze({__proto__:null,hcl:Ma,lab:us});class pr{constructor(e,i,n,o,l){this.type=e,this.operator=i,this.interpolation=n,this.input=o,this.labels=[],this.outputs=[];for(const[c,d]of l)this.labels.push(c),this.outputs.push(d)}static interpolationFactor(e,i,n,o){let l=0;if(e.name==="exponential")l=Mu(i,e.base,n,o);else if(e.name==="linear")l=Mu(i,1,n,o);else if(e.name==="cubic-bezier"){const c=e.controlPoints;l=new Ks(c[0],c[1],c[2],c[3]).solve(Mu(i,1,n,o))}return l}static parse(e,i){let[n,o,l,...c]=e;if(!Array.isArray(o)||o.length===0)return i.error("Expected an interpolation type expression.",1);if(o[0]==="linear")o={name:"linear"};else if(o[0]==="exponential"){const _=o[1];if(typeof _!="number")return i.error("Exponential interpolation requires a numeric base.",1,1);o={name:"exponential",base:_}}else{if(o[0]!=="cubic-bezier")return i.error(`Unknown interpolation type ${String(o[0])}`,1,0);{const _=o.slice(1);if(_.length!==4||_.some(y=>typeof y!="number"||y<0||y>1))return i.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);o={name:"cubic-bezier",controlPoints:_}}}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.");if(l=i.parse(l,2,We),!l)return null;const d=[];let p=null;n==="interpolate-hcl"||n==="interpolate-lab"?p=br:i.expectedType&&i.expectedType.kind!=="value"&&(p=i.expectedType);for(let _=0;_<c.length;_+=2){const y=c[_],v=c[_+1],b=_+3,E=_+4;if(typeof y!="number")return i.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',b);if(d.length&&d[d.length-1][0]>=y)return i.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',b);const S=i.parse(v,E,p);if(!S)return null;p=p||S.type,d.push([y,S])}return p.kind==="number"||p.kind==="color"||p.kind==="array"&&p.itemType.kind==="number"&&typeof p.N=="number"?new pr(p,n,o,l,d):i.error(`Type ${Ti(p)} is not interpolatable.`)}evaluate(e){const i=this.labels,n=this.outputs;if(i.length===1)return n[0].evaluate(e);const o=this.input.evaluate(e);if(o<=i[0])return n[0].evaluate(e);const l=i.length;if(o>=i[l-1])return n[l-1].evaluate(e);const c=Fl(i,o),d=pr.interpolationFactor(this.interpolation,o,i[c],i[c+1]),p=n[c].evaluate(e),_=n[c+1].evaluate(e);return this.operator==="interpolate"?Al[this.type.kind.toLowerCase()](p,_,d):this.operator==="interpolate-hcl"?Ma.reverse(Ma.interpolate(Ma.forward(p),Ma.forward(_),d)):us.reverse(us.interpolate(us.forward(p),us.forward(_),d))}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"].concat(this.interpolation.controlPoints);const i=[this.operator,e,this.input.serialize()];for(let n=0;n<this.labels.length;n++)i.push(this.labels[n],this.outputs[n].serialize());return i}}function Mu(t,e,i,n){const o=n-i,l=t-i;return o===0?0:e===1?l/o:(Math.pow(e,l)-1)/(Math.pow(e,o)-1)}class jl{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 n=null;const o=i.expectedType;o&&o.kind!=="value"&&(n=o);const l=[];for(const d of e.slice(1)){const p=i.parse(d,1+l.length,n,void 0,{typeAnnotation:"omit"});if(!p)return null;n=n||p.type,l.push(p)}const c=o&&l.some(d=>ha(o,d.type));return new jl(c?Et:n,l)}evaluate(e){let i,n=null,o=0;for(const l of this.args){if(o++,n=l.evaluate(e),n&&n instanceof dr&&!n.available&&(i||(i=n),n=null,o===this.args.length))return i;if(n!==null)break}return n}
1eachChild(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 Gl{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 n=[];for(let l=1;l<e.length-1;l+=2){const c=e[l];if(typeof c!="string")return i.error(`Expected string, but found ${typeof c} instead.`,l);if(/[^a-zA-Z0-9_]/.test(c))return i.error("Variable names must contain only alphanumeric characters or '_'.",l);const d=i.parse(e[l+1],l+1);if(!d)return null;n.push([c,d])}const o=i.parse(e[e.length-1],e.length-1,i.expectedType,n);return o?new Gl(n,o):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[i,n]of this.bindings)e.push(i,n.serialize());return e.push(this.result.serialize()),e}}class Iu{constructor(e,i,n){this.type=e,this.index=i,this.input=n}static parse(e,i){if(e.length!==3)return i.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const n=i.parse(e[1],1,We),o=i.parse(e[2],2,rr(i.expectedType||Et));return n&&o?new Iu(o.type.itemType,n,o):null}evaluate(e){const i=this.index.evaluate(e),n=this.input.evaluate(e);if(i<0)throw new zi(`Array index out of bounds: ${i} < 0.`);if(i>=n.length)throw new zi(`Array index out of bounds: ${i} > ${n.length-1}.`);if(i!==Math.floor(i))throw new zi(`Array index must be an integer, but found ${i} instead.`);return n[i]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class Au{constructor(e,i){this.type=Ot,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 n=i.parse(e[1],1,Et),o=i.parse(e[2],2,Et);return n&&o?Cl(n.type,[Ot,Vt,We,zr,Et])?new Au(n,o):i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ti(n.type)} instead`):null}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(n==null)return!1;if(!ao(i,["boolean","string","number","null"]))throw new zi(`Expected first argument to be of type boolean, string, number or null, but found ${Ti(Si(i))} instead.`);if(!ao(n,["string","array"]))throw new zi(`Expected second argument to be of type array or string, but found ${Ti(Si(n))} instead.`);return n.indexOf(i)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class fo{constructor(e,i,n){this.type=We,this.needle=e,this.haystack=i,this.fromIndex=n}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 n=i.parse(e[1],1,Et),o=i.parse(e[2],2,Et);if(!n||!o)return null;if(!Cl(n.type,[Ot,Vt,We,zr,Et]))return i.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ti(n.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,We);return l?new fo(n,o,l):null}return new fo(n,o)}evaluate(e){const i=this.needle.evaluate(e),n=this.haystack.evaluate(e);if(!ao(i,["boolean","string","number","null"]))throw new zi(`Expected first argument to be of type boolean, string, number or null, but found ${Ti(Si(i))} instead.`);if(!ao(n,["string","array"]))throw new zi(`Expected second argument to be of type array or string, but found ${Ti(Si(n))} instead.`);if(this.fromIndex){const o=this.fromIndex.evaluate(e);return n.indexOf(i,o)}return n.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 Cu{constructor(e,i,n,o,l,c){this.inputType=e,this.type=i,this.input=n,this.cases=o,this.outputs=l,this.otherwise=c}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 n,o;
1i.expectedType&&i.expectedType.kind!=="value"&&(o=i.expectedType);const l={},c=[];for(let _=2;_<e.length-1;_+=2){let y=e[_];const v=e[_+1];Array.isArray(y)||(y=[y]);const b=i.concat(_);if(y.length===0)return b.error("Expected at least one branch label.");for(const S of y){if(typeof S!="number"&&typeof S!="string")return b.error("Branch labels must be numbers or strings.");if(typeof S=="number"&&Math.abs(S)>Number.MAX_SAFE_INTEGER)return b.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof S=="number"&&Math.floor(S)!==S)return b.error("Numeric branch labels must be integer values.");if(n){if(b.checkSubtype(n,Si(S)))return null}else n=Si(S);if(l[String(S)]!==void 0)return b.error("Branch labels must be unique.");l[String(S)]=c.length}const E=i.parse(v,_,o);if(!E)return null;o=o||E.type,c.push(E)}const d=i.parse(e[1],1,Et);if(!d)return null;const p=i.parse(e[e.length-1],e.length-1,o);return p?d.type.kind!=="value"&&i.concat(1).checkSubtype(n,d.type)?null:new Cu(n,o,d,l,c,p):null}evaluate(e){const i=this.input.evaluate(e);return(Si(i)===this.inputType&&this.outputs[this.cases[i]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],i=Object.keys(this.cases).sort(),n=[],o={};for(const c of i){const d=o[this.cases[c]];d===void 0?(o[this.cases[c]]=n.length,n.push([this.cases[c],[c]])):n[d][1].push(c)}const l=c=>this.inputType.kind==="number"?Number(c):c;for(const[c,d]of n)e.push(d.length===1?l(d[0]):d.map(l)),e.push(this.outputs[c].serialize());return e.push(this.otherwise.serialize()),e}}class Pu{constructor(e,i,n){this.type=e,this.branches=i,this.otherwise=n}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 n;i.expectedType&&i.expectedType.kind!=="value"&&(n=i.expectedType);const o=[];for(let c=1;c<e.length-1;c+=2){const d=i.parse(e[c],c,Ot);if(!d)return null;const p=i.parse(e[c+1],c+1,n);if(!p)return null;o.push([d,p]),n=n||p.type}const l=i.parse(e[e.length-1],e.length-1,n);return l?new Pu(n,o,l):null}evaluate(e){for(const[i,n]of this.branches)if(i.evaluate(e))return n.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[i,n]of this.branches)e(i),e(n);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 mo{constructor(e,i,n,o){this.type=e,this.input=i,this.beginIndex=n,this.endIndex=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 n=i.parse(e[1],1,Et),o=i.parse(e[2],2,We);if(!n||!o)return null;if(!Cl(n.type,[rr(Et),Vt,Et]))return i.error(`Expected first argument to be of type array or string, but found ${Ti(n.type)} instead`);if(e.length===4){const l=i.parse(e[3],3,We);return l?new mo(n.type,n,o,l):null}return new mo(n.type,n,o)}evaluate(e){const i=this.input.evaluate(e),n=this.beginIndex.evaluate(e);if(!ao(i,["string","array"]))throw new zi(`Expected first argument to be of type array or string, but found ${Ti(Si(i))} instead.`);if(this.endIndex){const o=this.endIndex.evaluate(e);return i.slice(n,o)}return i.slice(n)}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()]}}function hd(t,e){return t==="=="||t==="!="?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 zu(t,e,i,n){return n.compare(e,i)===0}function hs(t,e,i){const n=t!=="=="&&t!=="!=";return class f0{constructor(l,c,d){this.type=Ot,this.lhs=l,this.rhs=c,this.collator=d,this.hasUntypedArgument=l.type.kind==="value"||c.type.kind==="value"}static parse(l,c){if(l.length!==3&&l.length!==4)return c.error("Expected two or three arguments.");const d=l[0];let p=c.parse(l[1],1,Et);if(!p)return null;if(!hd(d,p.type))return c.concat(1).error(`"${d}" comparisons are not supported for type '${Ti(p.type)}'.`);let _=c.parse(l[2],2,Et);if(!_)return null;if(!hd(d,_.type))return c.concat(2).error(`"${d}" comparisons are not supported for type '${Ti(_.type)}'.`);if(p.type.kind!==_.type.kind&&p.type.kind!=="value"&&_.type.kind!=="value")return c.error(`Cannot compare types '${Ti(p.type)}' and '${Ti(_.type)}'.`);n&&(p.type.kind==="value"&&_.type.kind!=="value"?p=new Rr(_.type,[p]):p.type.kind!=="value"&&_.type.kind==="value"&&(_=new Rr(p.type,[_]))
vendor: 13,022 bytes, line 1
1);let y=null;if(l.length===4){if(p.type.kind!=="string"&&_.type.kind!=="string"&&p.type.kind!=="value"&&_.type.kind!=="value")return c.error("Cannot use collator to compare non-string types.");if(y=c.parse(l[3],3,ca),!y)return null}return new f0(p,_,y)}evaluate(l){const c=this.lhs.evaluate(l),d=this.rhs.evaluate(l);if(n&&this.hasUntypedArgument){const p=Si(c),_=Si(d);if(p.kind!==_.kind||p.kind!=="string"&&p.kind!=="number")throw new zi(`Expected arguments for "${t}" to be (string, string) or (number, number), but found (${p.kind}, ${_.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const p=Si(c),_=Si(d);if(p.kind!=="string"||_.kind!=="string")return e(l,c,d)}return this.collator?i(l,c,d,this.collator.evaluate(l)):e(l,c,d)}eachChild(l){l(this.lhs),l(this.rhs),this.collator&&l(this.collator)}outputDefined(){return!0}serialize(){const l=[t];return this.eachChild(c=>{l.push(c.serialize())}),l}}}const dd=hs("==",function(t,e,i){return e===i},zu),pd=hs("!=",function(t,e,i){return e!==i},function(t,e,i,n){return!zu(0,e,i,n)}),fd=hs("<",function(t,e,i){return e<i},function(t,e,i,n){return n.compare(e,i)<0}),md=hs(">",function(t,e,i){return e>i},function(t,e,i,n){return n.compare(e,i)>0}),Du=hs("<=",function(t,e,i){return e<=i},function(t,e,i,n){return n.compare(e,i)<=0}),Lu=hs(">=",function(t,e,i){return e>=i},function(t,e,i,n){return n.compare(e,i)>=0});class Ru{constructor(e,i,n,o,l,c){this.type=Vt,this.number=e,this.locale=i,this.currency=n,this.unit=o,this.minFractionDigits=l,this.maxFractionDigits=c}static parse(e,i){if(e.length!==3)return i.error("Expected two arguments.");const n=i.parse(e[1],1,We);if(!n)return null;const o=e[2];if(typeof o!="object"||Array.isArray(o))return i.error("NumberFormat options argument must be an object.");let l=null;if(o.locale&&(l=i.parse(o.locale,1,Vt),!l))return null;let c=null;if(o.currency&&(c=i.parse(o.currency,1,Vt),!c))return null;let d=null;if(o.unit&&(d=i.parse(o.unit,1,Vt),!d))return null;let p=null;if(o["min-fraction-digits"]&&(p=i.parse(o["min-fraction-digits"],1,We),!p))return null;let _=null;return o["max-fraction-digits"]&&(_=i.parse(o["max-fraction-digits"],1,We),!_)?null:new Ru(n,l,c,d,p,_)}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 ku{constructor(e){this.type=We,this.input=e}static parse(e,i){if(e.length!==2)return i.error(`Expected 1 argument, but found ${e.length-1} instead.`);const n=i.parse(e[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?i.error(`Expected argument of type string or array, but found ${Ti(n.type)} instead.`):new ku(n):null}evaluate(e){const i=this.input.evaluate(e);if(typeof i=="string"||Array.isArray(i))return i.length;throw new zi(`Expected value to be of type string or array, but found ${Ti(Si(i))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(i=>{e.push(i.serialize())}),e}}function Ou(t){return function(){t=1831565813+(t|=0)|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}const ds={"==":dd,"!=":pd,">":md,"<":fd,">=":Lu,"<=":Du,array:Rr,at:Iu,boolean:Rr,case:Pu,coalesce:jl,collator:_a,format:pa,image:fa,in:Au,"index-of":fo,interpolate:pr,"interpolate-hcl":pr,"interpolate-lab":pr,length:ku,let:Gl,literal:cn,match:Cu,number:Rr,"number-format":Ru,object:Rr,slice:mo,step:po,string:Rr,"to-boolean":Jr,"to-color":Jr,"to-number":Jr,"to-string":Jr,var:ls,within:un,distance:Qr,config:hn};function _d(t,[e,i,n,o]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const l=o?o.evaluate(t):1,c=Dr(e,i,n,l);if(c)throw new zi(c);return new Nt(e/255*l,i/255*l,n/255*l,l)}function gd(t,[e,i,n,o]){e=e.evaluate(t),i=i.evaluate(t),n=n.evaluate(t);const l=o?o.evaluate(t):1,c=function(_,y,v,b){return typeof _=="number"&&_>=0&&_<=360?typeof y=="number"&&y>=0&&y<=100&&typeof v=="number"&&v>=0&&v<=100?b===void 0||typeof b=="number"&&b>=0&&b<=1?null:`Invalid hsla value [${[_,y,v,b].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof b=="number"?[_,y,v,b]:[_,y,v]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof b=="number"?[_,y,v,b]:[_,y,v]).join(", ")}]: 'h' must be between 0 and 360.`}(e,i,n,l);if(c)throw new zi(c);const d=`hsla(${e}, ${i}%, ${n}%, ${l})`,p=Nt.parse(d);if(!p)throw new zi(`Failed to parse HSLA color: ${d}`);return p}function yd(t,e){return t in e}function Bu(t,e){const i=e[t];return i===void 0?null:i}function _o(t){return{type:t}}function xd(t){return{result:"success",value:t}}function go(t){return{result:"error",value:t}}function vd(t,e){return!!t&&!!t.parameters&&t.parameters.indexOf(e)>-1}function Fu(t){return t["property-type"]==="data-driven"}function u(t){return vd(t.expression,"measure-light")}function r(t){return vd(t.expression,"zoom")}function a(t){return!!t.expression&&t.expression.interpolated}function h(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function f(t){return t}function m(t,e){const i=e.type==="color",n=t.stops&&typeof t.stops[0][0]=="object",o=n||!(n||t.property!==void 0),l=t.type||(a(e)?"exponential":"interval");if(i&&((t=ou({},t)).stops&&(t.stops=t.stops.map(_=>[_[0],Nt.parse(_[1])])),t.default=Nt.parse(t.default?t.default:e.default)),t.colorSpace&&t.colorSpace!=="rgb"&&!ud[t.colorSpace])throw new Error(`Unknown color space: ${t.colorSpace}`);let c,d,p;if(l==="exponential")c=T;else if(l==="interval")c=w;else if(l==="categorical"){c=x,d=Object.create(null);for(const _ of t.stops)d[_[0]]=_[1];p=typeof t.stops[0][0]}else{if(l!=="identity")throw new Error(`Unknown function type "${l}"`);c=M}if(n){const _={},y=[];for(let E=0;E<t.stops.length;E++){const S=t.stops[E],I=S[0].zoom;_[I]===void 0&&(_[I]={zoom:I,type:t.type,property:t.property,default:t.default,stops:[]},y.push(I)),_[I].stops.push([S[0].value,S[1]])}const v=[];for(const E of y)v.push([_[E].zoom,m(_[E],e)]);const b={name:"linear"};return{kind:"composite",interpolationType:b,interpolationFactor:pr.interpolationFactor.bind(void 0,b),zoomStops:v.map(E=>E[0]),evaluate:({zoom:E},S)=>T({stops:v,base:t.base},e,E).evaluate(E,S)}}if(o){const _=l==="exponential"?{name:"exponential",base:t.base!==void 0?t.base:1}:null;return{kind:"camera",interpolationType:_,interpolationFactor:pr.interpolationFactor.bind(void 0,_),zoomStops:t.stops.map(y=>y[0]),evaluate:({zoom:y})=>c(t,e,y,d,p)}}return{kind:"source",evaluate(_,y){const v=y&&y.properties?y.properties[t.property]:void 0;return v===void 0?g(t.default,e.default):c(t,e,v,d,p)}}}function g(t,e,i){return t!==void 0?t:e!==void 0?e:i!==void 0?i:void 0}function x(t,e,i,n,o){return g(typeof i===o?n[i]:void 0,t.default,e.default)}function w(t,e,i){if(lo(i)!=="number")return g(t.default,e.default);const n=t.stops.length;if(n===1||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[n-1][0])return t.stops[n-1][1];const o=Fl(t.stops.map(l=>l[0]),i);return t.stops[o][1]}function T(t,e,i){const n=t.base!==void 0?t.base:1;if(lo(i)!=="number")return g(t.default,e.default);const o=t.stops.length;if(o===1||i<=t.stops[0][0])return t.stops[0][1];if(i>=t.stops[o-1][0])return t.stops[o-1][1];const l=Fl(t.stops.map(y=>y[0]),i),c=function(y,v,b,E){const S=E-b,I=y-b;return S===0?0:v===1?I/S:(Math.pow(v,I)-1)/(Math.pow(v,S)-1)}(i,n,t.stops[l][0],t.stops[l+1][0]),d=t.stops[l][1],p=t.stops[l+1][1];let _=Al[e.type]||f;if(t.colorSpace&&t.colorSpace!=="rgb"){const y=ud[t.colorSpace];_=(v,b)=>y.reverse(y.interpolate(y.forward(v),y.forward(b),c))}return typeof d.evaluate=="function"?{evaluate(...y){const v=d.evaluate.apply(void 0,y),b=p.evaluate.apply(void 0,y);if(v!==void 0&&b!==void 0)return _(v,b,c)}}:_(d,p,c)}function M(t,e,i){return e.type==="color"?i=Nt.parse(i):e.type==="formatted"?i=Bi.fromString(i.toString()):e.type==="resolvedImage"?i=dr.fromString(i.toString()):lo(i)===e.type||e.type==="enum"&&e.values[i]||(i=void 0),g(i,t.default,e.default)}Ki.register(ds,{error:[{kind:"error"},[Vt],(t,[e])=>{throw new zi(e.evaluate(t))}],typeof:[Vt,[Et],(t,[e])=>Ti(Si(e.evaluate(t)))],"to-rgba":[rr(We,4),[br],(t,[e])=>e.evaluate(t).toRenderColor(null).toArray()],rgb:[br,[We,We,We],_d],rgba:[br,[We,We,We,We],_d],hsl:[br,[We,We,We],gd],hsla:[br,[We,We,We,We],gd],has:{type:Ot,overloads:[[[Vt],(t,[e])=>yd(e.evaluate(t),t.properties())],[[Vt,Qo],(t,[e,i])=>yd(e.evaluate(t),i.evaluate(t))]]},get:{type:Et,overloads:[[[Vt],(t,[e])=>Bu(e.evaluate(t),t.properties())],[[Vt,Qo],(t,[e,i])=>Bu(e.evaluate(t),i.evaluate(t))]]},"feature-state":[Et,[Vt],(t,[e])=>Bu(e.evaluate(t),t.featureState||{})],properties:[Qo,[],t=>t.properties()],"geometry-type":[Vt,[],t=>t.geometryType()],id:[Et,[],t=>t.id()],zoom:[We,[],t=>t.globals.zoom],pitch:[We,[],t=>t.globals.pitch||0],"distance-from-center":[We,[],t=>t.distanceFromCenter()],"measure-light":[We,[Vt],(t,[e])=>t.measureLight(e.evaluate(t))],"heatmap-density":[We,[],t=>t.globals.heatmapDensity||0],"line-progress":[We,[],t=>t.globals.lineProgress||0],"raster-value":[We,[],t=>t.globals.rasterValue||0],"raster-particle-speed":[We,[],t=>t.globals.rasterParticleSpeed||0],"sky-radial-progress":[We,[],t=>t.globals.skyRadialProgress||0],accumulated:[Et,[],t=>t.globals.accumulated===void 0?null:t.globals.accumulated],"+":[We,_o(We),(t,e)=>{let i=0;for(const n of e)i+=n.evaluate(t);return i}],"*":[We,_o(We),(t,e)=>{let i=1;for(const n of e)i*=n.evaluate(t);return i}],"-":{type:We,overloads:[[[We,We],(t,[e,i])=>e.evaluate(t)-i.evaluate(t)],[[We],(t,[e])=>-e.evaluate(t)]]},"/":[We,[We,We],(t,[e,i])=>e.evaluate(t)/i.evaluate(t)],"%":[We,[We,We],(t,[e,i])=>e.evaluate(t)%i.evaluate(t)],ln2:[We,[],()=>Math.LN2],pi:[We,[],()=>Math.PI],e:[We,[],()=>Math.E],"^":[We,[We,We],(t,[e,i])=>Math.pow(e.evaluate(t),i.evaluate(t))],sqrt:[We,[We],(t,[e])=>Math.sqrt(e.evaluate(t))],log10:[We,[We],(t,[e])=>Math.log(e.evaluate(t))/Math.LN10],ln:[We,[We],(t,[e])=>Math.log(e.evaluate(t))],log2:[We,[We],(t,[e])=>Math.log(e.evaluate(t))/Math.LN2],sin:[We,[We],(t,[e])=>Math.sin(e.evaluate(t))],cos:[We,[We],(t,[e])=>Math.cos(e.evaluate(t))],tan:[We,[We],(t,[e])=>Math.tan(e.evaluate(t))],asin:[We,[We],(t,[e])=>Math.asin(e.evaluate(t))],acos:[We,[We],(t,[e])=>Math.acos(e.evaluate(t))],atan:[We,[We],(t,[e])=>Math.atan(e.evaluate(t))],min:[We,_o(We),(t,e)=>Math.min(...e.map(i=>i.evaluate(t)))],max:[We,_o(We),(t,e)=>Math.max(...e.map(i=>i.evaluate(t)))],abs:[We,[We],(t,[e])=>Math.abs(e.evaluate(t))],round:[We,[We],(t,[e])=>{const i=e.evaluate(t);return i<0?-Math.round(-i):Math.round(i)}],floor:[We,[We],(t,[e])=>Math.floor(e.evaluate(t))],ceil:[We,[We],(t,[e])=>Math.ceil(e.evaluate(t))],"filter-==":[Ot,[Vt,Et],(t,[e,i])=>t.properties()[e.value]===i.value],"filter-id-==":[Ot,[Et],(t,[e])=>t.id()===e.value],"filter-type-==":[Ot,[Vt],(t,[e])=>t.geometryType()===e.value],"filter-<":[Ot,[Vt,Et],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n<o}],"filter-id-<":[Ot,[Et],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<n}],"filter->":[Ot,[Vt,Et],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n>o}],"filter-id->":[Ot,[Et],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>n}],"filter-<=":[Ot,[Vt,Et],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n<=o}],"filter-id-<=":[Ot,[Et],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i<=n}],"filter->=":[Ot,[Vt,Et],(t,[e,i])=>{const n=t.properties()[e.value],o=i.value;return typeof n==typeof o&&n>=o}],"filter-id->=":[Ot,[Et],(t,[e])=>{const i=t.id(),n=e.value;return typeof i==typeof n&&i>=n}],"filter-has":[Ot,[Et],(t,[e])=>e.value in t.properties()],"filter-has-id":[Ot,[],t=>t.id()!==null&&t.id()!==void 0],"filter-type-in":[Ot,[rr(Vt)],(t,[e])=>e.value.indexOf(t.geometryType())>=0],"filter-id-in":[Ot,[rr(Et)],(t,[e])=>e.value.indexOf(t.id())>=0],"filter-in-small":[Ot,[Vt,rr(Et)],(t,[e,i])=>i.value.indexOf(t.properties()[e.value])>=0],"filter-in-large":[Ot,[Vt,rr(Et)],(t,[e,i])=>function(n,o,l,c){for(;l<=c;){const d=l+c>>1;
1if(o[d]===n)return!0;o[d]>n?c=d-1:l=d+1}return!1}(t.properties()[e.value],i.value,0,i.value.length-1)],all:{type:Ot,overloads:[[[Ot,Ot],(t,[e,i])=>e.evaluate(t)&&i.evaluate(t)],[_o(Ot),(t,e)=>{for(const i of e)if(!i.evaluate(t))return!1;return!0}]]},any:{type:Ot,overloads:[[[Ot,Ot],(t,[e,i])=>e.evaluate(t)||i.evaluate(t)],[_o(Ot),(t,e)=>{for(const i of e)if(i.evaluate(t))return!0;return!1}]]},"!":[Ot,[Ot],(t,[e])=>!e.evaluate(t)],"is-supported-script":[Ot,[Vt],(t,[e])=>{const i=t.globals&&t.globals.isSupportedScript;return!i||i(e.evaluate(t))}],upcase:[Vt,[Vt],(t,[e])=>e.evaluate(t).toUpperCase()],downcase:[Vt,[Vt],(t,[e])=>e.evaluate(t).toLowerCase()],concat:[Vt,_o(Et),(t,e)=>e.map(i=>Lr(i.evaluate(t))).join("")],"resolved-locale":[Vt,[ca],(t,[e])=>e.evaluate(t).resolvedLocale()],random:[We,[We,We,Et],(t,e)=>{const[i,n,o]=e.map(c=>c.evaluate(t));if(i>n||i===n)return i;let l;if(typeof o=="string")l=function(c){let d=0;if(c.length===0)return d;for(let p=0;p<c.length;p++)d=(d<<5)-d+c.charCodeAt(p),d|=0;return d}(o);else{if(typeof o!="number")throw new zi(`Invalid seed input: ${o}`);l=o}return i+Ou(l)()*(n-i)}]});class A{constructor(e,i,n,o){this.expression=e,this._warningHistory={},this._evaluator=new Pl(n,o),this._defaultValue=i?function(l){return l.type==="color"&&(h(l.default)||Array.isArray(l.default))?new Nt(0,0,0,0):l.type==="color"?Nt.parse(l.default)||null:l.default===void 0?null:l.default}(i):null,this._enumValues=i&&i.type==="enum"?i.values:null}evaluateWithoutErrorHandling(e,i,n,o,l,c,d,p){return this._evaluator.globals=e,this._evaluator.feature=i,this._evaluator.featureState=n,this._evaluator.canonical=o||null,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=c,this._evaluator.featureTileCoord=d||null,this._evaluator.featureDistanceData=p||null,this.expression.evaluate(this._evaluator)}evaluate(e,i,n,o,l,c,d,p){this._evaluator.globals=e,this._evaluator.feature=i||null,this._evaluator.featureState=n||null,this._evaluator.canonical=o||null,this._evaluator.availableImages=l||null,this._evaluator.formattedSection=c||null,this._evaluator.featureTileCoord=d||null,this._evaluator.featureDistanceData=p||null;try{const _=this.expression.evaluate(this._evaluator);if(_==null||typeof _=="number"&&_!=_)return this._defaultValue;if(this._enumValues&&!(_ in this._enumValues))throw new zi(`Expected value to be one of ${Object.keys(this._enumValues).map(y=>JSON.stringify(y)).join(", ")}, but found ${JSON.stringify(_)} instead.`);return _}catch(_){return this._warningHistory[_.message]||(this._warningHistory[_.message]=!0,typeof console<"u"&&console.warn(_.message)),this._defaultValue}}}function P(t){return Array.isArray(t)&&t.length>0&&typeof t[0]=="string"&&t[0]in ds}function z(t,e,i,n){const o=new Bl(ds,[],e?function(c){const d={color:br,string:Vt,number:We,enum:Vt,boolean:Ot,formatted:Kr,resolvedImage:ua};return c.type==="array"?rr(d[c.value]||Et,c.length):d[c.type]}(e):void 0,void 0,void 0,i,n),l=o.parse(t,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return l?xd(new A(l,e,i,n)):go(o.errors)}class R{constructor(e,i,n){this.kind=e,this._styleExpression=i,this.isLightConstant=n,this.isStateDependent=e!=="constant"&&!Ol(i.expression),this.isConfigDependent=!xu(i.expression)}evaluateWithoutErrorHandling(e,i,n,o,l,c){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,o,l,c)}evaluate(e,i,n,o,l,c){return this._styleExpression.evaluate(e,i,n,o,l,c)}}class k{constructor(e,i,n,o,l){this.kind=e,this.zoomStops=n,this._styleExpression=i,this.isStateDependent=e!=="camera"&&!Ol(i.expression),this.isLightConstant=l,this.isConfigDependent=!xu(i.expression),this.interpolationType=o}evaluateWithoutErrorHandling(e,i,n,o,l,c){return this._styleExpression.evaluateWithoutErrorHandling(e,i,n,o,l,c)}evaluate(e,i,n,o,l,c){return this._styleExpression.evaluate(e,i,n,o,l,c)}interpolationFactor(e,i,n){return this.interpolationType?pr.interpolationFactor(this.interpolationType,e,i,n):0}}function O(t,e,i,n){if((t=z(t,e,i,n)).result==="error")return t;const o=t.value.expression,l=Ta(o);if(!l&&!Fu(e))return go([new Yr("","data expressions not supported")]);const c=Ea(o,["zoom","pitch","distance-from-center"]);if(!c&&!r(e))return go([new Yr("","zoom expressions not supported")]);const d=Ea(o,["measure-light"]);if(!d&&!u(e))return go([new Yr("","measure-light expression not supported")]);const p=e.expression&&e.expression.relaxZoomRestriction,_=G(o);return _||c||p?_ instanceof Yr?go([_]):_ instanceof pr&&!a(e)?go([new Yr("",'"interpolate" expressions cannot be used with this property')]):xd(_?new k(l?"camera":"composite",t.value,_.labels,_ instanceof pr?_.interpolation:void 0,d):new R(l?"constant":"source",t.value,d)):go([new Yr("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class B{constructor(e,i){this._parameters=e,this._specification=i,ou(this,m(this._parameters,this._specification))}static deserialize(e){return new B(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function G(t){let e=null;if(t instanceof Gl)e=G(t.result);else if(t instanceof jl){for(const i of t.args)if(e=G(i),e)break}else(t instanceof po||t instanceof pr)&&t.input instanceof Ki&&t.input.name==="zoom"&&(e=t);return e instanceof Yr||t.eachChild(i=>{const n=G(i);n instanceof Yr?e=n:e&&n&&e!==n&&(e=new Yr("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}var q=K,Z=3;function K(t,e,i){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var o=new Int32Array(this.arrayBuffer);t=o[0],this.d=(e=o[1])+2*(i=o[2]);for(var l=0;l<this.d*this.d;l++){var c=o[Z+l],d=o[Z+l+1];n.push(c===d?null:o.subarray(c,d))}var p=o[Z+n.length+1];this.keys=o.subarray(o[Z+n.length],p),this.bboxes=o.subarray(p),this.insert=this._insertReadonly}else{this.d=e+2*i;for(var _=0;_<this.d*this.d;_++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=i,this.scale=e/t,this.uid=0;var y=i/e*t;this.min=-y,this.max=t+y}
1K.prototype.insert=function(t,e,i,n,o){this._forEachCell(e,i,n,o,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(i),this.bboxes.push(n),this.bboxes.push(o)},K.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},K.prototype._insertCell=function(t,e,i,n,o,l){this.cells[o].push(l)},K.prototype.query=function(t,e,i,n,o){var l=this.min,c=this.max;if(t<=l&&e<=l&&c<=i&&c<=n&&!o)return Array.prototype.slice.call(this.keys);var d=[];return this._forEachCell(t,e,i,n,this._queryCell,d,{},o),d},K.prototype._queryCell=function(t,e,i,n,o,l,c,d){var p=this.cells[o];if(p!==null)for(var _=this.keys,y=this.bboxes,v=0;v<p.length;v++){var b=p[v];if(c[b]===void 0){var E=4*b;(d?d(y[E+0],y[E+1],y[E+2],y[E+3]):t<=y[E+2]&&e<=y[E+3]&&i>=y[E+0]&&n>=y[E+1])?(c[b]=!0,l.push(_[b])):c[b]=!1}}},K.prototype._forEachCell=function(t,e,i,n,o,l,c,d){for(var p=this._convertToCellCoord(t),_=this._convertToCellCoord(e),y=this._convertToCellCoord(i),v=this._convertToCellCoord(n),b=p;b<=y;b++)for(var E=_;E<=v;E++){var S=this.d*E+b;if((!d||d(this._convertFromCellCoord(b),this._convertFromCellCoord(E),this._convertFromCellCoord(b+1),this._convertFromCellCoord(E+1)))&&o.call(this,t,e,i,n,S,l,c,d))return}},K.prototype._convertFromCellCoord=function(t){return(t-this.padding)/this.scale},K.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},K.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=Z+this.cells.length+1+1,i=0,n=0;n<this.cells.length;n++)i+=this.cells[n].length;var o=new Int32Array(e+i+this.keys.length+this.bboxes.length);o[0]=this.extent,o[1]=this.n,o[2]=this.padding;for(var l=e,c=0;c<t.length;c++){var d=t[c];o[Z+c]=l,o.set(d,l),l+=d.length}return o[Z+t.length]=l,o.set(this.keys,l),o[Z+t.length+1]=l+=this.keys.length,o.set(this.bboxes,l),l+=this.bboxes.length,o.buffer};var Y=Gr(q);const te={};function N(t,e,i={}){Object.defineProperty(t,"_classRegistryKey",{value:e,writable:!1}),te[e]={klass:t,omit:i.omit||[]}}N(Object,"Object"),Y.serialize=function(t,e){const i=t.toArrayBuffer();return e&&e.add(i),{buffer:i}},Y.deserialize=function(t){return new Y(t.buffer)},Object.defineProperty(Y,"name",{value:"Grid"}),N(Y,"Grid"),N(Nt,"Color"),N(Error,"Error"),N(Bi,"Formatted"),N(da,"FormattedSection"),N(vl,"AJAXError"),N(dr,"ResolvedImage"),N(B,"StylePropertyFunction"),N(A,"StyleExpression",{omit:["_evaluator"]}),N(k,"ZoomDependentExpression"),N(R,"ZoomConstantExpression"),N(Ki,"CompoundExpression",{omit:["_evaluate"]});for(const t in ds)te[ds[t]._classRegistryKey]||N(ds[t],`Expression${t}`);function $(t){return t&&typeof ArrayBuffer<"u"&&(t instanceof ArrayBuffer||t.constructor&&t.constructor.name==="ArrayBuffer")}function re(t){return self.ImageBitmap&&t instanceof ImageBitmap}function de(t,e){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp)return t;if($(t)||re(t))return e&&e.add(t),t;if(ArrayBuffer.isView(t)){const i=t;return e&&e.add(i.buffer),i}if(t instanceof ImageData)return e&&e.add(t.data.buffer),t;if(Array.isArray(t)){const i=[];for(const n of t)i.push(de(n,e));return i}if(t instanceof Map){const i={$name:"Map"};for(const[n,o]of t.entries())i[n]=de(o);return i}if(typeof t=="object"){const i=t.constructor,n=i._classRegistryKey;if(!n)throw new Error(`can't serialize object of unregistered class ${n}`);const o=i.serialize?i.serialize(t,e):{};if(!i.serialize){for(const l in t)t.hasOwnProperty(l)&&(te[n].omit.indexOf(l)>=0||(o[l]=de(t[l],e)));t instanceof Error&&(o.message=t.message)}if(o.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(o.$name=n),o}throw new Error("can't serialize object of type "+typeof t)}function se(t){if(t==null||typeof t=="boolean"||typeof t=="number"||typeof t=="string"||t instanceof Boolean||t instanceof Number||t instanceof String||t instanceof Date||t instanceof RegExp||$(t)||re(t)||ArrayBuffer.isView(t)||t instanceof ImageData)return t;if(Array.isArray(t))return t.map(se);if(typeof t=="object"){const e=t.$name||"Object";if(e==="Map"){const o=new Map;for(const l of Object.keys(t))l!=="$name"&&o.set(l,se(t[l]));return o}const{klass:i}=te[e];if(!i)throw new Error(`can't deserialize unregistered class ${e}`);if(i.deserialize)return i.deserialize(t);const n=Object.create(i.prototype);for(const o of Object.keys(t))o!=="$name"&&(n[o]=se(t[o]));return n}throw new Error("can't deserialize object of type "+typeof t)}const Q={"Latin-1 Supplement":t=>t>=128&&t<=255,Arabic:t=>t>=1536&&t<=1791,"Arabic Supplement":t=>t>=1872&&t<=1919,"Arabic Extended-A":t=>t>=2208&&t<=2303,"Hangul Jamo":t=>t>=4352&&t<=4607,"Unified Canadian Aboriginal Syllabics":t=>t>=5120&&t<=5759,Khmer:t=>t>=6016&&t<=6143,"Unified Canadian Aboriginal Syllabics Extended":t=>t>=6320&&t<=6399,"General Punctuation":t=>t>=8192&&t<=8303,"Letterlike Symbols":t=>t>=8448&&t<=8527,"Number Forms":t=>t>=8528&&t<=8591,"Miscellaneous Technical":t=>t>=8960&&t<=9215,"Control Pictures":t=>t>=9216&&t<=9279,"Optical Character Recognition":t=>t>=9280&&t<=9311,"Enclosed Alphanumerics":t=>t>=9312&&t<=9471,"Geometric Shapes":t=>t>=9632&&t<=9727,"Miscellaneous Symbols":t=>t>=9728&&t<=9983,"Miscellaneous Symbols and Arrows":t=>t>=11008&&t<=11263,"CJK Radicals Supplement":t=>t>=11904&&t<=12031,"Kangxi Radicals":t=>t>=12032&&t<=12255,"Ideographic Description Characters":t=>t>=12272&&t<=12287,"CJK Symbols and Punctuation":t=>t>=12288&&t<=12351,Hiragana:t=>t>=12352&&t<=12447,Katakana:t=>t>=12448&&t<=12543,Bopomofo:t=>t>=12544&&t<=12591,"Hangul Compatibility Jamo":t=>t>=12592&&t<=12687,Kanbun:t=>t>=12688&&t<=12703,"Bopomofo Extended":t=>t>=12704&&t<=12735,"CJK Strokes":t=>t>
1=12736&&t<=12783,"Katakana Phonetic Extensions":t=>t>=12784&&t<=12799,"Enclosed CJK Letters and Months":t=>t>=12800&&t<=13055,"CJK Compatibility":t=>t>=13056&&t<=13311,"CJK Unified Ideographs Extension A":t=>t>=13312&&t<=19903,"Yijing Hexagram Symbols":t=>t>=19904&&t<=19967,"CJK Unified Ideographs":t=>t>=19968&&t<=40959,"Yi Syllables":t=>t>=40960&&t<=42127,"Yi Radicals":t=>t>=42128&&t<=42191,"Hangul Jamo Extended-A":t=>t>=43360&&t<=43391,"Hangul Syllables":t=>t>=44032&&t<=55215,"Hangul Jamo Extended-B":t=>t>=55216&&t<=55295,"Private Use Area":t=>t>=57344&&t<=63743,"CJK Compatibility Ideographs":t=>t>=63744&&t<=64255,"Arabic Presentation Forms-A":t=>t>=64336&&t<=65023,"Vertical Forms":t=>t>=65040&&t<=65055,"CJK Compatibility Forms":t=>t>=65072&&t<=65103,"Small Form Variants":t=>t>=65104&&t<=65135,"Arabic Presentation Forms-B":t=>t>=65136&&t<=65279,"Halfwidth and Fullwidth Forms":t=>t>=65280&&t<=65519,"CJK Unified Ideographs Extension B":t=>t>=131072&&t<=173791};function fe(t){for(const e of t)if(Se(e.charCodeAt(0)))return!0;return!1}function Me(t){for(const e of t)if(!Ie(e.charCodeAt(0)))return!1;return!0}function Ie(t){return!(Q.Arabic(t)||Q["Arabic Supplement"](t)||Q["Arabic Extended-A"](t)||Q["Arabic Presentation Forms-A"](t)||Q["Arabic Presentation Forms-B"](t))}function Se(t){return!(t!==746&&t!==747&&(t<4352||!(Q["Bopomofo Extended"](t)||Q.Bopomofo(t)||Q["CJK Compatibility Forms"](t)&&!(t>=65097&&t<=65103)||Q["CJK Compatibility Ideographs"](t)||Q["CJK Compatibility"](t)||Q["CJK Radicals Supplement"](t)||Q["CJK Strokes"](t)||!(!Q["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||t===12336)||Q["CJK Unified Ideographs Extension A"](t)||Q["CJK Unified Ideographs"](t)||Q["Enclosed CJK Letters and Months"](t)||Q["Hangul Compatibility Jamo"](t)||Q["Hangul Jamo Extended-A"](t)||Q["Hangul Jamo Extended-B"](t)||Q["Hangul Jamo"](t)||Q["Hangul Syllables"](t)||Q.Hiragana(t)||Q["Ideographic Description Characters"](t)||Q.Kanbun(t)||Q["Kangxi Radicals"](t)||Q["Katakana Phonetic Extensions"](t)||Q.Katakana(t)&&t!==12540||!(!Q["Halfwidth and Fullwidth Forms"](t)||t===65288||t===65289||t===65293||t>=65306&&t<=65310||t===65339||t===65341||t===65343||t>=65371&&t<=65503||t===65507||t>=65512&&t<=65519)||!(!Q["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||Q["Unified Canadian Aboriginal Syllabics"](t)||Q["Unified Canadian Aboriginal Syllabics Extended"](t)||Q["Vertical Forms"](t)||Q["Yijing Hexagram Symbols"](t)||Q["Yi Syllables"](t)||Q["Yi Radicals"](t))))}function le(t){return!(Se(t)||function(e){return!!(Q["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Q["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)||Q["Letterlike Symbols"](e)||Q["Number Forms"](e)||Q["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)||Q["Control Pictures"](e)&&e!==9251||Q["Optical Character Recognition"](e)||Q["Enclosed Alphanumerics"](e)||Q["Geometric Shapes"](e)||Q["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Q["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Q["CJK Symbols and Punctuation"](e)||Q.Katakana(e)||Q["Private Use Area"](e)||Q["CJK Compatibility Forms"](e)||Q["Small Form Variants"](e)||Q["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(t))}function _e(t){return t>=1424&&t<=2303||Q["Arabic Presentation Forms-A"](t)||Q["Arabic Presentation Forms-B"](t)}function we(t,e){return!(!e&&_e(t)||t>=2304&&t<=3583||t>=3840&&t<=4255||Q.Khmer(t))}function Ve(t){for(const e of t)if(_e(e.charCodeAt(0)))return!0;return!1}const Ue="deferred",qe="loading",je="loaded";let Be=null,ve="unavailable",He=null;const yt=function(t){t&&typeof t=="string"&&t.indexOf("NetworkError")>-1&&(ve="error"),Be&&Be(t)};function it(){ht.fire(new hr("pluginStateChange",{pluginStatus:ve,pluginURL:He}))}const ht=new so,It=function(){return ve},oi=function(){if(ve!==Ue||!He)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");ve=qe,it(),He&&Dn({url:He},t=>{t?yt(t):(ve=je,it())})},St={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>ve===je||St.applyArabicShaping!=null,isLoading:()=>ve===qe,setState(t){ve=t.pluginStatus,He=t.pluginURL},isParsed:()=>St.applyArabicShaping!=null&&St.processBidirectionalText!=null&&St.processStyledBidirectionalText!=null,getPluginURL:()=>He};class st{constructor(e,i){this.zoom=e,i?(this.now=i.now,this.fadeDuration=i.fadeDuration,this.transition=i.transition,this.pitch=i.pitch,this.brightness=i.brightness):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(i,n){for(const o of i)if(!we(o.charCo
1deAt(0),n))return!1;return!0}(e,St.isLoaded())}}class Jt{constructor(e,i,n,o){this.property=e,this.value=i,this.expression=function(l,c,d,p){if(h(l))return new B(l,c);if(P(l)||Array.isArray(l)&&l.length>0){const _=O(l,c,d,p);if(_.result==="error")throw new Error(_.value.map(y=>`${y.key}: ${y.message}`).join(", "));return _.value}{let _=l;return typeof l=="string"&&c.type==="color"&&(_=Nt.parse(l)),{kind:"constant",isConfigDependent:!1,evaluate:()=>_}}}(i===void 0?e.specification.default:i,e.specification,n,o)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,i,n){return this.property.possiblyEvaluate(this,e,i,n)}}class Zt{constructor(e,i,n){this.property=e,this.value=new Jt(e,void 0,i,n)}transitioned(e,i){return new dt(this.property,this.value,i,Xi({},e.transition,this.transition),e.now)}untransitioned(){return new dt(this.property,this.value,null,{},0)}}class At{constructor(e,i,n){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=i,this._options=n,this.isConfigDependent=!1}getValue(e){return Hr(this._values[e].value.value)}setValue(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new Zt(this._values[e].property,this._scope,this._options)),this._values[e].value=new Jt(this._values[e].property,i===null?void 0:Hr(i),this._scope,this._options),this.isConfigDependent=this.isConfigDependent||this._values[e].value.expression.isConfigDependent}setTransitionOrValue(e,i){i&&(this._options=i);const n=this._properties.properties;if(e)for(const o in e){const l=e[o];if(eo(o,"-transition")){const c=o.slice(0,-11);n[c]&&this.setTransition(c,l)}else n.hasOwnProperty(o)&&this.setValue(o,l)}}getTransition(e){return Hr(this._values[e].transition)}setTransition(e,i){this._values.hasOwnProperty(e)||(this._values[e]=new Zt(this._values[e].property)),this._values[e].transition=Hr(i)||void 0}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n);const o=this.getTransition(i);o!==void 0&&(e[`${i}-transition`]=o)}return e}transitioned(e,i){const n=new ti(this._properties);for(const o of Object.keys(this._values))n._values[o]=this._values[o].transitioned(e,i._values[o]);return n}untransitioned(){const e=new ti(this._properties);for(const i of Object.keys(this._values))e._values[i]=this._values[i].untransitioned();return e}}class dt{constructor(e,i,n,o,l){const c=o.delay||0,d=o.duration||0;l=l||0,this.property=e,this.value=i,this.begin=l+c,this.end=this.begin+d,e.specification.transition&&(o.delay||o.duration)&&(this.prior=n)}possiblyEvaluate(e,i,n){const o=e.now||0,l=this.value.possiblyEvaluate(e,i,n),c=this.prior;if(c){if(o>this.end)return this.prior=null,l;if(this.value.isDataDriven())return this.prior=null,l;if(o<this.begin)return c.possiblyEvaluate(e,i,n);{const d=(o-this.begin)/(this.end-this.begin);return this.property.interpolate(c.possiblyEvaluate(e,i,n),l,Js(d))}}return l}}class ti{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,i,n){const o=new ii(this._properties);for(const l of Object.keys(this._values))o._values[l]=this._values[l].possiblyEvaluate(e,i,n);return o}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class yi{constructor(e,i,n){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=i,this._options=n,this.isConfigDependent=!1}getValue(e){return Hr(this._values[e].value)}setValue(e,i){this._values[e]=new Jt(this._values[e].property,i===null?void 0:Hr(i),this._scope,this._options),this.isConfigDependent=this.isConfigDependent||this._values[e].expression.isConfigDependent}serialize(){const e={};for(const i of Object.keys(this._values)){const n=this.getValue(i);n!==void 0&&(e[i]=n)}return e}possiblyEvaluate(e,i,n){const o=new ii(this._properties);for(const l of Object.keys(this._values))o._values[l]=this._values[l].possiblyEvaluate(e,i,n);return o}}class Ht{constructor(e,i,n){this.property=e,this.value=i,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,i,n,o){return this.property.evaluate(this.value,this.parameters,e,i,n,o)}}class ii{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Ee{constructor(e){this.specification=e}
vendor: 8,056 bytes, line 1
1possiblyEvaluate(e,i){return e.expression.evaluate(i)}interpolate(e,i,n){const o=Al[this.specification.type];return o?o(e,i,n):e}}class $e{constructor(e,i){this.specification=e,this.overrides=i}possiblyEvaluate(e,i,n,o){return new Ht(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(i,null,{},n,o)}:e.expression,i)}interpolate(e,i,n){if(e.value.kind!=="constant"||i.value.kind!=="constant")return e;if(e.value.value===void 0||i.value.value===void 0)return new Ht(this,{kind:"constant",value:void 0},e.parameters);const o=Al[this.specification.type];return o?new Ht(this,{kind:"constant",value:o(e.value.value,i.value.value,n)},e.parameters):e}evaluate(e,i,n,o,l,c){return e.kind==="constant"?e.value:e.evaluate(i,n,o,l,c)}}class Di{constructor(e){this.specification=e}possiblyEvaluate(e,i,n,o){return!!e.expression.evaluate(i,null,{},n,o)}interpolate(){return!1}}class Gt{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const i=new st(0,{});for(const n in e){const o=e[n];o.specification.overridable&&this.overridableProperties.push(n);const l=this.defaultPropertyValues[n]=new Jt(o,void 0),c=this.defaultTransitionablePropertyValues[n]=new Zt(o);this.defaultTransitioningPropertyValues[n]=c.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=l.possiblyEvaluate(i)}}}N($e,"DataDrivenProperty"),N(Ee,"DataConstantProperty"),N(Di,"ColorRampProperty");var he=JSON.parse('{"$version":8,"$root":{"version":{"required":true,"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"required":false,"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"imports":{"type":"array","value":"import"},"schema":{"type":"schema"},"sources":{"required":true,"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"required":true,"type":"array","value":"layer"},"models":{"type":"models"}},"model":{"type":"string","required":true},"import":{"id":{"type":"string","required":true},"url":{"type":"string","required":true},"config":{"type":"config"},"data":{"type":"$root"}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","property-type":"data-constant","expression":{},"required":true},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string","required":true},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false,"expression":{},"property-type":"data-constant"},"shadow-intensity":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_ambient":{"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"required":true,"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"required":true,"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"required":true,"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"experimental":true,"type":{"required":true,"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"required":true,"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0}
1,"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"required":true,"type":"enum","values":{"video":1}},"urls":{"required":true,"type":"array","value":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"required":true,"type":"enum","values":{"image":1}},"url":{"required":false,"type":"string"},"coordinates":{"required":true,"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_model":{"type":{"required":true,"type":"enum","values":{"model":1,"batched-model":1}},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"}},"layer":{"id":{"type":"string","required":true},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"raster":{},"raster-particle":{"experimental":true},"hillshade":{},"model":{"experimental":true},"background":{},"sky":{},"slot":{},"clip":{"experimental":true}},"required":true},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{},"property-type":"data-constant","experimental":true}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"},"fill-extrusion-edge-radius":{"type":"number","experimental":true,"private":true,"default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"constant"}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","experimental":true,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-size":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}
1,"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-rotate":{"type":"number","default":0,"period":360,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{},"property-type":"constant"}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*","required":false}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"high-color":{"type":"color","property-type":"data-constant","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"space-color":{"type":"color","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"horizon-blend":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","property-type":"data-constant","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective","property-type":"data-constant"}},"colorTheme":{"data":{"type":"string","property-type":"data-constant","expression":{}}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"property-type":"data-constant","expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","property-type":"data-constant","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"intensity":{"type":"number","property-type":"data-constant","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator","required":true},"center":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","property-type":"data-constant","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string","required":true},"exaggeration":{"type":"number","property-type":"data-constant","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"fill-extrusion-ambient-occlusion-intensity":{"property-type":"data-constant","type":"number","private":true,"default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"property-type":"data-constant","type":"number","private":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"property-type":"data-constant","type":"number","experimental":true,"default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"property-type":"data-constant","type":"color","experimental":true,"default":"#ffffff","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"property-type":"data-constant","type":"number","experimental":true,"default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","experimental":true,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"property-type":"data-constant","type":"number","experimental":true,"default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"property-type":"data-constant","type":"number","experimental":true,"default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"property-type":"data-constant","type":"boolean","default":true,"experimental":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"
1property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-gradient":{"type":"color","expression":{"interpolated":true,"parameters":["line-progress"]},"property-type":"color-ramp"},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"property-type":"constant"},"line-trim-fade-range":{"type":"array","value":"number","experimental":true,"length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-trim-color":{"type":"color","experimental":true,"default":"transparent","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"line-border-width":{"type":"number","private":true,"default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","private":true,"default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true,"property-type":"data-constant"}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"expression":{"interpolated":true,"parameters":["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":1,"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"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-image-cross-fade":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"transition":true},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-value"]},"property-type":"color-ramp"},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","property-type":"data-constant","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"raster-array-band":{"type":"string","required":false,"experimental":true,"property-type":"data-constant"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"experimental":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string","required":false,"property-type":"data-constant"},"raster-particle-count":{"type":"number","default":512,"minimum":1,"property-type":"data-constant"},"raster-particle-color":{"type":"color","expression":{"interpolated":true,"parameters":["raster-particle-speed"]},"property-type":"color-ramp"},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1,"property-type":"data-constant"},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1,"property-type":"data-constant"}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-accent-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_background":{"background-color":{"type":"color","default":"#000000","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-constant"}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100,"property-type":"data-constant"},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]},"property-type":"data-constant"},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radi
1al-progress"],0.8,"#87ceeb",1,"white"],"expression":{"interpolated":true,"parameters":["sky-radial-progress"]},"property-type":"color-ramp"},"sky-atmosphere-halo-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-atmosphere-color":{"type":"color","default":"white","property-type":"data-constant"},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d","property-type":"data-constant"},"model-cast-shadows":{"type":"boolean","default":true,"expression":{},"property-type":"data-constant"},"model-receive-shadows":{"type":"boolean","default":true,"expression":{},"property-type":"data-constant"},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"property-type":"data-constant","transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{},"property-type":"data-constant"},"model-front-cutoff":{"type":"array","private":true,"value":"number","property-type":"data-constant","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"property-type":{"data-driven":{"type":"property-type"},"color-ramp":{"type":"property-type"},"data-constant":{"type":"property-type"},"constant":{"type":"property-type"}},"promoteId":{"*":{"type":"string"}}}');function Ji(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}function qi(t){if(Array.isArray(t))return t.map(qi);if(t instanceof Object&&!(t instanceof Number||t instanceof String||t instanceof Boolean)){const e={};for(const i in t)e[i]=qi(t[i]);return e}return Ji(t)}function Li(t){if(t===!0||t===!1)return!0;if(!Array.isArray(t)||t.length===0)return!1;switch(t[0]){case"has":return t.length>=2&&t[1]!=="$id"&&t[1]!=="$type";case"in":return t.length>
1=3&&(typeof t[1]!="string"||Array.isArray(t[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return t.length!==3||Array.isArray(t[1])||Array.isArray(t[2]);case"any":case"all":for(const e of t.slice(1))if(!Li(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}function Zi(t,e="fill"){if(t==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Li(t)||(t=en(t));const i=t;let n=!0;try{n=function(_){if(!fr(_))return _;let y=qi(_);return dn(y),y=Br(y),y}(i)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate.
2This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md
3and paste the contents of this message in the report.
4Thank you!
5Filter Expression:
6${JSON.stringify(i,null,2)}
7        `)}const o=he[`filter_${e}`],l=z(n,o);let c=null;if(l.result==="error")throw new Error(l.value.map(_=>`${_.key}: ${_.message}`).join(", "));c=(_,y,v)=>l.value.evaluate(_,y,{},v);let d=null,p=null;if(n!==i){const _=z(i,o);if(_.result==="error")throw new Error(_.value.map(y=>`${y.key}: ${y.message}`).join(", "));d=(y,v,b,E,S)=>_.value.evaluate(y,v,{},b,void 0,void 0,E,S),p=!Ta(_.value.expression)}return{filter:c,dynamicFilter:d||void 0,needGeometry:Bn(n),needFeature:!!p}}function Br(t){if(!Array.isArray(t))return t;const e=function(i){if(kn.has(i[0])){for(let n=1;n<i.length;n++)if(fr(i[n]))return!0}return i}(t);return e===!0?e:e.map(i=>Br(i))}function dn(t){let e=!1;const i=[];if(t[0]==="case"){for(let n=1;n<t.length-1;n+=2)e=e||fr(t[n]),i.push(t[n+1]);i.push(t[t.length-1])}else if(t[0]==="match"){e=e||fr(t[1]);for(let n=2;n<t.length-1;n+=2)i.push(t[n+1]);i.push(t[t.length-1])}else if(t[0]==="step"){e=e||fr(t[1]);for(let n=1;n<t.length-1;n+=2)i.push(t[n+1])}e&&(t.length=0,t.push("any",...i));for(let n=1;n<t.length;n++)dn(t[n])}function fr(t){if(!Array.isArray(t))return!1;if((e=t[0])==="pitch"||e==="distance-from-center")return!0;var e;for(let i=1;i<t.length;i++)if(fr(t[i]))return!0;return!1}const kn=new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function On(t,e){return t<e?-1:t>e?1:0}function Bn(t){if(!Array.isArray(t))return!1;if(t[0]==="within"||t[0]==="distance")return!0;for(let e=1;e<t.length;e++)if(Bn(t[e]))return!0;return!1}function en(t){if(!t)return!0;const e=t[0];return t.length<=1?e!=="any":e==="=="?yo(t[1],t[2],"=="):e==="!="?fs(yo(t[1],t[2],"==")):e==="<"||e===">"||e==="<="||e===">="?yo(t[1],t[2],e):e==="any"?(i=t.slice(1),["any"].concat(i.map(en))):e==="all"?["all"].concat(t.slice(1).map(en)):e==="none"?["all"].concat(t.slice(1).map(en).map(fs)):e==="in"?ps(t[1],t.slice(2)):e==="!in"?fs(ps(t[1],t.slice(2))):e==="has"?Ia(t[1]):e!=="!has"||fs(Ia(t[1]));var i}function yo(t,e,i){switch(t){case"$type":return[`filter-type-${i}`,e];case"$id":return[`filter-id-${i}`,e];default:return[`filter-${i}`,t,e]}}function ps(t,e){if(e.length===0)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(i=>typeof i!=typeof e[0])?["filter-in-large",t,["literal",e.sort(On)]]:["filter-in-small",t,["literal",e]]}}function Ia(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function fs(t){return["!",t]}const ms="�";function ql(t,e){return e?`${t}${ms}${e}`:t}const Zl="-transition",xo=new Set(["fill","line","background","hillshade","raster"]);class $i extends so{constructor(e,i,n,o,l){if(super(),this.id=e.id,this.fqid=ql(this.id,n),this.type=e.type,this.scope=n,this.lut=o,this.options=l,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.isConfigDependent=!1,e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&e.type!=="sky"&&e.type!=="slot"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),e.slot&&(this.slot=e.slot),i.layout&&(this._unevaluatedLayout=new yi(i.layout,this.scope,l),this.isConfigDependent=this.isConfigDependent||this._unevaluatedLayout.isConfigDependent),i.paint)){this._transitionablePaint=new At(i.paint,this.scope,l);for(const c in e.paint)this.setPaintProperty(c,e.paint[c]);for(const c in e.layout)this.setLayoutProperty(c,e.layout[c]);this.isConfigDependent=this.isConfigDependent||this._transitionablePaint.isConfigDependent,this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ii(i.paint)}}onAdd(e){}onRemove(e){}isDraped(e){return xo.has(this.type)}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}
7setLayoutProperty(e,i){if(this.type==="custom"&&e==="visibility")return void(this.visibility=i);const n=this._unevaluatedLayout;n._properties.properties[e]&&(n.setValue(e,i),this.isConfigDependent=this.isConfigDependent||n.isConfigDependent,e==="visibility"&&this.possiblyEvaluateVisibility())}possiblyEvaluateVisibility(){this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0})}getPaintProperty(e){return eo(e,Zl)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}setPaintProperty(e,i){const n=this._transitionablePaint,o=n._properties.properties;if(eo(e,Zl)){const v=e.slice(0,-11);return o[v]&&n.setTransition(v,i||void 0),!1}if(!o[e])return!1;const l=n._values[e],c=l.value.isDataDriven(),d=l.value;n.setValue(e,i),this.isConfigDependent=this.isConfigDependent||n.isConfigDependent,this._handleSpecialPaintPropertyUpdate(e);const p=n._values[e].value,_=p.isDataDriven(),y=eo(e,"pattern")||e==="line-dasharray";return _||c||y||this._handleOverridablePaintPropertyUpdate(e,d,p)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,i,n){return null}_handleOverridablePaintPropertyUpdate(e,i,n){return!1}isHidden(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)}
7serialize(){return Fc({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(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}isStateDependent(){for(const e in this.paint._values){const i=this.paint.get(e);if(i instanceof Ht&&Fu(i.property.specification)&&(i.value.kind==="source"||i.value.kind==="composite")&&i.value.isStateDependent)return!0}return!1}compileFilter(){this._filterCompiled||(this._featureFilter=Zi(this.filter),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,n,o,l,c,d,p,_){}queryIntersectsMatchingFeature(e,i,n,o){}}const Nu={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class bd{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 ci{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,i){return e._trim(),i&&(e.isTransferred=!0,i.add(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){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 qt(t,e=1){let i=0,n=0;return{members:t.map(o=>{const l=Nu[o.type].BYTES_PER_ELEMENT,c=i=Bm(i,Math.max(e,l)),d=o.components||1;return n=Math.max(n,l),i+=l*d,{name:o.name,type:o.type,components:d,offset:c}}),size:Bm(i,Math.max(n,e)),alignment:e}}function Bm(t,e){return Math.ceil(t/e)*e}class pn extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const o=2*e;return this.int16[o+0]=i,this.int16[o+1]=n,e}}pn.prototype.bytesPerElement=4,N(pn,"StructArrayLayout2i4");class wd extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,n)}emplace(e,i,n,o){const l=3*e;return this.int16[l+0]=i,this.int16[l+1]=n,this.int16[l+2]=o,e}}wd.prototype.bytesPerElement=6,N(wd,"StructArrayLayout3i6");class _s extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=4*e;return this.int16[c+0]=i,this.int16[c+1]=n,this.int16[c+2]=o,this.int16[c+3]=l,e}}_s.prototype.bytesPerElement=8,N(_s,"StructArrayLayout4i8");class Yp extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,n,o,l)}emplace(e,i,n,o,l,c){const d=5*e;return this.int16[d+0]=i,this.int16[d+1]=n,this.int16[d+2]=o,this.int16[d+3]=l,this.int16[d+4]=c,e}}Yp.prototype.bytesPerElement=10,N(Yp,"StructArrayLayout5i10");class Kp extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,n,o,l,c,d)}emplace(e,i,n,o,l,c,d,p){const _=6*e,y=12*e,v=3*e;return this.int16[_+0]=i,this.int16[_+1]=n,this.uint8[y+4]=o,this.uint8[y+5]=l,this.uint8[y+6]=c,this.uint8[y+7]=d,this.float32[v+2]=p,e}}Kp.prototype.bytesPerElement=12,N(Kp,"StructArrayLayout2i4ub1f12");class gs extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=4*e;return this.float32[c+0]=i,this.float32[c+1]=n,this.float32[c+2]=o,this.float32[c+3]=l,e}}gs.prototype.bytesPerElement=16,N(gs,"StructArrayLayout4f16");class ys extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,n)}emplace(e,i,n,o){const l=3*e;return this.float32[l+0]=i,this.float32[l+1]=n,this.float32[l+2]=o,e}}ys.prototype.bytesPerElement=12,N(ys,"StructArrayLayout3f12");class xs extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,n,o,l)}emplace(e,i,n,o,l,c){const d=6*e,p=3*e;return this.uint16[d+0]=i,this.uint16[d+1]=n,this.uint16[d+2]=o,this.uint16[d+3]=l,this.float32[p+2]=c,e}}xs.prototype.bytesPerElement=12,N(xs,"StructArrayLayout4ui1f12");class Td extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=4*e;return this.uint16[c+0]=i,this.uint16[c+1]=n,this.uint16[c+2]=o,this.uint16[c+3]=l,e}}Td.prototype.bytesPerElement=8,N(Td,"StructArrayLayout4ui8");class Ed extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,n,o,l,c)}emplace(e,i,n,o,l,c,d){const p=6*e;return this.int16[p+0]=i,this.int16[p+1]=n,this.int16[p+2]=o,this.int16[p+3]=l,this.int16[p+4]=c,this.int16[p+5]=d,e}}
7Ed.prototype.bytesPerElement=12,N(Ed,"StructArrayLayout6i12");class Jp extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d,p,_,y,v,b){const E=this.length;return this.resize(E+1),this.emplace(E,e,i,n,o,l,c,d,p,_,y,v,b)}emplace(e,i,n,o,l,c,d,p,_,y,v,b,E){const S=12*e;return this.int16[S+0]=i,this.int16[S+1]=n,this.int16[S+2]=o,this.int16[S+3]=l,this.uint16[S+4]=c,this.uint16[S+5]=d,this.uint16[S+6]=p,this.uint16[S+7]=_,this.int16[S+8]=y,this.int16[S+9]=v,this.int16[S+10]=b,this.int16[S+11]=E,e}}Jp.prototype.bytesPerElement=24,N(Jp,"StructArrayLayout4i4ui4i24");class Qp extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c){const d=this.length;return this.resize(d+1),this.emplace(d,e,i,n,o,l,c)}emplace(e,i,n,o,l,c,d){const p=10*e,_=5*e;return this.int16[p+0]=i,this.int16[p+1]=n,this.int16[p+2]=o,this.float32[_+2]=l,this.float32[_+3]=c,this.float32[_+4]=d,e}}Qp.prototype.bytesPerElement=20,N(Qp,"StructArrayLayout3i3f20");class ef extends ci{_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}}ef.prototype.bytesPerElement=4,N(ef,"StructArrayLayout1ul4");class Aa extends ci{_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}}Aa.prototype.bytesPerElement=4,N(Aa,"StructArrayLayout1f4");class vs extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const o=2*e;return this.uint16[o+0]=i,this.uint16[o+1]=n,e}}vs.prototype.bytesPerElement=4,N(vs,"StructArrayLayout2ui4");class tf extends ci{_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,n,o,l,c,d,p,_,y,v,b,E){const S=this.length;return this.resize(S+1),this.emplace(S,e,i,n,o,l,c,d,p,_,y,v,b,E)}emplace(e,i,n,o,l,c,d,p,_,y,v,b,E,S){const I=20*e,C=10*e;return this.int16[I+0]=i,this.int16[I+1]=n,this.int16[I+2]=o,this.int16[I+3]=l,this.int16[I+4]=c,this.float32[C+3]=d,this.float32[C+4]=p,this.float32[C+5]=_,this.float32[C+6]=y,this.int16[I+14]=v,this.uint32[C+8]=b,this.uint16[I+18]=E,this.uint16[I+19]=S,e}}tf.prototype.bytesPerElement=40,N(tf,"StructArrayLayout5i4f1i1ul2ui40");class Sd extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,n,o,l,c,d)}emplace(e,i,n,o,l,c,d,p){const _=8*e;return this.int16[_+0]=i,this.int16[_+1]=n,this.int16[_+2]=o,this.int16[_+4]=l,this.int16[_+5]=c,this.int16[_+6]=d,this.int16[_+7]=p,e}}Sd.prototype.bytesPerElement=16,N(Sd,"StructArrayLayout3i2i2i16");class rf extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,n,o,l)}emplace(e,i,n,o,l,c){const d=4*e,p=8*e;return this.float32[d+0]=i,this.float32[d+1]=n,this.float32[d+2]=o,this.int16[p+6]=l,this.int16[p+7]=c,e}}rf.prototype.bytesPerElement=16,N(rf,"StructArrayLayout2f1f2i16");class nf extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=12*e,d=3*e;return this.uint8[c+0]=i,this.uint8[c+1]=n,this.float32[d+1]=o,this.float32[d+2]=l,e}}nf.prototype.bytesPerElement=12,N(nf,"StructArrayLayout2ub2f12");class Ri extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n){const o=this.length;return this.resize(o+1),this.emplace(o,e,i,n)}emplace(e,i,n,o){const l=3*e;return this.uint16[l+0]=i,this.uint16[l+1]=n,this.uint16[l+2]=o,e}}Ri.prototype.bytesPerElement=6,N(Ri,"StructArrayLayout3ui6");class of extends ci{_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,n,o,l,c,d,p,_,y,v,b,E,S,I,C,D,V,U,j,X){const H=this.length;return this.resize(H+1),this.emplace(H,e,i,n,o,l,c,d,p,_,y,v,b,E,S,I,C,D,V,U,j,X)}emplace(e,i,n,o,l,c,d,p,_,y,v,b,E,S,I,C,D,V,U,j,X,H){const ie=30*e,ne=15*e,ue=60*e;return this.int16[ie+0]=i,this.int16[ie+1]=n,this.int16[ie+2]=o,this.float32[ne+2]=l,this.float32[ne+3]=c,this.uint16[ie+8]=d,this.uint16[ie+9]=p,this.uint32[ne+5]=_,this.uint32[ne+6]=y,this.uint32[ne+7]=v,this.uint16[ie+16]=b,this.uint16[ie+17]=E,this.uint16[ie+18]=S,this.float32[ne+10]=I,this.float32[ne+11]=C,this.uint8[ue+48]=D,this.uint8[ue+49]=V,this.uint8[ue+50]=U,this.uint32[ne+13]=j,this.int16[ie+28]=X,this.uint8[ue+58]=H,e}}of.prototype.bytesPerElement=60,N(of,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class sf extends ci{_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,n,o,l,c,d,p,_,y,v,b,E,S,I,C,D,V,U,j,X,H,ie,ne,ue,ye,pe,Te,ze,be,Ae,xe,Ce,Re){const Pe=this.length;return this.resize(Pe+1),this.emplace(Pe,e,i,n,o,l,c,d,p,_,y,v,b,E,S,I,C,D,V,U,j,X,H,ie,ne,ue,ye,pe,Te,ze,be,Ae,xe,Ce,Re)}emplace(e,i,n,o,l,c,d,p,_,y,v,b,E,S,I,C,D,V,U,j,X,H,ie,ne,ue,ye,pe,Te,ze,be,Ae,xe,Ce,Re,Pe){const Ze=22*e,De=44*e,Oe=88*e;return this.float32[Ze+0]=i,this.float32[Ze+1]=n,this.int16[De+4]=o,this.int16[De+5]=l,this.int16[De+6]=c,this.int16[De+7]=d,this.int16[De+8]=p,this.int16[De+9]=_,this.int16[De+10]=y,this.int16[De+11]=v,this.int16[De+12]=b,this.uint16[De+13]=E,this.uint16[De+14]=S,this.uint16[De+15]=I,this.uint16[De+16]=C,this.uint16[De+17]=D,this.uint16[De+18]=V,this.uint16[De+19]=U,this.uint16[De+20]=j,this.uint16[De+21]=X,this.uint16[De+22]=H,this.uint16[De+23]=ie,this.uint16[De+24]=ne,this.uint16[De+25]=ue,this.uint16[De+26]=ye,this.uint16[De+27]=pe,this.uint32[Ze+14]=Te,this.float32[Ze+15]=ze,this.float32[Ze+16]=be,this.float32[Ze+17]=Ae,this.float32[Ze+18]=xe,this.float32[Ze+19]=Ce,this.float32[Ze+20]=Re,this.uint8[Oe+84]=Pe,e}}sf.prototype.bytesPerElement=88,N(sf,"StructArrayLayout2f9i15ui1ul6f1ub88");class Ca extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l){const c=this.length;return this.resize(c+1),this.emplace(c,e,i,n,o,l)}emplace(e,i,n,o,l,c){const d=5*e;return this.float32[d+0]=i,this.float32[d+1]=n,this.float32[d+2]=o,this.float32[d+3]=l,this.float32[d+4]=c,e}}Ca.prototype.bytesPerElement=20,N(Ca,"StructArrayLayout5f20");class af extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,n,o,l,c,d)}emplace(e,i,n,o,l,c,d,p){const _=7*e;return this.float32[_+0]=i,this.float32[_+1]=n,this.float32[_+2]=o,this.float32[_+3]=l,this.float32[_+4]=c,this.float32[_+5]=d,this.float32[_+6]=p,e}}af.prototype.bytesPerElement=28,N(af,"StructArrayLayout7f28");class $l extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i){const n=this.length;return this.resize(n+1),this.emplace(n,e,i)}emplace(e,i,n){const o=2*e;return this.float32[o+0]=i,this.float32[o+1]=n,e}}$l.prototype.bytesPerElement=8,N($l,"StructArrayLayout2f8");class lf extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,i,n,o){const l=this.length;return this.resize(l+1),this.emplace(l,e,i,n,o)}emplace(e,i,n,o,l){const c=6*e;
vendor: 5,538 bytes, line 7
7return this.uint32[3*e+0]=i,this.uint16[c+2]=n,this.uint16[c+3]=o,this.uint16[c+4]=l,e}}lf.prototype.bytesPerElement=12,N(lf,"StructArrayLayout1ul3ui12");class Vu extends ci{_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}}Vu.prototype.bytesPerElement=2,N(Vu,"StructArrayLayout1ui2");class cf extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d,p,_,y,v,b,E,S,I,C){const D=this.length;return this.resize(D+1),this.emplace(D,e,i,n,o,l,c,d,p,_,y,v,b,E,S,I,C)}emplace(e,i,n,o,l,c,d,p,_,y,v,b,E,S,I,C,D){const V=16*e;return this.float32[V+0]=i,this.float32[V+1]=n,this.float32[V+2]=o,this.float32[V+3]=l,this.float32[V+4]=c,this.float32[V+5]=d,this.float32[V+6]=p,this.float32[V+7]=_,this.float32[V+8]=y,this.float32[V+9]=v,this.float32[V+10]=b,this.float32[V+11]=E,this.float32[V+12]=S,this.float32[V+13]=I,this.float32[V+14]=C,this.float32[V+15]=D,e}}cf.prototype.bytesPerElement=64,N(cf,"StructArrayLayout16f64");class Md extends ci{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,i,n,o,l,c,d){const p=this.length;return this.resize(p+1),this.emplace(p,e,i,n,o,l,c,d)}emplace(e,i,n,o,l,c,d,p){const _=10*e,y=5*e;return this.uint16[_+0]=i,this.uint16[_+1]=n,this.uint16[_+2]=o,this.uint16[_+3]=l,this.float32[y+2]=c,this.float32[y+3]=d,this.float32[y+4]=p,e}}Md.prototype.bytesPerElement=20,N(Md,"StructArrayLayout4ui3f20");class uf extends ci{_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}}uf.prototype.bytesPerElement=2,N(uf,"StructArrayLayout1i2");class hf extends ci{_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}}hf.prototype.bytesPerElement=1,N(hf,"StructArrayLayout1ub1");class Fm extends bd{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]}}Fm.prototype.size=40;class df extends tf{get(e){return new Fm(this,e)}}N(df,"CollisionBoxArray");class Nm extends bd{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(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}}Nm.prototype.size=60;class Vm extends of{get(e){return new Nm(this,e)}}N(Vm,"PlacedSymbolArray");class Um extends bd{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]}
vendor: 4,278 bytes, line 7
7get 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 occlusionState(){return this._structArray.float32[this._pos4+19]}set occlusionState(e){this._structArray.float32[this._pos4+19]=e}get occlusionOpacity(){return this._structArray.float32[this._pos4+20]}set occlusionOpacity(e){this._structArray.float32[this._pos4+20]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+84]}}Um.prototype.size=88;class jm extends sf{get(e){return new Um(this,e)}}N(jm,"SymbolInstanceArray");class Gm extends Aa{getoffsetX(e){return this.float32[1*e+0]}}N(Gm,"GlyphOffsetArray");class qm extends pn{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}N(qm,"SymbolLineVertexArray");class Zm extends bd{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]}}Zm.prototype.size=12;class $m extends lf{get(e){return new Zm(this,e)}}N($m,"FeatureIndexArray");class Wm extends vs{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}N(Wm,"FillExtrusionCentroidArray");const g0=qt([{name:"a_pos",components:2,type:"Int16"}],4),y0=qt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class pi{constructor(e=[]){this.segments=e}_prepareSegment(e,i,n,o){let l=this.segments[this.segments.length-1];return e>pi.MAX_VERTEX_ARRAY_LENGTH&&vi(`Max vertices per segment is ${pi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!l||l.vertexLength+e>pi.MAX_VERTEX_ARRAY_LENGTH||l.sortKey!==o)&&(l={vertexOffset:i,primitiveOffset:n,vertexLength:0,primitiveLength:0},o!==void 0&&(l.sortKey=o),this.segments.push(l)),l}prepareSegment(e,i,n,o){return this._prepareSegment(e,i.length,n.length,o)}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,n,o){return new pi([{vertexOffset:e,primitiveOffset:i,vertexLength:n,primitiveLength:o,vaos:{},sortKey:0}])}}function Hm(t,e){return 256*(t=ft(Math.floor(t),0,255))+ft(Math.floor(e),0,255)}pi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,N(pi,"SegmentVector");const x0=qt([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),v0=qt([{name:"a_dash",components:4,type:"Uint16"}]);class Uu{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}
7add(e,i,n,o){this.ids.push(Xm(e)),this.positions.push(i,n,o)}eachPosition(e,i){const n=Xm(e);let o=0,l=this.ids.length-1;for(;o<l;){const c=o+l>>1;this.ids[c]>=n?l=c:o=c+1}for(;this.ids[o]===n;)i(this.positions[3*o],this.positions[3*o+1],this.positions[3*o+2]),o++}static serialize(e,i){const n=new Float64Array(e.ids),o=new Uint32Array(e.positions);return pf(n,o,0,n.length-1),i&&(i.add(n.buffer),i.add(o.buffer)),{ids:n,positions:o}}static deserialize(e){const i=new Uu;let n;i.ids=e.ids,i.positions=e.positions;for(const o of i.ids)o!==n&&i.uniqueIds.push(o),n=o;return i.indexed=!0,i}}function Xm(t){const e=+t;return!isNaN(e)&&Number.MIN_SAFE_INTEGER<=e&&e<=Number.MAX_SAFE_INTEGER?e:la(String(t))}function pf(t,e,i,n){for(;i<n;){const o=t[i+n>>1];let l=i-1,c=n+1;for(;;){do l++;while(t[l]<o);do c--;while(t[c]>o);if(l>=c)break;Id(t,l,c),Id(e,3*l,3*c),Id(e,3*l+1,3*c+1),Id(e,3*l+2,3*c+2)}c-i<n-c?(pf(t,e,i,c),i=c+1):(pf(t,e,c+1,n),n=c)}}function Id(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}N(Uu,"FeaturePositionMap");class vo{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,n){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class Ad extends vo{constructor(e){super(e),this.current=0}set(e,i,n){this.fetchUniformLocation(e,i)&&this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}}class sr extends vo{constructor(e){super(e),this.current=0}set(e,i,n){this.fetchUniformLocation(e,i)&&this.current!==n&&(this.current=n,this.gl.uniform1f(this.location,n))}}class bo extends vo{constructor(e){super(e),this.current=[0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1])))}}class ff extends vo{constructor(e){super(e),this.current=[0,0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2])))}}class mf extends vo{constructor(e){super(e),this.current=[0,0,0,0]}set(e,i,n){this.fetchUniformLocation(e,i)&&(n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]&&n[3]===this.current[3]||(this.current=n,this.gl.uniform4f(this.location,n[0],n[1],n[2],n[3])))}}class Ym extends vo{constructor(e){super(e),this.current=Nt.transparent.toRenderColor(null)}set(e,i,n){this.fetchUniformLocation(e,i)&&(n.r===this.current.r&&n.g===this.current.g&&n.b===this.current.b&&n.a===this.current.a||(this.current=n,this.gl.uniform4f(this.location,n.r,n.g,n.b,n.a)))}}const b0=new Float32Array(16);class ju extends vo{constructor(e){super(e),this.current=b0}set(e,i,n){if(this.fetchUniformLocation(e,i)){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let o=1;o<16;o++)if(n[o]!==this.current[o]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}}}const w0=new Float32Array(9),T0=new Float32Array(4);class _f extends vo{constructor(e){super(e),this.current=T0}set(e,i,n){if(this.fetchUniformLocation(e,i)){for(let o=0;o<4;o++)if(n[o]!==this.current[o]){this.current=n,this.gl.uniformMatrix2fv(this.location,!1,n);break}}}}function gf(t){return[Hm(255*t.r,255*t.g),Hm(255*t.b,255*t.a)]}class Gu{constructor(e,i,n,o){this.value=e,this.uniformNames=i.map(l=>`u_${l}`),this.type=n,this.context=o}setUniform(e,i,n,o,l){const c=o.constantOr(this.value);i.set(e,l,c instanceof Nt?c.toRenderColor(this.context.lut):c)}getBinding(e,i){return this.type==="color"?new Ym(e):new sr(e)}}class Wl{constructor(e,i){this.uniformNames=i.map(n=>`u_${n}`),this.pattern=null,this.pixelRatio=1}setConstantPatternPositions(e){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br)}setUniform(e,i,n,o,l){const c=l==="u_pattern"||l==="u_dash"?this.pattern:l==="u_pixel_ratio"?this.pixelRatio:null;c&&i.set(e,l,c)}getBinding(e,i){return i==="u_pattern"||i==="u_dash"?new mf(e):new sr(e)}}class wo{constructor(e,i,n,o){this.expression=e,this.type=n,this.maxValue=0,this.paintVertexAttributes=i.map(l=>({name:`a_${l}`,type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new o}populatePaintArray(e,i,n,o,l,c,d){const p=this.paintVertexArray.length,_=this.expression.evaluate(new st(0,{brightness:c}),i,{},l,o,d);this.paintVertexArray.resize(e),this._setPaintValue(p,e,_,this.context)}updatePaintArray(e,i,n,o,l,c,d){const p=this.expression.evaluate({zoom:0,brightness:d},n,o,void 0,l);this._setPaintValue(e,i,p,this.context)}
7_setPaintValue(e,i,n,o){if(this.type==="color"){const l=gf(n.toRenderColor(o.lut));for(let c=e;c<i;c++)this.paintVertexArray.emplace(c,l[0],l[1])}else{for(let l=e;l<i;l++)this.paintVertexArray.emplace(l,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class fn{constructor(e,i,n,o,l,c){this.expression=e,this.uniformNames=i.map(d=>`u_${d}_t`),this.type=n,this.useIntegerZoom=o,this.context=l,this.maxValue=0,this.paintVertexAttributes=i.map(d=>({name:`a_${d}`,type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new c}populatePaintArray(e,i,n,o,l,c,d){const p=this.expression.evaluate(new st(this.context.zoom,{brightness:c}),i,{},l,o,d),_=this.expression.evaluate(new st(this.context.zoom+1,{brightness:c}),i,{},l,o,d),y=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(y,e,p,_,this.context)}updatePaintArray(e,i,n,o,l,c,d){const p=this.expression.evaluate({zoom:this.context.zoom,brightness:d},n,o,void 0,l),_=this.expression.evaluate({zoom:this.context.zoom+1,brightness:d},n,o,void 0,l);this._setPaintValue(e,i,p,_,this.context)}_setPaintValue(e,i,n,o,l){if(this.type==="color"){const c=gf(n.toRenderColor(l.lut)),d=gf(n.toRenderColor(l.lut));for(let p=e;p<i;p++)this.paintVertexArray.emplace(p,c[0],c[1],d[0],d[1])}else{for(let c=e;c<i;c++)this.paintVertexArray.emplace(c,n,o);this.maxValue=Math.max(this.maxValue,Math.abs(n),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.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,i,n,o,l){const c=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,d=ft(this.expression.interpolationFactor(c,this.context.zoom,this.context.zoom+1),0,1);i.set(e,l,d)}getBinding(e,i){return new sr(e)}}class bs{constructor(e,i,n,o,l){this.expression=e,this.layerId=l,this.paintVertexAttributes=(n==="array"?v0:x0).members;for(let c=0;c<i.length;++c);this.paintVertexArray=new o}populatePaintArray(e,i,n,o){const l=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(l,e,i.patterns&&i.patterns[this.layerId],n)}updatePaintArray(e,i,n,o,l,c,d){this._setPaintValues(e,i,n.patterns&&n.patterns[this.layerId],c)}_setPaintValues(e,i,n,o){if(!o||!n)return;const l=o[n];if(!l)return;const{tl:c,br:d,pixelRatio:p}=l;for(let _=e;_<i;_++)this.paintVertexArray.emplace(_,c[0],c[1],d[0],d[1],p)}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Pa{constructor(e,i,n=()=>!0){this.binders={},this._buffers=[],this.context=i;const o=[];for(const l in e.paint._values){const c=e.paint.get(l);if(!n(l)||!(c instanceof Ht&&Fu(c.property.specification)))continue;const d=S0(l,e.type),p=c.value,_=c.property.specification.type,y=!!c.property.useIntegerZoom,v=l==="line-dasharray"||l.endsWith("pattern"),b=l==="line-dasharray"&&e.layout.get("line-cap").value.kind!=="constant";if(p.kind!=="constant"||b)if(p.kind==="source"||b||v){const E=Km(l,_,"source");this.binders[l]=v?new bs(p,d,_,E,e.id):new wo(p,d,_,E),o.push(`/a_${l}`)}else{const E=Km(l,_,"composite");this.binders[l]=new fn(p,d,_,y,i,E),o.push(`/z_${l}`)}else this.binders[l]=v?new Wl(p.value,d):new Gu(p.value,d,_,i),o.push(`/u_${l}`)}this.cacheKey=o.sort().join("")}getMaxValue(e){const i=this.binders[e];return i instanceof wo||i instanceof fn?i.maxValue:0}populatePaintArrays(e,i,n,o,l,c,d){for(const p in this.binders){const _=this.binders[p];_.context=this.context,(_ instanceof wo||_ instanceof fn||_ instanceof bs)&&_.populatePaintArray(e,i,n,o,l,c,d)}}setConstantPatternPositions(e){for(const i in this.binders){const n=this.binders[i];n instanceof Wl&&n.setConstantPatternPositions(e)}}updatePaintArrays(e,i,n,o,l,c,d,p){let _=!1;const y=Object.keys(e),v=y.length!==0,b=v?y:i.uniqueIds;this.context.lut=l.lut;for(const E in this.binders){const S=this.binders[E];if(S.context=this.context,(S instanceof wo||S instanceof fn||S instanceof bs)&&(S.expression.isStateDependent===!0||S.expression.isLightConstant===!1)){const I=l.paint.get(E);S.expression=I.value;for(const C of b){const D=e[C.toString()];i.eachPosition(C,(V,U,j)=>{const X=o.feature(V);S.updatePaintArray(U,j,X,D,c,d,p)})}if(!v)for(const C of n.uniqueIds){const D=e[C.toString()];n.eachPosition(C,(V,U,j)=>{const X=o.feature(V);S.updatePaintArray(U,j,X,D,c,d,p)})}_=!0}}return _}defines(){const e=[];for(const i in this.binders){const n=this.binders[i];(n instanceof Gu||n instanceof Wl)&&e.push(...n.uniformNames.map(o=>`#define HAS_UNIFORM_${o}`))}return e}getBinderAttributes(){const e=[];for(const i in this.binders){const n=this.binders[i];if(n instanceof wo||n instanceof fn||n instanceof bs)for(let o=0;o<n.paintVertexAttributes.length;
vendor: 4,278 bytes, line 7
7o++)e.push(n.paintVertexAttributes[o].name)}return e}getBinderUniforms(){const e=[];for(const i in this.binders){const n=this.binders[i];if(n instanceof Gu||n instanceof Wl||n instanceof fn)for(const o of n.uniformNames)e.push(o)}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const i=[];for(const n in this.binders){const o=this.binders[n];if(o instanceof Gu||o instanceof Wl||o instanceof fn)for(const l of o.uniformNames)i.push({name:l,property:n,binding:o.getBinding(e,l)})}return i}setUniforms(e,i,n,o,l){for(const{name:c,property:d,binding:p}of n)this.binders[d].setUniform(e,p,l,o.get(d),c)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const i=this.binders[e];(i instanceof wo||i instanceof fn||i instanceof bs)&&i.paintVertexBuffer&&this._buffers.push(i.paintVertexBuffer)}}upload(e){for(const i in this.binders){const n=this.binders[i];(n instanceof wo||n instanceof fn||n instanceof bs)&&n.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const i=this.binders[e];(i instanceof wo||i instanceof fn||i instanceof bs)&&i.destroy()}}}class ws{constructor(e,i,n=()=>!0){this.programConfigurations={};for(const o of e)this.programConfigurations[o.id]=new Pa(o,i,n);this.needsUpload=!1,this._featureMap=new Uu,this._featureMapWithoutIds=new Uu,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,i,n,o,l,c,d,p){for(const _ in this.programConfigurations)this.programConfigurations[_].populatePaintArrays(e,i,o,l,c,d,p);i.id!==void 0?this._featureMap.add(i.id,n,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,n,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,i,n,o,l,c){for(const d of n)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,i,d,o,l,c||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 E0={"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"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio"],"fill-pattern":["pattern","pixel_ratio"],"fill-extrusion-pattern":["pattern","pixel_ratio"],"line-dasharray":["dash"]};function S0(t,e){return E0[t]||[t.replace(`${e}-`,"").replace(/-/g,"_")]}const M0={"line-pattern":{source:xs,composite:xs},"fill-pattern":{source:xs,composite:xs},"fill-extrusion-pattern":{source:xs,composite:xs},"line-dasharray":{source:Td,composite:Td}},I0={color:{source:$l,composite:gs},number:{source:Aa,composite:$l}};function Km(t,e,i){const n=M0[t];return n&&n[i]||I0[e][i]}N(Gu,"ConstantBinder"),N(Wl,"PatternConstantBinder"),N(wo,"SourceExpressionBinder"),N(bs,"PatternCompositeBinder"),N(fn,"CompositeExpressionBinder"),N(Pa,"ProgramConfiguration",{omit:["_buffers"]}),N(ws,"ProgramConfigurationSet");const ar=Ne/Math.PI/2,yf=5,Jm=6,A0=16383,Hl=64,xf=[Hl,32,16],tn=-ar,rn=ar;function Xl(t,e,i,n=ar){return i=Pt(i),[t*Math.sin(i)*n,-e*n,t*Math.cos(i)*n]}function za(t,e,i){return Xl(Math.cos(Pt(t)),Math.sin(Pt(t)),e,i)}const Yl=63710088e-1,vf=2*Math.PI*Yl;class Bt{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 Bt(Qn(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,n=this.lat*i,o=e.lat*i,l=Math.sin(n)*Math.sin(o)+Math.cos(n)*Math.cos(o)*Math.cos((e.lng-this.lng)*i);return Yl*Math.acos(Math.min(l,1))}
7toBounds(e=0){const i=360*e/40075017,n=i/Math.cos(Math.PI/180*this.lat);return new Ts({lng:this.lng-n,lat:this.lat-i},{lng:this.lng+n,lat:this.lat+i})}toEcef(e){return za(this.lat,this.lng,ar+e*ar/Yl)}static convert(e){if(e instanceof Bt)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new Bt(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new Bt(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 Ts{constructor(e,i){if(e)if(i)this.setSouthWest(e).setNorthEast(i);else if(e.length===4){const n=e;this.setSouthWest([n[0],n[1]]).setNorthEast([n[2],n[3]])}else{const n=e;this.setSouthWest(n[0]).setNorthEast(n[1])}}setNorthEast(e){return this._ne=e instanceof Bt?new Bt(e.lng,e.lat):Bt.convert(e),this}setSouthWest(e){return this._sw=e instanceof Bt?new Bt(e.lng,e.lat):Bt.convert(e),this}extend(e){const i=this._sw,n=this._ne;let o,l;if(e instanceof Bt)o=e,l=e;else{if(!(e instanceof Ts))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Ts.convert(e)):this.extend(Bt.convert(e)):typeof e=="object"&&e!==null&&e.hasOwnProperty("lat")&&(e.hasOwnProperty("lon")||e.hasOwnProperty("lng"))?this.extend(Bt.convert(e)):this;if(o=e._sw,l=e._ne,!o||!l)return this}return i||n?(i.lng=Math.min(o.lng,i.lng),i.lat=Math.min(o.lat,i.lat),n.lng=Math.max(l.lng,n.lng),n.lat=Math.max(l.lat,n.lat)):(this._sw=new Bt(o.lng,o.lat),this._ne=new Bt(l.lng,l.lat)),this}getCenter(){return new Bt((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 Bt(this.getWest(),this.getNorth())}getSouthEast(){return new Bt(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:n}=Bt.convert(e);let o=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=n&&n<=this._ne.lat&&o}static convert(e){return!e||e instanceof Ts?e:new Ts(e)}}var Qm={};(function(t,e){(function(i){function n(l,c,d){var p=o(256*l,256*(c=Math.pow(2,d)-c-1),d),_=o(256*(l+1),256*(c+1),d);return p[0]+","+p[1]+","+_[0]+","+_[1]}function o(l,c,d){var p=2*Math.PI*6378137/256/Math.pow(2,d);return[l*p-2*Math.PI*6378137/2,c*p-2*Math.PI*6378137/2]}i.getURL=function(l,c,d,p,_,y){return y=y||{},l+"?"+["bbox="+n(d,p,_),"format="+(y.format||"image/png"),"service="+(y.service||"WMS"),"version="+(y.version||"1.1.1"),"request="+(y.request||"GetMap"),"srs="+(y.srs||"EPSG:3857"),"width="+(y.width||256),"height="+(y.height||256),"layers="+c].join("&")},i.getTileBBox=n,i.getMercCoords=o,Object.defineProperty(i,"__esModule",{value:!0})})(e)})(0,Qm);var C0=Qm;class Da{constructor(e,i,n){this.z=e,this.x=i,this.y=n,this.key=qu(0,e,e,i,n)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,i){const n=C0.getTileBBox(this.x,this.y,this.z),o=function(l,c,d){let p,_="";for(let y=l;y>0;y--)p=1<<y-1,_+=(c&p?1:0)+(d&p?2:0);return _}(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}",o).replace("{bbox-epsg-3857}",n)}toString(){return`${this.z}/${this.x}/${this.y}`}}class e_{constructor(e,i){this.wrap=e,this.canonical=i,this.key=qu(e,i.z,i.z,i.x,i.y)}}class Ci{constructor(e,i,n,o,l){this.overscaledZ=e,this.wrap=i,this.canonical=new Da(n,+o,+l),this.key=i===0&&e===n?this.canonical.key:qu(i,e,n,o,l)}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 Ci(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ci(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 qu(this.wrap*+i,e,this.canonical.z,this.canonical.x,this.canonical.y);{const n=this.canonical.z-e;return qu(this.wrap*+i,e,e,this.canonical.x>>n,this.canonical.y>>n)}}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 Ci(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const i=this.canonical.z+1,n=2*this.canonical.x,o=2*this.canonical.y;return[new Ci(i,this.wrap,i,n,o),new Ci(i,this.wrap,i,n+1,o),new Ci(i,this.wrap,i,n,o+1),new Ci(i,this.wrap,i,n+1,o+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>
vendor: 4,287 bytes, line 7
7e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Ci(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Ci(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 e_(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function qu(t,e,i,n,o){const l=1<<Math.min(i,22);let c=l*(o%l)+n%l;return t&&i<22&&(c+=l*l*((t<0?-2*t-1:2*t)%(1<<2*(22-i)))),16*(32*c+i)+(e-i)}const P0=[t=>{let e=t.canonical.x-1,i=t.wrap;return e<0&&(e=(1<<t.canonical.z)-1,i--),new Ci(t.overscaledZ,i,t.canonical.z,e,t.canonical.y)},t=>{let e=t.canonical.x+1,i=t.wrap;return e===1<<t.canonical.z&&(e=0,i++),new Ci(t.overscaledZ,i,t.canonical.z,e,t.canonical.y)},t=>new Ci(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,(t.canonical.y===0?1<<t.canonical.z:t.canonical.y)-1),t=>new Ci(t.overscaledZ,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y===(1<<t.canonical.z)-1?0:t.canonical.y+1)];N(Da,"CanonicalTileID"),N(Ci,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]});const z0=0,D0=25.5;function bf(t){return vf*Math.cos(t*Math.PI/180)}function Fn(t){return(180+t)/360}function Nn(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))/360}function lr(t,e){return t/bf(e)}function mr(t){return 360*t-180}function Fi(t){return 360/Math.PI*Math.atan(Math.exp((180-360*t)*Math.PI/180))-90}function t_(t,e){return t*bf(Fi(e))}const _r=85.051129;function i_(t){return Math.cos(Pt(ft(t,-85.051129,_r)))}function La(t,e){const i=ft(e,z0,D0),n=Math.pow(2,i);return i_(t)*vf/(512*n)}function r_(t){return 1/Math.cos(t*Math.PI/180)}function Cd(t,e=0){const i=Math.exp(Math.PI*(1-(t.y+e/Ne)/(1<<t.z)*2));return 80150034*i/(i*i+1)/Ne/(1<<t.z)}class Qi{constructor(e,i,n=0){this.x=+e,this.y=+i,this.z=+n}static fromLngLat(e,i=0){const n=Bt.convert(e);return new Qi(Fn(n.lng),Nn(n.lat),lr(i,n.lat))}toLngLat(){return new Bt(mr(this.x),Fi(this.y))}toAltitude(){return t_(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/vf*r_(Fi(this.y))}}function wf(t,e,i,n,o,l,c,d,p){const _=(e+n)/2,y=(i+o)/2,v=new Ge(_,y);d(v),function(b,E,S,I,C,D){const V=S-C,U=I-D;return Math.abs((I-E)*V-(S-b)*U)/Math.hypot(V,U)}(v.x,v.y,l.x,l.y,c.x,c.y)>=p?(wf(t,e,i,_,y,l,v,d,p),wf(t,_,y,n,o,v,c,d,p)):t.push(c)}function n_(t,e,i){let n=t[0],o=n.x,l=n.y;e(n);const c=[n];for(let d=1;d<t.length;d++){const p=t[d],{x:_,y}=p;e(p),wf(c,o,l,_,y,n,p,e,i),o=_,l=y,n=p}return c}function Tf(t,e,i,n){if(n(e,i)){const o=e.add(i)._mult(.5);Tf(t,e,o,n),Tf(t,o,i,n)}else t.push(i)}function L0(t,e){let i=t[0];const n=[i];for(let o=1;o<t.length;o++){const l=t[o];Tf(n,i,l,e),i=l}return n}const Ef=Math.pow(2,14)-1,o_=-Ef-1;function R0(t,e){const i=Math.round(t.x*e),n=Math.round(t.y*e);return t.x=ft(i,o_,Ef),t.y=ft(n,o_,Ef),(i<t.x||i>t.x+1||n<t.y||n>t.y+1)&&vi("Geometry exceeds allowed extent, reduce your vector tile buffer size"),t}function mn(t,e,i){const n=t.loadGeometry(),o=t.extent,l=Ne/o;if(e&&i&&i.projection.isReprojectedInTileSpace){const c=1<<e.z,{scale:d,x:p,y:_,projection:y}=i,v=b=>{const E=mr((e.x+b.x/o)/c),S=Fi((e.y+b.y/o)/c),I=y.project(E,S);b.x=(I.x*d-p)*o,b.y=(I.y*d-_)*o};for(let b=0;b<n.length;b++)if(t.type!==1)n[b]=n_(n[b],v,1);else{const E=[];for(const S of n[b])S.x<0||S.x>=o||S.y<0||S.y>=o||(v(S),E.push(S));n[b]=E}}for(const c of n)for(const d of c)R0(d,l);return n}function To(t,e){return{type:t.type,id:t.id,properties:t.properties,geometry:e?mn(t):[]}}function Pd(t,e,i,n,o){t.emplaceBack(2*e+(n+1)/2,2*i+(o+1)/2)}function zd(t,e,i){t.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class Sf{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 pn,this.indexArray=new Ri,this.segments=new pi,this.programConfigurations=new ws(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id)}updateFootprints(e,i){}populate(e,i,n,o){const l=this.layers[0],c=[];let d=null;
7l.type==="circle"&&(d=l.layout.get("circle-sort-key"));for(const{feature:_,id:y,index:v,sourceLayerIndex:b}of e){const E=this.layers[0]._featureFilter.needGeometry,S=To(_,E);if(!this.layers[0]._featureFilter.filter(new st(this.zoom),S,n))continue;const I=d?d.evaluate(S,{},n):void 0,C={id:y,properties:_.properties,type:_.type,sourceLayerIndex:b,index:v,geometry:E?S.geometry:mn(_,n,o),patterns:{},sortKey:I};c.push(C)}d&&c.sort((_,y)=>_.sortKey-y.sortKey);let p=null;o.projection.name==="globe"&&(this.globeExtVertexArray=new Ed,p=o.projection);for(const _ of c){const{geometry:y,index:v,sourceLayerIndex:b}=_,E=e[v].feature;this.addFeature(_,y,v,i.availableImages,n,p,i.brightness),i.featureIndex.insert(E,y,v,b,this.index)}}update(e,i,n,o,l){const c=Object.keys(e).length!==0;c&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,c?this.stateDependentLayers:this.layers,n,o,l)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,g0.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,y0.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy())}addFeature(e,i,n,o,l,c,d){for(const p of i)for(const _ of p){const y=_.x,v=_.y;if(y<0||y>=Ne||v<0||v>=Ne)continue;if(c){const S=c.projectTilePoint(y,v,l),I=c.upVector(l,y,v),C=this.globeExtVertexArray;zd(C,S,I),zd(C,S,I),zd(C,S,I),zd(C,S,I)}const b=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),E=b.vertexLength;Pd(this.layoutVertexArray,y,v,-1,-1),Pd(this.layoutVertexArray,y,v,1,-1),Pd(this.layoutVertexArray,y,v,1,1),Pd(this.layoutVertexArray,y,v,-1,1),this.indexArray.emplaceBack(E,E+1,E+2),this.indexArray.emplaceBack(E,E+2,E+3),b.vertexLength+=4,b.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,{},o,l,d)}}function Mf(t,e){for(let i=0;i<t.length;i++)if(Es(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(Es(t,e[i]))return!0;return!!If(t,e)}function k0(t,e,i){return!!Es(t,e)||!!Af(e,t,i)}function s_(t,e){if(t.length===1)return l_(e,t[0]);for(let i=0;i<e.length;i++){const n=e[i];for(let o=0;o<n.length;o++)if(Es(t,n[o]))return!0}for(let i=0;i<t.length;i++)if(l_(e,t[i]))return!0;for(let i=0;i<e.length;i++)if(If(t,e[i]))return!0;return!1}function O0(t,e,i){if(t.length>1){if(If(t,e))return!0;for(let n=0;n<e.length;n++)if(Af(e[n],t,i))return!0}for(let n=0;n<t.length;n++)if(Af(t[n],e,i))return!0;return!1}function If(t,e){if(t.length===0||e.length===0)return!1;for(let i=0;i<t.length-1;i++){const n=t[i],o=t[i+1];for(let l=0;l<e.length-1;l++)if(B0(n,o,e[l],e[l+1]))return!0}return!1}function B0(t,e,i,n){return Ei(t,i,n)!==Ei(e,i,n)&&Ei(t,e,i)!==Ei(t,e,n)}function Af(t,e,i){const n=i*i;if(e.length===1)return t.distSqr(e[0])<n;for(let o=1;o<e.length;o++)if(a_(t,e[o-1],e[o])<n)return!0;return!1}function a_(t,e,i){const n=e.distSqr(i);if(n===0)return t.distSqr(e);const o=((t.x-e.x)*(i.x-e.x)+(t.y-e.y)*(i.y-e.y))/n;return t.distSqr(o<0?e:o>1?i:i.sub(e)._mult(o)._add(e))}function l_(t,e){let i,n,o,l=!1;for(let c=0;c<t.length;c++){i=t[c];for(let d=0,p=i.length-1;d<i.length;p=d++)n=i[d],o=i[p],n.y>e.y!=o.y>e.y&&e.x<(o.x-n.x)*(e.y-n.y)/(o.y-n.y)+n.x&&(l=!l)}return l}function Es(t,e){let i=!1;for(let n=0,o=t.length-1;n<t.length;o=n++){const l=t[n],c=t[o];l.y>e.y!=c.y>e.y&&e.x<(c.x-l.x)*(e.y-l.y)/(c.y-l.y)+l.x&&(i=!i)}return i}function c_(t,e,i,n,o){for(const c of t)if(e<=c.x&&i<=c.y&&n>=c.x&&o>=c.y)return!0;const l=[new Ge(e,i),new Ge(e,o),new Ge(n,o),new Ge(n,i)];if(t.length>2){for(const c of l)if(Es(t,c))return!0}for(let c=0;c<t.length-1;c++)if(F0(t[c],t[c+1],l))return!0;return!1}function F0(t,e,i){const n=i[0],o=i[2];if(t.x<n.x&&e.x<n.x||t.x>o.x&&e.x>o.x||t.y<n.y&&e.y<n.y||t.y>o.y&&e.y>o.y)return!1;const l=Ei(t,e,i[0]);return l!==Ei(t,e,i[1])||l!==Ei(t,e,i[2])||l!==Ei(t,e,i[3])}function Kl(t,e,i,n,o,l){let c=e.y-t.y,d=t.x-e.x;if(l=l||0){const p=c*c+d*d;if(p===0)return!0;const _=Math.sqrt(p);c/=_,d/=_}return!((i.x-t.x)*c+(i.y-t.y)*d-l<0||(n.x-t.x)*c+(n.y-t.y)*d-l<0||(o.x-t.x)*c+(o.y-t.y)*d-l<0)}function Cf(t,e,i,n,o,l,c){return!(Kl(t,e,n,o,l,c)||Kl(e,i,n,o,l,c)||Kl(i,t,n,o,l,c)||Kl(n,o,t,e,i,c)||Kl(o,l,t,e,i,c)||Kl(l,n,t,e,i,c))}function Jl(t,e,i){const n=e.paint.get(t).value;return n.kind==="constant"?n.value:i.programConfigurations.get(e.id).getMaxValue(t)}function Dd(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function u_(t,e,i,n,o){if(!e[0]&&!e[1])return t;const l=Ge.convert(e)._mult(o);i==="viewport"&&l._rotate(-n);const c=[];for(let d=0;d<t.length;d++)c.push(t[d].sub(l));return c}function h_(t,e,i,n){const o=Ge.convert(t)._mult(n);return e==="viewport"&&o._rotate(-i),o}N(Sf,"CircleBucket",{omit:["layers"]});const N0=new Gt({"circle-sort-key":new $e(he.layout_circle["circle-sort-key"]),visibility:new Ee(he.layout_circle.visibility)});var V0={paint:new Gt({"circle-radius":new $e(he.paint_circle["circle-radius"]),"circle-color":new $e(he.paint_circle["circle-color"]),"circle-blur":new $e(he.paint_circle["circle-blur"]),"circle-opacity":new $e(he.paint_circle["circle-opacity"]),"circle-translate":new Ee(he.paint_circle["circle-translate"]),"circle-translate-anchor":new Ee(he.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ee(he.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ee(he.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new $e(he.paint_circle["circle-stroke-width"]),"circle-stroke-color":new $e(he.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new $e(he.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new Ee(he.paint_circle["circle-emissive-strength"])}),layout:N0};class Pf{constructor(e,i){this.pos=e,this.dir=i}intersectsPlane(e,i,n){const o=s._.dot(i,this.dir);if(Math.abs(o)<1e-6)return!1;const l=((e[0]-this.pos[0])*i[0]+(e[1]-this.pos[1])*i[1]+(e[2]-this.pos[2])*i[2])/o;return n[0]=this.pos[0]+this.dir[0]*l,n[1]=this.pos[1]+this.dir[1]*l,n[2]=this.pos[2]+this.dir[2]*l,!0}closestPointOnSphere(e,i,n){if(s._.equals(this.pos,e)||i===0)return n[0]=n[1]=n[2]=0,!1;const[o,l,c]=this.dir,d=this.pos[0]-e[0],p=this.pos[1]-e[1],_=this.pos[2]-e[2],y=o*o+l*l+c*c,v=2*(d*o+p*l+_*c),b=v*v-4*y*(d*d+p*p+_*_-i*i);if(b<0){const E=Math.max(-v/2,0),S=d+o*E,I=p+l*E,C=_+c*E,D=Math.hypot(S,I,C);return n[0]=S*i/D,n[1]=I*i/D,n[2]=C*i/D,!1}{const E=(-v-Math.sqrt(b))/(2*y);if(E<0){const S=Math.hypot(d,p,_);return n[0]=d*i/S,n[1]=p*i/S,n[2]=_*i/S,!1}return n[0]=d+o*E,n[1]=p+l*E,n[2]=_+c*E,!0}}}class zf{constructor(e,i,n,o,l){this.TL=e,this.TR=i,this.BR=n,this.BL=o,this.horizon=l}static fromInvProjectionMatrix(e,i,n){const o=[-1,1,1],l=[1,1,1],c=[1,-1,1],d=[-1,-1,1],p=s._.transformMat4(o,o,e),_=s._.transformMat4(l,l,e),y=s._.transformMat4(c,c,e),v=s._.transformMat4(d,d,e);return new zf(p,_,y,v,i/n)}}function Zu(t,e,i){let n=1/0,o=-1/0;const l=[];for(const c of t){s._.sub(l,c,e);const d=s._.dot(l,i);n=Math.min(n,d),o=Math.max(o,d)}return[n,o]}function d_(t,e){let i=!0;for(let n=0;n<t.planes.length;n++){const o=t.planes[n];let l=0;for(let c=0;c<e.length;c++)l+=s._.dot(o,e[c])+o[3]>=0;if(l===0)return 0;l!==e.length&&(i=!1)}return i?2:1}function p_(t,e){for(const i of t.projections){const n=Zu(e,t.points[0],i.axis);if(i.projection[1]<n[0]||i.projection[0]>n[1])return 0}return 1}function f_(t,e){let i=0;const n=[0,0,0,0];for(let o=0;o<t.length;o++)n[0]=t[o][0],n[1]=t[o][1],n[2]=t[o][2],n[3]=1,s.aA.dot(n,e)>=0&&i++;return i}class Df{constructor(e,i){this.points=e||new Array(8).fill([0,0,0]),this.planes=i||new Array(6).fill([
70,0,0,0]),this.bounds=ui.fromPoints(this.points),this.projections=[],this.frustumEdges=[s._.sub([],this.points[2],this.points[3]),s._.sub([],this.points[0],this.points[3]),s._.sub([],this.points[4],this.points[0]),s._.sub([],this.points[5],this.points[1]),s._.sub([],this.points[6],this.points[2]),s._.sub([],this.points[7],this.points[3])];for(const n of this.frustumEdges){const o=[0,-n[2],n[1]],l=[n[2],0,-n[0]];this.projections.push({axis:o,projection:Zu(this.points,this.points[0],o)}),this.projections.push({axis:l,projection:Zu(this.points,this.points[0],l)})}}static fromInvProjectionMatrix(e,i,n,o){const l=Math.pow(2,n),c=[[-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(_=>{const y=s.aA.transformMat4([],_,e),v=1/y[3]/i*l;return s.aA.mul(y,y,[v,v,o?1/y[3]:v,v])}),d=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(_=>{const y=s._.sub([],c[_[0]],c[_[1]]),v=s._.sub([],c[_[2]],c[_[1]]),b=s._.normalize([],s._.cross([],y,v)),E=-s._.dot(b,c[_[1]]);return b.concat(E)}),p=[];for(let _=0;_<c.length;_++)p.push([c[_][0],c[_][1],c[_][2]]);return new Df(p,d)}intersectsPrecise(e,i,n){for(let o=0;o<i.length;o++)if(!f_(e,i[o]))return 0;for(let o=0;o<this.planes.length;o++)if(!f_(e,this.planes[o]))return 0;for(const o of n)for(const l of this.frustumEdges){const c=s._.cross([],o,l),d=s._.length(c);if(d===0)continue;s._.scale(c,c,1/d);const p=Zu(this.points,this.points[0],c),_=Zu(e,this.points[0],c);if(p[0]>_[1]||_[0]>p[1])return 0}return 1}}class ui{static fromPoints(e){const i=[1/0,1/0,1/0],n=[-1/0,-1/0,-1/0];for(const o of e)s._.min(i,i,o),s._.max(n,n,o);return new ui(i,n)}static fromTileIdAndHeight(e,i,n){const o=1<<e.canonical.z,l=e.canonical.x,c=e.canonical.y;return new ui([l/o,c/o,i],[(l+1)/o,(c+1)/o,n])}static applyTransform(e,i){const n=e.getCorners();for(let o=0;o<n.length;++o)s._.transformMat4(n[o],n[o],i);return ui.fromPoints(n)}static applyTransformFast(e,i){const n=[i[12],i[13],i[14]],o=[...n];for(let l=0;l<3;l++)for(let c=0;c<3;c++){const d=i[4*c+l],p=d*e.min[c],_=d*e.max[c];n[l]+=Math.min(p,_),o[l]+=Math.max(p,_)}return new ui(n,o)}static projectAabbCorners(e,i){const n=e.getCorners();for(let o=0;o<n.length;++o)s._.transformMat4(n[o],n[o],i);return n}constructor(e,i){this.min=e,this.max=i,this.center=s._.scale([],s._.add([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],n=s._.clone(this.min),o=s._.clone(this.max);for(let l=0;l<i.length;l++)n[l]=i[l]?this.min[l]:this.center[l],o[l]=i[l]?this.center[l]:this.max[l];return o[2]=this.max[2],new ui(n,o)}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)?d_(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?d_(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)?p_(e,this.getCorners()):0}intersectsPreciseFlat(e,i){return i||this.intersectsFlat(e)?p_(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])]}}N(ui,"Aabb");const U0=qt([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),{members:Ld}=U0,m_=qt([{name:"a_pos_3",components:3,type:"Int16"}]);var $u=qt([{name:"a_pos",type:"Int16",components:2}]);function Rd(t){return t*ar/Yl}const j0=[new ui([tn,tn,tn],[rn,rn,rn]),new ui([tn,tn,tn],[0,0,rn]),new ui([0,tn,tn],[rn,0,rn]),new ui([tn,0,tn],[0,rn,rn]),new ui([0,0,tn],[rn,rn,rn])];function __(t,e,i,n=!0){const o=s._.scale([],t._camera.position,t.worldSize),l=[e,i,1,1];s.aA.transformMat4(l,l,t.pixelMatrixInverse),s.aA.scale(l,l,1/l[3]);const c=s._.sub([],l,o),d=s._.normalize([],c),p=t.globeMatrix,_=[p[12],p[13],p[14]],y=s._.sub([],_,o),v=s._.length(y),b=s._.normalize([],y),E=t.worldSize/(2*Math.PI),S=s._.dot(b,d),I=Math.asin(E/v);if(I<Math.acos(S)){if(!n)return null;const pe=[],Te=[];s._.scale(pe,d,v/S),s._.normalize(Te,s._.sub(Te,pe,y)),s._.normalize(d,s._.add(d,y,s._.scale(d,Te,Math.tan(I)*v)))}const C=[];new Pf(o,d).closestPointOnSphere(_,E,C);const D=s._.normalize([],ta(p,0)),V=s._.normalize([],ta(p,1)),U=s._.normalize([],ta(p,2)),j=s._.dot(D,C),X=s._.dot(V,C),H=s._.dot(U,C),ie=Hi(Math.asin(-X/E));let ne=Hi(Math.atan2(j,H));ne=t.center.lng+function(pe,Te){const ze=(Te-pe+180)%360-180;return ze<-180?ze+360:ze}(t.center.lng,ne);const ue=Fn(ne),ye=ft(Nn(ie),0,1);return new Qi(ue,ye)}class G0{constructor(e,i,n){this.a=s._.sub([],e,n),this.b=s._.sub([],i,n),this.center=n;const o=s._.normalize([],this.a),l=s._.normalize([],this.b);this.angle=Math.acos(s._.dot(o,l))}}function Lf(t,e){if(t.angle===0)return null;let i;return i=t.a[e]===0?1/t.angle*.5*Math.PI:1/t.angle*Math.atan(t.b[e]/t.a[e]/Math.sin(t.angle)-1/Math.tan(t.angle)),i<0||i>1?null:function(n,o,l,c){const d=Math.sin(l);return n*(Math.sin((1-c)*l)/d)+o*(Math.sin(c*l)/d)}(t.a[e],t.b[e],t.angle,ft(i,0,1))+t.center[e]}function Vn(t){if(t.z<=1)return j0[t.z+2*t.y+t.x];const e=Rf(kd(t));return ui.fromPoints(e)}function Eo(t,e,i){return s._.scale(t,t,1-i),s._.scaleAndAdd(t,t,e,i)}function g_(t,e){const i=So(e.zoom);if(i===0)return Vn(t);const n=kd(t),o=Rf(n),l=Fn(n.getWest())*e.worldSize,c=Fn(n.getEast())*e.worldSize,d=Nn(n.getNorth())*e.worldSize,p=Nn(n.getSouth())*e.worldSize,_=[l,d,0],y=[c,d,0],v=[l,p,0],b=[c,p,0],E=s.ad.invert([],e.globeMatrix);return s._.transformMat4(_,_,E),s._.transformMat4(y,y,E),s._.transformMat4(v,v,E),s._.transformMat4(b,b,E),o[0]=Eo(o[0],v,i),o[1]=Eo(o[1],b,i),o[2]=Eo(o[2],y,i),o[3]=Eo(o[3],_,i),ui.fromPoints(o)}function y_(t,e,i){for(const n of t)s._.transformMat4(n,n,e),s._.scale(n,n,i)}function x_(t,e,i,n){const o=e/t.worldSize,l=t.globeMatrix;if(i.z<=1){const ue=Vn(i).getCorners();return y_(ue,l,o),ui.fromPoints(ue)}const c=kd(i,n),d=Rf(c,ar+Rd(t._tileCoverLift));y_(d,l,o);const p=Number.MAX_VALUE,_=[-p,-p,-p],y=[p,p,p];if(c.contains(t.center)){for(const pe of d)s._.min(y,y,pe),s._.max(_,_,pe);_[2]=0;const ue=t.point,ye=[ue.x*o,ue.y*o,0];return s._.min(y,y,ye),s._.max(_,_,ye),new ui(y,_)}if(t._tileCoverLift>0){for(const ue of d)s._.min(y,y,ue),s._.max(_,_,ue);return new ui(y,_)}const v=[l[12]*o,l[13]*o,l[14]*o],b=c.getCenter(),E=ft(t.center.lat,-85.051129,_r),S=ft(b.lat,-85.051129,_r),I=Fn(t.center.lng),C=Nn(E);let D=I-Fn(b.lng);const V=C-Nn(S);D>.5?D-=1:D<-.5&&(D+=1);let U=0;if(Math.abs(D)>Math.abs(V))U=D>=0?1:3;else{U=V>=0?0:2;const ue=[l[4]*o,l[5]*o,l[6]*o],ye=-Math.sin(Pt(V>=0?c.getSouth():c.getNorth()))*ar;s._.scaleAndAdd(v,v,ue,ye)}const j=d[U],X=d[(U+1)%4],H=new G0(j,X,v),ie=[Lf(H,0)||j[0],Lf(H,1)||j[1],Lf(H,2)||j[2]],ne=So(t.zoom);if(ne>0){const ue=function({x:pe,y:Te,z:ze},be,Ae,xe,Ce){const Re=1/(1<<ze);let Pe=pe*Re,Ze=Pe+Re,De=Te*Re,Oe=De+Re,Qe=0;const Je=(Pe+Ze)/2-xe;return Je>.5?Qe=-1:Je<-.5&&(Qe=1),Pe=((Pe+Qe)*be-(xe*=be))*Ae+xe,Ze=((Ze+Qe)*be-xe)*Ae+xe,De=(De*be-(Ce*=be))*Ae+Ce,Oe=(Oe*be-Ce)*Ae+Ce,[[Pe,Oe,0],[Ze,Oe,0],[Ze,De,0],[Pe,De,0]]}(i,e,t._pixelsPerMercatorPixel,I,C);for(let pe=0;pe<d.length;pe++)Eo(d[pe],ue[pe],ne);const ye=s._.add([],ue[U],ue[(U+1)%4]);s._.scale(ye,ye,.5),Eo(ie,ye,ne)}for(const ue of d)s._.min(y,y,ue),s._.max(_,_,ue);return y[2]=Math.min(j[2],X[2]),s._.min(y,y,ie),s._.max(_,_,ie),new ui(y,_)}function kd({x:t,y:e,z:i},n=!1){const o=1/(1<<i),l=new Bt(mr(t*o),e===(1<<i)-1&&n?-90:Fi((e+1)*o)),c=new Bt(mr((t+1)*o),e===0&&n?90:Fi(e*o)
7);return new Ts(l,c)}function Rf(t,e=ar){const i=Pt(t.getNorth()),n=Pt(t.getSouth()),o=Math.cos(i),l=Math.cos(n),c=Math.sin(i),d=Math.sin(n),p=t.getWest(),_=t.getEast();return[Xl(l,d,p,e),Xl(l,d,_,e),Xl(o,c,_,e),Xl(o,c,p,e)]}function Wu(t,e,i,n){const o=1<<i.z,l=(t/Ne+i.x)/o;return za(Fi((e/Ne+i.y)/o),mr(l),n)}function Od({min:t,max:e}){return A0/Math.max(e[0]-t[0],e[1]-t[1],e[2]-t[2])}const v_=new Float64Array(16);function Hu(t){const e=Od(t),i=s.ad.fromScaling(v_,[e,e,e]);return s.ad.translate(i,i,s._.negate([],t.min))}function kf(t){const e=s.ad.fromTranslation(v_,t.min),i=1/Od(t);return s.ad.scale(e,e,[i,i,i])}function Of(t){const e=Ne/(2*Math.PI);return t/(2*Math.PI)/e}function b_(t,e){return Ne/(512*Math.pow(2,t))*Od(Vn(e))}function w_(t,e,i,n,o){const l=Of(i),c=[t,e,-i/(2*Math.PI)],d=s.ad.identity(new Float64Array(16));return s.ad.translate(d,d,c),s.ad.scale(d,d,[l,l,l]),s.ad.rotateX(d,d,Pt(-o)),s.ad.rotateY(d,d,Pt(-n)),d}function So(t){return Qs(yf,Jm,t)}function T_(t,e){const i=za(e.lat,e.lng),n=function(l){const c=za(l._center.lat,l._center.lng),d=s._.fromValues(0,1,0);let p=s._.cross([],d,c);const _=s.ad.fromRotation([],-l.angle,c);p=s._.transformMat4(p,p,_),s.ad.fromRotation(_,-l._pitch,p);const y=s._.normalize([],c);return s._.scale(y,y,Rd(l.cameraToCenterDistance/l.pixelsPerMeter)),s._.transformMat4(y,y,_),s._.add([],c,y)}(t),o=s._.subtract([],n,i);return s._.angle(o,i)}function Bf(t,e){return T_(t,e)>Math.PI/2*1.01}const E_=Pt(85),q0=Math.cos(E_),Z0=Math.sin(E_),$0=s.ad.create(),S_=t=>{const e=[];return t.paint.get("circle-pitch-alignment")==="map"&&e.push("PITCH_WITH_MAP"),t.paint.get("circle-pitch-scale")==="map"&&e.push("SCALE_WITH_MAP"),e};function M_(t,e,i,n,o,l,c,d,p){if(l&&t.queryGeometry.isAboveHorizon)return!1;l&&(p*=t.pixelToTileUnitsFactor);const _=t.tileID.canonical,y=i.projection.upVectorScale(_,i.center.lat,i.worldSize).metersToTile;for(const v of e)for(const b of v){const E=b.add(d),S=o&&i.elevation?i.elevation.exaggeration()*o.getElevationAt(E.x,E.y,!0):0,I=i.projection.projectTilePoint(E.x,E.y,_);if(S>0){const U=i.projection.upVector(_,E.x,E.y);I.x+=U[0]*y*S,I.y+=U[1]*y*S,I.z+=U[2]*y*S}const C=l?E:W0(I.x,I.y,I.z,n),D=l?t.tilespaceRays.map(U=>X0(U,S)):t.queryGeometry.screenGeometry,V=s.aA.transformMat4([],[I.x,I.y,I.z,1],n);if(!c&&l?p*=V[3]/i.cameraToCenterDistance:c&&!l&&(p*=i.cameraToCenterDistance/V[3]),l){const U=Fi((b.y/Ne+_.y)/(1<<_.z));p/=i.projection.pixelsPerMeter(U,1)/lr(1,U)}if(k0(D,C,p))return!0}return!1}function W0(t,e,i,n){const o=s.aA.transformMat4([],[t,e,i,1],n);return new Ge(o[0]/o[3],o[1]/o[3])}const I_=s._.fromValues(0,0,0),H0=s._.fromValues(0,0,1);function X0(t,e){const i=s._.create();return I_[2]=e,t.intersectsPlane(I_,H0,i),new Ge(i[0],i[1])}class A_ extends Sf{}function C_(t,{width:e,height:i},n,o){if(o){if(o instanceof Uint8ClampedArray)o=new Uint8Array(o.buffer);else if(o.length!==e*i*n)throw new RangeError("mismatched image size")}else o=new Uint8Array(e*i*n);return t.width=e,t.height=i,t.data=o,t}function P_(t,e,i){const{width:n,height:o}=e;n===t.width&&o===t.height||(Ff(t,e,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,n),height:Math.min(t.height,o)},i,null),t.width=n,t.height=o,t.data=e.data)}function Ff(t,e,i,n,o,l,c,d){if(o.width===0||o.height===0)return e;if(o.width>t.width||o.height>t.height||i.x>t.width-o.width||i.y>t.height-o.height)throw new RangeError("out of range source coordinates for image copy");if(o.width>e.width||o.height>e.height||n.x>e.width-o.width||n.y>e.height-o.height)throw new RangeError("out of range destination coordinates for image copy");const p=t.data,_=e.data,y=l===4&&d;for(let v=0;v<o.height;v++){const b=((i.y+v)*t.width+i.x)*l,E=((n.y+v)*e.width+n.x)*l;if(y)for(let S=0;S<o.width;S++){const I=b+S*l+3,C=E+S*l;_[C+0]=255,_[C+1]=255,_[C+2]=255,_[C+3]=p[I]}else if(c)for(let S=0;S<o.width;S++){const I=b+S*l,C=E+S*l,D=p[I+3],V=new Nt(p[I+0]/255*D,p[I+1]/255*D,p[I+2]/255*D,D).toRenderColor(c).toArray();_[C+0]=V[0],_[C+1]=V[1],_[C+2]=V[2],_[C+3]=V[3]}else for(let S=0;S<o.width*l;S++)_[E+S]=p[b+S]}return e}N(A_,"HeatmapBucket",{omit:["layers"]});class Ss{constructor(e,i){C_(this,e,1,i)}resize(e){P_(this,new Ss(e),1)}clone(){return new Ss({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,n,o,l){Ff(e,i,n,o,l,1,null)}}class Fr{constructor(e,i){C_(this,e,4,i)}resize(e){P_(this,new Fr(e),4)}replace(e,i){i?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Fr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,i,n,o,l,c,d){Ff(e,i,n,o,l,4,c,d)}}class z_{constructor(e,i){this.width=e.width,this.height=e.height,this.data=i instanceof Uint8Array?new Float32Array(i.buffer):i}}N(Ss,"AlphaImage"),N(Fr,"RGBAImage");const Y0=new Gt({visibility:new Ee(he.layout_heatmap.visibility)});var K0={paint:new Gt({"heatmap-radius":new $e(he.paint_heatmap["heatmap-radius"]),"heatmap-weight":new $e(he.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ee(he.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Di(he.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ee(he.paint_heatmap["heatmap-opacity"])}),layout:Y0};function Xu(t){const e={},i=t.resolution||256,n=t.clips?t.clips.length:1,o=t.image||new Fr({width:i,height:n}),l=(c,d,p)=>{e[t.evaluationKey]=p;const _=t.expression.evaluate(e);_&&(o.data[c+d+0]=Math.floor(255*_.r/_.a),o.data[c+d+1]=Math.floor(255*_.g/_.a),o.data[c+d+2]=Math.floor(255*_.b/_.a),o.data[c+d+3]=Math.floor(255*_.a))};if(t.clips)for(let c=0,d=0;c<n;++c,d+=4*i)for(let p=0,_=0;p<i;p++,_+=4){const y=p/(i-1),{start:v,end:b}=t.clips[c];l(d,_,v*(1-y)+b*y)}else for(let c=0,d=0;c<i;c++,d+=4)l(0,d,c/(i-1));return o}const J0=new Gt({visibility:new Ee(he.layout_hillshade.visibility)});var Q0={paint:new Gt({"hillshade-illumination-direction":new Ee(he.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ee(he.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ee(he.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ee(he.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ee(he.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ee(he.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new Ee(he.paint_hillshade["hillshade-emissive-strength"])}),layout:J0};const ex=qt([{name:"a_pos",components:2,type:"Int16"}],4),{members:tx}=ex;function Yu(t,e,i=2){const n=e&&e.length,o=n?e[0]*i:t.length;let l=D_(t,0,o,i,!0);const c=[];if(!l||l.next===l.prev)return c;let d,p,_;if(n&&(l=function(y,v,b,E){const S=[];for(let I=0,C=v.length;I<C;I++){const D=D_(y,v[I]*E,I<C-1?v[I+1]*E:y.length,E,!1);D===D.next&&(D.steiner=!0),S.push(cx(D))}S.sort(sx);for(let I=0;I<S.length;I++)b=ax(S[I],b);return b}(t,e,l,i)),t.length>80*i){d=1/0,p=1/0;let y=-1/0,v=-1/0;for(let b=i;b<o;b+=i){const E=t[b],S=t[b+1];E<d&&(d=E),S<p&&(p=S),E>y&&(y=E),S>v&&(v=S)}_=Math.max(y-d,v-p),_=_!==0?32767/_:0}return Ku(l,c,i,d,p,_,0),c}function D_(t,e,i,n,o){let l;if(o===function(c,d,p,_){let y=0;for(let v=d,b=p-_;v<p;v+=_)y+=(c[b]-c[v])*(c[v+1]+c[b+1]),b=v;return y}(t,e,i,n)>0)for(let c=e;c<i;c+=n)l=k_(c/n|0,t[c],t[c+1],l);else for(let c=i-n;c>=e;c-=n)l=k_(c/n|0,t[c],t[c+1],l);return l&&Bd(l,l.next)&&(Qu(l),l=l.next),l}function Ra(t,e){if(!t)return t;e||(e=t);let i,n=t;do if(i=!1,n.steiner||!Bd(n,n.next)&&Pi(n.prev,n,n.next)!==0)n=n.next;else{if(Qu(n),n=e=n.prev,n===n.next)break;
vendor: 4,084 bytes, line 7
7i=!0}while(i||n!==e);return e}function Ku(t,e,i,n,o,l,c){if(!t)return;!c&&l&&function(p,_,y,v){let b=p;do b.z===0&&(b.z=Nf(b.x,b.y,_,y,v)),b.prevZ=b.prev,b.nextZ=b.next,b=b.next;while(b!==p);b.prevZ.nextZ=null,b.prevZ=null,function(E){let S,I=1;do{let C,D=E;E=null;let V=null;for(S=0;D;){S++;let U=D,j=0;for(let H=0;H<I&&(j++,U=U.nextZ,U);H++);let X=I;for(;j>0||X>0&&U;)j!==0&&(X===0||!U||D.z<=U.z)?(C=D,D=D.nextZ,j--):(C=U,U=U.nextZ,X--),V?V.nextZ=C:E=C,C.prevZ=V,V=C;D=U}V.nextZ=null,I*=2}while(S>1)}(b)}(t,n,o,l);let d=t;for(;t.prev!==t.next;){const p=t.prev,_=t.next;if(l?rx(t,n,o,l):ix(t))e.push(p.i,t.i,_.i),Qu(t),t=_.next,d=_.next;else if((t=_)===d){c?c===1?Ku(t=nx(Ra(t),e),e,i,n,o,l,2):c===2&&ox(t,e,i,n,o,l):Ku(Ra(t),e,i,n,o,l,1);break}}}function ix(t){const e=t.prev,i=t,n=t.next;if(Pi(e,i,n)>=0)return!1;const o=e.x,l=i.x,c=n.x,d=e.y,p=i.y,_=n.y,y=o<l?o<c?o:c:l<c?l:c,v=d<p?d<_?d:_:p<_?p:_,b=o>l?o>c?o:c:l>c?l:c,E=d>p?d>_?d:_:p>_?p:_;let S=n.next;for(;S!==e;){if(S.x>=y&&S.x<=b&&S.y>=v&&S.y<=E&&Ql(o,d,l,p,c,_,S.x,S.y)&&Pi(S.prev,S,S.next)>=0)return!1;S=S.next}return!0}function rx(t,e,i,n){const o=t.prev,l=t,c=t.next;if(Pi(o,l,c)>=0)return!1;const d=o.x,p=l.x,_=c.x,y=o.y,v=l.y,b=c.y,E=d<p?d<_?d:_:p<_?p:_,S=y<v?y<b?y:b:v<b?v:b,I=d>p?d>_?d:_:p>_?p:_,C=y>v?y>b?y:b:v>b?v:b,D=Nf(E,S,e,i,n),V=Nf(I,C,e,i,n);let U=t.prevZ,j=t.nextZ;for(;U&&U.z>=D&&j&&j.z<=V;){if(U.x>=E&&U.x<=I&&U.y>=S&&U.y<=C&&U!==o&&U!==c&&Ql(d,y,p,v,_,b,U.x,U.y)&&Pi(U.prev,U,U.next)>=0||(U=U.prevZ,j.x>=E&&j.x<=I&&j.y>=S&&j.y<=C&&j!==o&&j!==c&&Ql(d,y,p,v,_,b,j.x,j.y)&&Pi(j.prev,j,j.next)>=0))return!1;j=j.nextZ}for(;U&&U.z>=D;){if(U.x>=E&&U.x<=I&&U.y>=S&&U.y<=C&&U!==o&&U!==c&&Ql(d,y,p,v,_,b,U.x,U.y)&&Pi(U.prev,U,U.next)>=0)return!1;U=U.prevZ}for(;j&&j.z<=V;){if(j.x>=E&&j.x<=I&&j.y>=S&&j.y<=C&&j!==o&&j!==c&&Ql(d,y,p,v,_,b,j.x,j.y)&&Pi(j.prev,j,j.next)>=0)return!1;j=j.nextZ}return!0}function nx(t,e){let i=t;do{const n=i.prev,o=i.next.next;!Bd(n,o)&&L_(n,i,i.next,o)&&Ju(n,o)&&Ju(o,n)&&(e.push(n.i,i.i,o.i),Qu(i),Qu(i.next),i=t=o),i=i.next}while(i!==t);return Ra(i)}function ox(t,e,i,n,o,l){let c=t;do{let d=c.next.next;for(;d!==c.prev;){if(c.i!==d.i&&ux(c,d)){let p=R_(c,d);return c=Ra(c,c.next),p=Ra(p,p.next),Ku(c,e,i,n,o,l,0),void Ku(p,e,i,n,o,l,0)}d=d.next}c=c.next}while(c!==t)}function sx(t,e){return t.x-e.x}function ax(t,e){const i=function(o,l){let c=l;const d=o.x,p=o.y;let _,y=-1/0;do{if(p<=c.y&&p>=c.next.y&&c.next.y!==c.y){const I=c.x+(p-c.y)*(c.next.x-c.x)/(c.next.y-c.y);if(I<=d&&I>y&&(y=I,_=c.x<c.next.x?c:c.next,I===d))return _}c=c.next}while(c!==l);if(!_)return null;const v=_,b=_.x,E=_.y;let S=1/0;c=_;do{if(d>=c.x&&c.x>=b&&d!==c.x&&Ql(p<E?d:y,p,b,E,p<E?y:d,p,c.x,c.y)){const I=Math.abs(p-c.y)/(d-c.x);Ju(c,o)&&(I<S||I===S&&(c.x>_.x||c.x===_.x&&lx(_,c)))&&(_=c,S=I)}c=c.next}while(c!==v);return _}(t,e);if(!i)return e;const n=R_(i,t);return Ra(n,n.next),Ra(i,i.next)}function lx(t,e){return Pi(t.prev,t,e.prev)<0&&Pi(e.next,t,t.next)<0}function Nf(t,e,i,n,o){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-i)*o|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-n)*o|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function cx(t){let e=t,i=t;do(e.x<i.x||e.x===i.x&&e.y<i.y)&&(i=e),e=e.next;while(e!==t);return i}function Ql(t,e,i,n,o,l,c,d){return(o-c)*(e-d)>=(t-c)*(l-d)&&(t-c)*(n-d)>=(i-c)*(e-d)&&(i-c)*(l-d)>=(o-c)*(n-d)}function ux(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(i,n){let o=i;do{if(o.i!==i.i&&o.next.i!==i.i&&o.i!==n.i&&o.next.i!==n.i&&L_(o,o.next,i,n))return!0;o=o.next}while(o!==i);return!1}(t,e)&&(Ju(t,e)&&Ju(e,t)&&function(i,n){let o=i,l=!1;const c=(i.x+n.x)/2,d=(i.y+n.y)/2;do o.y>d!=o.next.y>d&&o.next.y!==o.y&&c<(o.next.x-o.x)*(d-o.y)/(o.next.y-o.y)+o.x&&(l=!l),o=o.next;while(o!==i);return l}(t,e)&&(Pi(t.prev,t,e.prev)||Pi(t,e.prev,e))||Bd(t,e)&&Pi(t.prev,t,t.next)>0&&Pi(e.prev,e,e.next)>0)}function Pi(t,e,i){return(e.y-t.y)*(i.x-e.x)-(e.x-t.x)*(i.y-e.y)}function Bd(t,e){return t.x===e.x&&t.y===e.y}function L_(t,e,i,n){const o=Nd(Pi(t,e,i)),l=Nd(Pi(t,e,n)),c=Nd(Pi(i,n,t)),d=Nd(Pi(i,n,e));
7return o!==l&&c!==d||!(o!==0||!Fd(t,i,e))||!(l!==0||!Fd(t,n,e))||!(c!==0||!Fd(i,t,n))||!(d!==0||!Fd(i,e,n))}function Fd(t,e,i){return e.x<=Math.max(t.x,i.x)&&e.x>=Math.min(t.x,i.x)&&e.y<=Math.max(t.y,i.y)&&e.y>=Math.min(t.y,i.y)}function Nd(t){return t>0?1:t<0?-1:0}function Ju(t,e){return Pi(t.prev,t,t.next)<0?Pi(t,e,t.next)>=0&&Pi(t,t.prev,e)>=0:Pi(t,e,t.prev)<0||Pi(t,t.next,e)<0}function R_(t,e){const i=Vf(t.i,t.x,t.y),n=Vf(e.i,e.x,e.y),o=t.next,l=e.prev;return t.next=e,e.prev=t,i.next=o,o.prev=i,n.next=i,i.prev=n,l.next=n,n.prev=l,n}function k_(t,e,i,n){const o=Vf(t,e,i);return n?(o.next=n.next,o.prev=n,n.next.prev=o,n.next=o):(o.prev=o,o.next=o),o}function Qu(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Vf(t,e,i){return{i:t,x:e,y:i,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function Vd(t,e){const i=t.length;if(i<=1)return[t];const n=[];let o,l;for(let c=0;c<i;c++){const d=to(t[c]);d!==0&&(t[c].area=Math.abs(d),l===void 0&&(l=d<0),l===d<0?(o&&n.push(o),o=[t[c]]):o.push(t[c]))}if(o&&n.push(o),e>1)for(let c=0;c<n.length;c++)n[c].length<=e||(qh(n[c],e,1,n[c].length-1,hx),n[c]=n[c].slice(0,e));return n}function hx(t,e){return e.area-t.area}function Uf(t,e,i){const n=i.patternDependencies;let o=!1;for(const l of e){const c=l.paint.get(`${t}-pattern`);c.isConstant()||(o=!0);const d=c.constantOr(null);d&&(o=!0,n[d]=!0)}return o}function jf(t,e,i,n,o){const l=o.patternDependencies;for(const c of e){const d=c.paint.get(`${t}-pattern`).value;if(d.kind!=="constant"){let p=d.evaluate({zoom:n},i,{},o.availableImages);p=p&&p.name?p.name:p,l[p]=!0,i.patterns[c.id]=p}}return i}class Ud{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.patternFeatures=[],this.layoutVertexArray=new pn,this.indexArray=new Ri,this.indexArray2=new vs,this.programConfigurations=new ws(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new pi,this.segments2=new pi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.projection=e.projection}updateFootprints(e,i){}populate(e,i,n,o){this.hasPattern=Uf("fill",this.layers,i);const l=this.layers[0].layout.get("fill-sort-key"),c=[];for(const{feature:d,id:p,index:_,sourceLayerIndex:y}of e){const v=this.layers[0]._featureFilter.needGeometry,b=To(d,v);if(!this.layers[0]._featureFilter.filter(new st(this.zoom),b,n))continue;const E=l?l.evaluate(b,{},n,i.availableImages):void 0,S={id:p,properties:d.properties,type:d.type,sourceLayerIndex:y,index:_,geometry:v?b.geometry:mn(d,n,o),patterns:{},sortKey:E};c.push(S)}l&&c.sort((d,p)=>d.sortKey-p.sortKey);for(const d of c){const{geometry:p,index:_,sourceLayerIndex:y}=d;if(this.hasPattern){const v=jf("fill",this.layers,d,this.zoom,i);this.patternFeatures.push(v)}else this.addFeature(d,p,_,n,{},i.availableImages,i.brightness);i.featureIndex.insert(e[_].feature,p,_,y,this.index)}}update(e,i,n,o,l){const c=Object.keys(e).length!==0;c&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,c?this.stateDependentLayers:this.layers,n,o,l)}addFeatures(e,i,n,o,l,c){for(const d of this.patternFeatures)this.addFeature(d,d.geometry,d.index,i,n,o,c)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,tx),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,i,n,o,l,c=[],d){for(const p of Vd(i,500)){let _=0;for(const I of p)_+=I.length;const y=this.segments.prepareSegment(_,this.layoutVertexArray,this.indexArray),v=y.vertexLength,b=[],E=[];for(const I of p){if(I.length===0)continue;I!==p[0]&&E.push(b.length/2);const C=this.segments2.prepareSegment(I.length,this.layoutVertexArray,this.indexArray2),D=C.vertexLength;this.layoutVertexArray.emplaceBack(I[0].x,I[0].y),this.indexArray2.emplaceBack(D+I.length-1,D),b.push(I[0].x),b.push(I[0].y);for(let V=1;V<I.length;V++)this.layoutVertexArray.emplaceBack(I[V].x,I[V].y),this.indexArray2.emplaceBack(D+V-1,D+V),b.push(I[V].x),b.push(I[V].y);C.vertexLength+=I.length,C.primitiveLength+=I.length}const S=Yu(b,E);for(let I=0;I<S.length;I+=3)this.indexArray.emplaceBack(v+S[I],v+S[I+1],v+S[I+2]);y.vertexLength+=_,y.primitiveLength+=S.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,l,c,o,d)}}N(Ud,"FillBucket",{omit:["layers","patternFeatures"]});const dx=new Gt({"fill-sort-key":new $e(he.layout_fill["fill-sort-key"]),visibility:new Ee(he.layout_fill.visibility)});var px={paint:new Gt({"fill-antialias":new Ee(he.paint_fill["fill-antialias"]),"fill-opacity":new $e(he.paint_fill["fill-opacity"]),"fill-color":new $e(he.paint_fill["fill-color"]),"fill-outline-color":new $e(he.paint_fill["fill-outline-color"]),"fill-translate":new Ee(he.paint_fill["fill-translate"]),"fill-translate-anchor":new Ee(he.paint_fill["fill-translate-anchor"]),"fill-pattern":new $e(he.paint_fill["fill-pattern"]),"fill-emissive-strength":new Ee(he.paint_fill["fill-emissive-strength"])}),layout:dx};class Gf{constructor(e,i,n,o){if(this.triangleCount=i.length/3,this.min=new Ge(0,0),this.max=new Ge(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[l,c]=[e[0].clone(),e[0].clone()];for(let v=1;v<e.length;++v){const b=e[v];l.x=Math.min(l.x,b.x),l.y=Math.min(l.y,b.y),c.x=Math.max(c.x,b.x),c.y=Math.max(c.y,b.y)}if(o){const v=Math.ceil(Math.max(c.x-l.x,c.y-l.y)/o);n=Math.max(n,v)}if(n===0)return;this.min=l,this.max=c;const d=this.max.sub(this.min);d.x=Math.max(d.x,1),d.y=Math.max(d.y,1);const p=Math.max(d.x,d.y)/n;this.cellsX=Math.max(1,Math.ceil(d.x/p)),this.cellsY=Math.max(1,Math.ceil(d.y/p)),this.xScale=1/p,this.yScale=1/p;const _=[];for(let v=0;v<this.triangleCount;v++){const b=e[i[3*v+0]].sub(this.min),E=e[i[3*v+1]].sub(this.min),S=e[i[3*v+2]].sub(this.min),I=Un(Math.floor(Math.min(b.x,E.x,S.x)),this.xScale,this.cellsX),C=Un(Math.floor(Math.max(b.x,E.x,S.x)),this.xScale,this.cellsX),D=Un(Math.floor(Math.min(b.y,E.y,S.y)),this.yScale,this.cellsY),V=Un(Math.floor(Math.max(b.y,E.y,S.y)),this.yScale,this.cellsY),U=new Ge(0,0),j=new Ge(0,0),X=new Ge(0,0),H=new Ge(0,0);for(let ie=D;ie<=V;++ie){U.y=j.y=ie*p,X.y=H.y=(ie+1)*p;for(let ne=I;ne<=C;++ne)U.x=X.x=ne*p,j.x=H.x=(ne+1)*p,(Cf(b,E,S,U,j,H)||Cf(b,E,S,U,H,X))&&_.push({cellIdx:ie*this.cellsX+ne,triIdx:v})}}if(_.length===0)return;_.sort((v,b)=>v.cellIdx-b.cellIdx||v.triIdx-b.triIdx);let y=0;for(;y<_.length;){const v=_[y].cellIdx,b={start:this.payload.length,len:0};for(;y<_.length&&_[y].cellIdx===v;)++b.len,this.payload.push(_[y++].triIdx);this.cells[v]=b}}_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 n=Un(e.x-this.min.x,this.xScale,this.cellsX),o=Un(e.y-this.min.y,this.yScale,this.cellsY),l=this.cells[o*this.cellsX+n];if(l){this._lazyInitLookup();for(let c=0;c<l.len;c++){const d=this.payload[l.start+c],p=Math.floor(d/8),_=1<<d%8;if(!(this.lookup[p]&_)&&(this.lookup[p]|=_,i.push(d),i.length===this.triangleCount))return}}}query(e,i,n){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 o=Un(e.x-this.min.x,this.xScale,this.cellsX),l=Un(i.x-this.min.x,this.xScale,this.cellsX),c=Un(e.y-this.min.y,this.yScale,this.cellsY),d=Un(i.y-this.min.y,this.yScale,this.cellsY);for(let p=c;p<=d;p++)for(let _=o;_<=l;_++){const y=this.cells[p*this.cellsX+_];if(y)for(let v=0;v<y.len;v++){const b=this.payload[y.start+v],E=Math.floor(b/8),S=1<<b%8;if(!(this.lookup[E]&S)&&(this.lookup[E]|=S,n.push(b),n.length===this.triangleCount))return}}}}
7function Un(t,e,i){return Math.max(0,Math.min(i-1,Math.floor(t*e)))}N(Gf,"TriangleGridIndex");class O_{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=[]}updateFootprints(e,i){for(const n of this.footprints)i.push({footprint:n,id:e})}populate(e,i,n,o){const l=[];for(const{feature:c,id:d,index:p,sourceLayerIndex:_}of e){const y=this.layers[0]._featureFilter.needGeometry,v=To(c,y);if(!this.layers[0]._featureFilter.filter(new st(this.zoom),v,n))continue;const b={id:d,properties:c.properties,type:c.type,sourceLayerIndex:_,index:p,geometry:y?v.geometry:mn(c,n,o),patterns:{}};l.push(b)}for(const c of l){const{geometry:d,index:p,sourceLayerIndex:_}=c;this.addFeature(c,d,p,n,{},i.availableImages,i.brightness),i.featureIndex.insert(e[p].feature,d,p,_,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(e){}update(e,i,n,o,l){}destroy(){}addFeature(e,i,n,o,l,c=[],d){for(const p of Vd(i,2)){const _=[],y=[],v=[],b=new Ge(1/0,1/0),E=new Ge(-1/0,-1/0);for(const C of p)if(C.length!==0){C!==p[0]&&v.push(y.length/2);for(let D=0;D<C.length;D++)y.push(C[D].x),y.push(C[D].y),_.push(C[D]),b.x=Math.min(b.x,C[D].x),b.y=Math.min(b.y,C[D].y),E.x=Math.max(E.x,C[D].x),E.y=Math.max(E.y,C[D].y)}const S=Yu(y,v),I=new Gf(_,S,8,256);this.footprints.push({vertices:_,indices:S,grid:I,min:b,max:E})}}}N(O_,"ClipBucket",{omit:["layers"]});const fx=new Gt({"clip-layer-types":new Ee(he.layout_clip["clip-layer-types"])});var mx={paint:new Gt({}),layout:fx};const _x=qt([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),gx=qt([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),yx=qt([{name:"a_centroid_pos",components:2,type:"Uint16"}]),xx=qt([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),vx=qt([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:bx}=_x;var jd={},wx=ll,B_=ec;function ec(t,e,i,n,o){this.properties={},this.extent=i,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=o,t.readFields(Tx,this,e)}function Tx(t,e,i){t==1?e.id=i.readVarint():t==2?function(n,o){for(var l=n.readVarint()+n.pos;n.pos<l;){var c=o._keys[n.readVarint()],d=o._values[n.readVarint()];o.properties[c]=d}}(i,e):t==3?e.type=i.readVarint():t==4&&(e._geometry=i.pos)}function Ex(t){for(var e,i,n=0,o=0,l=t.length,c=l-1;o<l;c=o++)n+=((i=t[c]).x-(e=t[o]).x)*(e.y+i.y);return n}ec.types=["Unknown","Point","LineString","Polygon"],ec.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,i=t.readVarint()+t.pos,n=1,o=0,l=0,c=0,d=[];t.pos<i;){if(o<=0){var p=t.readVarint();n=7&p,o=p>>3}if(o--,n===1||n===2)l+=t.readSVarint(),c+=t.readSVarint(),n===1&&(e&&d.push(e),e=[]),e.push(new wx(l,c));else{if(n!==7)throw new Error("unknown command "+n);e&&e.push(e[0].clone())}}return e&&d.push(e),d},ec.prototype.bbox=function(){var t=this._pbf;t.pos=this._geometry;for(var e=t.readVarint()+t.pos,i=1,n=0,o=0,l=0,c=1/0,d=-1/0,p=1/0,_=-1/0;t.pos<e;){if(n<=0){var y=t.readVarint();i=7&y,n=y>>3}if(n--,i===1||i===2)(o+=t.readSVarint())<c&&(c=o),o>d&&(d=o),(l+=t.readSVarint())<p&&(p=l),l>_&&(_=l);else if(i!==7)throw new Error("unknown command "+i)}return[c,p,d,_]},ec.prototype.toGeoJSON=function(t,e,i){var n,o,l=this.extent*Math.pow(2,i),c=this.extent*t,d=this.extent*e,p=this.loadGeometry(),_=ec.types[this.type];function y(E){for(var S=0;S<E.length;S++){var I=E[S];E[S]=[360*(I.x+c)/l-180,360/Math.PI*Math.atan(Math.exp((180-360*(I.y+d)/l)*Math.PI/180))-90]}}switch(this.type){case 1:var v=[];for(n=0;n<p.length;n++)v[n]=p[n][0];y(p=v);break;case 2:for(n=0;n<p.length;n++)y(p[n]);break;case 3:for(p=function(E){var S=E.length;if(S<=1)return[E];for(var I,C,D=[],V=0;V<S;V++){var U=Ex(E[V]);U!==0&&(C===void 0&&(C=U<0),C===U<0?(I&&D.push(I),I=[E[V]]):I.push(E[V]))}return I&&D.push(I),D}(p),n=0;n<p.length;n++)for(o=0;o<p[n].length;o++)y(p[n][o])}p.length===1?p=p[0]:_="Multi"+_;var b={type:"Feature",geometry:{type:_,coordinates:p},properties:this.properties};return"id"in this&&(b.id=this.id),b};var Sx=B_,F_=N_;function N_(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(M
7x,this,e),this.length=this._features.length}function Mx(t,e,i){t===15?e.version=i.readVarint():t===1?e.name=i.readString():t===5?e.extent=i.readVarint():t===2?e._features.push(i.pos):t===3?e._keys.push(i.readString()):t===4&&e._values.push(function(n){for(var o=null,l=n.readVarint()+n.pos;n.pos<l;){var c=n.readVarint()>>3;o=c===1?n.readString():c===2?n.readFloat():c===3?n.readDouble():c===4?n.readVarint64():c===5?n.readVarint():c===6?n.readSVarint():c===7?n.readBoolean():null}return o}(i))}N_.prototype.feature=function(t){if(t<0||t>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[t];var e=this._pbf.readVarint()+this._pbf.pos;return new Sx(this._pbf,e,this.extent,this._keys,this._values)};var Ix=F_;function Ax(t,e,i){if(t===3){var n=new Ix(i,i.readVarint()+i.pos);n.length&&(e[n.name]=n)}}var qf=jd.VectorTile=function(t,e){this.layers=t.readFields(Ax,{},e)},Gd=jd.VectorTileFeature=B_;jd.VectorTileLayer=F_;class ka extends Ge{constructor(e,i,n){super(e,i),this.z=n}}class V_ extends ka{constructor(e,i,n,o){super(e,i,n),this.w=o}}function qd(t,e,i,n){const o=[],l=n===0?(c,d,p,_,y,v)=>{c.push(new Ge(v,p+(v-d)/(_-d)*(y-p)))}:(c,d,p,_,y,v)=>{c.push(new Ge(d+(v-p)/(y-p)*(_-d),v))};for(const c of t){const d=[];for(const p of c){if(p.length<=2)continue;const _=[];for(let b=0;b<p.length-1;b++){const E=p[b].x,S=p[b].y,I=p[b+1].x,C=p[b+1].y,D=n===0?E:S,V=n===0?I:C;D<e?V>e&&l(_,E,S,I,C,e):D>i?V<i&&l(_,E,S,I,C,i):_.push(p[b]),V<e&&D>=e&&l(_,E,S,I,C,e),V>i&&D<=i&&l(_,E,S,I,C,i)}let y=p[p.length-1];const v=n===0?y.x:y.y;v>=e&&v<=i&&_.push(y),_.length&&(y=_[_.length-1],_[0].x===y.x&&_[0].y===y.y||_.push(_[0]),d.push(_))}d.length&&o.push(d)}return o}function U_(t,e,i,n){const o=i==="x"?"y":"x",l=(n-t[i])/(e[i]-t[i]);t[o]=t[o]+(e[o]-t[o])*l,t[i]=n,t.hasOwnProperty("z")&&(t.z=tt(t.z,e.z,l)),t.hasOwnProperty("w")&&(t.w=tt(t.w,e.w,l))}function j_(t,e,i,n){const o=i,l=n;for(const c of["x","y"]){let d=t,p=e;d[c]>=p[c]&&(d=e,p=t),d[c]<o&&p[c]>o&&U_(d,p,c,o),d[c]<l&&p[c]>l&&U_(p,d,c,l)}}function Zd(t,e){return t.x-e.x||t.y-e.y}function G_(t,e){return Zd(t.min,e.min)===0&&Zd(t.max,e.max)===0}function Zf(t,e){return!(t.min.x>e.max.x||t.max.x<e.min.x||t.min.y>e.max.y||t.max.y<e.min.y)}function $f(t,e){if(t.length!==e.length)return!1;for(let i=0;i<t.length;i++)if(t[i].sourceId!==e[i].sourceId||!G_(t[i],e[i])||t[i].order!==e[i].order||t[i].clipMask!==e[i].clipMask)return!1;return!0}function q_(t,e,i){const n=1/Ne,o=1/(1<<i.canonical.z),l=(e.x*n+i.canonical.x)*o+i.wrap,c=(e.y*n+i.canonical.y)*o;return{min:new Ge((t.x*n+i.canonical.x)*o+i.wrap,(t.y*n+i.canonical.y)*o),max:new Ge(l,c)}}function Cx(t,e,i){const n=1<<i.canonical.z,o=((e.x-i.wrap)*n-i.canonical.x)*Ne,l=(e.y*n-i.canonical.y)*Ne;return{min:new Ge(((t.x-i.wrap)*n-i.canonical.x)*Ne,(t.y*n-i.canonical.y)*Ne),max:new Ge(o,l)}}function Z_(t,e,i,n,o,l,c){const d=t.indices,p=t.vertices,_=[];for(let y=n;y<n+o;y+=3){const v=e[i[y+0]+l],b=e[i[y+1]+l],E=e[i[y+2]+l],S=Math.min(v.x,b.x,E.x),I=Math.max(v.x,b.x,E.x),C=Math.min(v.y,b.y,E.y),D=Math.max(v.y,b.y,E.y);_.length=0,t.grid.query(new Ge(S,C),new Ge(I,D),_);for(let V=0;V<_.length;V++){const U=_[V];if(Cf(p[d[3*U+0]],p[d[3*U+1]],p[d[3*U+2]],v,b,E,c))return!0}}return!1}function $_(t,e,i,n){if(!t||!i)return!1;let o=t.vertices;if(!e.canonical.equals(n.canonical)||e.wrap!==n.wrap){if(i.vertices.length<t.vertices.length)return $_(i,n,t,e);const l=e.canonical,c=n.canonical,d=Math.pow(2,c.z-l.z);o=t.vertices.map(p=>new Ge((p.x+l.x*Ne)*d-c.x*Ne,(p.y+l.y*Ne)*d-c.y*Ne))}return Z_(i,o,t.indices,0,t.indices.length,0,0)}function W_(t,e,i,n){const o=Math.pow(2,n.z-i.z);return new Ge((t+i.x*Ne)*o-n.x*Ne,(e+i.y*Ne)*o-n.y*Ne)}function H_(t,e){const i=[];e.footprint.grid.queryPoint(t,i);const n=e.footprint.indices,o=e.footprint.vertices;for(let l=0;l<i.length;l++){const c=i[l];if(Es([o[n[3*c+0]],o[n[3*c+1]],o[n[3*c+2]]],t))return!0}return!1}class X_{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,i){const n=this.toIdx(e,i);return{min:this.minimums[n],max:this.maximums[n]}}isLeaf(e,i){return this.leaves[this.toIdx(e,i)]}toIdx(e,i){return i*this.size+e}}function Y_(t,e,i,n){let o=0,l=Number.MAX_VALUE;for(let c=0;c<3;c++)if(Math.abs(n[c])<1e-15){if(i[c]<t[c]||i[c]>e[c])return null}else{const d=1/n[c];let p=(t[c]-i[c])*d,_=(e[c]-i[c])*d;if(p>_){const y=p;p=_,_=y}if(p>o&&(o=p),_<l&&(l=_),o>l)return null}return o}function K_(t,e,i,n,o,l,c,d,p,_,y){const v=n-t,b=o-e,E=l-i,S=c-t,I=d-e,C=p-i,D=y[1]*C-y[2]*I,V=y[2]*S-y[0]*C,U=y[0]*I-y[1]*S,j=v*D+b*V+E*U;if(Math.abs(j)<1e-15)return null;const X=1/j,H=_[0]-t,ie=_[1]-e,ne=_[2]-i,ue=(H*D+ie*V+ne*U)*X;if(ue<0||ue>1)return null;const ye=ie*E-ne*b,pe=ne*v-H*E,Te=H*b-ie*v,ze=(y[0]*ye+y[1]*pe+y[2]*Te)*X;return ze<0||ue+ze>1?null:(S*ye+I*pe+C*Te)*X}function J_(t,e,i){return(t-e)/(i-e)}function Q_(t,e,i,n,o,l,c,d,p){const _=1<<i,y=l-n,v=c-o,b=(t+1)/_*y+n,E=(e+0)/_*v+o,S=(e+1)/_*v+o;d[0]=(t+0)/_*y+n,d[1]=E,p[0]=b,p[1]=S}class eg{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(l){const c=Math.ceil(Math.log2(l.dim/8)),d=[];let p=Math.ceil(Math.pow(2,c));const _=1/p,y=(E,S,I,C,D)=>{const V=C?1:0,U=(E+1)*I-V,j=S*I,X=(S+1)*I-V;D[0]=E*I,D[1]=j,D[2]=U,D[3]=X};let v=new X_(p);const b=[];for(let E=0;E<p*p;E++){y(E%p,Math.floor(E/p),_,!1,b);const S=Ms(b[0],b[1],l),I=Ms(b[2],b[1],l),C=Ms(b[2],b[3],l),D=Ms(b[0],b[3],l);v.minimums.push(Math.min(S,I,C,D)),v.maximums.push(Math.max(S,I,C,D)),v.leaves.push(1)}for(d.push(v),p/=2;p>=1;p/=2){const E=d[d.length-1];v=new X_(p);for(let S=0;S<p*p;S++){y(S%p,Math.floor(S/p),2,!0,b);const I=E.getElevation(b[0],b[1]),C=E.getElevation(b[2],b[1]),D=E.getElevation(b[2],b[3]),V=E.getElevation(b[0],b[3]),U=E.isLeaf(b[0],b[1]),j=E.isLeaf(b[2],b[1]),X=E.isLeaf(b[2],b[3]),H=E.isLeaf(b[0],b[3]),ie=Math.min(I.min,C.min,D.min,V.min),ne=Math.max(I.max,C.max,D.max,V.max),ue=U&&j&&X&&H;v.maximums.push(ne),v.minimums.push(ie),v.leaves.push(ne-ie<=5&&ue?1:0)}d.push(v)}return d}(this.dem),n=i.length-1,o=i[n];this._addNode(o.minimums[0],o.maximums[0],o.leaves[0]),this._construct(i,
vendor: 34,135 bytes, line 7
70,0,n,0)}raycastRoot(e,i,n,o,l,c,d=1){return Y_([e,i,-100],[n,o,this.maximums[0]*d],l,c)}raycast(e,i,n,o,l,c,d=1){if(!this.nodeCount)return null;const p=this.raycastRoot(e,i,n,o,l,c,d);if(p==null)return null;const _=[],y=[],v=[],b=[],E=[{idx:0,t:p,nodex:0,nodey:0,depth:0}];for(;E.length>0;){const{idx:S,t:I,nodex:C,nodey:D,depth:V}=E.pop();if(this.leaves[S]){Q_(C,D,V,e,i,n,o,v,b);const j=1<<V,X=(C+0)/j,H=(C+1)/j,ie=(D+0)/j,ne=(D+1)/j,ue=Ms(X,ie,this.dem)*d,ye=Ms(H,ie,this.dem)*d,pe=Ms(H,ne,this.dem)*d,Te=Ms(X,ne,this.dem)*d,ze=K_(v[0],v[1],ue,b[0],v[1],ye,b[0],b[1],pe,l,c),be=K_(b[0],b[1],pe,v[0],b[1],Te,v[0],v[1],ue,l,c),Ae=Math.min(ze!==null?ze:Number.MAX_VALUE,be!==null?be:Number.MAX_VALUE);if(Ae!==Number.MAX_VALUE)return Ae;{const xe=s._.scaleAndAdd([],l,c,I);if(tg(ue,ye,Te,pe,J_(xe[0],v[0],b[0]),J_(xe[1],v[1],b[1]))>=xe[2])return I}continue}let U=0;for(let j=0;j<this._siblingOffset.length;j++){Q_((C<<1)+this._siblingOffset[j][0],(D<<1)+this._siblingOffset[j][1],V+1,e,i,n,o,v,b),v[2]=-100,b[2]=this.maximums[this.childOffsets[S]+j]*d;const X=Y_(v,b,l,c);if(X!=null){const H=X;_[j]=H;let ie=!1;for(let ne=0;ne<U&&!ie;ne++)H>=_[y[ne]]&&(y.splice(ne,0,j),ie=!0);ie||(y[U]=j),U++}}for(let j=0;j<U;j++){const X=y[j];E.push({idx:this.childOffsets[S]+X,t:_[X],nodex:(C<<1)+this._siblingOffset[X][0],nodey:(D<<1)+this._siblingOffset[X][1],depth:V+1})}}return null}_addNode(e,i,n){return this.minimums.push(e),this.maximums.push(i),this.leaves.push(n),this.childOffsets.push(0),this.nodeCount++}_construct(e,i,n,o,l){if(e[o].isLeaf(i,n)===1)return;this.childOffsets[l]||(this.childOffsets[l]=this.nodeCount);const c=o-1,d=e[c];let p=0,_=0;for(let y=0;y<this._siblingOffset.length;y++){const v=2*i+this._siblingOffset[y][0],b=2*n+this._siblingOffset[y][1],E=d.getElevation(v,b),S=d.isLeaf(v,b),I=this._addNode(E.min,E.max,S);S&&(p|=1<<y),_||(_=I)}for(let y=0;y<this._siblingOffset.length;y++)p&1<<y||this._construct(e,2*i+this._siblingOffset[y][0],2*n+this._siblingOffset[y][1],c,_+y)}}function tg(t,e,i,n,o,l){return tt(tt(t,i,l),tt(e,n,l),o)}function Ms(t,e,i){const n=i.dim,o=ft(t*n-.5,0,n-1),l=ft(e*n-.5,0,n-1),c=Math.floor(o),d=Math.floor(l),p=Math.min(c+1,n-1),_=Math.min(d+1,n-1);return tg(i.get(c,d),i.get(p,d),i.get(c,_),i.get(p,_),o-c,l-d)}const Px={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function zx(t,e,i){return(256*t*256+256*e+i)/10-1e4}function Dx(t,e,i){return 256*t+e+i/256-32768}class $d{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,i,n,o=!1){if(this.uid=e,i.height!==i.width)throw new RangeError("DEM tiles must be square");if(n&&n!=="mapbox"&&n!=="terrarium")return vi(`"${n}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=i.height;const l=this.dim=i.height-2,c=new Uint32Array(i.data.buffer);if(this.pixels=new Uint8Array(i.data.buffer),this.floatView=new Float32Array(i.data.buffer),this.borderReady=o,this._modifiedForSources={},!o){for(let p=0;p<l;p++)c[this._idx(-1,p)]=c[this._idx(0,p)],c[this._idx(l,p)]=c[this._idx(l-1,p)],c[this._idx(p,-1)]=c[this._idx(p,0)],c[this._idx(p,l)]=c[this._idx(p,l-1)];c[this._idx(-1,-1)]=c[this._idx(0,0)],c[this._idx(l,-1)]=c[this._idx(l-1,0)],c[this._idx(-1,l)]=c[this._idx(0,l-1)],c[this._idx(l,l)]=c[this._idx(l-1,l-1)]}const d=n==="terrarium"?Dx:zx;for(let p=0;p<c.length;++p){const _=4*p;this.floatView[p]=d(this.pixels[_],this.pixels[_+1],this.pixels[_+2])}this._timestamp=Oi.now()}_buildQuadTree(){this._tree=new eg(this)}get(e,i,n=!1){n&&(e=ft(e,-1,this.dim),i=ft(i,-1,this.dim));const o=this._idx(e,i);return this.floatView[o]}set(e,i,n){const o=this._idx(e,i),l=this.floatView[o];return this.floatView[o]=n,n-l}static getUnpackVector(e){return Px[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 n=[0,0,0,0],o=$d.getUnpackVector(i);let l=Math.floor((e+o[3])/o[2]);return n[2]=l%256,l=Math.floor(l/256),n[1]=l%256,l=Math.floor(l/256),n[0]=l,n}getPixels(){return new z_({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,i,n){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let o=i*this.dim,l=i*this.dim+this.dim,c=n*this.dim,d=n*this.dim+this.dim;switch(i){case-1:o=l-1;break;case 1:l=o+1}switch(n){case-1:c=d-1;break;case 1:d=c+1}const p=-i*this.dim,_=-n*this.dim;for(let y=c;y<d;y++)for(let v=o;v<l;v++){const b=4*this._idx(v,y),E=4*this._idx(v+p,y+_);this.pixels[b+0]=e.pixels[E+0],this.pixels[b+1]=e.pixels[E+1],this.pixels[b+2]=e.pixels[E+2],this.pixels[b+3]=e.pixels[E+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}N($d,"DEMData"),N(eg,"DemMinMaxQuadTree",{omit:["dem"]});class tc{constructor(e,i,n){this._demTile=e,this._dem=this._demTile.dem,this._scale=i,this._offset=n}static create(e,i,n){const o=n||e.findDEMTileFor(i);if(!o||!o.dem)return;const l=o.dem,c=o.tileID,d=1<<i.canonical.z-c.canonical.z;return new tc(o,l.dim/Ne/d,[(i.canonical.x/d-c.canonical.x)*l.dim,(i.canonical.y/d-c.canonical.y)*l.dim])}tileCoordToPixel(e,i){const n=i*this._scale+this._offset[1],o=Math.floor(e*this._scale+this._offset[0]),l=Math.floor(n);return new Ge(o,l)}getElevationAt(e,i,n,o){const l=e*this._scale+this._offset[0],c=i*this._scale+this._offset[1],d=Math.floor(l),p=Math.floor(c),_=this._dem;return o=!!o,n?tt(tt(_.get(d,p,o),_.get(d,p+1,o),c-p),tt(_.get(d+1,p,o),_.get(d+1,p+1,o),c-p),l-d):_.get(d,p,o)}getElevationAtPixel(e,i,n){return this._dem.get(e,i,!!n)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*lr(1,e)*this._dem.stride}}const ig={None:0,Model:1,Symbol:2,FillExtrusion:4,All:7},Lx=Gd.types,Rx=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius"],kx=["fill-extrusion-flood-light-ground-radius"],Ox=Math.pow(2,13),Bx=Math.pow(2,15)-1,rg=new Ge(0,1),Is=2147483648;function eh(t,e,i,n,o,l,c,d){t.emplaceBack((e<<1)+c,(i<<1)+l,(Math.floor(n*Ox)<<1)+o,Math.round(d))}function Wd(t,e,i,n,o,l){t.emplaceBack(e.x,e.y,(i.x<<1)+n,(i.y<<1)+o,l)}function th(t,e,i){t.emplaceBack(e.x,e.y,e.z,i[0]*16384,i[1]*16384,i[2]*16384)}class ng{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class og{constructor(){this.centroidXY=new Ge(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 Ge(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new Ge(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0}span(){return new Ge(this.max.x-this.min.x,this.max.y-this.min.y)}}class sg{constructor(){this.acc=new Ge(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,n){this.accCount++,this.acc._add(i);let o=!!this.borders;i.x<e.min.x?(e.min.x=i.x,o=!0):i.x>e.max.x&&(e.max.x=i.x,o=!0),i.y<e.min.y?(e.min.y=i.y,o=!0):i.y>e.max.y&&(e.max.y=i.y,o=!0),((i.x===0||i.x===Ne)&&i.x===n.x)!=((i.y===0||i.y===Ne)&&i.y===n.y)&&this.processBorderOverlap(i,n),o&&this.checkBorderIntersection(i,n)}checkBorderIntersection(e,i){i.x<0!=e.x<0&&this.addBorderIntersection(0,tt(i.y,e.y,(0-i.x)/(e.x-i.x))),i.x>Ne!=e.x>Ne&&this.addBorderIntersection(1,tt(i.y,e.y,(Ne-i.x)/(e.x-i.x))),i.y<0!=e.y<0&&this.addBorderIntersection(2,tt(i.x,e.x,(0-i.y)/(e.y-i.y))),i.y>Ne!=e.y>Ne&&this.addBorderIntersection(3,tt(i.x,e.x,(Ne-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 n=this.borders[e];i<n[0]&&(n[0]=i),i>n[1]&&(n[1]=i)}processBorderOverlap(e,i){if(e.x===i.x){if(e.y===i.y)return;const n=e.x===0?0:1;this.addBorderIntersection(n,i.y),this.addBorderIntersection(n,e.y)}else{const n=e.y===0?2:3;this.addBorderIntersection(n,i.x),this.addBorderIntersection(n,e.x)}}centroid(){return this.accCount===0?new Ge(0,0):new Ge(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 ag(t,e){const i=t.add(e)._unit(),n=ft(t.x*i.x+t.y*i.y,-1,1);var o,l,c;return o=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(o)))/4*Bx*((l=t).x*(c=e).y-l.y*c.x<0?-1:1)}const Fx=[t=>t.x<0,t=>t.x>Ne,t=>t.y<0,t=>t.y>Ne];function Nx(t,e,i,n){const o=[4];if(n===0)return o;i._mult(n);const l=t.sub(i),c=e.sub(i),d=[t,e,l,c];for(let p=0;p<4;p++)for(const _ of d)if(Fx[p](_)){o.push(p);break}return o}class lg{constructor(e){this.vertexArray=new Yp,this.indexArray=new Ri,this.programConfigurations=new ws(e.layers,{zoom:e.zoom,lut:e.lut},i=>kx.includes(i)),this._segments=new pi,this.hiddenByLandmarkVertexArray=new hf,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new pi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(e,i,n,o=!1){const l=e.length;if(l>2){let c=Math.max(0,this._segments.get().length-1);const d=this._segments._prepareSegment(4*l,this.vertexArray.length,2*this._segmentToGroundQuads[c].length);let p;c!==this._segments.get().length-1&&(c++,this._segmentToGroundQuads[c]=[],this._segmentToRegionTriCounts[c]=[0,0,0,0,0]);{const _=e[0],y=e[1];p=ag(_.sub(e[l-1])._perp()._unit(),y.sub(_)._perp()._unit())}for(let _=0;_<l;_++){const y=_===l-1?0:_+1,v=e[_],b=e[y],E=e[y===l-1?0:y+1],S=b.sub(v)._perp()._unit(),I=ag(S,E.sub(b)._perp()._unit()),C=p,D=I;if(Wf(v,b,i)||o&&hg(v,i)&&hg(b,i)){p=I;continue}const V=d.vertexLength;Wd(this.vertexArray,v,b,1,1,C),Wd(this.vertexArray,v,b,1,0,C),Wd(this.vertexArray,v,b,0,1,D),Wd(this.vertexArray,v,b,0,0,D),d.vertexLength+=4;const U=Nx(v,b,S,n);for(const j of U)this._segmentToGroundQuads[c].push({id:V,region:j}),this._segmentToRegionTriCounts[c][j]+=2,d.primitiveLength+=2;p=I}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),i=e.length;for(let n=0;n<i;n++)this._segmentToGroundQuads[n].sort((o,l)=>o.region-l.region);for(let n=0;n<i;n++){const o=this._segmentToGroundQuads[n],l=e[n],c=this._segmentToRegionTriCounts[n];c.reduce((p,_)=>p+_,0);let d=0;for(let p=0;p<=4;p++){const _=c[p];if(_!==0){let y=this.regionSegments[p];y||(y=this.regionSegments[p]=new pi);const v={vertexOffset:l.vertexOffset,primitiveOffset:l.primitiveOffset+d,vertexLength:l.vertexLength,primitiveLength:_};y.get().push(v)}d+=_}for(let p=0;p<o.length;p++){const _=o[p].id;this.indexArray.emplaceBack(_,_+1,_+3),this.indexArray.emplaceBack(_,_+3,_+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,i,n,o,l,c){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,i,n,o,l,c)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,gx.members),this.indexBuffer=e.createIndexBuffer(this.indexArray))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,i,n,o,l,c){this.hasData()&&this.programConfigurations.updatePaintArrays(e,i,n,o,l,c)}updateHiddenByLandmark(e){if(!this.hasData())return;const i=e.groundVertexCount+e.groundVertexArrayOffset;if(e.groundVertexCount===0)return;const n=e.flags&Is?1:0;for(let o=e.groundVertexArrayOffset;o<i;++o)this.hiddenByLandmarkVertexArray.emplace(o,n);this._needsHiddenByLandmarkUpdate=!0}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,xx.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 Hd{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,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 Ri,this.footprintVertices=new pn,this.footprintSegments=[],this.layoutVertexArray=new _s,this.centroidVertexArray=new Wm,this.indexArray=new Ri,this.programConfigurations=new ws(e.layers,{zoom:e.zoom,lut:e.lut},i=>Rx.includes(i)),this.segments=new pi,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.groundEffect=new lg(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[]}updateFootprints(e,i){}populate(e,i,n,o){this.features=[],this.hasPattern=Uf("fill-extrusion",this.layers,i),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.tileToMeter=Cd(n),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter;for(const{feature:l,id:c,index:d,sourceLayerIndex:p}of e){const _=this.layers[0]._featureFilter.needGeometry,y=To(l,_);if(!this.layers[0]._featureFilter.filter(new st(this.zoom),y,n))continue;const v={id:c,sourceLayerIndex:p,index:d,geometry:_?y.geometry:mn(l,n,o),properties:l.properties,type:l.type,patterns:{}},b=this.layoutVertexArray.length;this.hasPattern?this.features.push(jf("fill-extrusion",this.layers,v,this.zoom,i)):this.addFeature(v,v.geometry,d,n,{},i.availableImages,o,i.brightness),i.featureIndex.insert(l,v.geometry,d,p,this.index,b)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,i,n,o,l,c){for(const d of this.features){const{geometry:p}=d;this.addFeature(d,p,d.index,i,n,o,l,c)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(e,i,n,o,l){const c=Object.keys(e).length!==0;if(c&&!this.stateDependentLayers.length)return;const d=c?this.stateDependentLayers:this.layers;this.programConfigurations.updatePaintArrays(e,i,d,n,o,l),this.groundEffect.update(e,i,d,n,o,l)}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,bx),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,vx.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,yx.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,n,o,l,c,d,p){const _=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(e,{})/this.tileToMeter,y=[new Ge(0,0),new Ge(Ne,Ne)],v=d.projection,b=v.name==="globe",E=Lx[e.type]==="Polygon",S=new sg;S.centroidDataIndex=this.centroidData.length;const I=new og,C=this.layers[0].paint.get("fill-extrusion-base").evaluate(e,{},o)<=0,D=this.layers[0].paint.get("fill-extrusion-height").evaluate(e,{},o);I.height=D,I.vertexArrayOffset=this.layoutVertexArray.length,I.groundVertexArrayOffset=this.groundEffect.vertexArray.length,b&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new Ed);const V=Vd(i,500);for(let ne=V.length-1;ne>=0;ne--){const ue=V[ne];(ue.length===0||(U=ue[0]).every(ye=>ye.x<=0)||U.every(ye=>ye.x>=Ne)||U.every(ye=>ye.y<=0)||U.every(ye=>ye.y>=Ne))&&V.splice(ne,1)}var U;let j;if(b)j=mg(V,y,o);else{j=[];for(const ne of V)j.push({polygon:ne,bounds:y})}const X=E?this.edgeRadius:0,H=X>0&&this.zoom<17,ie=(ne,ue)=>{if(ne.length===0)return!1;const ye=ne[ne.length-1];return ue.x===ye.x&&ue.y===ye.y};for(const{polygon:ne,bounds:ue}of j){let ye=0,pe=0;for(const Ae of ne)E&&!Ae[0].equals(Ae[Ae.length-1])&&Ae.push(Ae[0]),pe+=E?Ae.length-1:Ae.length;const Te=this.segments.prepareSegment((E?5:4)*pe,this.layoutVertexArray,this.indexArray);I.footprintSegIdx<0&&(I.footprintSegIdx=this.footprintSegments.length),I.polygonSegIdx<0&&(I.polygonSegIdx=this.polygonSegments.length);const ze={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},be=new ng;if(be.vertexOffset=this.footprintVertices.length,be.indexOffset=3*this.footprintIndices.length,be.ringIndices=[],E){const Ae=[],xe=[];ye=Te.vertexLength;for(let Re=0;Re<ne.length;Re++){const Pe=ne[Re];Pe.length&&Re!==0&&xe.push(Ae.length/2);const Ze=[];let De,Oe;De=Pe[1].sub(Pe[0])._perp()._unit(),be.ringIndices.push(Pe.length-1);for(let Qe=1;Qe<Pe.length;Qe++){const Je=Pe[Qe],Ye=Pe[Qe===Pe.length-1?1:Qe+1],ke=Je.clone();if(X){Oe=Ye.sub(Je)._perp()._unit();const et=De.add(Oe)._unit(),_t=X*Math.min(4,1/(De.x*et.x+De.y*et.y));ke.x+=_t*et.x,ke.y+=_t*et.y,ke.x=Math.round(ke.x),ke.y=Math.round(ke.y),De=Oe}!C||X!==0&&!H||ie(Ze,ke)||Ze.push(ke),eh(this.layoutVertexArray,ke.x,ke.y,0,0,1,1,0),Te.vertexLength++,this.footprintVertices.emplaceBack(Je.x,Je.y),Ae.push(Je.x,Je.y),b&&th(this.layoutVertexExtArray,v.projectTilePoint(ke.x,ke.y,o),v.upVector(o,ke.x,ke.y))}C&&(X===0||H)&&(Ze.length!==0&&ie(Ze,Ze[0])&&Ze.pop(),this.groundEffect.addData(Ze,ue,_))}const Ce=Yu(Ae,xe);for(let Re=0;Re<Ce.length;Re+=3)this.footprintIndices.emplaceBack(be.vertexOffset+Ce[Re+0],be.vertexOffset+Ce[Re+1],be.vertexOffset+Ce[Re+2]),this.indexArray.emplaceBack(ye+Ce[Re],ye+Ce[Re+2],ye+Ce[Re+1]),Te.primitiveLength++;be.indexCount+=Ce.length,be.vertexCount+=this.footprintVertices.length-be.vertexOffset}for(let Ae=0;Ae<ne.length;Ae++){const xe=ne[Ae];S.startRing(I,xe[0]);let Ce=xe.length>4&&dg(xe[xe.length-2],xe[0],xe[1]),Re=X?Vx(xe[xe.length-2],xe[0],xe[1],X):0;const Pe=[];let Ze,De,Oe;De=xe[1].sub(xe[0])._perp()._unit();let Qe=!0;for(let Je=1,Ye=0;Je<xe.length;Je++){let ke=xe[Je-1],et=xe[Je];const _t=xe[Je===xe.length-1?1:Je+1];if(S.appendEdge(I,et,ke),Wf(et,ke,ue)){X&&(De=_t.sub(et)._perp()._unit(),Qe=!Qe);continue}const ot=et.sub(ke)._perp(),bt=ot.x/(Math.abs(ot.x)+Math.abs(ot.y)),gt=ot.y>0?1:0,Mt=ke.dist(et);if(Ye+Mt>32768&&(Ye=0),X){Oe=_t.sub(et)._perp()._unit();let Ut=ug(ke,et,_t,cg(De,Oe),X);isNaN(Ut)&&(Ut=0);const Rt=et.sub(ke)._unit();ke=ke.add(Rt.mult(Re))._round(),et=et.add(Rt.mult(-Ut))._round(),Re=Ut,De=Oe,C&&this.zoom>=17&&(ie(Pe,ke)||Pe.push(ke),ie(Pe,et)||Pe.push(et))}const rt=Te.vertexLength,Yt=xe.length>4&&dg(ke,et,_t);let Xt=pg(Ye,Ce,Qe);if(eh(this.layoutVertexArray,ke.x,ke.y,bt,gt,0,0,Xt),eh(this.layoutVertexArray,ke.x,ke.y,bt,gt,0,1,Xt),Ye+=Mt,Xt=pg(Ye,Yt,!Qe),Ce=Yt,eh(this.layoutVertexArray,et.x,et.y,bt,gt,0,0,Xt),eh(this.layoutVertexArray,et.x,et.y,bt,gt,0,1,Xt),Te.vertexLength+=4,this.indexArray.emplaceBack(rt+0,rt+1,rt+2),this.indexArray.emplaceBack(rt+1,rt+3,rt+2),Te.primitiveLength+=2,X){const Ut=ye+(Je===1?xe.length-2:Je-2),Rt=Je===1?ye:Ut+1;if(this.indexArray.emplaceBack(rt+1,Ut,rt+3),this.indexArray.emplaceBack(Ut,Rt,rt+3),Te.primitiveLength+=2,Ze===void 0&&(Ze=rt),!Wf(_t,xe[Je],ue)){const jt=Je===xe.length-1?Ze:Te.vertexLength;this.indexArray.emplaceBack(rt+2,rt+3,jt),this.indexArray.emplaceBack(rt+3,jt+1,jt),this.indexArray.emplaceBack(rt+3,Rt,jt+1),Te.primitiveLength+=3}Qe=!Qe}if(b){const Ut=this.layoutVertexExtArray,Rt=v.projectTilePoint(ke.x,ke.y,o),jt=v.projectTilePoint(et.x,et.y,o),ni=v.upVector(o,ke.x,ke.y),ei=v.upVector(o,et.x,et.y);th(Ut,Rt,ni),th(Ut,Rt,ni),th(Ut,jt,ei),th(Ut,jt,ei)}}E&&(ye+=xe.length-1),C&&X&&this.zoom>=17&&(Pe.length!==0&&ie(Pe,Pe[0])&&Pe.pop(),this.groundEffect.addData(Pe,ue,_,X>0))}this.footprintSegments.push(be),ze.triangleCount=this.indexArray.length-ze.triangleArrayOffset,this.polygonSegments.push(ze),++I.footprintSegLen,++I.polygonSegLen}if(I.vertexCount=this.layoutVertexArray.length-I.vertexArrayOffset,I.groundVertexCount=this.groundEffect.vertexArray.length-I.groundVertexArrayOffset,I.vertexCount!==0){if(I.centroidXY=S.borders?rg:this.encodeCentroid(S,I),this.centroidData.push(I),S.borders){this.featuresOnBorder.push(S);const ne=this.featuresOnBorder.length-1;for(let ue=0;ue<S.borders.length;ue++)S.borders[ue][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[ue].push(ne)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,l,c,o,p),this.groundEffect.addPaintPropertiesData(e,n,l,c,o,p),this.maxHeight=Math.max(this.maxHeight,D)}}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((i,n)=>this.featuresOnBorder[i].borders[e][0]-this.featuresOnBorder[n].borders[e][0])}splitToSubtiles(){const e=[];for(let d=0;d<this.centroidData.length;d++){const p=this.centroidData[d],_=+(p.min.y+p.max.y>Ne),y=2*_+(+(p.min.x+p.max.x>Ne)^_);for(let v=0;v<p.polygonSegLen;v++){const b=p.polygonSegIdx+v;e.push({centroidIdx:d,subtile:y,polygonSegmentIdx:b,triangleSegmentIdx:this.polygonSegments[b].triangleSegIdx})}}const i=new Ri;e.sort((d,p)=>d.triangleSegmentIdx===p.triangleSegmentIdx?d.subtile-p.subtile:d.triangleSegmentIdx-p.triangleSegmentIdx);let n=0,o=0,l=0;for(const d of e){if(d.triangleSegmentIdx!==n)break;l++}const c=e.length;for(;o!==e.length;){n=e[o].triangleSegmentIdx;let d=0,p=o,_=o;for(let y=p;y<l&&e[y].subtile===d;y++)_++;for(;p!==l;){const y=e[p];d=y.subtile;const v=this.centroidData[y.centroidIdx].min.clone(),b=this.centroidData[y.centroidIdx].max.clone(),E={vertexOffset:this.segments.segments[n].vertexOffset,primitiveOffset:i.length,vertexLength:this.segments.segments[n].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let S=p;S<_;S++){const I=e[S],C=this.polygonSegments[I.polygonSegmentIdx],D=this.centroidData[I.centroidIdx].min,V=this.centroidData[I.centroidIdx].max,U=this.indexArray.uint16;for(let j=C.triangleArrayOffset;j<C.triangleArrayOffset+C.triangleCount;j++)i.emplaceBack(U[3*j],U[3*j+1],U[3*j+2]);E.primitiveLength+=C.triangleCount,v.x=Math.min(v.x,D.x),v.y=Math.min(v.y,D.y),b.x=Math.max(b.x,V.x),b.y=Math.max(b.y,V.y)}E.primitiveLength>0&&this.triangleSubSegments.push({segment:E,min:v,max:b}),p=_;for(let S=p;S<l&&e[S].subtile===e[p].subtile;S++)_++}o=l;for(let y=o;y<c&&e[y].triangleSegmentIdx===e[o].triangleSegmentIdx;y++)l++}i._trim(),this.indexArray=i}getVisibleSegments(e,i,n){let o=0,l=0;const c=1<<e.canonical.z;if(i){const I=i.getMinMaxForTile(e);I&&(o=I.min,l=I.max)}l+=this.maxHeight;const d=e.toUnwrapped();let p;const _=[d.canonical.x/c+d.wrap,d.canonical.y/c],y=[(d.canonical.x+1)/c+d.wrap,(d.canonical.y+1)/c],v=new pi,b=(I,C,D)=>[I[0]*(1-D[0])+C[0]*D[0],I[1]*(1-D[1])+C[1]*D[1]],E=[],S=[];for(const I of this.triangleSubSegments){E[0]=I.min.x/Ne,E[1]=I.min.y/Ne,S[0]=I.max.x/Ne,S[1]=I.max.y/Ne;const C=b(_,y,E),D=b(_,y,S);if(new ui([C[0],C[1],o],[D[0],D[1],l]).intersectsPrecise(n)===0){p&&(v.segments.push(p),p=void 0);continue}const V=I.segment;p&&p.vertexOffset!==V.vertexOffset&&(v.segments.push(p),p=void 0),p?(p.vertexLength+=V.vertexLength,p.primitiveLength+=V.primitiveLength):p={vertexOffset:V.vertexOffset,primitiveLength:V.primitiveLength,vertexLength:V.vertexLength,primitiveOffset:V.primitiveOffset,sortKey:void 0,vaos:{}}}return p&&v.segments.push(p),v}encodeCentroid(e,i){const n=e.centroid(),o=i.span(),l=Math.min(7,Math.round(o.x*this.tileToMeter/10)),c=Math.min(7,Math.round(o.y*this.tileToMeter/10));return new Ge(ft(n.x,1,Ne-1)<<3|l,ft(n.y,1,Ne-1)<<3|c)}encodeBorderCentroid(e){if(!e.borders)return new Ge(0,0);const i=e.borders,n=Number.MAX_VALUE;if(i[0][0]!==n||i[1][0]!==n){const o=i[0][0]!==n?0:1;return new Ge(6|(i[0][0]!==n?0:65528),(i[o][0]+i[o][1])/2<<3|6)}{const o=i[2][0]!==n?2:3;return new Ge((i[o][0]+i[o][1])/2<<3|6,6|(i[2][0]!==n?0:65528))}}showCentroid(e){const i=this.centroidData[e.centroidDataIndex];i.flags&=Is,i.centroidXY.x=0,i.centroidXY.y=0,this.writeCentroidToBuffer(i)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const i=e.vertexArrayOffset,n=e.vertexCount+e.vertexArrayOffset,o=e.flags&Is?rg:e.centroidXY,l=this.centroidVertexArray.geta_centroid_pos0(i);if(this.centroidVertexArray.geta_centroid_pos1(i)!==o.y||l!==o.x){for(let c=i;c<n;++c)this.centroidVertexArray.emplace(c,o.x,o.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,n){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const o=i.getReplacementRegionsForTile(e.toUnwrapped());if($f(this.activeReplacements,o))return;if(this.activeReplacements=o,this.centroidVertexArray.length===0)this.createCentroidsBuffer();else for(const c of this.centroidData)c.flags&=2147483647;const l=[];for(const c of this.activeReplacements){if(c.order<n)continue;const d=Math.pow(2,c.footprintTileId.canonical.z-e.canonical.z);for(const p of this.centroidData)if(!(p.flags&Is||c.min.x>p.max.x||p.min.x>c.max.x||c.min.y>p.max.y||p.min.y>c.max.y))for(let _=0;_<p.footprintSegLen;_++){const y=this.footprintSegments[p.footprintSegIdx+_];if(l.length=0,Ux(this.footprintVertices,y.vertexOffset,y.vertexCount,c.footprintTileId.canonical,e.canonical,l),Z_(c.footprint,l,this.footprintIndices.uint16,y.indexOffset,y.indexCount,-y.vertexOffset,-d)){p.flags|=Is;break}}}for(const c of this.centroidData)this.writeCentroidToBuffer(c);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,i,n){let o=!1;for(let l=0;l<n.footprintSegLen;l++){const c=this.footprintSegments[n.footprintSegIdx+l];let d=0;for(const p of c.ringIndices){for(let _=d,y=p+d-1;_<p+d;y=_++){const v=this.footprintVertices.int16[2*(_+c.vertexOffset)+0],b=this.footprintVertices.int16[2*(_+c.vertexOffset)+1],E=this.footprintVertices.int16[2*(y+c.vertexOffset)+1];b>i!=E>i&&e<(this.footprintVertices.int16[2*(y+c.vertexOffset)+0]-v)*(i-b)/(E-b)+v&&(o=!o)}d=p}}return o}getHeightAtTileCoord(e,i){let n=Number.NEGATIVE_INFINITY,o=!0;const l=4*(e+Ne)*Ne+(i+Ne);if(this.partLookup.hasOwnProperty(l)){const c=this.partLookup[l];return c?{height:c.height,hidden:!!(c.flags&Is)}:void 0}for(const c of this.centroidData)e>c.max.x||c.min.x>e||i>c.max.y||c.min.y>i||this.footprintContainsPoint(e,i,c)&&c&&c.height>n&&(n=c.height,this.partLookup[l]=c,o=!!(c.flags&Is));if(n!==Number.NEGATIVE_INFINITY)return{height:n,hidden:o};this.partLookup[l]=void 0}}function cg(t,e){const i=t.add(e)._unit();return t.x*i.x+t.y*i.y}function Vx(t,e,i,n){const o=e.sub(t)._perp()._unit(),l=i.sub(e)._perp()._unit();return ug(t,e,i,cg(o,l),n)}function ug(t,e,i,n,o){const l=Math.sqrt(1-n*n);return Math.min(t.dist(e)/3,e.dist(i)/3,o*l/n)}function Wf(t,e,i){return t.x<i[0].x&&e.x<i[0].x||t.x>i[1].x&&e.x>i[1].x||t.y<i[0].y&&e.y<i[0].y||t.y>i[1].y&&e.y>i[1].y}function hg(t,e){return t.x<e[0].x||t.x>e[1].x||t.y<e[0].y||t.y>e[1].y}function dg(t,e,i){if(t.x<0||t.x>=Ne||e.x<0||e.x>=Ne||i.x<0||i.x>=Ne)return!1;const n=i.sub(e),o=n.perp(),l=t.sub(e);return(n.x*l.x+n.y*l.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(l.x*l.x+l.y*l.y))>-.866&&o.x*l.x+o.y*l.y<0}function pg(t,e,i){const n=e?2|t:-3&t;return i?1|n:-2&n}function fg(){const t=Math.PI/32,e=Math.tan(t),i=Yl;return i*Math.sqrt(1+2*e*e)-i}function mg(t,e,i){const n=1<<i.z,o=mr(i.x/n),l=mr((i.x+1)/n),c=Fi(i.y/n),d=Fi((i.y+1)/n);return function(p,_,y,v,b=0,E){const S=[];if(!p.length||!y||!v)return S;const I=(H,ie)=>{for(const ne of H)S.push({polygon:ne,bounds:ie})},C=Math.ceil(Math.log2(y)),D=Math.ceil(Math.log2(v)),V=C-D,U=[];for(let H=0;H<Math.abs(V);H++)U.push(V>0?0:1);for(let H=0;H<Math.min(C,D);H++)U.push(0),U.push(1);let j=p;if(j=qd(j,_[0].y-b,_[1].y+b,1),j=qd(j,_[0].x-b,_[1].x+b,0),!j.length)return S;const X=[];for(U.length?X.push({polygons:j,bounds:_,depth:0}):I(j,_);X.length;){const H=X.pop(),ie=H.depth,ne=U[ie],ue=H.bounds[0],ye=H.bounds[1],pe=ne===0?ue.x:ue.y,Te=ne===0?ye.x:ye.y,ze=E?E(ne,pe,Te):.5*(pe+Te),be=qd(H.polygons,pe-b,ze+b,ne),Ae=qd(H.polygons,ze-b,Te+b,ne);if(be.length){const xe=[ue,new Ge(ne===0?ze:ye.x,ne===1?ze:ye.y)];U.length>ie+1?X.push({polygons:be,bounds:xe,depth:ie+1}):I(be,xe)}if(Ae.length){const xe=[new Ge(ne===0?ze:ue.x,ne===1?ze:ue.y),ye];U.length>ie+1?X.push({polygons:Ae,bounds:xe,depth:ie+1}):I(Ae,xe)}}return S}(t,e,Math.ceil((l-o)/11.25),Math.ceil((c-d)/11.25),1,(p,_,y)=>{if(p===0)return .5*(_+y);{const v=Fi((i.y+_/Ne)/n);return(Nn(.5*(Fi((i.y+y/Ne)/n)+v))*n-i.y)*Ne}})}function Ux(t,e,i,n,o,l){const c=Math.pow(2,n.z-o.z);for(let d=0;d<i;d++){let p=t.int16[2*(d+e)+0],_=t.int16[2*(d+e)+1];p=(p+o.x*Ne)*c-n.x*Ne,_=(_+o.y*Ne)*c-n.y*Ne,l.push(new Ge(p,_))}}N(Hd,"FillExtrusionBucket",{omit:["layers","features"]}),N(og,"PartData"),N(ng,"FootprintSegment"),N(sg,"BorderCentroidData"),N(lg,"GroundEffect");const jx=new Gt({visibility:new Ee(he["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new Ee(he["layout_fill-extrusion"]["fill-extrusion-edge-radius"])});var Gx={paint:new Gt({"fill-extrusion-opacity":new Ee(he["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new $e(he["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ee(he["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ee(he["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new $e(he["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new $e(he["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new $e(he["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ee(he["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new Ee(he["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new Ee(he["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new Ee(he["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new Ee(he["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new Ee(he["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new Ee(he["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new Ee(he["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new $e(he["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new $e(he["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new Ee(he["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new Ee(he["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new Ee(he["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new Ee(he["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-emissive-strength":new Ee(he["paint_fill-extrusion"]["fill-extrusion-emissive-strength"])}),layout:jx};function ih(t,e){return t.x*e.x+t.y*e.y}function _g(t,e){if(t.length===1){let i=0;const n=e[i++];let o;for(;!o||n.equals(o);)if(o=e[i++],!o)return 1/0;for(;i<e.length;i++){const l=e[i],c=t[0],d=o.sub(n),p=l.sub(n),_=c.sub(n),y=ih(d,d),v=ih(d,p),b=ih(p,p),E=ih(_,d),S=ih(_,p),I=y*b-v*v,C=(b*E-v*S)/I,D=(y*S-v*E)/I,V=n.z*(1-C-D)+o.z*C+l.z*D;if(isFinite(V))return V}return 1/0}{let i=1/0;for(const n of e)i=Math.min(i,n.z);return i}}function gg(t,e,i,n,o,l,c,d){const p=c*o.getElevationAt(t,e,!0,!0),_=l[0]!==0,y=_?l[1]===0?c*(l[0]/7-450):c*function(v,b,E){const S=Math.floor(b[0]/8),I=Math.floor(b[1]/8),C=10*(b[0]-8*S),D=10*(b[1]-8*I),V=v.getElevationAt(S,I,!0,!0),U=v.getMeterToDEM(E),j=Math.floor(.5*(C*U-1)),X=Math.floor(.5*(D*U-1)),H=v.tileCoordToPixel(S,I),ie=2*j+1,ne=2*X+1,ue=function(Ae,xe,Ce,Re,Pe){return[Ae.getElevationAtPixel(xe,Ce,!0),Ae.getElevationAtPixel(xe+Pe,Ce,!0),Ae.getElevationAtPixel(xe,Ce+Pe,!0),Ae.getElevationAtPixel(xe+Re,Ce+Pe,!0)]}(v,H.x-j,H.y-X,ie,ne),ye=Math.abs(ue[0]-ue[1]),pe=Math.abs(ue[2]-ue[3]),Te=Math.abs(ue[0]-ue[2])+Math.abs(ue[1]-ue[3]),ze=Math.min(.25,.5*U*(ye+pe)/ie),be=Math.min(.25,.5*U*Te/ne);return V+Math.max(ze*C,be*D)}(o,l,d):p;return{base:p+(i===0)?-1:i,top:_?Math.max(y+n,p+i+2):p+n}}const qx=qt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),{members:Zx}=qx,$x=qt([{name:"a_packed",components:4,type:"Float32"}]),{members:Wx}=$x,Hx=qt([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:Xx}=Hx,Yx=qt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}
vendor: 4,116 bytes, line 7
7],4),Kx=qt([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Jx=qt([{name:"a_projected_pos",components:4,type:"Float32"}],4);qt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Hf=qt([{name:"a_occlusion_query_opacity",components:1,type:"Float32"}],4),yg=qt([{name:"a_z_offset",components:1,type:"Float32"}],4),Qx=qt([{name:"a_texb",components:2,type:"Uint16"}]),ev=qt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),tv=qt([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_z_offset",components:1,type:"Float32"}]);qt([{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 xg=qt([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),iv=qt([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);qt([{name:"triangle",components:3,type:"Uint16"}]),qt([{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"}]),qt([{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:"Float32",name:"occlusionState"},{type:"Float32",name:"occlusionOpacity"},{type:"Uint8",name:"hasIconTextFit"}]),qt([{type:"Float32",name:"offsetX"}]),qt([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);class vg{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.image=new Ss({width:e,height:i}),this.positions={},this.uploaded=!1}getDash(e,i){const n=this.getKey(e,i);return this.positions[n]}trim(){const e=this.width,i=this.height=Oc(this.nextRow);this.image.resize({width:e,height:i})}getKey(e,i){return e.join(",")+i}getDashRanges(e,i,n){const o=[];
vendor: 1,650 bytes, line 7
7let l=e.length%2==1?-e[e.length-1]*n:0,c=e[0]*n,d=!0;o.push({left:l,right:c,isDash:d,zeroLength:e[0]===0});let p=e[0];for(let _=1;_<e.length;_++){d=!d;const y=e[_];l=p*n,p+=y,c=p*n,o.push({left:l,right:c,isDash:d,zeroLength:y===0})}return o}addRoundDash(e,i,n){const o=i/2;for(let l=-n;l<=n;l++){const c=this.width*(this.nextRow+n+l);let d=0,p=e[d];for(let _=0;_<this.width;_++){_/p.right>1&&(p=e[++d]);const y=Math.abs(_-p.left),v=Math.abs(_-p.right),b=Math.min(y,v);let E;const S=l/n*(o+1);if(p.isDash){const I=o-Math.abs(S);E=Math.sqrt(b*b+I*I)}else E=o-Math.sqrt(b*b+S*S);this.image.data[c+_]=Math.max(0,Math.min(255,E+128))}}}addRegularDash(e,i){for(let p=e.length-1;p>=0;--p){const _=e[p],y=e[p+1];_.zeroLength?e.splice(p,1):y&&y.isDash===_.isDash&&(y.left=_.left,e.splice(p,1))}const n=e[0],o=e[e.length-1];n.isDash===o.isDash&&(n.left=o.left-this.width,o.right=n.right+this.width);const l=this.width*this.nextRow;let c=0,d=e[c];for(let p=0;p<this.width;p++){p/d.right>1&&(d=e[++c]);const _=Math.abs(p-d.left),y=Math.abs(p-d.right),v=Math.min(_,y);this.image.data[l+p]=Math.max(0,Math.min(255,(d.isDash?v:-v)+i+128))}}addDash(e,i){const n=this.getKey(e,i);if(this.positions[n])return this.positions[n];const o=i==="round",l=o?7:0,c=2*l+1;if(this.nextRow+c>this.height)return vi("LineAtlas out of space"),null;e.length===0&&e.push(1);let d=0;for(let y=0;y<e.length;y++)e[y]<0&&(vi("Negative value is found in line dasharray, replacing values with 0"),e[y]=0),d+=e[y];if(d!==0){const y=this.width/d,v=this.getDashRanges(e,this.width,y);o?this.addRoundDash(v,y,l):this.addRegularDash(v,i==="square"?.5*y:0)}const p=this.nextRow+l;this.nextRow+=c;
7const _={tl:[p,l],br:[d,0]};return this.positions[n]=_,_}}N(vg,"LineAtlas");const rv=Gd.types,nv=Math.cos(Math.PI/180*37.5),ov=Math.cos(Math.PI/180*5);class Xd{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.projection=e.projection,this.hasPattern=!1,this.hasZOffset=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(i=>{this.gradients[i.id]={}}),this.layoutVertexArray=new Kp,this.layoutVertexArray2=new gs,this.patternVertexArray=new ys,this.indexArray=new Ri,this.programConfigurations=new ws(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new pi,this.maxLineLength=0,this.zOffsetVertexArray=new Aa,this.stateDependentLayerIds=this.layers.filter(i=>i.isStateDependent()).map(i=>i.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:Ne/64}updateFootprints(e,i){}populate(e,i,n,o){this.hasPattern=Uf("line",this.layers,i);const l=this.layers[0].layout.get("line-sort-key"),c=this.layers[0].layout.get("line-z-offset");this.hasZOffset=!c.isConstant()||!!c.constantOr(0);const d=[];for(const{feature:v,id:b,index:E,sourceLayerIndex:S}of e){const I=this.layers[0]._featureFilter.needGeometry,C=To(v,I);if(!this.layers[0]._featureFilter.filter(new st(this.zoom),C,n))continue;const D=l?l.evaluate(C,{},n):void 0,V={id:b,properties:v.properties,type:v.type,sourceLayerIndex:S,index:E,geometry:I?C.geometry:mn(v,n,o),patterns:{},sortKey:D};d.push(V)}l&&d.sort((v,b)=>v.sortKey-b.sortKey);const{lineAtlas:p,featureIndex:_}=i,y=this.addConstantDashes(p);for(const v of d){const{geometry:b,index:E,sourceLayerIndex:S}=v;if(y&&this.addFeatureDashes(v,p),this.hasPattern){const I=jf("line",this.layers,v,this.zoom,i);this.patternFeatures.push(I)}else this.addFeature(v,b,E,n,p.positions,i.availableImages,i.brightness);_.insert(e[E].feature,b,E,S,this.index)}}addConstantDashes(e){let i=!1;for(const n of this.layers){const o=n.paint.get("line-dasharray").value,l=n.layout.get("line-cap").value;if(o.kind!=="constant"||l.kind!=="constant")i=!0;else{const c=l.value,d=o.value;if(!d)continue;e.addDash(d,c)}}return i}addFeatureDashes(e,i){const n=this.zoom;for(const o of this.layers){const l=o.paint.get("line-dasharray").value,c=o.layout.get("line-cap").value;if(l.kind==="constant"&&c.kind==="constant")continue;let d,p;if(l.kind==="constant"){if(d=l.value,!d)continue}else d=l.evaluate({zoom:n},e);p=c.kind==="constant"?c.value:c.evaluate({zoom:n},e),i.addDash(d,p),e.patterns[o.id]=i.getKey(d,p)}}update(e,i,n,o,l){const c=Object.keys(e).length!==0;c&&!this.stateDependentLayers.length||this.programConfigurations.updatePaintArrays(e,i,c?this.stateDependentLayers:this.layers,n,o,l)}addFeatures(e,i,n,o,l,c){for(const d of this.patternFeatures)this.addFeature(d,d.geometry,d.index,i,n,o,c)}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,Wx)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,Xx)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,yg.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Zx),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,n,o,l,c,d){const p=this.layers[0].layout,_=p.get("line-join").evaluate(e,{}),y=p.get("line-cap").evaluate(e,{}),v=p.get("line-miter-limit"),b=p.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const E of i)this.addLine(E,e,o,_,y,v,b);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,n,l,c,o,d)}addLine(e,i,n,o,l,c,d){this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineS
7oFar=0,this.currentVertex=void 0;const p={zoom:this.zoom,lineProgress:void 0},_=this.layers[0].layout,y=o==="none";if(this.patternJoinNone=this.hasPattern&&y,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[],this.lineClips){this.lineClipsArray.push(this.lineClips);for(let H=0;H<e.length-1;H++)this.totalDistance+=e[H].dist(e[H+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const v=rv[i.type]==="Polygon";let b=e.length;for(;b>=2&&e[b-1].equals(e[b-2]);)b--;let E=0;for(;E<b-1&&e[E].equals(e[E+1]);)E++;if(b<(v?3:2))return;o==="bevel"&&(c=1.05);const S=this.overscaling<=16?15*Ne/(512*this.overscaling):0,I=this.segments.prepareSegment(10*b,this.layoutVertexArray,this.indexArray);let C,D,V,U,j,X;this.e1=this.e2=-1,v&&(C=e[b-2],j=e[E].sub(C)._unit()._perp());for(let H=E;H<b;H++){if(V=H===b-1?v?e[E+1]:void 0:e[H+1],V&&e[H].equals(V))continue;if(j&&(U=j),C&&(D=C),C=e[H],this.hasZOffset){const xe=_.get("line-z-offset").value;if(xe.kind==="constant")X=xe.value;else{if(this.lineClips){const Ce=this.totalDistance/(this.lineClips.end-this.lineClips.start);p.lineProgress=(Ce*this.lineClips.start+this.distance+(D?D.dist(C):0))/Ce}else vi(`line-z-offset evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`),p.lineProgress=0;X=xe.evaluate(p,i)}X=X||0}j=V?V.sub(C)._unit()._perp():U,U=U||j;const ie=D&&V;let ne=ie?o:v||y?"butt":l;const ue=U.x*j.x+U.y*j.y;if(y){const xe=function(Ce){if(Ce.patternJoinNone){const Re=Ce.segmentPoints.length/2,Pe=Ce.lineSoFar-Ce.segmentStart;for(let Ze=0;Ze<Re;++Ze){const De=Ce.segmentPoints[2*Ze+1],Oe=Math.round(Ce.segmentPoints[2*Ze])+.5+.25*De;Ce.patternVertexArray.emplaceBack(Oe,Pe,Ce.segmentStart),Ce.patternVertexArray.emplaceBack(Oe,Pe,Ce.segmentStart)}Ce.segmentPoints.length=0}Ce.e1=Ce.e2=-1};if(ie&&ue<ov){this.updateDistance(D,C),this.addCurrentVertex(C,U,1,1,I,X),xe(this),this.addCurrentVertex(C,j,-1,-1,I,X);continue}if(D){if(!V){this.updateDistance(D,C),this.addCurrentVertex(C,U,1,1,I,X),xe(this);continue}ne="miter"}}let ye=U.add(j);ye.x===0&&ye.y===0||ye._unit();const pe=ye.x*j.x+ye.y*j.y,Te=pe!==0?1/pe:1/0,ze=2*Math.sqrt(2-2*pe),be=pe<nv&&D&&V,Ae=U.x*j.y-U.y*j.x>0;if(be&&H>E){const xe=C.dist(D);if(xe>2*S){const Ce=C.sub(C.sub(D)._mult(S/xe)._round());this.updateDistance(D,Ce),this.addCurrentVertex(Ce,U,0,0,I,X),D=Ce}}if(ie&&ne==="round"&&(Te<d?ne="miter":Te<=2&&(ne="fakeround")),ne==="miter"&&Te>c&&(ne="bevel"),ne==="bevel"&&(Te>2&&(ne="flipbevel"),Te<c&&(ne="miter")),D&&this.updateDistance(D,C),ne==="miter")ye._mult(Te),this.addCurrentVertex(C,ye,0,0,I,X);else if(ne==="flipbevel"){if(Te>100)ye=j.mult(-1);else{const xe=Te*U.add(j).mag()/U.sub(j).mag();ye._perp()._mult(xe*(Ae?-1:1))}this.addCurrentVertex(C,ye,0,0,I,X),this.addCurrentVertex(C,ye.mult(-1),0,0,I,X)}else if(ne==="bevel"||ne==="fakeround"){const xe=-Math.sqrt(Te*Te-1),Ce=Ae?xe:0,Re=Ae?0:xe;if(D&&this.addCurrentVertex(C,U,Ce,Re,I,X),ne==="fakeround"){const Pe=Math.round(180*ze/Math.PI/20);for(let Ze=1;Ze<Pe;Ze++){let De=Ze/Pe;if(De!==.5){const Qe=De-.5;De+=De*Qe*(De-1)*((1.0904+ue*(ue*(3.55645-1.43519*ue)-3.2452))*Qe*Qe+(.848013+ue*(.215638*ue-1.06021)))}const Oe=j.sub(U)._mult(De)._add(U)._unit()._mult(Ae?-1:1);this.addHalfVertex(C,Oe.x,Oe.y,!1,Ae,0,I,X)}}V&&this.addCurrentVertex(C,j,-Ce,-Re,I,X)}else ne==="butt"?this.addCurrentVertex(C,ye,0,0,I,X):ne==="square"?(D||this.addCurrentVertex(C,ye,-1,-1,I,X),this.addCurrentVertex(C,ye,0,0,I,X),D&&this.addCurrentVertex(C,ye,1,1,I,X)):ne==="round"&&(D&&(this.addCurrentVertex(C,U,0,0,I,X),this.addCurrentVertex(C,U,1,1,I,X,!0)),V&&(this.addCurrentVertex(C,j,-1,-1,I,X,!0),this.addCurrentVertex(C,j,0,0,I,X)));if(be&&H<b-1){const xe=C.dist(V);if(xe>2*S){const Ce=C.add(V.sub(C)._mult(S/xe)._round());this.updateDistance(C,Ce),this.addCurrentVertex(Ce,j,0,0,I,X),C=Ce}}}}addVerticesTo(e,i,n,o,l,c,d,p,_,y){const v=(i.w-e.w)/this.tessellationStep|0;if(v>1){this.lineSoFar=e.w;const b=(i.x-e.x)/v,E=(i.y-e.y)/v,S=(i.z-e.z)/v,I=(i.w-e.w)/v;for(let C=1;C<v;++C)e.x+=b,e.y+=E,e.z+=S,this.lineSoFar+=I,this.addHalfVertex(e,n,o,y,!1,d,_,e.z),this.addHalfVertex(e,l,c,y,!0,-p,_,e.z)}
7this.lineSoFar=i.w,this.addHalfVertex(i,n,o,y,!1,d,_,i.z),this.addHalfVertex(i,l,c,y,!0,-p,_,i.z)}addCurrentVertex(e,i,n,o,l,c,d=!1){const p=i.x+i.y*n,_=i.y-i.x*n,y=i.y*o-i.x,v=-i.y-i.x*o;if(c!=null){const E=Ne+10,S=c,I=new V_(e.x,e.y,S,this.lineSoFar),C=bg(e,-10,E),D=this.lineSoFar;if(this.currentVertex)if(C){const V=this.currentVertexIsOutside,U=this.currentVertex,j=new V_(e.x,e.y,S,this.lineSoFar);j_(U,j,-10,E),bg(j,-10,E)||(V&&(this.e1=this.e2=-1,this.lineSoFar=U.w,this.addHalfVertex(U,p,_,d,!1,n,l,U.z),this.addHalfVertex(U,y,v,d,!0,-o,l,U.z)),this.addVerticesTo(U,j,p,_,y,v,n,o,l,d))}else{const V=this.currentVertex;this.currentVertexIsOutside&&(j_(V,I,-10,E),this.e1=this.e2=-1,this.lineSoFar=V.w,this.addHalfVertex(V,p,_,d,!1,n,l,V.z),this.addHalfVertex(V,y,v,d,!0,-o,l,V.z)),this.addVerticesTo(V,I,p,_,y,v,n,o,l,d)}else C||(this.addHalfVertex(e,p,_,d,!1,n,l,c),this.addHalfVertex(e,y,v,d,!0,-o,l,c));this.currentVertex=I,this.currentVertexIsOutside=C,this.lineSoFar=D}else this.addHalfVertex(e,p,_,d,!1,n,l,c),this.addHalfVertex(e,y,v,d,!0,-o,l,c)}addHalfVertex({x:e,y:i},n,o,l,c,d,p,_){this.patternJoinNone&&(this.segmentPoints.length===0&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),c||this.segmentPoints.push(this.lineSoFar-this.segmentStart,d)),this.layoutVertexArray.emplaceBack((e<<1)+(l?1:0),(i<<1)+(c?1:0),Math.round(63*n)+128,Math.round(63*o)+128,1+(d===0?0:d<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips&&this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,this.lineClips.start,this.lineClips.end);const y=p.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,y),p.primitiveLength++),c?this.e2=y:this.e1=y,_!=null&&this.zOffsetVertexArray.emplaceBack(_)}updateScaledDistance(){if(this.lineClips){const e=this.totalDistance/(this.lineClips.end-this.lineClips.start);this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e*this.lineClips.start+this.distance}else this.lineSoFar=this.distance}updateDistance(e,i){this.distance+=e.dist(i),this.updateScaledDistance()}}function bg(t,e,i){return t.x<e||t.x>i||t.y<e||t.y>i}N(Xd,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const sv=new Gt({"line-cap":new $e(he.layout_line["line-cap"]),"line-join":new $e(he.layout_line["line-join"]),"line-miter-limit":new Ee(he.layout_line["line-miter-limit"]),"line-round-limit":new Ee(he.layout_line["line-round-limit"]),"line-sort-key":new $e(he.layout_line["line-sort-key"]),"line-z-offset":new $e(he.layout_line["line-z-offset"]),visibility:new Ee(he.layout_line.visibility)});var Yd={paint:new Gt({"line-opacity":new $e(he.paint_line["line-opacity"]),"line-color":new $e(he.paint_line["line-color"]),"line-translate":new Ee(he.paint_line["line-translate"]),"line-translate-anchor":new Ee(he.paint_line["line-translate-anchor"]),"line-width":new $e(he.paint_line["line-width"]),"line-gap-width":new $e(he.paint_line["line-gap-width"]),"line-offset":new $e(he.paint_line["line-offset"]),"line-blur":new $e(he.paint_line["line-blur"]),"line-dasharray":new $e(he.paint_line["line-dasharray"]),"line-pattern":new $e(he.paint_line["line-pattern"]),"line-gradient":new Di(he.paint_line["line-gradient"]),"line-trim-offset":new Ee(he.paint_line["line-trim-offset"]),"line-trim-fade-range":new Ee(he.paint_line["line-trim-fade-range"]),"line-trim-color":new Ee(he.paint_line["line-trim-color"]),"line-emissive-strength":new Ee(he.paint_line["line-emissive-strength"]),"line-border-width":new $e(he.paint_line["line-border-width"]),"line-border-color":new $e(he.paint_line["line-border-color"]),"line-occlusion-opacity":new Ee(he.paint_line["line-occlusion-opacity"])}),layout:sv};function wg(t,e,i){return e*(Ne/(t.tileSize*Math.pow(2,i-t.tileID.overscaledZ)))}function Tg(t,e){return 1/wg(t,1,e.tileZoom)}function Eg(t,e,i,n){return t.translatePosMatrix(n||e.tileID.projMatrix,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Sg=t=>{const e=[];Mg(t)&&e.push("RENDER_LINE_DASH"),t.paint.get("line-gradient")&&e.push("RENDER_LINE_GRADIENT");const i=t.paint.get("line-trim-offset");
7i[0]===0&&i[1]===0||e.push("RENDER_LINE_TRIM_OFFSET"),t.paint.get("line-border-width").constantOr(1)!==0&&e.push("RENDER_LINE_BORDER");const n=t.layout.get("line-join").constantOr("miter")==="none",o=!!t.paint.get("line-pattern").constantOr(1);return n&&o&&e.push("LINE_JOIN_NONE"),e};function Mg(t){const e=t.paint.get("line-dasharray").value;return e.value||e.kind!=="constant"}class Ig{constructor(e){this._stringToNumber={},this._numberToString=[];for(let i=0;i<e.length;i++){const n=e[i];this._stringToNumber[n]=i,this._numberToString[i]=n}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}var av={read:function(t,e,i,n,o){var l,c,d=8*o-n-1,p=(1<<d)-1,_=p>>1,y=-7,v=i?o-1:0,b=i?-1:1,E=t[e+v];for(v+=b,l=E&(1<<-y)-1,E>>=-y,y+=d;y>0;l=256*l+t[e+v],v+=b,y-=8);for(c=l&(1<<-y)-1,l>>=-y,y+=n;y>0;c=256*c+t[e+v],v+=b,y-=8);if(l===0)l=1-_;else{if(l===p)return c?NaN:1/0*(E?-1:1);c+=Math.pow(2,n),l-=_}return(E?-1:1)*c*Math.pow(2,l-n)},write:function(t,e,i,n,o,l){var c,d,p,_=8*l-o-1,y=(1<<_)-1,v=y>>1,b=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=n?0:l-1,S=n?1:-1,I=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(d=isNaN(e)?1:0,c=y):(c=Math.floor(Math.log(e)/Math.LN2),e*(p=Math.pow(2,-c))<1&&(c--,p*=2),(e+=c+v>=1?b/p:b*Math.pow(2,1-v))*p>=2&&(c++,p/=2),c+v>=y?(d=0,c=y):c+v>
7=1?(d=(e*p-1)*Math.pow(2,o),c+=v):(d=e*Math.pow(2,v-1)*Math.pow(2,o),c=0));o>=8;t[i+E]=255&d,E+=S,d/=256,o-=8);for(c=c<<o|d,_+=o;_>0;t[i+E]=255&c,E+=S,c/=256,_-=8);t[i+E-S]|=128*I}},Ag=hi,Kd=av;function hi(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}hi.Varint=0,hi.Fixed64=1,hi.Bytes=2,hi.Fixed32=5;var Xf=4294967296,Cg=1/Xf,Pg=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function Mo(t){return t.type===hi.Bytes?t.readVarint()+t.pos:t.pos+1}function ic(t,e,i){return i?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function zg(t,e,i){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));i.realloc(n);for(var o=i.pos-1;o>=t;o--)i.buf[o+n]=i.buf[o]}function lv(t,e){for(var i=0;i<t.length;i++)e.writeVarint(t[i])}function cv(t,e){for(var i=0;i<t.length;i++)e.writeSVarint(t[i])}function uv(t,e){for(var i=0;i<t.length;i++)e.writeFloat(t[i])}function hv(t,e){for(var i=0;i<t.length;i++)e.writeDouble(t[i])}function dv(t,e){for(var i=0;i<t.length;i++)e.writeBoolean(t[i])}function pv(t,e){for(var i=0;i<t.length;i++)e.writeFixed32(t[i])}function fv(t,e){for(var i=0;i<t.length;i++)e.writeSFixed32(t[i])}function mv(t,e){for(var i=0;i<t.length;i++)e.writeFixed64(t[i])}function _v(t,e){for(var i=0;i<t.length;i++)e.writeSFixed64(t[i])}function Jd(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+16777216*t[e+3]}function rc(t,e,i){t[i]=e,t[i+1]=e>>>8,t[i+2]=e>>>16,t[i+3]=e>>>24}function Dg(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}hi.prototype={destroy:function(){this.buf=null},readFields:function(t,e,i){for(i=i||this.length;this.pos<i;){var n=this.readVarint(),o=n>>3,l=this.pos;this.type=7&n,t(o,e,this),this.pos===l&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=Jd(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=Dg(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=Jd(this.buf,this.pos)+Jd(this.buf,this.pos+4)*Xf;return this.pos+=8,t},readSFixed64:function(){var t=Jd(this.buf,this.pos)+Dg(this.buf,this.pos+4)*Xf;return this.pos+=8,t},readFloat:function(){var t=Kd.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=Kd.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,i,n=this.buf;return e=127&(i=n[this.pos++]),i<128?e:(e|=(127&(i=n[this.pos++]))<<7,i<128?e:(e|=(127&(i=n[this.pos++]))<<14,i<128?e:(e|=(127&(i=n[this.pos++]))<<21,i<128?e:function(o,l,c){var d,p,_=c.buf;if(d=(112&(p=_[c.pos++]))>>4,p<128||(d|=(127&(p=_[c.pos++]))<<3,p<128)||(d|=(127&(p=_[c.pos++]))<<10,p<128)||(d|=(127&(p=_[c.pos++]))<<17,p<128)||(d|=(127&(p=_[c.pos++]))<<24,p<128)||(d|=(1&(p=_[c.pos++]))<<31,p<128))return ic(o,d,l);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(i=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var t=this.readVarint()+this.pos,e=this.pos;return this.pos=t,t-e>=12&&Pg?function(i,n,o){return Pg.decode(i.subarray(n,o))}(this.buf,e,t):function(i,n,o){for(var l="",c=n;c<o;){var d,p,_,y=i[c],v=null,b=y>239?4:y>223?3:y>191?2:1;if(c+b>o)break;b===1?y<128&&(v=y):b===2?(192&(d=i[c+1]))==128&&(v=(31&y)<<6|63&d)<=127&&(v=null):b===3?(p=i[c+2],(192&(d=i[c+1]))==128&&(192&p)==128&&((v=(15&y)<<12|(63&d)<<6|63&p)<=2047||v>=55296&&v<=57343)&&(v=null)):b===4&&(p=i[c+2],_=i[c+3],(192&(d=i[c+1]))==128&&(192&p)==128&&(192&_)==128&&((v=(15&y)<<18|(63&d)<<12|(63&p)<<6|63&_)<=65535||v>=1114112)&&(v=null)),v===null?(v=65533,b=1):v>65535&&(v-=65536,l+=String.fromCharCode(v>>>10&1023|55296),v=56320|1023&v),l+=String.fromCharCode(v),c+=b}return l}(this.buf,e,t)},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){if(this.type!==hi.Bytes)return t.push(this.readVarint(e));var i=Mo(this);for(t=t||[];this.pos<i;)t.push(this.readVarint(e));return t}
vendor: 4,444 bytes, line 7
7,readPackedSVarint:function(t){if(this.type!==hi.Bytes)return t.push(this.readSVarint());var e=Mo(this);for(t=t||[];this.pos<e;)t.push(this.readSVarint());return t},readPackedBoolean:function(t){if(this.type!==hi.Bytes)return t.push(this.readBoolean());var e=Mo(this);for(t=t||[];this.pos<e;)t.push(this.readBoolean());return t},readPackedFloat:function(t){if(this.type!==hi.Bytes)return t.push(this.readFloat());var e=Mo(this);for(t=t||[];this.pos<e;)t.push(this.readFloat());return t},readPackedDouble:function(t){if(this.type!==hi.Bytes)return t.push(this.readDouble());var e=Mo(this);for(t=t||[];this.pos<e;)t.push(this.readDouble());return t},readPackedFixed32:function(t){if(this.type!==hi.Bytes)return t.push(this.readFixed32());var e=Mo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed32());return t},readPackedSFixed32:function(t){if(this.type!==hi.Bytes)return t.push(this.readSFixed32());var e=Mo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed32());return t},readPackedFixed64:function(t){if(this.type!==hi.Bytes)return t.push(this.readFixed64());var e=Mo(this);for(t=t||[];this.pos<e;)t.push(this.readFixed64());return t},readPackedSFixed64:function(t){if(this.type!==hi.Bytes)return t.push(this.readSFixed64());var e=Mo(this);for(t=t||[];this.pos<e;)t.push(this.readSFixed64());return t},skip:function(t){var e=7&t;if(e===hi.Varint)for(;this.buf[this.pos++]>127;);else if(e===hi.Bytes)this.pos=this.readVarint()+this.pos;else if(e===hi.Fixed32)this.pos+=4;else{if(e!==hi.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(t,e){this.writeVarint(t<<3|e)},realloc:function(t){for(var e=this.length||16;e<this.pos+t;)e*=2;if(e!==this.length){var i=new Uint8Array(e);i.set(this.buf),this.buf=i,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(t){this.realloc(4),rc(this.buf,t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),rc(this.buf,t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),rc(this.buf,-1&t,this.pos),rc(this.buf,Math.floor(t*Cg),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),rc(this.buf,-1&t,this.pos),rc(this.buf,Math.floor(t*Cg),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t||0)>268435455||t<0?function(e,i){var n,o;if(e>=0?(n=e%4294967296|0,o=e/4294967296|0):(o=~(-e/4294967296),4294967295^(n=~(-e%4294967296))?n=n+1|0:(n=0,o=o+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");i.realloc(10),function(l,c,d){d.buf[d.pos++]=127&l|128,l>>>=7,d.buf[d.pos++]=127&l|128,l>>>=7,d.buf[d.pos++]=127&l|128,l>>>=7,d.buf[d.pos++]=127&l|128,d.buf[d.pos]=127&(l>>>=7)}(n,0,i),function(l,c){var d=(7&l)<<4;c.buf[c.pos++]|=d|((l>>>=3)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l|((l>>>=7)?128:0),l&&(c.buf[c.pos++]=127&l)))))}(o,i)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(!!t)},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(n,o,l){for(var c,d,p=0;p<o.length;p++){if((c=o.charCodeAt(p))>55295&&c<57344){if(!d){c>56319||p+1===o.length?(n[l++]=239,n[l++]=191,n[l++]=189):d=c;continue}if(c<56320){n[l++]=239,n[l++]=191,n[l++]=189,d=c;continue}c=d-55296<<10|c-56320|65536,d=null}else d&&(n[l++]=239,n[l++]=191,n[l++]=189,d=null);c<128?n[l++]=c:(c<2048?n[l++]=c>>6|192:(c<65536?n[l++]=c>>12|224:(n[l++]=c>>18|240,n[l++]=c>>12&63|128),n[l++]=c>>6&63|128),n[l++]=63&c|128)}return l}(this.buf,t,this.pos);var i=this.pos-e;i>=128&&zg(e,i,this),this.pos=e-1,this.writeVarint(i),this.pos+=i},writeFloat:function(t){this.realloc(4),Kd.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),Kd.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var i=0;i<e;i++)this.buf[this.pos++]=t[i]},writeRawMessage:function(t,e){this.pos++;var i=this.pos;t(e,this);var n=this.pos-i;n>=128&&zg(i,n,this),this.pos=i-1,this.writeVarint(n),this.pos+=n}
7,writeMessage:function(t,e,i){this.writeTag(t,hi.Bytes),this.writeRawMessage(e,i)},writePackedVarint:function(t,e){e.length&&this.writeMessage(t,lv,e)},writePackedSVarint:function(t,e){e.length&&this.writeMessage(t,cv,e)},writePackedBoolean:function(t,e){e.length&&this.writeMessage(t,dv,e)},writePackedFloat:function(t,e){e.length&&this.writeMessage(t,uv,e)},writePackedDouble:function(t,e){e.length&&this.writeMessage(t,hv,e)},writePackedFixed32:function(t,e){e.length&&this.writeMessage(t,pv,e)},writePackedSFixed32:function(t,e){e.length&&this.writeMessage(t,fv,e)},writePackedFixed64:function(t,e){e.length&&this.writeMessage(t,mv,e)},writePackedSFixed64:function(t,e){e.length&&this.writeMessage(t,_v,e)},writeBytesField:function(t,e){this.writeTag(t,hi.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,hi.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,hi.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,hi.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,hi.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,hi.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,hi.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,hi.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,hi.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,hi.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,!!e)}};var nc=Gr(Ag);const gv=["id","tile","layer","source","sourceLayer","state"];class Lg{constructor(e,i,n,o,l){this.type="Feature",this._vectorTileFeature=e,this._z=i,this._x=n,this._y=o,this.properties=e.properties,this.id=l}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 gv)this[i]!==void 0&&(e[i]=this[i]);return e}}class yv{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,n){const o=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},Xi(this.stateChanges[e][o],n),this.deletedStates[e]===null){this.deletedStates[e]={};for(const l in this.state[e])l!==o&&(this.deletedStates[e][l]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][o]===null){this.deletedStates[e][o]={};for(const l in this.state[e][o])n[l]||(this.deletedStates[e][o][l]=null)}else for(const l in n)this.deletedStates[e]&&this.deletedStates[e][o]&&this.deletedStates[e][o][l]===null&&delete this.deletedStates[e][o][l]}removeFeatureState(e,i,n){if(this.deletedStates[e]===null)return;const o=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},n&&i!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][n]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o])for(n in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][n]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,i){const n=String(i),o=Xi({},(this.state[e]||{})[n],(this.stateChanges[e]||{})[n]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const l=this.deletedStates[e][i];if(l===null)return{};for(const c in l)delete o[c]}return o}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const n={};for(const o in this.stateChanges){this.state[o]=this.state[o]||{};const l={};for(const c in this.stateChanges[o])this.state[o][c]||(this.state[o][c]={}),Xi(this.state[o][c],this.stateChanges[o][c]),l[c]=this.state[o][c];n[o]=l}for(const o in this.deletedStates){this.state[o]=this.state[o]||{};const l={};if(this.deletedStates[o]===null)for(const c in this.state[o])l[c]={},this.state[o][c]={};else for(const c in this.deletedStates[o]){if(this.deletedStates[o][
7c]===null)this.state[o][c]={};else if(this.state[o][c])for(const d of Object.keys(this.deletedStates[o][c]))delete this.state[o][c][d];l[c]=this.state[o][c]}n[o]=n[o]||{},Xi(n[o],l)}if(this.stateChanges={},this.deletedStates={},Object.keys(n).length!==0)for(const o in e)e[o].setFeatureState(n,i)}}class Rg{constructor(e,i){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Y(Ne,16,0),this.featureIndexArray=new $m,this.promoteId=i,this.is3DTile=!1}insert(e,i,n,o,l,c=0,d=0){const p=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,o,l,c);const _=this.grid;for(let y=0;y<i.length;y++){const v=i[y],b=[1/0,1/0,-1/0,-1/0];for(let E=0;E<v.length;E++){const S=v[E];b[0]=Math.min(b[0],S.x),b[1]=Math.min(b[1],S.y),b[2]=Math.max(b[2],S.x),b[3]=Math.max(b[3],S.y)}d!==0&&(b[0]-=d,b[1]-=d,b[2]+=d,b[3]+=d),b[0]<Ne&&b[1]<Ne&&b[2]>=0&&b[3]>=0&&_.insert(p,b[0],b[1],b[2],b[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new qf(new nc(this.rawTileData)).layers,this.sourceLayerCoder=new Ig(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,n,o){this.loadVTLayers();const l=e.params||{},c=Zi(l.filter),d=e.tileResult,p=e.transform,_=d.bufferedTilespaceBounds,y=this.grid.query(_.min.x,_.min.y,_.max.x,_.max.y,(S,I,C,D)=>c_(d.bufferedTilespaceGeometry,S,I,C,D));y.sort(xv);let v=null;p.elevation&&y.length>0&&(v=tc.create(p.elevation,this.tileID));const b={};let E;for(let S=0;S<y.length;S++){const I=y[S];if(I===E)continue;E=I;const C=this.featureIndexArray.get(I);let D=null;if(this.is3DTile){const V=this.bucketLayerIDs[0][0],U=i[V];if(U.type!=="model")continue;const{queryFeature:j,intersectionZ:X}=U.queryIntersectsMatchingFeature(d,C.featureIndex,c,p);j&&this.appendToResult(b,V,C.featureIndex,j,X)}else this.loadMatchingFeature(b,C,c,l.layers,l.availableImages,i,n,o,(V,U,j,X=0)=>(D||(D=mn(V,this.tileID.canonical,e.tileTransform)),U.queryIntersectsFeature(d,V,j,D,this.z,e.transform,e.pixelPosMatrix,v,X)))}return b}loadMatchingFeature(e,i,n,o,l,c,d,p,_){const{featureIndex:y,bucketIndex:v,sourceLayerIndex:b,layoutVertexArrayOffset:E}=i,S=this.bucketLayerIDs[v];if(o&&!function(V,U){for(let j=0;j<V.length;j++)if(U.indexOf(V[j])>=0)return!0;return!1}(o,S))return;const I=this.sourceLayerCoder.decode(b),C=this.vtLayers[I].feature(y);if(n.needGeometry){const V=To(C,!0);if(!n.filter(new st(this.tileID.overscaledZ),V,this.tileID.canonical))return}else if(!n.filter(new st(this.tileID.overscaledZ),C))return;const D=this.getId(C,I);for(let V=0;V<S.length;V++){const U=S[V];if(o&&o.indexOf(U)<0)continue;const j=c[U];if(!j)continue;let X={};D!==void 0&&p&&(X=p.getState(j.sourceLayer||"_geojsonTileLayer",D));const H=!_||_(C,j,X,E);if(!H)continue;const ie=new Lg(C,this.z,this.x,this.y,D),ne=Xi({},d[U]);ne.paint=kg(ne.paint,j.paint,C,X,l),ne.layout=kg(ne.layout,j.layout,C,X,l),ie.layer=ne,this.appendToResult(e,U,y,ie,H)}}appendToResult(e,i,n,o,l){let c=e[i];c===void 0&&(c=e[i]=[]),c.push({featureIndex:n,feature:o,intersectionZ:l})}lookupSymbolFeatures(e,i,n,o,l,c,d,p){const _={};this.loadVTLayers();const y=Zi(l);for(const v of e)this.loadMatchingFeature(_,{bucketIndex:n,sourceLayerIndex:o,featureIndex:v,layoutVertexArrayOffset:0},y,c,d,p,i);return _}loadFeature(e){const{featureIndex:i,sourceLayerIndex:n}=e;this.loadVTLayers();const o=this.sourceLayerCoder.decode(n),l=this.vtFeatures[o];if(l[i])return l[i];const c=this.vtLayers[o].feature(i);return l[i]=c,c}hasLayer(e){for(const i of this.bucketLayerIDs)for(const n of i)if(e===n)return!0;return!1}getId(e,i){let n=e.id;if(this.promoteId){const o=typeof this.promoteId=="string"?this.promoteId:this.promoteId[i];o!=null&&(n=e.properties[o]),typeof n=="boolean"&&(n=Number(n))}return n}}function kg(t,e,i,n,o){return Pn(t,(l,c)=>{const d=e instanceof ii?e.get(c):null;return d&&d.evaluate?d.evaluate(i,n,o):d})}function xv(t,e){return e-t}N(Rg,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});var Wi=24;const _n=128;function Yf(t,e){const{expression:i}=e;if(i.kind==="constant")return{kind:"constant",layoutSize:i.evaluate(new st(t+1))};if(i.kind==="source")return{kind:"source"};{const{zoomStops:n,interpolationType:o}=i;let l=0;for(;l<n.length&&n[l]<=t;)l++;l=Math.max(0,l-1);let c=l;for(;c<n.length&&n[c]<t+1;)c++;c=Math.min(n.length-1,c);const d=n[l],p=n[c];return i.kind==="composite"?{kind:"composite",minZoom:d,maxZoom:p,interpolationType:o}:{kind:"camera",minZoom:d,maxZoom:p,minSize:i.evaluate(new st(d)),maxSize:i.evaluate(new st(p)),interpolationType:o}}}function Qd(t,{uSize:e,uSizeT:i},{lowerSize:n,upperSize:o}){return t.kind==="source"?n/_n:t.kind==="composite"?tt(n/_n,o/_n,i):e}function oc(t,e){let i=0,n=0;if(t.kind==="constant")n=t.layoutSize;else if(t.kind!=="source"){const{interpolationType:o,minZoom:l,maxZoom:c}=t,d=o?ft(pr.interpolationFactor(o,e,l,c),0,1):0;t.kind==="camera"?n=tt(t.minSize,t.maxSize,d):i=d}return{uSizeT:i,uSize:n}}var vv=Object.freeze({__proto__:null,SIZE_PACK_FACTOR:_n,evaluateSizeForFeature:Qd,evaluateSizeForZoom:oc,getSizeData:Yf});function bv(t,e,i){return t.sections.forEach(n=>
7{n.text=function(o,l,c){const d=l.layout.get("text-transform").evaluate(c,{});return d==="uppercase"?o=o.toLocaleUpperCase():d==="lowercase"&&(o=o.toLocaleLowerCase()),St.applyArabicShaping&&(o=St.applyArabicShaping(o)),o}(n.text,e,i)}),t}const rh={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function wv(t){return t==="︶"||t==="﹈"||t==="︸"||t==="﹄"||t==="﹂"||t==="︾"||t==="︼"||t==="︺"||t==="︘"||t==="﹀"||t==="︐"||t==="︓"||t==="︔"||t==="`"||t===" ̄"||t==="︑"||t==="︒"}function Tv(t){return t==="︵"||t==="﹇"||t==="︷"||t==="﹃"||t==="﹁"||t==="︽"||t==="︻"||t==="︹"||t==="︗"||t==="︿"}const Kf=3;function Ev(t,e,i){e.glyphs=[],t===1&&i.readMessage(Sv,e)}function Sv(t,e,i){if(t===3){const{id:n,bitmap:o,width:l,height:c,left:d,top:p,advance:_}=i.readMessage(Mv,{});e.glyphs.push({id:n,bitmap:new Ss({width:l+2*Kf,height:c+2*Kf},o),metrics:{width:l,height:c,left:d,top:p,advance:_}})}else t===4?e.ascender=i.readSVarint():t===5&&(e.descender=i.readSVarint())}function Mv(t,e,i){t===1?e.id=i.readVarint():t===2?e.bitmap=i.readBytes():t===3?e.width=i.readVarint():t===4?e.height=i.readVarint():t===5?e.left=i.readSVarint():t===6?e.top=i.readSVarint():t===7&&(e.advance=i.readVarint())}const Iv=Kf,Nr={horizontal:1,vertical:2,horizontalOnly:3};class nh{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,i){const n=new nh;return n.scale=e||1,n.fontStack=i,n}static forImage(e){const i=new nh;return i.imageName=e,i}}class sc{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,i){const n=new sc;for(let o=0;o<e.sections.length;o++){const l=e.sections[o];l.image?n.addImageSection(l):n.addTextSection(l,i)}return n}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,n){let o="";for(let l=0;l<i.length;l++){const c=i.charCodeAt(l+1)||null,d=i.charCodeAt(l-1)||null;o+=!n&&(c&&le(c)&&!rh[i[l+1]]||d&&le(d)&&!rh[i[l-1]])||!rh[i[l]]?i[l]:rh[i[l]]}return o}(this.text,e)}trim(){let e=0;for(let n=0;n<this.text.length&&ep[this.text.charCodeAt(n)];n++)e++;let i=this.text.length;for(let n=this.text.length-1;n>=0&&n>=e&&ep[this.text.charCodeAt(n)];n--)i--;this.text=this.text.substring(e,i),this.sectionIndex=this.sectionIndex.slice(e,i)}substring(e,i){const n=new sc;return n.text=this.text.substring(e,i),n.sectionIndex=this.sectionIndex.slice(e,i),n.sections=this.sections,n}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(nh.forText(e.scale,e.fontStack||i));const n=this.sections.length-1;for(let o=0;o<e.text.length;++o)this.sectionIndex.push(n)}addImageSection(e){const i=e.image?e.image.namePrimary:"";if(i.length===0)return void vi("Can't add FormattedSection with an empty image.");const n=this.getNextImageSectionCharCode();n?(this.text+=String.fromCodePoint(n),this.sections.push(nh.forImage(i)),this.sectionIndex.push(this.sections.length-1)):vi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Jf(t,e,i,n,o,l,c,d,p,_,y,v,b,E,S){const I=sc.fromFeature(t,o);v===Nr.vertical&&I.verticalizePunctuation(b);let C=[];const D=function(H,ie,ne,ue,ye,pe){if(!H)return[];const Te=[],ze=function(Ce,Re,Pe,Ze,De,Oe){let Qe=0;for(let Je=0;Je<Ce.length();Je++){const Ye=Ce.getSection(Je);Qe+=Og(Ce.getCodePoint(Je),Ye,Ze,De,Re,Oe)}return Qe/Math.max(1,Math.ceil(Qe/Pe))}(H,ie,ne,ue,ye,pe),be=H.text.indexOf("​")>=0;let Ae=0;for(let Ce=0;Ce<H.length();Ce++){const Re=H.getSection(Ce),Pe=H.getCodePoint(Ce);if(ep[Pe]||(Ae+=Og(Pe,Re,ue,ye,ie,pe)),Ce<H.length()-1){const Ze=!((xe=Pe)<11904||!(Q["Bopomofo Extended"](xe)||Q.Bopomofo(xe)||Q["CJK Compatibility Forms"](xe)||Q["CJK Compatibility Ideographs"](xe)||Q["CJK Compatibility"](xe)||Q["CJK Radicals Supplement"](xe)||Q["CJK Strokes"](xe)||Q["CJK Symbols and Punctuation"](xe)||Q["CJK Unified Ideographs Extension A"](xe)||Q["CJK Unified Ideographs"](xe)||Q["Enclosed CJK Letters and Months"](xe)||Q["Halfwidth and Fullwidth Forms"](xe)||Q.Hiragana(xe)||Q["Ideographic Description Characters"](xe)||Q["Kangxi Radicals"](xe)||Q["Katakana Phonet
7ic Extensions"](xe)||Q.Katakana(xe)||Q["Vertical Forms"](xe)||Q["Yi Radicals"](xe)||Q["Yi Syllables"](xe)));(Av[Pe]||Ze||Re.imageName)&&Te.push(Fg(Ce+1,Ae,ze,Te,Cv(Pe,H.getCodePoint(Ce+1),Ze&&be),!1))}}var xe;return Ng(Fg(H.length(),Ae,ze,Te,0,!0))}(I,_,l,e,n,E),{processBidirectionalText:V,processStyledBidirectionalText:U}=St;if(V&&I.sections.length===1){const H=V(I.toString(),D);for(const ie of H){const ne=new sc;ne.text=ie,ne.sections=I.sections;for(let ue=0;ue<ie.length;ue++)ne.sectionIndex.push(0);C.push(ne)}}else if(U){const H=U(I.text,I.sectionIndex,D);for(const ie of H){const ne=new sc;ne.text=ie[0],ne.sectionIndex=ie[1],ne.sections=I.sections,C.push(ne)}}else C=function(H,ie){const ne=[],ue=H.text;let ye=0;for(const pe of ie)ne.push(H.substring(ye,pe)),ye=pe;return ye<ue.length&&ne.push(H.substring(ye,ue.length)),ne}(I,D);const j=[],X={positionedLines:j,text:I.toString(),top:y[1],bottom:y[1],left:y[0],right:y[0],writingMode:v,iconsInText:!1,verticalizable:!1,hasBaseline:!1};return function(H,ie,ne,ue,ye,pe,Te,ze,be,Ae,xe,Ce){let Re=0,Pe=0,Ze=0;const De=ze==="right"?1:ze==="left"?0:.5;let Oe=!1;for(const _t of ye){const ot=_t.getSections();for(const bt of ot){if(bt.imageName)continue;const gt=ie[bt.fontStack];if(gt&&(Oe=gt.ascender!==void 0&&gt.descender!==void 0,!Oe))break}if(!Oe)break}let Qe=0;for(const _t of ye){_t.trim();const ot=_t.getMaxScale(),bt=(ot-1)*Wi,gt={positionedGlyphs:[],lineOffset:0};H.positionedLines[Qe]=gt;const Mt=gt.positionedGlyphs;let rt=0;if(!_t.length()){Pe+=pe,++Qe;continue}let Yt=0,Xt=0;for(let Rt=0;Rt<_t.length();Rt++){const jt=_t.getSection(Rt),ni=_t.getSectionIndex(Rt),ei=_t.getCodePoint(Rt);let _i=jt.scale,fi=null,er=null,bi=null,di=Wi,Ai=0;const Ni=!(be===Nr.horizontal||!xe&&!Se(ei)||xe&&(ep[ei]||(Je=ei,Q.Arabic(Je)||Q["Arabic Supplement"](Je)||Q["Arabic Extended-A"](Je)||Q["Arabic Presentation Forms-A"](Je)||Q["Arabic Presentation Forms-B"](Je))));if(jt.imageName){const Vi=ue[jt.imageName];if(!Vi)continue;bi=jt.imageName,H.iconsInText=H.iconsInText||!0,er=Vi.paddedRect;const ri=Vi.displaySize;_i=_i*Wi/Ce,fi={width:ri[0],height:ri[1],left:0,top:-3,advance:Ni?ri[1]:ri[0],localGlyph:!1},Ai=Oe?-fi.height*_i:ot*Wi-17-ri[1]*_i,di=fi.advance;const cr=(Ni?ri[0]:ri[1])*_i-Wi*ot;cr>0&&cr>rt&&(rt=cr)}else{const Vi=ne[jt.fontStack];if(!Vi)continue;Vi[ei]&&(er=Vi[ei]);const ri=ie[jt.fontStack];if(!ri)continue;const cr=ri.glyphs[ei];if(!cr)continue;if(fi=cr.metrics,di=ei!==8203?Wi:0,Oe){const Ao=ri.ascender!==void 0?Math.abs(ri.ascender):0,sn=ri.descender!==void 0?Math.abs(ri.descender):0,wn=(Ao+sn)*_i;Yt<wn&&(Yt=wn,Xt=(Ao-sn)/2*_i),Ai=-Ao*_i}else Ai=(ot-_i)*Wi-17}Ni?(H.verticalizable=!0,Mt.push({glyph:ei,imageName:bi,x:Re,y:Pe+Ai,vertical:Ni,scale:_i,localGlyph:fi.localGlyph,fontStack:jt.fontStack,sectionIndex:ni,metrics:fi,rect:er}),Re+=di*_i+Ae):(Mt.push({glyph:ei,imageName:bi,x:Re,y:Pe+Ai,vertical:Ni,scale:_i,localGlyph:fi.localGlyph,fontStack:jt.fontStack,sectionIndex:ni,metrics:fi,rect:er}),Re+=fi.advance*_i+Ae)}Mt.length!==0&&(Ze=Math.max(Re-Ae,Ze),Oe?Vg(Mt,De,rt,Xt,pe*ot/2):Vg(Mt,De,rt,0,pe/2)),Re=0;const Ut=pe*ot+rt;gt.lineOffset=Math.max(rt,bt),Pe+=Ut,++Qe}var Je;const Ye=Pe,{horizontalAlign:ke,verticalAlign:et}=Qf(Te);(function(_t,ot,bt,gt,Mt,rt){const Yt=(ot-bt)*Mt,Xt=-rt*gt;for(const Ut of _t)for(const Rt of Ut.positionedGlyphs)Rt.x+=Yt,Rt.y+=Xt})(H.positionedLines,De,ke,et,Ze,Ye),H.top+=-et*Ye,H.bottom=H.top+Ye,H.left+=-ke*Ze,H.right=H.left+Ze,H.hasBaseline=Oe}(X,e,i,n,C,c,d,p,v,_,b,S),!function(H){for(const ie of H)if(ie.positionedGlyphs.length!==0)return!1;return!0}(j)&&X}const ep={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Av={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 Og(t,e,i,n,o,l){if(e.imageName){const c=n[e.imageName];return c?c.displaySize[0]*e.scale*Wi/l+o:0}{const c=i[e.fontStack],d=c&&c.glyphs[t];return d?d.metrics.advance*e.scale+o:0}}function Bg(t,e,i,n){const o=Math.pow(t-e,2);return n?t<e?o/2:2*o:o+Math.abs(i)*i}function Cv(t,e,i){let n=0;return t===10&&(n-=1e4),i&&(n+=150),t!==40&&t!==65288||(n+=50),e!==41&&e!==65289||(n+=50),n}function Fg(t,e,i,n,o,l){let c=null,d=Bg(e,i,o,l);for(const p of n){const _=Bg(e-p.x,i,o,l)+p.badness;_<=d&&(c=p,d=_)}return{index:t,x:e,priorBreak:c,badness:d}}function Ng(t){return t?Ng(t.priorBreak).concat(t.index):[]}function Qf(t){let e=.5,i=.5;
7switch(t){case"right":case"top-right":case"bottom-right":e=1;break;case"left":case"top-left":case"bottom-left":e=0}switch(t){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 Vg(t,e,i,n,o){if(!(e||i||n||o))return;const l=t.length-1,c=t[l],d=(c.x+c.metrics.advance*c.scale)*e;for(let p=0;p<=l;p++)t[p].x-=d,t[p].y+=i+n+o}function Pv(t,e,i,n){const{horizontalAlign:o,verticalAlign:l}=Qf(n),c=i[0]-t.displaySize[0]*o,d=i[1]-t.displaySize[1]*l;return{imagePrimary:t,imageSecondary:e,top:d,bottom:d+t.displaySize[1],left:c,right:c+t.displaySize[0]}}function Ug(t,e,i,n,o,l){const c=t.imagePrimary;let d;if(c.content){const C=c.content,D=c.pixelRatio||1;d=[C[0]/D,C[1]/D,c.displaySize[0]-C[2]/D,c.displaySize[1]-C[3]/D]}const p=e.left*l,_=e.right*l;let y,v,b,E;i==="width"||i==="both"?(E=o[0]+p-n[3],v=o[0]+_+n[1]):(E=o[0]+(p+_-c.displaySize[0])/2,v=E+c.displaySize[0]);const S=e.top*l,I=e.bottom*l;return i==="height"||i==="both"?(y=o[1]+S-n[0],b=o[1]+I+n[2]):(y=o[1]+(S+I-c.displaySize[1])/2,b=y+c.displaySize[1]),{imagePrimary:c,imageSecondary:void 0,top:y,right:v,bottom:b,left:E,collisionPadding:d}}class Io extends Ge{constructor(e,i,n,o,l){super(e,i),this.angle=o,this.z=n,l!==void 0&&(this.segment=l)}clone(){return new Io(this.x,this.y,this.z,this.angle,this.segment)}}function jg(t,e,i,n,o){if(e.segment===void 0)return!0;let l=e,c=e.segment+1,d=0;for(;d>-i/2;){if(c--,c<0)return!1;d-=t[c].dist(l),l=t[c]}d+=t[c].dist(t[c+1]),c++;const p=[];let _=0;for(;d<i/2;){const y=t[c],v=t[c+1];if(!v)return!1;let b=t[c-1].angleTo(y)-y.angleTo(v);for(b=Math.abs((b+3*Math.PI)%(2*Math.PI)-Math.PI),p.push({distance:d,angleDelta:b}),_+=b;d-p[0].distance>n;)_-=p.shift().angleDelta;if(_>o)return!1;c++,d+=y.dist(v)}return!0}function Gg(t){let e=0;for(let i=0;i<t.length-1;i++)e+=t[i].dist(t[i+1]);return e}function qg(t,e,i){return t?.6*e*i:0}function Zg(t,e){return Math.max(t?t.right-t.left:0,e?e.right-e.left:0)}function zv(t,e,i,n,o,l){const c=qg(i,o,l),d=Zg(i,n)*l;let p=0;const _=Gg(t)/2;for(let y=0;y<t.length-1;y++){const v=t[y],b=t[y+1],E=v.dist(b);if(p+E>_){const S=(_-p)/E,I=tt(v.x,b.x,S),C=tt(v.y,b.y,S),D=new Io(I,C,0,b.angleTo(v),y);return!c||jg(t,D,d,c,e)?D:void 0}p+=E}}function Dv(t,e,i,n,o,l,c,d,p){const _=qg(n,l,c),y=Zg(n,o),v=y*c,b=t[0].x===0||t[0].x===p||t[0].y===0||t[0].y===p;return e-v<e/4&&(e=v+e/4),$g(t,b?e/2*d%e:(y/2+2*l)*c*d%e,e,_,i,v,b,!1,p)}function $g(t,e,i,n,o,l,c,d,p){const _=l/2,y=Gg(t);let v=0,b=e-i,E=[];for(let S=0;S<t.length-1;S++){const I=t[S],C=t[S+1],D=I.dist(C),V=C.angleTo(I);for(;b+i<v+D;){b+=i;const U=(b-v)/D,j=tt(I.x,C.x,U),X=tt(I.y,C.y,U);if(j>=0&&j<p&&X>=0&&X<p&&b-_>=0&&b+_<=y){const H=new Io(j,X,0,V,S);n&&!jg(t,H,l,n,o)||E.push(H)}}v+=D}return d||E.length||c||(E=$g(t,v/2,i,n,o,l,c,!0,p)),E}function Wg(t,e,i,n,o){const l=[];for(let c=0;c<t.length;c++){const d=t[c];let p;for(let _=0;_<d.length-1;_++){let y=d[_],v=d[_+1];y.x<e&&v.x<e||(y.x<e?y=new Ge(e,y.y+(e-y.x)/(v.x-y.x)*(v.y-y.y))._round():v.x<e&&(v=new Ge(e,y.y+(e-y.x)/(v.x-y.x)*(v.y-y.y))._round()),y.y<i&&v.y<i||(y.y<i?y=new Ge(y.x+(i-y.y)/(v.y-y.y)*(v.x-y.x),i)._round():v.y<i&&(v=new Ge(y.x+(i-y.y)/(v.y-y.y)*(v.x-y.x),i)._round()),y.x>=n&&v.x>=n||(y.x>=n?y=new Ge(n,y.y+(n-y.x)/(v.x-y.x)*(v.y-y.y))._round():v.x>=n&&(v=new Ge(n,y.y+(n-y.x)/(v.x-y.x)*(v.y-y.y))._round()),y.y>=o&&v.y>=o||(y.y>=o?y=new Ge(y.x+(o-y.y)/(v.y-y.y)*(v.x-y.x),o)._round():v.y>=o&&(v=new Ge(y.x+(o-y.y)/(v.y-y.y)*(v.x-y.x),o)._round()),p&&y.equals(p[p.length-1])||(p=[y],l.push(p)),p.push(v)))))}}return l}function Hg(t){let e=0,i=0;for(const c of t)e+=c.w*c.h,i=Math.max(i,c.w);t.sort((c,d)=>d.h-c.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),i),h:1/0}];let o=0,l=0;for(const c of t)for(let d=n.length-1;d>=0;d--){const p=n[d];if(!(c.w>p.w||c.h>p.h)){if(c.x=p.x,c.y=p.y,l=Math.max(l,c.y+c.h),o=Math.max(o,c.x+c.w),c.w===p.w&&c.h===p.h){const _=n.pop();d<n.length&&(n[d]=_)}else c.h===p.h?(p.x+=c.w,p.w-=c.w):c.w===p.w?(p.y+=c.h,p.h-=c.h):(n.push({x:p.x+c.w,y:p.y,w:p.w-c.w,h:c.h}),p.y+=c.h,p.h-=c.h);break}}return{w:o,h:l,fill:e/(o*l)||0}}N(Io,"Anchor");const Tr=1;class em{constructor(e,{pixelRatio:i,version:n,stretchX:o,stretchY:l,content:c}){this.paddedRect=e,this.pixelRatio=i,this.stretchX=o,this.stretchY=l,this.content=c,this.version=n}get tl(){return[this.paddedRect.x+Tr,this.paddedRect.y+Tr]}get br(){return[this.paddedRect.x+this.paddedRect.w-Tr,this.paddedRect.y+this.paddedRect.h-Tr]}get displaySize(){return[(this.paddedRect.w-2*Tr)/this.pixelRatio,(this.paddedRect.h-2*Tr)/this.pixelRatio]}}class Xg{constructor(e,i,n){const o={},l={};this.haveRenderCallbacks=[];const c=[];this.addImages(e,o,c),this.addImages(i,l,c);const{w:d,h:p}=Hg(c),_=new Fr({width:d||1,height:p||1});
7for(const y in e){const v=e[y],b=o[y].paddedRect;Fr.copy(v.data,_,{x:0,y:0},{x:b.x+Tr,y:b.y+Tr},v.data,n,v.sdf)}for(const y in i){const v=i[y],b=l[y].paddedRect,E=b.x+Tr,S=b.y+Tr,I=v.data.width,C=v.data.height;Fr.copy(v.data,_,{x:0,y:0},{x:E,y:S},v.data,n),Fr.copy(v.data,_,{x:0,y:C-1},{x:E,y:S-1},{width:I,height:1},n),Fr.copy(v.data,_,{x:0,y:0},{x:E,y:S+C},{width:I,height:1},n),Fr.copy(v.data,_,{x:I-1,y:0},{x:E-1,y:S},{width:1,height:C},n),Fr.copy(v.data,_,{x:0,y:0},{x:E+I,y:S},{width:1,height:C},n)}this.image=_,this.iconPositions=o,this.patternPositions=l}addImages(e,i,n){for(const o in e){const l=e[o],c={x:0,y:0,w:l.data.width+2*Tr,h:l.data.height+2*Tr};n.push(c),i[o]=new em(c,l),l.hasRenderCallback&&this.haveRenderCallbacks.push(o)}}patchUpdatedImages(e,i,n){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(o=>e.hasImage(o,n)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,n);for(const o in e.getUpdatedImages(n))this.patchUpdatedImage(this.iconPositions[o],e.getImage(o,n),i),this.patchUpdatedImage(this.patternPositions[o],e.getImage(o,n),i)}patchUpdatedImage(e,i,n){if(!e||!i||e.version===i.version)return;e.version=i.version;const[o,l]=e.tl,c=!!Object.keys(this.patternPositions).length;n.update(i.data,{useMipmap:c},{x:o,y:l})}}N(em,"ImagePosition"),N(Xg,"ImageAtlas");const tp=1e20;function Yg(t,e,i,n,o,l,c,d,p){for(let _=e;_<e+n;_++)Kg(t,i*l+_,l,o,c,d,p);for(let _=i;_<i+o;_++)Kg(t,_*l+e,1,n,c,d,p)}function Kg(t,e,i,n,o,l,c){l[0]=0,c[0]=-1e20,c[1]=tp,o[0]=t[e];for(let d=1,p=0,_=0;d<n;d++){o[d]=t[e+d*i];const y=d*d;do{const v=l[p];_=(o[d]-o[v]+y-v*v)/(d-v)/2}while(_<=c[p]&&--p>-1);p++,l[p]=d,c[p]=_,c[p+1]=tp}for(let d=0,p=0;d<n;d++){for(;c[p+1]<d;)p++;const _=l[p],y=d-_;t[e+d*i]=o[_]+y*y}}const gn=2,tm={none:0,ideographs:1,all:2};class ac{constructor(e,i,n){this.requestManager=e,this.localGlyphMode=i,this.localFontFamily=n,this.urls={},this.entries={},this.localGlyphs={200:{},400:{},500:{},900:{}}}setURL(e,i){this.urls[i]=e}getGlyphs(e,i,n){const o=[],l=this.urls[i]||mt.GLYPHS_URL;for(const c in e)for(const d of e[c])o.push({stack:c,id:d});ir(o,({stack:c,id:d},p)=>{let _=this.entries[c];_||(_=this.entries[c]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let y=_.glyphs[d];if(y!==void 0)return void p(null,{stack:c,id:d,glyph:y});if(y=this._tinySDF(_,c,d),y)return _.glyphs[d]=y,void p(null,{stack:c,id:d,glyph:y});const v=Math.floor(d/256);if(256*v>65535)return void p(new Error("glyphs > 65535 not supported"));if(_.ranges[v])return void p(null,{stack:c,id:d,glyph:y});let b=_.requests[v];b||(b=_.requests[v]=[],ac.loadGlyphRange(c,v,l,this.requestManager,(E,S)=>{if(S){_.ascender=S.ascender,_.descender=S.descender;for(const I in S.glyphs)this._doesCharSupportLocalGlyph(+I)||(_.glyphs[+I]=S.glyphs[+I]);_.ranges[v]=!0}for(const I of b)I(E,S);delete _.requests[v]})),b.push((E,S)=>{E?p(E):S&&p(null,{stack:c,id:d,glyph:S.glyphs[d]||null})})},(c,d)=>{if(c)n(c);else if(d){const p={};for(const{stack:_,id:y,glyph:v}of d)p[_]===void 0&&(p[_]={}),p[_].glyphs===void 0&&(p[_].glyphs={}),p[_].glyphs[y]=v&&{id:v.id,bitmap:v.bitmap.clone(),metrics:v.metrics},p[_].ascender=this.entries[_].ascender,p[_].descender=this.entries[_].descender;n(null,p)}})}_doesCharSupportLocalGlyph(e){return this.localGlyphMode!==tm.none&&(this.localGlyphMode===tm.all?!!this.localFontFamily:!!this.localFontFamily&&(Q["CJK Unified Ideographs"](e)||Q["Hangul Syllables"](e)||Q.Hiragana(e)||Q.Katakana(e)||Q["CJK Symbols and Punctuation"](e)||Q["CJK Unified Ideographs Extension A"](e)||Q["CJK Unified Ideographs Extension B"](e)))}_tinySDF(e,i,n){const o=this.localFontFamily;if(!o||!this._doesCharSupportLocalGlyph(n))return;let l=e.tinySDF;if(!l){let I="400";/bold/i.test(i)?I="900":/medium/i.test(i)?I="500":/light/i.test(i)&&(I="200"),l=e.tinySDF=new ac.TinySDF({fontFamily:o,fontWeight:I,fontSize:24*gn,buffer:3*gn,radius:8*gn}),l.fontWeight=I}if(this.localGlyphs[l.fontWeight][n])return this.localGlyphs[l.fontWeight][n];const c=String.fromCodePoint(n),{data:d,width:p,height:_,glyphWidth:y,glyphHeight:v,glyphLeft:b,glyphTop:E,glyphAdvance:S}=l.draw(c);return this.localGlyphs[l.fontWeight][n]={id:n,bitmap:new Ss({width:p,height:_},d),metrics:{width:y/gn,height:v/gn,left:b/gn,top:E/gn-27,advance:S/gn,localGlyph:!0}}}}
7ac.loadGlyphRange=function(t,e,i,n,o){const l=256*e,c=l+255,d=n.transformRequest(n.normalizeGlyphsURL(i).replace("{fontstack}",t).replace("{range}",`${l}-${c}`),xl.Glyphs);Dn(d,(p,_)=>{if(p)o(p);else if(_){const y={},v=function(b){return new nc(b).readFields(Ev,{})}(_);for(const b of v.glyphs)y[b.id]=b;o(null,{glyphs:y,ascender:v.ascender,descender:v.descender})}})},ac.TinySDF=class{constructor({fontSize:t=24,buffer:e=3,radius:i=8,cutoff:n=.25,fontFamily:o="sans-serif",fontWeight:l="normal",fontStyle:c="normal"}={}){this.buffer=e,this.cutoff=n,this.radius=i;const d=this.size=t+4*e,p=this._createCanvas(d),_=this.ctx=p.getContext("2d",{willReadFrequently:!0});_.font=`${c} ${l} ${t}px ${o}`,_.textBaseline="alphabetic",_.textAlign="left",_.fillStyle="black",this.gridOuter=new Float64Array(d*d),this.gridInner=new Float64Array(d*d),this.f=new Float64Array(d),this.z=new Float64Array(d+1),this.v=new Uint16Array(d)}_createCanvas(t){const e=document.createElement("canvas");return e.width=e.height=t,e}draw(t){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:n,actualBoundingBoxLeft:o,actualBoundingBoxRight:l}=this.ctx.measureText(t),c=Math.ceil(i),d=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(l-o))),p=Math.min(this.size-this.buffer,c+Math.ceil(n)),_=d+2*this.buffer,y=p+2*this.buffer,v=Math.max(_*y,0),b=new Uint8ClampedArray(v),E={data:b,width:_,height:y,glyphWidth:d,glyphHeight:p,glyphTop:c,glyphLeft:0,glyphAdvance:e};if(d===0||p===0)return E;const{ctx:S,buffer:I,gridInner:C,gridOuter:D}=this;S.clearRect(I,I,d,p),S.fillText(t,I,I+c);const V=S.getImageData(I,I,d,p);D.fill(tp,0,v),C.fill(0,0,v);for(let U=0;U<p;U++)for(let j=0;j<d;j++){const X=V.data[4*(U*d+j)+3]/255;if(X===0)continue;const H=(U+I)*_+j+I;if(X===1)D[H]=0,C[H]=tp;else{const ie=.5-X;D[H]=ie>0?ie*ie:0,C[H]=ie<0?ie*ie:0}}Yg(D,0,0,_,y,_,this.f,this.v,this.z),Yg(C,I,I,d,p,_,this.f,this.v,this.z);for(let U=0;U<v;U++){const j=Math.sqrt(D[U])-Math.sqrt(C[U]);b[U]=Math.round(255-255*(j/this.radius+this.cutoff))}return E}};const Oa=Tr;function Jg(t,e,i,n){const o=[],l=t.imagePrimary,c=l.pixelRatio,d=l.paddedRect.w-2*Oa,p=l.paddedRect.h-2*Oa,_=t.right-t.left,y=t.bottom-t.top,v=l.stretchX||[[0,d]],b=l.stretchY||[[0,p]],E=(pe,Te)=>pe+Te[1]-Te[0],S=v.reduce(E,0),I=b.reduce(E,0),C=d-S,D=p-I;let V=0,U=S,j=0,X=I,H=0,ie=C,ne=0,ue=D;if(l.content&&n){const pe=l.content;V=ip(v,0,pe[0]),j=ip(b,0,pe[1]),U=ip(v,pe[0],pe[2]),X=ip(b,pe[1],pe[3]),H=pe[0]-V,ne=pe[1]-j,ie=pe[2]-pe[0]-U,ue=pe[3]-pe[1]-X}const ye=(pe,Te,ze,be)=>{const Ae=rp(pe.stretch-V,U,_,t.left),xe=np(pe.fixed-H,ie,pe.stretch,S),Ce=rp(Te.stretch-j,X,y,t.top),Re=np(Te.fixed-ne,ue,Te.stretch,I),Pe=rp(ze.stretch-V,U,_,t.left),Ze=np(ze.fixed-H,ie,ze.stretch,S),De=rp(be.stretch-j,X,y,t.top),Oe=np(be.fixed-ne,ue,be.stretch,I),Qe=new Ge(Ae,Ce),Je=new Ge(Pe,Ce),Ye=new Ge(Pe,De),ke=new Ge(Ae,De),et=new Ge(xe/c,Re/c),_t=new Ge(Ze/c,Oe/c),ot=e*Math.PI/180;if(ot){const Xt=Math.sin(ot),Ut=Math.cos(ot),Rt=[Ut,-Xt,Xt,Ut];Qe._matMult(Rt),Je._matMult(Rt),ke._matMult(Rt),Ye._matMult(Rt)}const bt=pe.stretch+pe.fixed,gt=ze.stretch+ze.fixed,Mt=Te.stretch+Te.fixed,rt=be.stretch+be.fixed,Yt=t.imageSecondary;return{tl:Qe,tr:Je,bl:ke,br:Ye,texPrimary:{x:l.paddedRect.x+Oa+bt,y:l.paddedRect.y+Oa+Mt,w:gt-bt,h:rt-Mt},texSecondary:Yt?{x:Yt.paddedRect.x+Oa+bt,y:Yt.paddedRect.y+Oa+Mt,w:gt-bt,h:rt-Mt}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:et,pixelOffsetBR:_t,minFontScaleX:ie/c/_,minFontScaleY:ue/c/y,isSDF:i}};if(n&&(l.stretchX||l.stretchY)){const pe=Qg(v,C,S),Te=Qg(b,D,I);for(let ze=0;ze<pe.length-1;ze++){const be=pe[ze],Ae=pe[ze+1];for(let xe=0;xe<Te.length-1;xe++)o.push(ye(be,Te[xe],Ae,Te[xe+1]))}}else o.push(ye({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:d+1},{fixed:0,stretch:p+1}));return o}function ip(t,e,i){let n=0;for(const o of t)n+=Math.max(e,Math.min(i,o[1]))-Math.max(e,Math.min(i,o[0]));return n}function Qg(t,e,i){const n=[{fixed:-1,stretch:0}];for(const[o,l]of t){const c=n[n.length-1];n.push({fixed:o-c.stretch,stretch:c.stretch}),n.push({fixed:o-c.stretch,stretch:c.stretch+(l-o)})}
7return n.push({fixed:e+Oa,stretch:i}),n}function rp(t,e,i,n){return t/e*i+n}function np(t,e,i,n){return t-e*i/n}function Lv(t,e,i,n){const o=e+t.positionedLines[n].lineOffset;return n===0?i+o/2:i+(o+(e+t.positionedLines[n-1].lineOffset))/2}function Rv(t,e=1,i=!1){let n=1/0,o=1/0,l=-1/0,c=-1/0;const d=t[0];for(let E=0;E<d.length;E++){const S=d[E];(!E||S.x<n)&&(n=S.x),(!E||S.y<o)&&(o=S.y),(!E||S.x>l)&&(l=S.x),(!E||S.y>c)&&(c=S.y)}const p=Math.min(l-n,c-o);let _=p/2;const y=new hu([],kv);if(p===0)return new Ge(n,o);for(let E=n;E<l;E+=p)for(let S=o;S<c;S+=p)y.push(new lc(E+_,S+_,_,t));let v=function(E){let S=0,I=0,C=0;const D=E[0];for(let V=0,U=D.length,j=U-1;V<U;j=V++){const X=D[V],H=D[j],ie=X.x*H.y-H.x*X.y;I+=(X.x+H.x)*ie,C+=(X.y+H.y)*ie,S+=3*ie}return new lc(I/S,C/S,0,E)}(t),b=y.length;for(;y.length;){const E=y.pop();(E.d>v.d||!v.d)&&(v=E,i&&console.log("found best %d after %d probes",Math.round(1e4*E.d)/1e4,b)),E.max-v.d<=e||(_=E.h/2,y.push(new lc(E.p.x-_,E.p.y-_,_,t)),y.push(new lc(E.p.x+_,E.p.y-_,_,t)),y.push(new lc(E.p.x-_,E.p.y+_,_,t)),y.push(new lc(E.p.x+_,E.p.y+_,_,t)),b+=4)}return i&&(console.log(`num probes: ${b}`),console.log(`best distance: ${v.d}`)),v.p}function kv(t,e){return e.max-t.max}class lc{constructor(e,i,n,o){this.p=new Ge(e,i),this.h=n,this.d=function(l,c){let d=!1,p=1/0;for(let _=0;_<c.length;_++){const y=c[_];for(let v=0,b=y.length,E=b-1;v<b;E=v++){const S=y[v],I=y[E];S.y>l.y!=I.y>l.y&&l.x<(I.x-S.x)*(l.y-S.y)/(I.y-S.y)+S.x&&(d=!d),p=Math.min(p,a_(l,S,I))}}return(d?1:-1)*Math.sqrt(p)}(this.p,o),this.max=this.d+this.h*Math.SQRT2}}const im=Number.POSITIVE_INFINITY,Ov=Math.sqrt(2);function ey(t,[e,i]){let n=0,o=0;if(i===im){e<0&&(e=0);const l=e/Ov;switch(t){case"top-right":case"top-left":o=l-7;break;case"bottom-right":case"bottom-left":o=7-l;break;case"bottom":o=7-e;break;case"top":o=e-7}switch(t){case"top-right":case"bottom-right":n=-l;break;case"top-left":case"bottom-left":n=l;break;case"left":n=e;break;case"right":n=-e}}else{switch(e=Math.abs(e),i=Math.abs(i),t){case"top-right":case"top-left":case"top":o=i-7;break;case"bottom-right":case"bottom-left":case"bottom":o=7-i}switch(t){case"top-right":case"bottom-right":case"right":n=-e;break;case"top-left":case"bottom-left":case"left":n=e}}return[n,o]}function rm(t){switch(t){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Bv(t,e,i,n,o,l,c,d,p,_,y,v,b,E,S){let I=l.textMaxSize.evaluate(e,{},v);I===void 0&&(I=c);const C=t.layers[0].layout,D=C.get("icon-offset").evaluate(e,{},v),V=iy(i.horizontal)||i.vertical,U=b.name==="globe",j=Wi,X=c/j,H=t.tilePixelRatio*I/j,ie=(Ae=t.overscaling,t.zoom>18&&Ae>2&&(Ae>>=1),Math.max(Ne/(512*Ae),1)*C.get("symbol-spacing")),ne=C.get("text-padding")*t.tilePixelRatio,ue=C.get("icon-padding")*t.tilePixelRatio,ye=Pt(C.get("text-max-angle")),pe=C.get("text-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",Te=C.get("icon-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point",ze=C.get("symbol-placement"),be=ie/2;var Ae;const xe=C.get("icon-text-fit").evaluate(e,{},v),Ce=C.get("icon-text-fit-padding").evaluate(e,{},v),Re=xe!=="none";let Pe;t.hasAnyIconTextFit===!1&&Re&&(t.hasAnyIconTextFit=!0),n&&Re&&(t.allowVerticalPlacement&&i.vertical&&(Pe=Ug(n,i.vertical,xe,Ce,D,X)),V&&(n=Ug(n,V,xe,Ce,D,X)));const Ze=(De,Oe,Qe)=>{if(Oe.x<0||Oe.x>=Ne||Oe.y<0||Oe.y>=Ne)return;let Je=null;if(U){const{x:Ye,y:ke,z:et}=b.projectTilePoint(Oe.x,Oe.y,Qe);Je={anchor:new Io(Ye,ke,et,0,void 0),up:b.upVector(Qe,Oe.x,Oe.y)}}(function(Ye,ke,et,_t,ot,bt,gt,Mt,rt,Yt,Xt,Ut,Rt,jt,ni,ei,_i,fi,er,bi,di,Ai,Ni,Vi,ri,cr,Ao){const sn=Ye.addToLineVertexArray(ke,_t);let wn,Rs,ks,Ga,n0,o0,s0,a0=0,l0=0,c0=0,u0=0,Pm=-1,zm=-1;const qn={};let h0=la("");const qa=et?et.anchor:ke,Dm=rt.layout.get("icon-text-fit").evaluate(di,{},ri)!=="none";let Lm=0,Rm=0;if(rt._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Lm,Rm]=rt.layout.get("text-offset").evaluate(di,{},ri).map(Sr=>Sr*Wi):(Lm=rt.layout.get("text-radial-offset").evaluate(di,{},ri)*Wi,Rm=im),Ye.allowVerticalPlacement&&ot.vertical){const Sr=ot.vertical;if(ni)o0=nm(Sr),Mt&&(s0=nm(Mt));else{const Mr=rt.layout.get("text-rotate").evaluate(di,{},ri)+90;ks=op(Yt,qa,ke,Xt,Ut,Rt,Sr,jt,Mr,ei),Mt&&(Ga=op(Yt,qa,ke,Xt,Ut,Rt,Mt,fi,Mr))}}if(bt){const Sr=rt.layout.get("icon-rotate").evaluate(di,{},ri),Mr=Jg(bt,Sr,Ni,Dm),gc=Mt?Jg(Mt,Sr,Ni,Dm):void 0;Rs=op(Yt,qa,ke,Xt,Ut,Rt,bt,fi,Sr),a0=4*Mr.length;const d0=Ye.iconSizeData;let Za=null;d0.kind==="source"?(Za=[_n*rt.layout.get("icon-size").evaluate(di,{},ri)],Za[0]>As&&vi(`${Ye.layerIds[0]}: Value for "icon-size" is >= ${oh}. Reduce your "icon-size".`)):d0.kind==="composite"&&(Za=[_n*Ai.compositeIconSizes[0].evaluate(di,{},ri),_n*Ai.compositeIconSizes[1].evaluate(di,{},ri)],(Za[0]>As||Za[1]>As)&&vi(`${Ye.layerIds[0]}: Value for "icon-size" is >= ${oh}. Reduce your "icon-size".`)),Ye.addSymbols(Ye.icon,Mr,Za,bi,er,di,!1,et,ke,sn.lineStartIndex,sn.lineLength,-1,Vi,ri,cr,Ao),Pm=Ye.icon.placedSymbolArray.length-1,gc&&(l0=4*gc.length,Ye.addSymbols(Ye.icon,gc,Za,bi,er,di,Nr.vertical,et,ke,sn.lineStartIndex,sn.lineLength,-1,Vi,ri,cr,Ao),zm=Ye.icon.placedSymbolArray.length-1)}for(const Sr in ot.horizontal){const Mr=ot.horizontal[Sr];wn||(h0=la(Mr.text),ni?n0=nm(Mr):wn=op(Yt,qa,ke,Xt,Ut,Rt,Mr,jt,rt.layout.get("text-rotate").evaluate(di,{},ri),ei));const gc=Mr.positionedLines.length===1;if(c0+=ty(Ye,et,ke,Mr,gt,rt,ni,di,ei,sn,ot.vertical?Nr.horizontal:Nr.horizontalOnly,gc?Object.keys(ot.horizontal):[Sr],qn,Pm,Ai,Vi,ri,cr),gc)break}ot.vertical&&(u0+=ty(Ye,et,ke,ot.vertical,gt,rt,ni,di,ei,sn,Nr.vertical,["vertical"],qn,zm,Ai,Vi,ri,cr));let Os=-1;const km=(Sr,Mr)=>Sr?Math.max(Sr,Mr):Mr;Os=km(n0,Os),Os=km(o0,Os),Os=km(s0,Os);const cb=Os>-1?1:0;Ye.glyphOffsetArray.length>=65535&&vi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),di.sortKey!==void 0&&Ye.addToSortKey
7Ranges(Ye.symbolInstances.length,di.sortKey),Ye.symbolInstances.emplaceBack(ke.x,ke.y,qa.x,qa.y,qa.z,qn.right>=0?qn.right:-1,qn.center>=0?qn.center:-1,qn.left>=0?qn.left:-1,qn.vertical>=0?qn.vertical:-1,Pm,zm,h0,wn!==void 0?wn:Ye.collisionBoxArray.length,wn!==void 0?wn+1:Ye.collisionBoxArray.length,ks!==void 0?ks:Ye.collisionBoxArray.length,ks!==void 0?ks+1:Ye.collisionBoxArray.length,Rs!==void 0?Rs:Ye.collisionBoxArray.length,Rs!==void 0?Rs+1:Ye.collisionBoxArray.length,Ga||Ye.collisionBoxArray.length,Ga?Ga+1:Ye.collisionBoxArray.length,Xt,c0,u0,a0,l0,cb,0,Lm,Rm,Os,0,1,1,Dm?1:0)})(t,Oe,Je,De,i,n,o,Pe,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,ne,pe,p,0,ue,Te,D,e,l,_,y,v,E,S)};if(ze==="line")for(const De of Wg(e.geometry,0,0,Ne,Ne)){const Oe=Dv(De,ie,ye,i.vertical||V,n,j,H,t.overscaling,Ne);for(const Qe of Oe)V&&Fv(t,V.text,be,Qe)||Ze(De,Qe,v)}else if(ze==="line-center"){for(const De of e.geometry)if(De.length>1){const Oe=zv(De,ye,i.vertical||V,n,j,H);Oe&&Ze(De,Oe,v)}}else if(e.type==="Polygon")for(const De of Vd(e.geometry,0)){const Oe=Rv(De,16);Ze(De[0],new Io(Oe.x,Oe.y,0,0,void 0),v)}else if(e.type==="LineString")for(const De of e.geometry)Ze(De,new Io(De[0].x,De[0].y,0,0,void 0),v);else if(e.type==="Point")for(const De of e.geometry)for(const Oe of De)Ze([Oe],new Io(Oe.x,Oe.y,0,0,void 0),v)}const oh=255,As=oh*_n;function ty(t,e,i,n,o,l,c,d,p,_,y,v,b,E,S,I,C,D){const V=function(X,H,ie,ne,ue,ye,pe,Te){const ze=[];if(H.positionedLines.length===0)return ze;const be=ne.layout.get("text-rotate").evaluate(ye,{})*Math.PI/180,Ae=function(Ze){const De=Ze[0],Oe=Ze[1],Qe=De*Oe;return Qe>0?[De,-Oe]:Qe<0?[-De,Oe]:De===0?[Oe,De]:[Oe,-De]}(ie);let xe=Math.abs(H.top-H.bottom);for(const Ze of H.positionedLines)xe-=Ze.lineOffset;const Ce=H.positionedLines.length,Re=xe/Ce;let Pe=H.top-ie[1];for(let Ze=0;Ze<Ce;++Ze){const De=H.positionedLines[Ze];Pe=Lv(H,Re,Pe,Ze);for(const Oe of De.positionedGlyphs){if(!Oe.rect)continue;const Qe=Oe.rect||{};let Je=Iv+1,Ye=!0,ke=1,et=0;if(Oe.imageName){const bi=pe[Oe.imageName];if(!bi)continue;if(bi.sdf){vi("SDF images are not supported in formatted text and will be ignored.");continue}Ye=!1,ke=bi.pixelRatio,Je=Tr/ke}const _t=(ue||Te)&&Oe.vertical,ot=Oe.metrics.advance*Oe.scale/2,bt=Oe.metrics,gt=Oe.rect;if(gt===null)continue;Te&&H.verticalizable&&(et=Oe.imageName?ot-Oe.metrics.width*Oe.scale/2:0);const Mt=ue?[Oe.x+ot,Oe.y]:[0,0];let rt=[0,0],Yt=[0,0],Xt=!1;ue||(_t?(Yt=[Oe.x+ot+Ae[0],Oe.y+Ae[1]-et],Xt=!0):rt=[Oe.x+ot+ie[0],Oe.y+ie[1]-et]);const Ut=gt.w*Oe.scale/(ke*(Oe.localGlyph?gn:1)),Rt=gt.h*Oe.scale/(ke*(Oe.localGlyph?gn:1));let jt,ni,ei,_i;if(_t){const bi=Oe.y-Pe,di=new Ge(-ot,ot-bi),Ai=-Math.PI/2,Ni=new Ge(...Yt);jt=new Ge(-ot+rt[0],rt[1]),jt._rotateAround(Ai,di)._add(Ni),jt.x+=-bi+ot,jt.y-=(bt.left-Je)*Oe.scale;const Vi=Oe.imageName?bt.advance*Oe.scale:Wi*Oe.scale,ri=String.fromCodePoint(Oe.glyph);wv(ri)?jt.x+=(1-Je)*Oe.scale:Tv(ri)?jt.x+=Vi-bt.height*Oe.scale+(-Je-1)*Oe.scale:jt.x+=Oe.imageName||bt.width+2*Je===gt.w&&bt.height+2*Je===gt.h?(Vi-Rt)/2:(Vi-(bt.height+2*Je)*Oe.scale)/2,ni=new Ge(jt.x,jt.y-Ut),ei=new Ge(jt.x+Rt,jt.y),_i=new Ge(jt.x+Rt,jt.y-Ut)}else{const bi=(bt.left-Je)*Oe.scale-ot+rt[0],di=(-bt.top-Je)*Oe.scale+rt[1],Ai=bi+Ut,Ni=di+Rt;jt=new Ge(bi,di),ni=new Ge(Ai,di),ei=new Ge(bi,Ni),_i=new Ge(Ai,Ni)}if(be){let bi;bi=ue?new Ge(0,0):Xt?new Ge(Ae[0],Ae[1]):new Ge(ie[0],ie[1]),jt._rotateAround(be,bi),ni._rotateAround(be,bi),ei._rotateAround(be,bi),_i._rotateAround(be,bi)}const fi=new Ge(0,0),er=new Ge(0,0);ze.push({tl:jt,tr:ni,bl:ei,br:_i,texPrimary:Qe,texSecondary:void 0,writingMode:H.writingMode,glyphOffset:Mt,sectionIndex:Oe.sectionIndex,isSDF:Ye,pixelOffsetTL:fi,pixelOffsetBR:er,minFontScaleX:0,minFontScaleY:0})}}return ze}(0,n,p,l,c,d,o,t.allowVerticalPlacement),U=t.textSizeData;let j=null;U.kind==="source"?(j=[_n*l.layout.get("text-size").evaluate(d,{},C)],j[0]>As&&vi(`${t.layerIds[0]}: Value for "text-size" is >= ${oh}. Reduce your "text-size".`)):U.kind==="composite"&&(j=[_n*S.compositeTextSizes[0].evaluate(d,{},C),_n*S.compositeTextSizes[1].evaluate(d,{},C)],(j[0]>As||j[1]>As)&&vi(`${t.layerIds[0]}: Value for "text-size" is >= ${oh}. Reduce your "text-size".`)),t.addSymbols(t.text,V,j,p,c,d,y,e,i,_.lineStartIndex,_.lineLength,E,I,C,D,!1);for(const X of v)b[X]=t.text.placedSymbolArray.length-1;return 4*V.length}function iy(t){for(const e in t)return t[e];return null}function op(t,e,i,n,o,l,c,d,p,_){let y=c.top,v=c.bottom,b=c.left,E=c.right;const S=c.collisionPadding;if(S&&(b-=S[0],y-=S[1],E+=S[2],v+=S[3]),p){const I=new Ge(b,y),C=new Ge(E,y),D=new Ge(b,v),V=new Ge(E,v),U=Pt(p);let j=new Ge(0,0);
vendor: 16,294 bytes, line 7
7_&&(j=new Ge(_[0],_[1])),I._rotateAround(U,j),C._rotateAround(U,j),D._rotateAround(U,j),V._rotateAround(U,j),b=Math.min(I.x,C.x,D.x,V.x),E=Math.max(I.x,C.x,D.x,V.x),y=Math.min(I.y,C.y,D.y,V.y),v=Math.max(I.y,C.y,D.y,V.y)}return t.emplaceBack(e.x,e.y,e.z,i.x,i.y,b,y,E,v,d,n,o,l),t.length-1}function nm(t){t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function Fv(t,e,i,n){const o=t.compareText;if(e in o){const l=o[e];for(let c=l.length-1;c>=0;c--)if(n.dist(l[c])<i)return!0}else o[e]=[];return o[e].push(n),!1}function ry(t,e){const i=t.fovAboveCenter,n=t.elevation?t.elevation.getMinElevationBelowMSL()*e:0,o=(t._camera.position[2]*t.worldSize-n)/Math.cos(t._pitch),l=Math.sin(i)*o/Math.sin(Math.max(Math.PI/2-t._pitch-i,.01)),c=Math.sin(t._pitch)*l+o;return Math.min(1.01*c,o*(1/t._horizonShift))}function Ba(t,e){if(!e.isReprojectedInTileSpace)return{scale:1<<t.z,x:t.x,y:t.y,x2:t.x+1,y2:t.y+1,projection:e};const i=Math.pow(2,-t.z),n=t.x*i,o=(t.x+1)*i,l=t.y*i,c=(t.y+1)*i,d=mr(n),p=mr(o),_=Fi(l),y=Fi(c),v=e.project(d,_),b=e.project(p,_),E=e.project(p,y),S=e.project(d,y);let I=Math.min(v.x,b.x,E.x,S.x),C=Math.min(v.y,b.y,E.y,S.y),D=Math.max(v.x,b.x,E.x,S.x),V=Math.max(v.y,b.y,E.y,S.y);const U=i/16;function j(H,ie,ne,ue,ye,pe){const Te=(ne+ye)/2,ze=(ue+pe)/2,be=e.project(mr(Te),Fi(ze)),Ae=Math.max(0,I-be.x,C-be.y,be.x-D,be.y-V);I=Math.min(I,be.x),D=Math.max(D,be.x),C=Math.min(C,be.y),V=Math.max(V,be.y),Ae>U&&(j(H,be,ne,ue,Te,ze),j(be,ie,Te,ze,ye,pe))}j(v,b,n,l,o,l),j(b,E,o,l,o,c),j(E,S,o,c,n,c),j(S,v,n,c,n,l),I-=U,C-=U,D+=U,V+=U;const X=1/Math.max(D-I,V-C);return{scale:X,x:I*X,y:C*X,x2:D*X,y2:V*X,projection:e}}function ny(t,{x:e,y:i},n=0){return new Ge(((e-n)*t.scale-t.x)*Ne,(i*t.scale-t.y)*Ne)}const Nv=s.ad.identity(new Float32Array(16));class Cs{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 Bt(0,0)}projectTilePoint(e,i,n){return{x:e,y:i,z:0}}locationPoint(e,i,n=!0){return e._coordinatePoint(e.locationCoordinate(i),n)}pixelsPerMeter(e,i){return lr(1,e)*i}pixelSpaceConversion(e,i,n){return 1}farthestPixelDistance(e){return ry(e,e.pixelsPerMeter)}pointCoordinate(e,i,n,o){const l=e.horizonLineFromTop(!1),c=new Ge(i,Math.max(l,n));return e.rayIntersectionCoordinate(e.pointRayIntersection(c,o))}pointCoordinate3D(e,i,n){const o=new Ge(i,n);if(e.elevation)return e.elevation.pointCoordinate(o);{const l=this.pointCoordinate(e,o.x,o.y,0);return[l.x,l.y,l.z]}}isPointAboveHorizon(e,i){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,i.x,i.y);const n=e.horizonLineFromTop();return i.y<n}createInversionMatrix(e,i){return Nv}createTileMatrix(e,i,n){let o,l,c;const d=n.canonical,p=s.ad.identity(new Float64Array(16));if(this.isReprojectedInTileSpace){const _=Ba(d,this);o=1,l=_.x+n.wrap*_.scale,c=_.y,s.ad.scale(p,p,[o/_.scale,o/_.scale,e.pixelsPerMeter/i])}else o=i/e.zoomScale(d.z),l=(d.x+Math.pow(2,d.z)*n.wrap)*o,c=d.y*o;return s.ad.translate(p,p,[l,c,0]),s.ad.scale(p,p,[o/Ne,o/Ne,1]),p}upVector(e,i,n){return[0,0,1]}upVectorScale(e,i,n){return{metersToTile:1}}}class Vv extends Cs{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[i,n]=this.parallels=e.parallels||[29.5,45.5],o=Math.sin(Pt(i));this.n=(o+Math.sin(Pt(n)))/2,this.c=1+o*(2*this.n-o),this.r0=Math.sqrt(this.c)/this.n}project(e,i){const{n,c:o,r0:l}=this,c=Pt(e-this.center[0]),d=Pt(i),p=Math.sqrt(o-2*n*Math.sin(d))/n;return{x:p*Math.sin(c*n),y:p*Math.cos(c*n)-l,z:0}}unproject(e,i){const{n,c:o,r0:l}=this,c=l+i;let d=Math.atan2(e,Math.abs(c))*Math.sign(c);c*n<0&&(d-=Math.PI*Math.sign(e)*Math.sign(c));const p=Pt(this.center[0])*n;d=Qn(d,-Math.PI-p,Math.PI-p);const _=ft(Hi(d/n)+this.center[0],-180,180),y=Math.asin(ft((o-(e*e+c*c)*n*n)/(2*n),-1,1)),v=ft(Hi(y),-85.051129,_r);return new Bt(_,v)}}const sh=1.340264,ah=-.081106,lh=893e-6,ch=.003796,sp=Math.sqrt(3)/2;class Uv extends Cs{project(e,i){i=i/180*Math.PI,e=e/180*Math.PI;const n=Math.asin(sp*Math.sin(i)),o=n*n,l=o*o*o;return{x:.5*(e*Math.cos(n)/(sp*(sh+3*ah*o+l*(7*lh+9*ch*o)))/Math.PI+.5),y:1-.5*(n*(sh+ah*o+l*(lh+ch*o))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,o=n*n,l=o*o*o;for(let y,v,b,E=0;E<12&&(v=n*(sh+ah*o+l*(lh+ch*o))-i,b=sh+3*ah*o+l*(7*lh+9*ch*o),y=v/b,n=ft(n-y,-Math.PI/3,Math.PI/3),o=n*n,l=o*o*o,!(Math.abs(y)<1e-12));++E);const c=sp*e*(sh+3*ah*o+l*(7*lh+9*ch*o))/Math.cos(n),d=Math.asin(Math.sin(n)/sp),p=ft(180*c/Math.PI,-180,180),_=ft(180*d/Math.PI,-85.051129,_r);return new Bt(p,_)}}class jv extends Cs{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 n=360*(e-.5),o=ft(360*(.5-i),-85.051129,_r);return new Bt(n,o)}}const cc=Math.PI/2;function ap(t){return Math.tan((cc+t)/2)}class Gv extends Cs{constructor(e){super(e),this.center=e.center||[0,30];const[i,n]=this.parallels=e.parallels||[30,30];let o=Pt(i),l=Pt(n);this.southernCenter=o+l<0,this.southernCenter&&(o=-o,l=-l);const c=Math.cos(o),d=ap(o);this.n=o===l?Math.sin(o):Math.log(c/Math.cos(l))/Math.log(ap(l)/d),this.f=c*Math.pow(ap(o),this.n)/this.n}project(e,i){i=Pt(i),this.southernCenter&&(i=-i),e=Pt(e-this.center[0]);const n=1e-6,{n:o,f:l}=this;l>0?i<-cc+n&&(i=-cc+n):i>cc-n&&(i=cc-n);const c=l/Math.pow(ap(i),o);let d=c*Math.sin(o*e),p=l-c*Math.cos(o*e);return d=.5*(d/Math.PI+.5),p=.5*(p/Math.PI+.5),{x:d,y:this.southernCenter?p:1-p,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,f:o}=this,l=o-i,c=Math.sign(l),d=Math.sign(n)*Math.sqrt(e*e+l*l);let p=Math.atan2(e,Math.abs(l))*c;l*n<0&&(p-=Math.PI*Math.sign(e)*c);const _=ft(Hi(p/n)+this.center[0],-180,180),y=ft(Hi(2*Math.atan(Math.pow(o/d,1/n))-cc),-85.051129,_r);return new Bt(_,this.southernCenter?-y:y)}}class oy extends Cs{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:Fn(e),y:Nn(i),z:0}}unproject(e,i){const n=mr(e),o=Fi(i);return new Bt(n,o)}}const sy=Pt(_r);class qv extends Cs{project(e,i){const n=(i=Pt(i))*i,o=n*n;return{x:.5*((e=Pt(e))*(.8707-.131979*n+o*(o*(.003971*n-.001529*o)-.013791))/Math.PI+.5),y:1-.5*(i*(1.007226+n*(.015085+o*(.028874*n-.044475-.005916*o)))/Math.PI+1),z:0}}unproject(e,i){e=(2*e-.5)*Math.PI;let n=i=(2*(1-i)-1)*Math.PI,o=25,l=0,c=n*n;do{c=n*n;const _=c*c;l=(n*(1.007226+c*(.015085+_*(.028874*c-.044475-.005916*_)))-i)/(1.007226+c*(.045255+_*(.259866*c-.311325-.005916*11*_))),n=ft(n-l,-sy,sy)}while(Math.abs(l)>1e-6&&--o>0);c=n*n;const d=ft(Hi(e/(.8707+c*(c*(c*c*c*(.003971-.001529*c)-.013791)-.131979))),-180,180),p=Hi(n);return new Bt(d,p)}}const ay=Pt(_r);class Zv extends Cs{project(e,i){i=Pt(i),e=Pt(e);const n=Math.cos(i),o=2/Math.PI,l=Math.acos(n*Math.cos(e/2)),c=Math.sin(l)/l,d=.5*(e*o+2*n*Math.sin(e/2)/c)||0,p=.5*(i+Math.sin(i)/c)||0;return{x:.5*(d/Math.PI+.5),y:1-.5*(p/Math.PI+1),z:0}}unproject(e,i){let n=e=(2*e-.5)*Math.PI,o=i=(2*(1-i)-1)*Math.PI,l=25;const c=1e-6;let d=0,p=0;do{const _=Math.cos(o),y=Math.sin(o),v=2*y*_,b=y*y,E=_*_,S=Math.cos(n/2),I=Math.sin(n/2),C=2*S*I,D=I*I,V=1-E*S*S,U=V?1/V:0,j=V?Math.acos(_*S)*Math.sqrt(1/V):0,X=.5*(2*j*_*I+2*n/Math.PI)-e,H=.5*(j*y+o)-i,ie=.5*U*(E*D+j*_*S*b)+1/Math.PI,ne=U*(C*v/4-j*y*I),ue=.125*U*(v*I-j*y*E*C),ye=.5*U*(b*S+j*D*_)+.5,pe=ne*ue-ye*ie;d=(H*ne-X*ye)/pe,p=(X*ue-H*ie)/pe,n=ft(n-d,-Math.PI,Math.PI),o=ft(o-p,-ay,ay)}while((Math.abs(d)>c||Math.abs(p)>c)&&--l>0);return new Bt(Hi(n),Hi(o))}}class ly extends Cs{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(Pt(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:n,cosPhi:o}=this;return{x:Pt(e)*o*n+.5,y:-Math.sin(Pt(i))/o*n+.5,z:0}}unproject(e,i){const{scale:n,cosPhi:o}=this,l=-(i-.5)/n,c=ft(Hi((e-.5)/n)/o,-180,180),d=Math.asin(ft(l*o,-1,1)),p=ft(Hi(d),-85.051129,_r);return new Bt(c,p)}}class $v extends oy{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,n){const o=Wu(e,i,n),l=Hu(Vn(n));return s._.transformMat4(o,o,l),{x:o[0],y:o[1],z:o[2]}}locationPoint(e,i){const n=za(i.lat,i.lng),o=s._.normalize([],n),l=e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(i),e._centerAltitude):e._centerAltitude,c=lr(1,0)*Ne*l;s._.scaleAndAdd(n,n,o,c);const d=s.ad.identity(new Float64Array(16));return s.ad.multiply(d,e.pixelMatrix,e.globeMatrix),s._.transformMat4(n,n,d),new Ge(n[0],n[1])}pixelsPerMeter(e,i){return lr(1,0)*i}pixelSpaceConversion(e,i,n){const o=lr(1,e)*i,l=tt(lr(1,45)*i,o,n);return this.pixelsPerMeter(e,i)/l}createTileMatrix(e,i,n){const o=kf(Vn(n.canonical));return s.ad.multiply(new Float64Array(16),e.globeMatrix,o)}createInversionMatrix(e,i){const{center:n}=e,o=Hu(Vn(i));return s.ad.rotateY(o,o,Pt(n.lng)),s.ad.rotateX(o,o,Pt(n.lat)),s.ad.scale(o,o,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(o)}pointCoordinate(e,i,n,o){return __(e,i,n,!0)||new Qi(0,0)}pointCoordinate3D(e,i,n){const o=this.pointCoordinate(e,i,n,0);return[o.x,o.y,o.z]}isPointAboveHorizon(e,i){return!__(e,i.x,i.y,!1)}farthestPixelDistance(e){const i=function(o,l){const c=o.cameraToCenterDistance,d=o._centerAltitude*l,p=o._camera,_=o._camera.forward(),y=s._.add([],s._.scale([],_,-c),[0,0,d]),v=o.worldSize/(2*Math.PI),b=[0,0,-v],E=o.width/o.height,S=Math.tan(o.fovAboveCenter),I=s._.scale([],p.up(),S),C=s._.scale([],p.right(),S*E),D=s._.normalize([],s._.add([],s._.add([],_,I),C)),V=[];let U;if(new Pf(y,D).closestPointOnSphere(b,v,V)){const j=s._.add([],V,b),X=s._.sub([],j,y);U=Math.cos(o.fovAboveCenter)*s._.length(X)}else{const j=s._.sub([],y,b),X=s._.sub([],b,y);s._.normalize(X,X);const H=s._.length(j)-v;U=Math.sqrt(H*(H+2*v));const ie=Math.acos(U/(v+H))-Math.acos(s._.dot(_,X));U*=Math.cos(ie)}return 1.01*U}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),n=So(e.zoom);if(n>0){const o=ry(e,lr(1,e.center.lat)*e.worldSize),l=e.worldSize/(2*Math.PI),c=Math.max(e.width,e.height)/e.worldSize*Math.PI;return tt(i,o+l*(1-Math.cos(c)),Math.pow(n,10))}return i}upVector(e,i,n){return Wu(i,n,e,1)}upVectorScale(e){return{metersToTile:Rd(Od(Vn(e)))}}}function cy(t){const e=t.parallels,i=!!e&&Math.abs(e[0]+e[1])<.01;switch(t.name){case"mercator":return new oy(t);case"equirectangular":return new jv(t);case"naturalEarth":return new qv(t);case"equalEarth":return new Uv(t);case"winkelTripel":return new Zv(t);case"albers":return i?new ly(t):new Vv(t);case"lambertConformalConic":return i?new ly(t):new Gv(t);case"globe":return new $v(t)}throw new Error(`Invalid projection name: ${t.name}`)}class Fa{constructor(e,i,n,o){this.id=Fa.uniqueIdxCounter,Fa.uniqueIdxCounter++,this.context=e;const l=e.gl;this.buffer=l.createBuffer(),this.dynamicDraw=!!n,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||o||i.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){this.id=Fa.uniqueIdxCounter,Fa.uniqueIdxCounter++;const i=this.context.gl;this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}Fa.uniqueIdxCounter=0;class uc{constructor(e,i,n){this.func=e,this.mask=i,this.range=n}}uc.ReadOnly=!1,uc.ReadWrite=!0,uc.disabled=new uc(519,uc.ReadOnly,[0,1]);const om=7680;class sm{constructor(e,i,n,o,l,c){this.test=e,this.ref=i,this.mask=n,this.fail=o,this.depthFail=l,this.pass=c}}sm.disabled=new sm({func:519,mask:0},0,0,om,om,om);const uh=771;class Er{constructor(e,i,n,o){this.blendFunction=e,this.blendColor=i,this.mask=n,this.blendEquation=o}}Er.Replace=[1,0,1,0],Er.disabled=new Er(Er.Replace,Nt.transparent,[!1,!1,!1,!1]),Er.unblended=new Er(Er.Replace,Nt.transparent,[!0,!0,!0,!0]),Er.alphaBlended=new Er([1,uh,1,uh],Nt.transparent,[!0,!0,!0,!0]),Er.alphaBlendedNonPremultiplied=new Er([770,uh,770,uh],Nt.transparent,[!0,!0,!0,!0]),Er.multiply=new Er([774,0,774,0],Nt.transparent,[!0,!0,!0,!0]);const am=1029,lm=2305;class yn{constructor(e,i,n){this.enable=e,this.mode=i,this.frontFace=n}}yn.disabled=new yn(!1,am,lm),yn.backCCW=new yn(!0,am,lm),yn.backCW=new yn(!0,am,2304),yn.frontCW=new yn(!0,1028,2304),yn.frontCCW=new yn(!0,1028,lm);const Wv=Gd.types,Hv=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function lp(t,e,i,n,o,l,c,d,p,_,y,v,b){const E=d?Math.min(As,Math.round(d[0])):0,S=d?Math.min(As,Math.round(d[1])):0;t.emplaceBack(e,i,Math.round(32*n),Math.round(32*o),l,c,(E<<1)+(p?1:0),S,16*_,16*y,256*v,256*b)}function cp(t,e,i){t.emplaceBack(e,i)}function up(t,e,i,n,o,l,c){t.emplaceBack(e,i,n,o,l,c)}function hp(t,e,i,n,o){t.emplaceBack(e,i,n,o),t.emplaceBack(e,i,n,o),t.emplaceBack(e,i,n,o),t.emplaceBack(e,i,n,o)}function Xv(t){for(const e of t.sections)if(Ve(e.text))return!0;return!1}class cm{constructor(e){this.layoutVertexArray=new Jp,this.indexArray=new Ri,this.programConfigurations=e,this.segments=new pi,this.dynamicLayoutVertexArray=new gs,this.opacityVertexArray=new ef,this.occlusionQueryOpacityVertexArray=new Aa,this.placedSymbolArray=new Vm,this.iconTransitioningVertexArray=new vs,this.globeExtVertexArray=new Qp,this.zOffsetVertexArray=new Aa}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,n,o,l){this.isEmpty()||(n&&(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Yx.members),this.indexBuffer=e.createIndexBuffer(this.indexArray,i),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,Jx.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Hv,!0),this.occlusionQueryOpacityVertexBuffer=e.createVertexBuffer(this.occlusionQueryOpacityVertexArray,Hf.members,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,Qx.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Kx.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||l)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,yg.members,!0)),this.opacityVertexBuffer.itemSize=1),(n||o)&&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.occlusionQueryOpacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy())}}N(cm,"SymbolBuffers");class um{constructor(e,i,n){this.layoutVertexArray=new e,this.layoutAttributes=i,this.indexArray=new n,this.segments=new pi,this.collisionVertexArray=new nf,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,ev.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,tv.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.de
7stroy())}}N(um,"CollisionBuffers");class hc{constructor(e){this.queries=new Map,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(c=>c.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=s.ad.identity([]),this.placementViewportMatrix=s.ad.identity([]);const i=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Yf(this.zoom,i["text-size"]),this.iconSizeData=Yf(this.zoom,i["icon-size"]);const n=this.layers[0].layout,o=n.get("symbol-sort-key"),l=n.get("symbol-z-order");this.canOverlap=n.get("text-allow-overlap")||n.get("icon-allow-overlap")||n.get("text-ignore-placement")||n.get("icon-ignore-placement"),this.sortFeaturesByKey=l!=="viewport-y"&&o.constantOr(1)!==void 0,this.sortFeaturesByY=(l==="viewport-y"||l==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=n.get("text-writing-mode").map(c=>Nr[c]),this.stateDependentLayerIds=this.layers.filter(c=>c.isStateDependent()).map(c=>c.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=n.get("symbol-z-elevate"),this.activeReplacements=[],this.replacementUpdateTime=0}createArrays(){this.text=new cm(new ws(this.layers,{zoom:this.zoom,lut:this.lut},e=>/^text/.test(e))),this.icon=new cm(new ws(this.layers,{zoom:this.zoom,lut:this.lut},e=>/^icon/.test(e))),this.glyphOffsetArray=new Gm,this.lineVertexArray=new qm,this.symbolInstances=new jm}calculateGlyphDependencies(e,i,n,o,l){for(let c=0;c<e.length;c++){const d=e.codePointAt(c);if(d===void 0)break;if(i[d]=!0,o&&l&&d<=65535){const p=rh[e.charAt(c)];p&&(i[p.charCodeAt(0)]=!0)}}}updateFootprints(e,i){}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!$f(this.activeReplacements,n)&&(this.activeReplacements=n,!0)}populate(e,i,n,o){const l=this.layers[0],c=l.layout,d=this.projection.name==="globe",p=c.get("text-font"),_=c.get("text-field"),y=c.get("icon-image"),v=(_.value.kind!=="constant"||_.value.value instanceof Bi&&!_.value.value.isEmpty()||_.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),b=y.value.kind!=="constant"||!!y.value.value||Object.keys(y.parameters).length>0,E=c.get("symbol-sort-key");if(this.features=[],!v&&!b)return;const S=i.iconDependencies,I=i.glyphDependencies,C=i.availableImages,D=new st(this.zoom);for(const{feature:V,id:U,index:j,sourceLayerIndex:X}of e){const H=l._featureFilter.needGeometry,ie=To(V,H);if(!l._featureFilter.filter(D,ie,n))continue;if(H||(ie.geometry=mn(V,n,o)),d&&V.type!==1&&n.z<=5){const pe=ie.geometry,Te=.98078528056,ze=(be,Ae)=>{const xe=Wu(be.x,be.y,n,1),Ce=Wu(Ae.x,Ae.y,n,1);return s._.dot(xe,Ce)<Te};for(let be=0;be<pe.length;be++)pe[be]=L0(pe[be],ze)}let ne,ue;if(v){const pe=l.getValueAndResolveTokens("text-field",ie,n,C),Te=Bi.factory(pe);Xv(Te)&&(this.hasRTLText=!0),(!this.hasRTLText||It()==="unavailable"||this.hasRTLText&&St.isParsed())&&(ne=bv(Te,l,ie))}if(b){const pe=l.getValueAndResolveTokens("icon-image",ie,n,C);ue=pe instanceof dr?pe:dr.fromString(pe)}if(!ne&&!ue)continue;const ye=this.sortFeaturesByKey?E.evaluate(ie,{},n):void 0;if(this.features.push({id:U,text:ne,icon:ue,index:j,sourceLayerIndex:X,geometry:ie.geometry,properties:V.properties,type:Wv[V.type],sortKey:ye}),ue&&(S[ue.namePrimary]=!0,ue.nameSecondary&&(S[ue.nameSecondary]=!0)),ne){const pe=p.evaluate(ie,{},n).join(","),Te=c.get("text-rotation-alignment")==="map"&&c.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Nr.vertical)>=0;for(const ze of ne.sections)if(ze.image)S[ze.image.namePrimary]=!0;else{const be=fe(ne.toString()),Ae=ze.fontStack||pe,xe=I[Ae]=I[Ae]||{};this.calculateGlyphDependencies(ze.text,xe,Te,this.allowVerticalPlacement,be)}}}c.get("symbol-placement")==="line"&&(this.features=function(V){const U={},j={},X=[];let H=0;function ie(pe){X.push(V[pe]),H++}function ne(pe,Te,ze){const be=j[pe];return delete j[pe],j[Te]=be,X[be].geometry[0].pop(),X[be].geometry[0]=X[be].geometry[0].concat(ze[0]),be}function ue(pe,Te,ze){const be=U[Te];return delete U[Te],U[pe]=be,X[be].geometry[0].shift(),X[be].geometry[0]=ze[0].concat(X[be].geometry[0]),be}function ye(pe,Te,ze){const be=ze?Te[0][Te[0].length-1]:Te[0][0];return`${pe}:${be.x}:${be.y}`}for(let pe=0;pe<V.length;pe++){const Te=V[pe],ze=Te.geometry,be=Te.text?Te.text.toString():null;if(!be){ie(pe);continue}const Ae=ye(be,ze),xe=ye(be,ze,!0);if(Ae in j&&xe in U&&j[Ae]!==U[xe]){const Ce=ue(Ae,xe,ze),Re=ne(Ae,xe,X[Ce].geometry);delete U[Ae],delete j[xe],j[ye(be,X[Re].geometry,!0)]=Re,X[Ce].geometry=null}else Ae in j?ne(Ae,xe,ze):xe in U?ue(Ae,xe,ze):(ie(pe),U[Ae]=H-1,j[xe]=H-1)}return X.filter(pe=>pe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((V,U)=>V.sortKey-U.sortKey)}update(e,i,n,o,l){const c=Object.keys(e).length!==0;if(c&&!this.stateDependentLayers.length)return;const d=c?this.stateDependentLayers:this.layers;this.text.programConfigurations.updatePaintArrays(e,i,d,n,o,l),this.icon.programConfigurations.updatePaintArrays(e,i,d,n,o,l)}updateOcclusionOpacities(e,i,n){if(!i.useOcclusionQueries)return!1;const o=this;if(o.projection.name==="globe")return!1;let l=!1;o.hasTextData()&&(l=l||o.text.occlusionQueryOpacityVertexArray.length!==0),o.hasIconData()&&(l=l||o.icon.occlusionQueryOpacityVertexArray.length!==0);const c=o.layers[0].paint,d=c.get("icon-occlusion-opacity").constantOr(0),p=c.get("text-occlusion-opacity").constantOr(0);if(!o.layers[0].hasInitialOcclusionOpacityProperties||d===1&&p===1)return!1;let _=!l;for(let E=0;E<o.symbolInstances.length;E++){const S=o.symbolInstances.get(E),I=S.occlusionOpacity;S.occlusionOpacity+=(S.occlusionState>.5?1:-1)*i.fadeSpeed*n*.001,S.occlusionOpacity=ft(S.occlusionOpacity,0,1),_=_||S.occlusionOpacity!==I}if(!_)return!1;let y=0,v=0;const b=(E,S,I,C)=>{let D=0,V=0;I?(D=v,v+=C,V=v):(D=y,y+=C,V=y),V>S.occlusionQueryOpacityVertexArray.length&&S.occlusionQueryOpacityVertexArray.resize(V);const U=E.occlusionOpacity;for(let j=0;j<C;j++)S.occlusionQueryOpacityVertexArray.emplace(j+D,U)};for(let E=0;E<o.symbolInstances.length;E++){const S=o.symbolInstances.get(E),{numHorizontalGlyphVertices:I,numVerticalGlyphVertices:C,numIconVertices:D}=S,V=D>0;if((I>0||C>0)&&(b(S,o.text,!1,I),b(S,o.text,!1,C)),V){const{placedIconSymbolIndex:U,verticalPlacedIconSymbolIndex:j}=S;U>=0&&b(S,o.icon,!0,D),j>=0&&b(S,o.icon,!0,S.numVerticalIconVertices)}}return o.hasTextData()&&o.text.occlusionQueryOpacityVertexBuffer&&(o.text.occlusionQueryOpacityVertexBuffer.length<o.text.occlusionQueryOpacityVertexArray.length?o.text.occlusionQueryOpacityVertexBuffer=e.createVertexBuffer(o.text.occlusionQueryOpacityVertexArray,Hf.members,!0):o.text.occlusionQueryOpacityVertexBuffer.updateData(o.text.occlusionQueryOpacityVertexArray)),o.hasIconData()&&o.icon.occlusionQueryOpacityVertexBuffer&&(o.icon.occlusionQueryOpacityVertexBuffer.length<o.icon.occlusionQueryOpacityVertexArray.length?o.icon.occlusionQueryOpacityVertexBuffer=e.createVertexBuffer(o.icon.occlusionQueryOpacityVertexArray,Hf.members,!0):o.icon.occlusionQueryOpacityVertexBuffer.updateData(o.icon.occlusionQueryOpacityVertexArray)),!0}updateZOffset(){const e=(l,c,d)=>{n+=c,n>l.length&&l.resize(n);for(let p=-c;p<0;p++)l.emplace(p+n,d)},i=(l,c,d)=>{o+=c,o>l.length&&l.resize(o);for(let p=-c;p<0;p++)l.emplace(p+o,d)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let n=0,o=0;for(let l=0;l<this.symbolInstances.length;l++){const c=this.symbolInstances.get(l),{numHorizontalGlyphVertices:d,numVerticalGlyphVertices:p,numIconVertices:_}=c,y=c.zOffset,v=_>0;if((d>0||p>0)&&(e(this.text.zOffsetVertexArray,d,y),e(this.text.zOffsetVertexArray,p,y)),v){const{placedIconSymbolIndex:b,verticalPlacedIconSymbolIndex:E}=c;b>=0&&i(this.icon.zOffsetVertexArray,_,y),E>=0&&i(this.icon.zOffsetVertexArray,c.numVerticalIconVertices,y)}}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=cy(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData();for(const e of this.queries.values())e.destroy()}
7addToLineVertexArray(e,i){const n=this.lineVertexArray.length;if(e.segment!==void 0)for(const{x:o,y:l}of i)this.lineVertexArray.emplaceBack(o,l);return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(e,i,n,o,l,c,d,p,_,y,v,b,E,S,I,C){const D=e.indexArray,V=e.layoutVertexArray,U=e.globeExtVertexArray,j=e.segments.prepareSegment(4*i.length,V,D,this.canOverlap?c.sortKey:void 0),X=this.glyphOffsetArray.length,H=j.vertexLength,ie=this.allowVerticalPlacement&&d===Nr.vertical?Math.PI/2:0,ne=c.text&&c.text.sections;for(let ye=0;ye<i.length;ye++){const{tl:pe,tr:Te,bl:ze,br:be,texPrimary:Ae,texSecondary:xe,pixelOffsetTL:Ce,pixelOffsetBR:Re,minFontScaleX:Pe,minFontScaleY:Ze,glyphOffset:De,isSDF:Oe,sectionIndex:Qe}=i[ye],Je=j.vertexLength,Ye=De[1];if(lp(V,_.x,_.y,pe.x,Ye+pe.y,Ae.x,Ae.y,n,Oe,Ce.x,Ce.y,Pe,Ze),lp(V,_.x,_.y,Te.x,Ye+Te.y,Ae.x+Ae.w,Ae.y,n,Oe,Re.x,Ce.y,Pe,Ze),lp(V,_.x,_.y,ze.x,Ye+ze.y,Ae.x,Ae.y+Ae.h,n,Oe,Ce.x,Re.y,Pe,Ze),lp(V,_.x,_.y,be.x,Ye+be.y,Ae.x+Ae.w,Ae.y+Ae.h,n,Oe,Re.x,Re.y,Pe,Ze),p){const{x:ke,y:et,z:_t}=p.anchor,[ot,bt,gt]=p.up;up(U,ke,et,_t,ot,bt,gt),up(U,ke,et,_t,ot,bt,gt),up(U,ke,et,_t,ot,bt,gt),up(U,ke,et,_t,ot,bt,gt),hp(e.dynamicLayoutVertexArray,ke,et,_t,ie)}else hp(e.dynamicLayoutVertexArray,_.x,_.y,_.z,ie);if(C){const ke=xe||Ae;cp(e.iconTransitioningVertexArray,ke.x,ke.y),cp(e.iconTransitioningVertexArray,ke.x+ke.w,ke.y),cp(e.iconTransitioningVertexArray,ke.x,ke.y+ke.h),cp(e.iconTransitioningVertexArray,ke.x+ke.w,ke.y+ke.h)}D.emplaceBack(Je,Je+1,Je+2),D.emplaceBack(Je+1,Je+2,Je+3),j.vertexLength+=4,j.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(De[0]),ye!==i.length-1&&Qe===i[ye+1].sectionIndex||e.programConfigurations.populatePaintArrays(V.length,c,c.index,{},E,S,I,ne&&ne[Qe])}const ue=p?p.anchor:_;e.placedSymbolArray.emplaceBack(ue.x,ue.y,ue.z,_.x,_.y,X,this.glyphOffsetArray.length-X,H,y,v,_.segment,n?n[0]:0,n?n[1]:0,o[0],o[1],d,0,!1,0,b,0)}_commitLayoutVertex(e,i,n,o,l,c,d){e.emplaceBack(i,n,o,l,c,Math.round(d.x),Math.round(d.y))}_addCollisionDebugVertices(e,i,n,o,l,c,d){const p=n.segments.prepareSegment(4,n.layoutVertexArray,n.indexArray),_=p.vertexLength,y=d.tileAnchorX,v=d.tileAnchorY;for(let E=0;E<4;E++)n.collisionVertexArray.emplaceBack(0,0,0,0);this._commitDebugCollisionVertexUpdate(n.collisionVertexArrayExt,i,e.padding,d.zOffset),this._commitLayoutVertex(n.layoutVertexArray,o,l,c,y,v,new Ge(e.x1,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,o,l,c,y,v,new Ge(e.x2,e.y1)),this._commitLayoutVertex(n.layoutVertexArray,o,l,c,y,v,new Ge(e.x2,e.y2)),this._commitLayoutVertex(n.layoutVertexArray,o,l,c,y,v,new Ge(e.x1,e.y2)),p.vertexLength+=4;const b=n.indexArray;b.emplaceBack(_,_+1),b.emplaceBack(_+1,_+2),b.emplaceBack(_+2,_+3),b.emplaceBack(_+3,_),p.primitiveLength+=4}_addTextDebugCollisionBoxes(e,i,n,o,l,c){for(let d=o;d<l;d++){const p=n.get(d),_=this.getSymbolInstanceTextSize(e,c,i,d);this._addCollisionDebugVertices(p,_,this.textCollisionBox,p.projectedAnchorX,p.projectedAnchorY,p.projectedAnchorZ,c)}}_addIconDebugCollisionBoxes(e,i,n,o,l,c){for(let d=o;d<l;d++){const p=n.get(d),_=this.getSymbolInstanceIconSize(e,i,c.placedIconSymbolIndex);this._addCollisionDebugVertices(p,_,this.iconCollisionBox,p.projectedAnchorX,p.projectedAnchorY,p.projectedAnchorZ,c)}}generateCollisionDebugBuffers(e,i){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new um(Sd,xg.members,vs),this.iconCollisionBox=new um(Sd,xg.members,vs);const n=oc(this.iconSizeData,e),o=oc(this.textSizeData,e);for(let l=0;l<this.symbolInstances.length;l++){const c=this.symbolInstances.get(l);this._addTextDebugCollisionBoxes(o,e,i,c.textBoxStartIndex,c.textBoxEndIndex,c),this._addTextDebugCollisionBoxes(o,e,i,c.verticalTextBoxStartIndex,c.verticalTextBoxEndIndex,c),this._addIconDebugCollisionBoxes(n,e,i,c.iconBoxStartIndex,c.iconBoxEndIndex,c),this._addIconDebugCollisionBoxes(n,e,i,c.verticalIconBoxStartIndex,c.verticalIconBoxEndIndex,c)}}getSymbolInstanceTextSize(e,i,n,o){const l=this.text.placedSymbolArray.get(i.rightJustifiedTextSymbolIndex>=0?i.rightJustifiedTextSymbolIndex:i.centerJustifiedTextSymbolIndex>=0?i.centerJustifiedTextSymbolIndex:i.leftJustifiedTextSymbolIndex>=0?i.leftJustifiedTextSymbolIndex:i.verticalPlacedTextSymbolIndex>=0?i.verticalPlacedTextSymbolIndex:o),c=Qd(this.textSizeData,e,l)/Wi;return this.tilePixelRatio*c}getSymbolInstanceIconSize(e,i,n){const o=this.icon.placedSymbolArray.get(n),l=Qd(this.iconSizeData,e,o);return this.tilePixelRatio*l}_commitDebugCollisionVertexUpdate(e,i,n,o){e.emplaceBack(i,-n,-n,o),e.emplaceBack(i,n,-n,o),e.emplaceBack(i,n,n,o),e.emplaceBack(i,-n,n,o)}_updateTextDebugCollisionBoxes(e,i,n,o,l,c){for(let d=o;d<l;d++){const p=n.get(d),_=this.getSymbolInstanceTextSize(e,c,i,d);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,_,p.padding,c.zOffset)}}_updateIconDebugCollisionBoxes(e,i,n,o,l,c){for(let d=o;d<l;d++){const p=n.get(d),_=this.getSymbolInstanceIconSize(e,i,c.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,_,p.padding,c.zOffset)}}updateCollisionDebugBuffers(e,i){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const n=oc(this.iconSizeData,e),o=oc(this.textSizeData,e);for(let l=0;l<this.symbolInstances.length;l++){const c=this.symbolInstances.get(l);this._updateTextDebugCollisionBoxes(o,e,i,c.textBoxStartIndex,c.textBoxEndIndex,c),this._updateTextDebugCollisionBoxes(o,e,i,c.verticalTextBoxStartIndex,c.verticalTextBoxEndIndex,c),this._updateIconDebugCollisionBoxes(n,e,i,c.iconBoxStartIndex,c.iconBoxEndIndex,c),this._updateIconDebugCollisionBoxes(n,e,i,c.verticalIconBoxStartIndex,c.verticalIconBoxEndIndex,c)}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,n,o,l,c,d,p,_){const y={};if(i<n){const{x1:v,y1:b,x2:E,y2:S,padding:I,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:V,tileAnchorX:U,tileAnchorY:j,featureIndex:X}=e.get(i);y.textBox={x1:v,y1:b,x2:E,y2:S,padding:I,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:V,tileAnchorX:U,tileAnchorY:j},y.textFeatureIndex=X}if(o<l){const{x1:v,y1:b,x2:E,y2:S,padding:I,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:V,tileAnchorX:U,tileAnchorY:j,featureIndex:X}=e.get(o);y.verticalTextBox={x1:v,y1:b,x2:E,y2:S,padding:I,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:V,tileAnchorX:U,tileAnchorY:j},y.verticalTextFeatureIndex=X}if(c<d){const{x1:v,y1:b,x2:E,y2:S,padding:I,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:V,tileAnchorX:U,tileAnchorY:j,featureIndex:X}=e.get(c);y.iconBox={x1:v,y1:b,x2:E,y2:S,padding:I,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:V,tileAnchorX:U,tileAnchorY:j},y.iconFeatureIndex=X}if(p<_){const{x1:v,y1:b,x2:E,y2:S,padding:I,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:V,tileAnchorX:U,tileAnchorY:j,featureIndex:X}=e.get(p);y.verticalIconBox={x1:v,y1:b,x2:E,y2:S,padding:I,projectedAnchorX:C,projectedAnchorY:D,projectedAnchorZ:V,tileAnchorX:U,tileAnchorY:j},y.verticalIconFeatureIndex=X}return y}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let i=0;i<this.symbolInstances.length;i++){const n=this.symbolInstances.get(i);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,n.textBoxStartIndex,n.textBoxEndIndex,n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n.iconBoxStartIndex,n.iconBoxEndIndex,n.verticalIconBoxStartIndex,n.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 n=e.placedSymbolArray.get(i),o=n.vertexStartIndex+4*n.numGlyphs;for(let l=n.vertexStartIndex;l<o;l+=4)e.indexArray.emplaceBack(l,l+1,l+2),e.indexArray.emplaceBack(l+1,l+2,l+3)}
7getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const i=Math.sin(e),n=Math.cos(e),o=[],l=[],c=[];for(let d=0;d<this.symbolInstances.length;++d){c.push(d);const p=this.symbolInstances.get(d);o.push(0|Math.round(i*p.tileAnchorX+n*p.tileAnchorY)),l.push(p.featureIndex)}return c.sort((d,p)=>o[d]-o[p]||l[p]-l[d]),c}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 n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===i?n.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 n=this.symbolInstances.get(i);this.featureSortOrder.push(n.featureIndex);const{rightJustifiedTextSymbolIndex:o,centerJustifiedTextSymbolIndex:l,leftJustifiedTextSymbolIndex:c,verticalPlacedTextSymbolIndex:d,placedIconSymbolIndex:p,verticalPlacedIconSymbolIndex:_}=n;o>=0&&this.addIndicesForPlacedSymbol(this.text,o),l>=0&&l!==o&&this.addIndicesForPlacedSymbol(this.text,l),c>=0&&c!==l&&c!==o&&this.addIndicesForPlacedSymbol(this.text,c),d>=0&&this.addIndicesForPlacedSymbol(this.text,d),p>=0&&this.addIndicesForPlacedSymbol(this.icon,p),_>=0&&this.addIndicesForPlacedSymbol(this.icon,_)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}N(hc,"SymbolBucket",{omit:["layers","collisionBoxArray","features","compareText"]}),hc.addDynamicAttributes=hp;class nn{constructor(e,i,n,o){this.context=e,this.format=n,this.texture=e.gl.createTexture(),this.update(i,o)}update(e,i,n){const{width:o,height:l}=e,{context:c}=this,{gl:d}=c;if(d.bindTexture(d.TEXTURE_2D,this.texture),c.pixelStoreUnpackFlipY.set(!1),c.pixelStoreUnpack.set(1),c.pixelStoreUnpackPremultiplyAlpha.set(this.format===d.RGBA&&(!i||i.premultiply!==!1)),this.useMipmap=!!(i&&i.useMipmap),n||this.size&&this.size[0]===o&&this.size[1]===l){const{x:p,y:_}=n||{x:0,y:0};if(e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap)d.texSubImage2D(d.TEXTURE_2D,0,p,_,d.RGBA,d.UNSIGNED_BYTE,e);else{let y=this.format,v=d.UNSIGNED_BYTE;this.format===d.R32F&&(y=d.RED,v=d.FLOAT),d.texSubImage2D(d.TEXTURE_2D,0,p,_,o,l,y,v,e.data)}}else if(this.size=[o,l],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap){let p=this.format;this.format===d.R8&&(p=d.RED),d.texImage2D(d.TEXTURE_2D,0,this.format,p,d.UNSIGNED_BYTE,e)}else{let p=this.format,_=this.format,y=d.UNSIGNED_BYTE,v=!1;this.format===d.DEPTH_COMPONENT&&(p=d.DEPTH_COMPONENT16,y=d.UNSIGNED_SHORT),this.format===d.DEPTH_STENCIL&&(p=d.DEPTH24_STENCIL8,y=d.UNSIGNED_INT_24_8,v=!0),this.format===d.R8&&(_=d.RED),this.format===d.R32F&&(y=d.FLOAT,_=d.RED),!this.useMipmap&&v?d.texStorage2D(d.TEXTURE_2D,1,p,o,l):d.texImage2D(d.TEXTURE_2D,0,p,o,l,0,_,y,e.data)}this.useMipmap&&d.generateMipmap(d.TEXTURE_2D)}bind(e,i,n=!1){const{context:o}=this,{gl:l}=o;l.bindTexture(l.TEXTURE_2D,this.texture),e!==this.minFilter&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MAG_FILTER,e),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_MIN_FILTER,this.useMipmap&&!n?e===l.NEAREST?l.NEAREST_MIPMAP_NEAREST:l.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),i!==this.wrapS&&(l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_S,i),l.texParameteri(l.TEXTURE_2D,l.TEXTURE_WRAP_T,i),this.wrapS=i)}bindExtraParam(e,i,n,o){const{context:l}=this,{gl:c}=l;c.bindTexture(c.TEXTURE_2D,this.texture),i!==this.magFilter&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MAG_FILTER,i),this.magFilter=i),e!==this.minFilter&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_MIN_FILTER,this.useMipmap?e===c.NEAREST?c.NEAREST_MIPMAP_NEAREST:c.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),n!==this.wrapS&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_S,n),this.wrapS=n),o!==this.wrapT&&(c.texParameteri(c.TEXTURE_2D,c.TEXTURE_WRAP_T,o),this.wrapT=o)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class dp{constructor(e,i){this.context=e,this.texture=i}bind(e,i){const{context:n}=this,{gl:o}=n;
7o.bindTexture(o.TEXTURE_2D,this.texture),e!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,e),this.minFilter=e),i!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,i),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,i),this.wrapS=i)}}const on=32,jn=33,Ps=new Uint16Array(8184);for(let t=0;t<2046;t++){let e=t+2,i=0,n=0,o=0,l=0,c=0,d=0;for(1&e?o=l=c=on:i=n=d=on;(e>>=1)>1;){const _=i+o>>1,y=n+l>>1;1&e?(o=i,l=n,i=c,n=d):(i=o,n=l,o=c,l=d),c=_,d=y}const p=4*t;Ps[p+0]=i,Ps[p+1]=n,Ps[p+2]=o,Ps[p+3]=l}const Gn=new Uint16Array(2178),zs=new Uint8Array(1089),pp=new Uint16Array(1089);function uy(t){return t===0?-.03125:t===32?.03125:0}var fp=qt([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]),Yv=qt([{name:"a_index",type:"Int16",components:1}]);const hy={type:2,extent:Ne,loadGeometry:()=>[[new Ge(0,0),new Ge(Ne+1,0),new Ge(Ne+1,Ne+1),new Ge(0,Ne+1),new Ge(0,0)]]};class mp{constructor(e,i,n,o,l){this.tileID=e,this.uid=ul(),this.uses=0,this.tileSize=i,this.tileZoom=n,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=l,o&&o.style&&(this._lastUpdatedBrightness=o.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",o&&o.transform&&(this.projection=o.transform.projection)}registerFadeDuration(e){const i=e+this.timeAdded;i<Oi.now()||this.fadeEndTime&&i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}get tileTransform(){return this._tileTransform||(this._tileTransform=Ba(this.tileID.canonical,this.projection)),this._tileTransform}loadVectorData(e,i,n){if(this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(o,l){const c={};if(!l)return c;for(const d of o){const p=d.layerIds.map(_=>l.getLayer(_)).filter(Boolean);if(p.length!==0){d.layers=p,d.stateDependentLayerIds&&(d.stateDependentLayers=d.stateDependentLayerIds.map(_=>p.filter(y=>y.id===_)[0]));for(const _ of p)c[_.fqid]=d}}return c}(e.buckets,i.style),this.hasSymbolBuckets=!1;for(const o in this.buckets){const l=this.buckets[o];if(l instanceof hc){if(this.hasSymbolBuckets=!0,!n)break;l.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const o in this.buckets){const l=this.buckets[o];if(l instanceof hc&&l.hasRTLText){this.hasRTLText=!0,St.isLoading()||St.isLoaded()||It()!=="deferred"||oi();break}}this.queryPadding=0;for(const o in this.buckets){const l=this.buckets[o],c=i.style.getOwnLayer(o);if(!c)continue;const d=c.queryRadius(l);this.queryPadding=Math.max(this.queryPadding,d)}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage),e.lineAtlas&&(this.lineAtlas=e.lineAtlas),this._lastUpdatedBrightness=e.brightness}else this.collisionBoxArray=new df}unloadVectorData(){if(this.hasData()){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state="unloaded"}}getBucket(e){return this.buckets[e.fqid]}upload(e){for(const o in this.buckets){const l=this.buckets[o];l.uploadPending()&&l.upload(e)}const i=e.gl,n=this.imageAtlas;if(n&&!n.uploaded){const o=!!Object.keys(n.patternPositions).length;this.imageAtlasTexture=new nn(e,n.image,i.RGBA,{useMipmap:o}),this.imageAtlas.uploaded=!0}this.glyphAtlasImage&&(this.glyphAtlasTexture=new nn(e,this.glyphAtlasImage,i.R8),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new nn(e,this.lineAtlas.image,i.R8),this.lineAtlas.uploaded=!0)}prepare(e,i,n){if(this.imageAtlas&&this.imageAtlasTexture&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture,n),!i||!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData)return;const o=i.style.getBrightness();(this._lastUpdatedBrightness||o)&&(this._lastUpdatedBrightness&&o&&Math.abs(this._lastUpdatedBrightness-o)<.001||(this._lastUpdatedBrightness=o,this.updateBuckets(void 0,i)))}queryRenderedFeatures(e,i,n,o,l,c,d,p){return this.latestFeatureIndex&&(this.latestFeatureIndex.rawTileData||this.latestFeatureIndex.is3DTile)?this.latestFeatureIndex.query({tileResult:o,pixelPosMatrix:d,transform:c,params:l,tileTransform:this.tileTransform},e,i,n):{}}querySourceFeatures(e,i){const n=this.latestFeatureIndex;if(!n||!n.rawTileData)return;const o=n.loadVTLayers(),l=i?i.sourceLayer:"",c=o._geojsonTileLayer||o[l];if(!c)return;const d=Zi(i&&i.filter),{z:p,x:_,y}=this.tileID.canonical,v={z:p,x:_,y};for(let b=0;b<c.length;b++){const E=c.feature(b);if(d.needGeometry){const C=To(E,!0);
7if(!d.filter(new st(this.tileID.overscaledZ),C,this.tileID.canonical))continue}else if(!d.filter(new st(this.tileID.overscaledZ),E))continue;const S=n.getId(E,l),I=new Lg(E,p,_,y,S);I.tile=v,e.push(I)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}bucketsLoaded(){for(const e in this.buckets)if(this.buckets[e].uploadPending())return!1;return!0}patternsLoaded(){return!!this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const n=Vc(e.cacheControl);n["max-age"]&&(this.expirationTime=Date.now()+1e3*n["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const n=Date.now();let o=!1;if(this.expirationTime>n)o=!1;else if(i)if(this.expirationTime<i)o=!0;else{const l=this.expirationTime-i;l?this.expirationTime=n+Math.max(l,3e4):o=!0}else o=!0;o?(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)}setFeatureState(e,i){this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData&&Object.keys(e).length!==0&&i&&this.updateBuckets(e,i)}updateBuckets(e,i){if(!this.latestFeatureIndex)return;const n=this.latestFeatureIndex.loadVTLayers(),o=i.style.listImages(),l=i.style.getBrightness();for(const c in this.buckets){if(!i.style.hasLayer(c))continue;const d=this.buckets[c],p=d.layers[0].sourceLayer||"_geojsonTileLayer",_=n[p];let y={};if(e&&(y=e[p],!_||!y||Object.keys(y).length===0))continue;if(d.update(y,_,o,this.imageAtlas&&this.imageAtlas.patternPositions||{},l),d instanceof Xd||d instanceof Ud){const b=i.style.getOwnSourceCache(d.layers[0].source);i._terrain&&i._terrain.enabled&&b&&d.programConfigurations.needsUpload&&i._terrain._clearRenderCacheForTile(b.id,this.tileID)}const v=i&&i.style&&i.style.getOwnLayer(c);v&&(this.queryPadding=Math.max(this.queryPadding,v.queryRadius(d)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<Oi.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=Oi.now()+e}setTexture(e,i){const n=i.context,o=n.gl;this.texture=this.texture||i.getTileTexture(e.width),this.texture&&this.texture instanceof nn?this.texture.update(e,{useMipmap:!0}):(this.texture=new nn(n,e,o.RGBA,{useMipmap:!0}),this.texture.bind(o.LINEAR,o.CLAMP_TO_EDGE))}setDependencies(e,i){const n={};for(const o of i)n[o]=!0;this.dependencies[e]=n}hasDependency(e,i){for(const n of e){const o=this.dependencies[n];if(o){for(const l of i)if(o[l])return!0}}return!1}clearQueryDebugViz(){}_makeDebugTileBoundsBuffers(e,i){if(!i||i.name==="mercator"||this._tileDebugBuffer)return;const n=mn(hy,this.tileID.canonical,this.tileTransform)[0],o=new pn,l=new Vu;for(let c=0;c<n.length;c++){const{x:d,y:p}=n[c];o.emplaceBack(d,p),l.emplaceBack(c)}l.emplaceBack(0),this._tileDebugIndexBuffer=e.createIndexBuffer(l),this._tileDebugBuffer=e.createVertexBuffer(o,$u.members),this._tileDebugSegments=pi.simpleSegment(0,0,o.length,l.length)}_makeTileBoundsBuffers(e,i){if(this._tileBoundsBuffer||!i||i.name==="mercator")return;const n=mn(hy,this.tileID.canonical,this.tileTransform)[0];let o,l;if(this.isRaster){const c=function(d,p){const _=Ba(d,p),y=Math.pow(2,d.z);for(let C=0;C<jn;C++)for(let D=0;D<jn;D++){const V=mr((d.x+(D+uy(D))/on)/y),U=Fi((d.y+(C+uy(C))/on)/y),j=p.project(V,U),X=C*jn+D;Gn[2*X+0]=Math.round((j.x*_.scale-_.x)*Ne),Gn[2*X+1]=Math.round((j.y*_.scale-_.y)*Ne)}zs.fill(0),pp.fill(0);for(let C=2045;C>=0;C--){const D=4*C,V=Ps[D+0],U=Ps[D+1],j=Ps[D+2],X=Ps[D+3],H=V+j>>1,ie=U+X>>1,ne=H+ie-U,ue=ie+V-H,ye=U*jn+V,pe=X*jn+j,Te=ie*jn+H,ze=Math.hypot((Gn[2*ye+0]+Gn[2*pe+0])/2-Gn[2*Te+0],(Gn[2*ye+1]+Gn[2*pe+1])/2-Gn[2*Te+1])>=16;zs[Te]=zs[Te]||(ze?1:0),C<1022&&(zs[Te]=zs[Te]||zs[(U+ue>>1)*jn+(V+ne>>1)]||zs[(X+ue>>1)*jn+(j+ne>>1)])}const v=new _s,b=new Ri;let E=0;function S(C,D){const V=D*jn+C;return pp[V]===0&&(v.emplaceBack(Gn[2*V+0],Gn[2*V+1],C*Ne/on,D*Ne/on),pp[V]=++E),pp[V]-1}function I(C,D,V,U,j,X){const H=C+V>>1,ie=D+U>>1;
7if(Math.abs(C-j)+Math.abs(D-X)>1&&zs[ie*jn+H])I(j,X,C,D,H,ie),I(V,U,j,X,H,ie);else{const ne=S(C,D),ue=S(V,U),ye=S(j,X);b.emplaceBack(ne,ue,ye)}}return I(0,0,on,on,on,0),I(on,on,0,0,0,on),{vertices:v,indices:b}}(this.tileID.canonical,i);o=c.vertices,l=c.indices}else{o=new _s,l=new Ri;for(const{x:d,y:p}of n)o.emplaceBack(d,p,0,0);const c=Yu(o.int16,void 0,4);for(let d=0;d<c.length;d+=3)l.emplaceBack(c[d],c[d+1],c[d+2])}this._tileBoundsBuffer=e.createVertexBuffer(o,fp.members),this._tileBoundsIndexBuffer=e.createIndexBuffer(l),this._tileBoundsSegments=pi.simpleSegment(0,0,o.length,l.length)}_makeGlobeTileDebugBuffers(e,i){const n=i.projection;if(!n||n.name!=="globe"||i.freezeTileCoverage)return;const o=this.tileID.canonical,l=Hu(g_(o,i)),c=So(i.zoom);let d;c>0&&(d=s.ad.invert(new Float64Array(16),i.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(e,o,i,l,d,c),this._makeGlobeTileDebugTextBuffer(e,o,i,l,d,c)}_globePoint(e,i,n,o,l,c,d){let p=Wu(e,i,n);if(c){const _=1<<n.z,y=Fn(o.center.lng),v=Nn(o.center.lat),b=(n.x+.5)/_-y;let E=0;b>.5?E=-1:b<-.5&&(E=1);let S=(e/Ne+n.x)/_+E,I=(i/Ne+n.y)/_;S=(S-y)*o._pixelsPerMercatorPixel+y,I=(I-v)*o._pixelsPerMercatorPixel+v;const C=[S*o.worldSize,I*o.worldSize,0];s._.transformMat4(C,C,c),p=Eo(p,C,d)}return s._.transformMat4(p,p,l)}_makeGlobeTileDebugBorderBuffer(e,i,n,o,l,c){const d=new pn,p=new Vu,_=new wd,y=(b,E,S,I,C)=>{const D=(S-b)/(C-1),V=(I-E)/(C-1),U=d.length;for(let j=0;j<C;j++){const X=b+j*D,H=E+j*V;d.emplaceBack(X,H);const ie=this._globePoint(X,H,i,n,o,l,c);_.emplaceBack(ie[0],ie[1],ie[2]),p.emplaceBack(U+j)}},v=Ne;y(0,0,v,0,16),y(v,0,v,v,16),y(v,v,0,v,16),y(0,v,0,0,16),this._tileDebugIndexBuffer=e.createIndexBuffer(p),this._tileDebugBuffer=e.createVertexBuffer(d,$u.members),this._globeTileDebugBorderBuffer=e.createVertexBuffer(_,m_.members),this._tileDebugSegments=pi.simpleSegment(0,0,d.length,p.length)}_makeGlobeTileDebugTextBuffer(e,i,n,o,l,c){const d=Ne/4,p=new pn,_=new Ri,y=new wd,v=25;_.reserve(32),p.reserve(v),y.reserve(v);const b=(E,S)=>v*E+S;for(let E=0;E<v;E++){const S=E*d;for(let I=0;I<v;I++){const C=I*d;p.emplaceBack(C,S);const D=this._globePoint(C,S,i,n,o,l,c);y.emplaceBack(D[0],D[1],D[2])}}for(let E=0;E<4;E++)for(let S=0;S<4;S++){const I=b(E,S),C=b(E,S+1),D=b(E+1,S),V=b(E+1,S+1);_.emplaceBack(I,C,D),_.emplaceBack(D,C,V)}this._tileDebugTextIndexBuffer=e.createIndexBuffer(_),this._tileDebugTextBuffer=e.createVertexBuffer(p,$u.members),this._globeTileDebugTextBuffer=e.createVertexBuffer(y,m_.members),this._tileDebugTextSegments=pi.simpleSegment(0,0,v,32)}destroy(e=!1){for(const i in this.buckets)this.buckets[i].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),!e&&this.texture&&this.texture instanceof nn&&(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"}}function Kv(t,e,i){t===1?e.header_length=i.readFixed32():t===2?e.x=i.readVarint():t===3?e.y=i.readVarint():t===4?e.z=i.readVarint():t===5&&e.layers.push(function(n,o){return n.readFields(i1,{version:0,name:"",units:"",tilesize:0,buffer:0,pixel_format:0,data_index:[]},o)}(i,i.readVarint()+i.pos))}function Jv(t,e,i){t===1?(e.delta_filter=function(n,o){return n.readFields(Qv,{block_size:0},o)}(i,i.readVarint()+i.pos),e.filter="delta_filter"):t===2?(i.readVarint(),e.filter="zigzag_filter"):t===3?(i.readVarint(),e.filter="bitshuffle_filter"):t===4&&(i.readVarint(),e.filter="byteshuffle_filter")}function Qv(t,e,i){t===1&&(e.block_size=i.readVarint())}function e1(t,e,i){t===1?(i.readVarint(),e.codec="gzip_data"):t===2?(i.readVarint(),e.codec="jpeg_image"):t===3?(i.readVarint(),e.codec="webp_image"):t===4&&(i.readVarint(),e.codec="png_image")}function t1(t,e,i){t===1?e.first_byte=i.readFixed64():t===2?e.last_byte=i.readFixed64():t===3?e.filters.push(function(n,o){return n.readFields(Jv,{},o)}(i,i.readVarint()+i.pos)):t===4?e.codec=function(n,o){return n.readFields(e1,{},o)}
7(i,i.readVarint()+i.pos):t===5?e.offset=i.readFloat():t===6?e.scale=i.readFloat():t===7&&e.bands.push(i.readString())}function i1(t,e,i){t===1?e.version=i.readVarint():t===2?e.name=i.readString():t===3?e.units=i.readString():t===4?e.tilesize=i.readVarint():t===5?e.buffer=i.readVarint():t===6?e.pixel_format=i.readVarint():t===7&&e.data_index.push(function(n,o){return n.readFields(t1,{first_byte:0,last_byte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},o)}(i,i.readVarint()+i.pos))}function r1(t,e,i){if(t===2)(function(n,o,l){n.readFields(n1,l,o)})(i,i.readVarint()+i.pos,e);else if(t===3)throw new Error("Not implemented")}function n1(t,e,i){if(t===1){let n=0;const o=i.readVarint()+i.pos;for(;i.pos<o;)e[n++]=i.readVarint()}}/**
8 * tiny-lru
9 *
10 * @copyright 2024 Jason Mulligan <[email protected]>
11 * @license BSD-3-Clause
12 * @version 11.2.11
13 */class o1{constructor(e=0,i=0,n=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=n,this.size=0,this.ttl=i}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){const i=this.items[e];delete this.items[e],this.size--,i.prev!==null&&(i.prev.next=i.next),i.next!==null&&(i.next.prev=i.prev),this.first===i&&(this.first=i.next),this.last===i&&(this.last=i.prev)}return this}entries(e=this.keys()){return e.map(i=>[i,this.get(i)])}evict(e=!1){if(e||this.size>0){const i=this.first;delete this.items[i.key],--this.size==0?(this.first=null,this.last=null):(this.first=i.next,this.first.prev=null)}return this}expiresAt(e){let i;return this.has(e)&&(i=this.items[e].expiry),i}get(e){let i;if(this.has(e)){const n=this.items[e];this.ttl>0&&n.expiry<=Date.now()?this.delete(e):(i=n.value,this.set(e,i,!0))}return i}has(e){return e in this.items}keys(){const e=[];let i=this.first;for(;i!==null;)e.push(i.key),i=i.next;return e}set(e,i,n=!1,o=this.resetTtl){let l;if(n||this.has(e)){if(l=this.items[e],l.value=i,n===!1&&o&&(l.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==l){const c=this.last,d=l.next,p=l.prev;this.first===l&&(this.first=l.next),l.next=null,l.prev=this.last,c.next=l,p!==null&&(p.next=d),d!==null&&(d.prev=p)}}else this.max>0&&this.size===this.max&&this.evict(!0),l=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:i},++this.size==1?this.first=l:this.last.next=l;return this.last=l,this}values(e=this.keys()){return e.map(i=>this.get(i))}}function s1(t,e){if(e.length!==4)throw new Error(`Expected data of dimension 4 but got ${e.length}.`);let i=e[3];for(let n=2;n>=1;n--){const o=n===1?1:0,l=n===2?1:0;for(let c=0;c<e[0];c++){const d=e[1]*c;for(let p=o;p<e[1];p++){const _=e[2]*(p+d);for(let y=l;y<e[2];y++){const v=e[3]*(y+_);for(let b=0;b<e[3];b++){const E=v+b;t[E]+=t[E-i]}}}}i*=e[n]}return t}function a1(t){for(let e=0,i=t.length;e<i;e++)t[e]=t[e]>>>1^-(1&t[e]);return t}function l1(t,e){switch(e){case"uint32":return t;case"uint16":for(let i=0;i<t.length;i+=2){const n=t[i],o=t[i+1];t[i]=(240&n)>>4|(61440&n)>>8|(240&o)<<4|61440&o,t[i+1]=15&n|(3840&n)>>4|(15&o)<<8|(3840&o)<<4}return t;case"uint8":for(let i=0;i<t.length;i+=4){const n=t[i],o=t[i+1],l=t[i+2],c=t[i+3];t[i+0]=(192&n)>>6|(192&o)>>4|(192&l)>>2|192&c,t[i+1]=(48&n)>>4|(48&o)>>2|48&l|(48&c)<<2,t[i+2]=(12&n)>>2|12&o|(12&l)<<2|(12&c)<<4,t[i+3]=3&n|(3&o)<<2|(3&l)<<4|(3&c)<<6}return t;default:throw new Error(`Invalid pixel format, "${e}"`)}}class Ds extends Error{constructor(e){super(e),this.name="MRTError"}}var Vr=Uint8Array,hh=Uint16Array,c1=Int32Array,dy=new Vr([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]),py=new Vr([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]),u1=new Vr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fy=function(t,e){for(var i=new hh(31),n=0;n<31;++n)i[n]=e+=1<<t[n-1];var o=new c1(i[30]);for(n=1;n<30;++n)for(var l=i[n];l<i[n+1];++l)o[l]=l-i[n]<<5|n;return{b:i,r:o}},my=fy(dy,2),_y=my.b,h1=my.r;_y[28]=258,h1[258]=28;for(var d1=fy(py,0).b,gy=new hh(32768),Mi=0;Mi<32768;++Mi){var dc=(43690&Mi)>>1|(21845&Mi)<<1;gy[Mi]=((65280&(dc=(61680&(dc=(52428&dc)>>2|(13107&dc)<<2))>>4|(3855&dc)<<4))>>8|(255&dc)<<8)>>1}
13var dh=function(t,e,i){for(var n=t.length,o=0,l=new hh(e);o<n;++o)t[o]&&++l[t[o]-1];var c,d=new hh(e);for(o=1;o<e;++o)d[o]=d[o-1]+l[o-1]<<1;{c=new hh(1<<e);var p=15-e;for(o=0;o<n;++o)if(t[o])for(var _=o<<4|t[o],y=e-t[o],v=d[t[o]-1]++<<y,b=v|(1<<y)-1;v<=b;++v)c[gy[v]>>p]=_}return c},ph=new Vr(288);for(Mi=0;Mi<144;++Mi)ph[Mi]=8;for(Mi=144;Mi<256;++Mi)ph[Mi]=9;for(Mi=256;Mi<280;++Mi)ph[Mi]=7;for(Mi=280;Mi<288;++Mi)ph[Mi]=8;var yy=new Vr(32);for(Mi=0;Mi<32;++Mi)yy[Mi]=5;var p1=dh(ph,9),f1=dh(yy,5),hm=function(t){for(var e=t[0],i=1;i<t.length;++i)t[i]>e&&(e=t[i]);return e},xn=function(t,e,i){var n=e/8|0;return(t[n]|t[n+1]<<8)>>(7&e)&i},dm=function(t,e){var i=e/8|0;return(t[i]|t[i+1]<<8|t[i+2]<<16)>>(7&e)},m1=["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"],vn=function(t,e,i){var n=new Error(e||m1[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,vn),!i)throw n;return n},_1=new Vr(0),g1=typeof TextDecoder<"u"&&new TextDecoder;try{g1.decode(_1,{stream:!0})}catch{}const y1={gzip_data:"gzip"},x1={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},v1={uint32:1,uint16:2,uint8:4},b1={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};class pm{constructor(e=1){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){return this.layers[e]}getHeaderLength(e){const i=new Uint8Array(e),n=new DataView(e);if(i[0]!==13)throw new Ds("File is not a valid MRT.");return n.getUint32(1,!0)}parseHeader(e){const i=new Uint8Array(e),n=this.getHeaderLength(e);if(i.length<n)throw new Ds(`Expected header with length >= ${n} but got buffer of length ${i.length}`);const o=function(l,c){return l.readFields(Kv,{header_length:0,x:0,y:0,z:0,layers:[]},void 0)}(new nc(i.subarray(0,n)));if(!isNaN(this.x)&&(this.x!==o.x||this.y!==o.y||this.z!==o.z))throw new Ds(`Invalid attempt to parse header ${o.z}/${o.x}/${o.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=o.x,this.y=o.y,this.z=o.z;for(const l of o.layers)this.layers[l.name]=new w1(l,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const i=[],n=this.getLayer(e.layerName);for(let o=0;o<n.dataIndex.length;o++){const l=n.dataIndex[o],c=l.first_byte-e.firstByte,d=l.last_byte+1-e.firstByte;if(o<e.firstBlock||o>e.lastBlock||n._blocksInProgress.has(o))continue;const p={layerName:n.name,firstByte:c,lastByte:d,pixelFormat:n.pixelFormat,blockIndex:o,blockShape:[l.bands.length].concat(n.bandShape),buffer:n.buffer,codec:l.codec.codec,filters:l.filters.map(_=>_.filter)};n._blocksInProgress.add(o),i.push(p)}return new xy(i,()=>{i.forEach(o=>n._blocksInProgress.delete(o.blockIndex))},(o,l)=>{if(i.forEach(c=>n._blocksInProgress.delete(c.blockIndex)),o)throw o;l.forEach(c=>{this.getLayer(c.layerName).processDecodedData(c)})})}}class w1{constructor({version:e,name:i,units:n,tilesize:o,pixel_format:l,buffer:c,data_index:d},p){if(this.version=e,this.version!==1)throw new Ds(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=i,this.units=n,this.tileSize=o,this.buffer=c,this.pixelFormat=x1[l],this.dataIndex=d,this.bandShape=[o+2*c,o+2*c,v1[this.pixelFormat]],this._decodedBlocks=function(_=1e3,y=0,v=!1){if(isNaN(_)||_<0)throw new TypeError("Invalid max value");if(isNaN(y)||y<0)throw new TypeError("Invalid ttl value");if(typeof v!="boolean")throw new TypeError("Invalid resetTtl value");return new o1(_,y,v)}(p?p.cacheSize:5),this._blocksInProgress=new Set}processDecodedData(e){const i=e.blockIndex.toString();this._decodedBlocks.get(i)||this._decodedBlocks.set(i,e.data)}getBlockForBand(e){let i=0;switch(typeof e){case"string":for(const[n,o]of this.dataIndex.entries()){for(const[l,c]of o.bands.entries())if(c===e)return{bandIndex:i+l,blockIndex:n,blockBandIndex:l};i+=o.bands.length}break;case"number":for(const[n,o]of this.dataIndex.entries()){if(e>=i&&e<i+o.bands.length)return{bandIndex:e,blockIndex:n,blockBandIndex:e-i};i+=o.bands.length}break;default:throw new Ds(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}throw new Ds(`Band not found: ${JSON.stringify(e)}`)}getDataRange(e){let i=1/0,n=-1/0,o=1/0,l=-1/0;for(const c of e){const{blockIndex:d}=this.getBlockForBand(c);if(d<0)throw new Ds(`Invalid band: ${JSON.stringify(c)}`);const p=this.dataIndex[d];o=Math.min(o,d),l=Math.max(l,d),i=Math.min(i,p.first_byte),n=Math.max(n,p.last_byte)}return{layerName:this.name,firstByte:i,lastByte:n,firstBlock:o,lastBlock:l}}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:n}=this.getBlockForBand(e),o=this._decodedBlocks.get(i.toString());if(!o)throw new Ds(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const l=this.dataIndex[i],c=this.bandShape.reduce((_,y)=>_*y,1),d=n*c,p=o.subarray(d,d+c);return{data:p,bytes:new Uint8Array(p.buffer).subarray(p.byteOffset,p.byteOffset+p.byteLength),tileSize:this.tileSize,buffer:this.buffer,offset:l.offset,scale:l.scale}}}class xy{constructor(e,i,n){this.tasks=e,this._onCancel=i,this._onComplete=n,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,i){this._finalized||(this._onComplete(e,i),this._finalized=!0)}}pm.performDecoding=function(t,e){return Promise.all(e.tasks.map(i=>{const{layerName:n,firstByte:o,lastByte:l,pixelFormat:c,blockShape:d,blockIndex:p,filters:_,codec:y}=i,v=new Uint8Array(t).subarray(o,l+1),b=new Uint32Array(d[0]*d[1]*d[2]);let E;if(y!=="gzip_data")throw new Error(`Unhandled codec: ${y}`);return E=function(S,I){if(!globalThis.DecompressionStream&&I==="gzip_data")return Promise.resolve(((U=function(H){H[0]==31&&H[1]==139&&H[2]==8||vn(6,"invalid gzip data");var ie=H[3],ne=10;4&ie&&(ne+=2+(H[10]|H[11]<<8));for(var ue=(ie>>3&1)+(ie>>4&1);ue>0;ue-=!H[ne++]);return ne+(2&ie)}(V=S))+8>V.length&&vn(6,"invalid gzip data"),function(H,ie,ne,ue){var ye=H.length;if(!ye||ie.f&&!ie.l)return ne||new Vr(0);var pe=!ne,Te=pe||ie.i!=2,ze=ie.i;pe&&(ne=new Vr(3*ye));var be,Ae,xe=function(Rs){var ks=ne.length;if(Rs>ks){var Ga=new Vr(Math.max(2*ks,Rs));Ga.set(ne),ne=Ga}},Ce=ie.f||0,Re=ie.p||0,Pe=ie.b||0,Ze=ie.l,De=ie.d,Oe=ie.m,Qe=ie.n,Je=8*ye;do{if(!Ze){Ce=xn(H,Re,1);var Ye=xn(H,Re+1,3);
13if(Re+=3,!Ye){var ke=H[(Rt=4+((Re+7)/8|0))-4]|H[Rt-3]<<8,et=Rt+ke;if(et>ye){ze&&vn(0);break}Te&&xe(Pe+ke),ne.set(H.subarray(Rt,et),Pe),ie.b=Pe+=ke,ie.p=Re=8*et,ie.f=Ce;continue}if(Ye==1)Ze=p1,De=f1,Oe=9,Qe=5;else if(Ye==2){var _t=xn(H,Re,31)+257,ot=xn(H,Re+10,15)+4,bt=_t+xn(H,Re+5,31)+1;Re+=14;for(var gt=new Vr(bt),Mt=new Vr(19),rt=0;rt<ot;++rt)Mt[u1[rt]]=xn(H,Re+3*rt,7);Re+=3*ot;var Yt=hm(Mt),Xt=(1<<Yt)-1,Ut=dh(Mt,Yt);for(rt=0;rt<bt;){var Rt,jt=Ut[xn(H,Re,Xt)];if(Re+=15&jt,(Rt=jt>>4)<16)gt[rt++]=Rt;else{var ni=0,ei=0;for(Rt==16?(ei=3+xn(H,Re,3),Re+=2,ni=gt[rt-1]):Rt==17?(ei=3+xn(H,Re,7),Re+=3):Rt==18&&(ei=11+xn(H,Re,127),Re+=7);ei--;)gt[rt++]=ni}}var _i=gt.subarray(0,_t),fi=gt.subarray(_t);Oe=hm(_i),Qe=hm(fi),Ze=dh(_i,Oe),De=dh(fi,Qe)}else vn(1);if(Re>Je){ze&&vn(0);break}}Te&&xe(Pe+131072);for(var er=(1<<Oe)-1,bi=(1<<Qe)-1,di=Re;;di=Re){var Ai=(ni=Ze[dm(H,Re)&er])>>4;if((Re+=15&ni)>Je){ze&&vn(0);break}if(ni||vn(2),Ai<256)ne[Pe++]=Ai;else{if(Ai==256){di=Re,Ze=null;break}var Ni=Ai-254;Ai>264&&(Ni=xn(H,Re,(1<<(cr=dy[rt=Ai-257]))-1)+_y[rt],Re+=cr);var Vi=De[dm(H,Re)&bi],ri=Vi>>4;if(Vi||vn(3),Re+=15&Vi,fi=d1[ri],ri>3){var cr=py[ri];fi+=dm(H,Re)&(1<<cr)-1,Re+=cr}if(Re>Je){ze&&vn(0);break}Te&&xe(Pe+131072);var Ao=Pe+Ni;if(Pe<fi){var sn=0-fi,wn=Math.min(fi,Ao);for(sn+Pe<0&&vn(3);Pe<wn;++Pe)ne[Pe]=(void 0)[sn+Pe]}for(;Pe<Ao;++Pe)ne[Pe]=ne[Pe-fi]}}ie.l=Ze,ie.p=di,ie.b=Pe,ie.f=Ce,Ze&&(Ce=1,ie.m=Oe,ie.d=De,ie.n=Qe)}while(!Ce);return Pe!=ne.length&&pe?(be=ne,((Ae=Pe)==null||Ae>be.length)&&(Ae=be.length),new Vr(be.subarray(0,Ae))):ne.subarray(0,Pe)}(V.subarray(U,-8),{i:2},new Vr(((C=V)[(D=C.length)-4]|C[D-3]<<8|C[D-2]<<16|C[D-1]<<24)>>>0))));var C,D,V,U;const j=y1[I];if(!j)throw new Error(`Unhandled codec: ${I}`);const X=new globalThis.DecompressionStream(j);return new Response(new Blob([S]).stream().pipeThrough(X)).arrayBuffer().then(H=>new Uint8Array(H))}(v,y).then(S=>(function(I,C){I.readFields(r1,C)}(new nc(S),b),new b1[c](b.buffer))),E.then(S=>{for(let I=_.length-1;I>=0;I--)switch(_[I]){case"delta_filter":s1(S,d);break;case"zigzag_filter":a1(S);break;case"bitshuffle_filter":l1(S,c);break;default:throw new Error(`Unhandled filter "${_[I]}"`)}return{layerName:n,blockIndex:p,data:S}}).catch(S=>{throw S})}))};class vy extends mp{constructor(e,i,n,o,l){super(e,i,n,o,l),this._workQueue=[],this._fetchQueue=[],this._isHeaderLoaded=!1}setTexture(e,i){const n=i.context,o=n.gl;this.texture=this.texture||i.getTileTexture(e.width),this.texture&&this.texture instanceof nn?this.texture.update(e,{useMipmap:!1,premultiply:!1}):this.texture=new nn(n,e,o.RGBA,{useMipmap:!1,premultiply:!1})}flushQueues(){for(;this._workQueue.length;)this._workQueue.pop()();for(;this._fetchQueue.length;)this._fetchQueue.pop()()}fetchHeader(e=16384,i){const n=this._mrt=new pm(30),o=Object.assign({},this.requestParams,{headers:{Range:"bytes=0-"+(e-1)}});return this.entireBuffer=null,this.request=Dn(o,(l,c,d,p)=>{if(l)i(l);else try{const _=n.getHeaderLength(c);if(_>e)return void(this.request=this.fetchHeader(_,i));n.parseHeader(c),this._isHeaderLoaded=!0;let y=0;for(const v of Object.values(n.layers))y=Math.max(y,v.dataIndex[v.dataIndex.length-1].last_byte);c.byteLength>=y&&(this.entireBuffer=c),i(null,this.entireBuffer||c,d,p)}catch(_){i(_)}}),this.request}fetchBand(e,i,n){const o=this._mrt;if(!this._isHeaderLoaded||!o)return void n(new Error("Tile header is not ready"));const l=this.actor;if(!l)return void n(new Error("Can't fetch tile band without an actor"));let c;const d=(v,b)=>{c.complete(v,b),v?n(v):(this.updateTextureDescriptor(e,i),n(null,this.textureDescriptor&&this.textureDescriptor.img))},p=(v,b)=>{if(v)return n(v);const E=l.send("decodeRasterArray",{buffer:b,task:c},d,void 0,!0);this._workQueue.push(()=>{E&&E.cancel(),c.cancel()})},_=o.getLayer(e);if(!_)return void n(new Error(`Unknown sourceLayer "${e}"`));if(_.hasDataForBand(i))return this.updateTextureDescriptor(e,i),void n(null,this.textureDescriptor?this.textureDescriptor.img:null);const y=_.getDataRange([i]);if(c=o.createDecodingTask(y),!c||c.tasks.length)if(this.flushQueues(),this.entireBuffer)p(null,this.entireBuffer.slice(y.firstByte,y.lastByte+1));else{const v=Object.assign({}
13,this.requestParams,{headers:{Range:`bytes=${y.firstByte}-${y.lastByte}`}}),b=Dn(v,p);this._fetchQueue.push(()=>{b.cancel(),c.cancel()})}else n(null)}updateNeeded(e,i){return(!this.textureDescriptor||this.textureDescriptor.band!==i||this.textureDescriptor.layer!==e)&&this.state!=="errored"}updateTextureDescriptor(e,i){if(!this._mrt)return;const n=this._mrt.getLayer(e);if(!n||!n.hasBand(i)||!n.hasDataForBand(i))return;const{bytes:o,tileSize:l,buffer:c,offset:d,scale:p}=n.getBandView(i),_=l+2*c,y={data:o,width:_,height:_},v=this.texture;v&&v instanceof nn&&v.update(y,{useMipmap:!1,premultiply:!1}),this.textureDescriptor={layer:e,band:i,img:y,buffer:c,offset:d,tileSize:l,format:n.pixelFormat,mix:[p,256*p,65536*p,16777216*p]}}}class T1{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(const e in this.data)for(const i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,n){const o=e.wrapped().key;this.data[o]===void 0&&(this.data[o]=[]);const l={value:i,timeout:void 0};if(n!==void 0&&(l.timeout=setTimeout(()=>{this.remove(e,l)},n)),this.data[o].push(l),this.order.push(o),this.order.length>this.max){const c=this._getAndRemoveByKey(this.order[0]);c&&this.onRemove(c)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){const i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;const n=e.wrapped().key,o=i===void 0?0:this.data[n].indexOf(i),l=this.data[n][o];return this.data[n].splice(o,1),l.timeout&&clearTimeout(l.timeout),this.data[n].length===0&&delete this.data[n],this.onRemove(l.value),this.order.splice(this.order.indexOf(n),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(e){const i=[];for(const n in this.data)for(const o of this.data[n])e(o.value)||i.push(o);for(const n of i)this.remove(n.value.tileID,n)}}class Na extends so{constructor(e,i,n){super(),this.id=e,this._onlySymbols=n,i.on("data",o=>{o.dataType==="source"&&o.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&o.dataType==="source"&&o.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),i.on("error",()=>{this._sourceErrored=!0}),this._source=i,this._tiles={},this._cache=new T1(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=i.minTileCacheSize,this._maxTileCacheSize=i.maxTileCacheSize,this._loadedParentTiles={},this.castsShadows=!1,this.tileCoverLift=0,this._coveredTiles={},this._shadowCasterTiles={},this._state=new yv,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(e){this.map=e,this._minTileCacheSize=this._minTileCacheSize===void 0&&e?e._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&e?e._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const e in this._tiles){const i=this._tiles[e];if(i.state!=="errored"&&(i.state!=="loaded"||!i.bucketsLoaded()))return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(e,i){return e.isSymbolTile=this._onlySymbols,e.isExtraShadowCaster=this._shadowCasterTiles[e.tileID.key],this._source.loadTile(e,i)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e)}_abortTile(e){if(this._source.abortTile)return this._source.abortTile(e)}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const i in this._tiles){const n=this._tiles[i];n.upload(e),n.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return kc(this._tiles).map(e=>e.tileID).sort(by).map(e=>e.key)}getRenderableIds(e,i){const n=[];for(const o in this._tiles)this._isIdRenderable(+o,e,i)&&n.push(this._tiles[o]);return e?n.sort((o,l)=>{const c=o.tileID,d=l.tileID,p=new Ge(c.canonical.x,c.canonical.y)._rotate(this.transform.angle),_=new Ge(d.canonical.x,d.canonical.y)._rotate(this.transform.angle);return c.overscaledZ-d.overscaledZ||_.y-p.y||_.x-p.x}).map(o=>o.tileID.key):n.map(o=>o.tileID).sort(by).map(o=>o.key)}hasRenderableParent(e){const i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i,n){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())&&(n||!this._shadowCasterTiles[e])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(+e,"reloading")}}_reloadTile(e,i){const n=this._tiles[e];n&&(n.state!=="loading"&&(n.state=i),this._loadTile(n,this._tileLoaded.bind(this,n,e,i)))}_tileLoaded(e,i,n,o){if(o)if(e.state="errored",o.status!==404)this._source.fire(new ln(o,{tile:e}));else{if(!(e.tileID.key in this._loadedParentTiles))return void this._source.fire(new hr("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id}));if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const l=this.map.painter.terrain;this.update(this.transform,l.getScaledDemTileSize(),!0),l.resetTileLookupCache(this.id
vendor: 3,914 bytes, line 13
13)}else this.update(this.transform)}else e.timeAdded=Oi.now(),n==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),this._source.type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),this._source.fire(new hr("data",{dataType:"source",tile:e,coord:e.tileID,sourceCacheId:this.id}))}_backfillDEM(e){const i=this.getRenderableIds();for(let o=0;o<i.length;o++){const l=i[o];if(e.neighboringTiles&&e.neighboringTiles[l]){const c=this.getTileByID(l);n(e,c),n(c,e)}}function n(o,l){if(!o.dem||o.dem.borderReady)return;o.needsHillshadePrepare=!0,o.needsDEMTextureUpload=!0;let c=l.tileID.canonical.x-o.tileID.canonical.x;const d=l.tileID.canonical.y-o.tileID.canonical.y,p=Math.pow(2,o.tileID.canonical.z),_=l.tileID.key;c===0&&d===0||Math.abs(d)>1||(Math.abs(c)>1&&(Math.abs(c+p)===1?c+=p:Math.abs(c-p)===1&&(c-=p)),l.dem&&o.dem&&(o.dem.backfillBorder(l.dem,c,d),o.neighboringTiles&&o.neighboringTiles[_]&&(o.neighboringTiles[_].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,n,o){for(const l in this._tiles){let c=this._tiles[l];if(o[l]||!c.hasData()||c.tileID.overscaledZ<=i||c.tileID.overscaledZ>n)continue;let d=c.tileID;for(;c&&c.tileID.overscaledZ>i+1;){const _=c.tileID.scaledTo(c.tileID.overscaledZ-1);c=this._tiles[_.key],c&&c.hasData()&&(d=_)}let p=d;for(;p.overscaledZ>i;)if(p=p.scaledTo(p.overscaledZ-1),e[p.key]){o[d.key]=d;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){const n=this._loadedParentTiles[e.key];return n&&n.tileID.overscaledZ>=i?n:null}for(let n=e.overscaledZ-1;n>=i;n--){const o=e.scaledTo(n),l=this._getLoadedTile(o);if(l)return l}}_getLoadedTile(e){const i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(this._source.reparseOverscaled?e.wrapped().key:e.canonical.key)}updateCacheSize(e,i){i=i||this._source.tileSize;const n=Math.ceil(e.width/i)+1,o=Math.ceil(e.height/i)+1,l=Math.floor(n*o*5),c=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,l):l,d=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,c):c;this._cache.setMaxSize(d)}handleWrapJump(e){const i=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,i){const n={};for(const o in this._tiles){const l=this._tiles[o];l.tileID=l.tileID.unwrapTo(l.tileID.wrap+i),n[l.tileID.key]=l}this._tiles=n;for(const o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(const o in this._tiles)this._setTileReloadTimer(+o,this._tiles[o])}}update(e,i,n,o){if(this.transform=e,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!n)return;let l;if(this.updateCacheSize(e,i),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={},this.used||this.usedForTerrain){if(this._source.tileID)l=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(p=>new Ci(p.canonical.z,p.wrap,p.canonical.z,p.canonical.x,p.canonical.y));else if(this.tileCoverLift!==0){const p=e.clone();p.tileCoverLift=this.tileCoverLift,l=p.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.minzoom<=1&&e.projection.name==="globe"&&(l.push(new Ci(1,0,1,0,0)),l.push(new Ci(1,0,1,1,0)),l.push(new Ci(1,0,1,0,1)),l.push(new Ci(1,0,1,1,1)))}else if(l=e.coveringTiles({tileSize:i||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!n,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile){const p=this._source.hasTile.bind(this._source);l=l.filter(_=>p(_))}}else l=[];
13if(l.length>0&&this.castsShadows&&o&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!fm(this._source.type)){const p=e.coveringZoomLevel({tileSize:i||this._source.tileSize,roundZoom:this._source.roundZoom&&!n}),_=Math.min(p,this._source.maxzoom),y=e.extendTileCoverForShadows(l,o,_);for(const v of y)this._shadowCasterTiles[v.key]=!0,l.push(v)}const c=this._updateRetainedTiles(l);if(fm(this._source.type)&&l.length!==0){const p={},_={},y=Object.keys(c);for(const b of y){const E=c[b],S=this._tiles[b];if(!S||S.fadeEndTime&&S.fadeEndTime<=Oi.now())continue;const I=this.findLoadedParent(E,Math.max(E.overscaledZ-Na.maxOverzooming,this._source.minzoom));I&&(this._addTile(I.tileID),p[I.tileID.key]=I.tileID),_[b]=E}const v=l[l.length-1].overscaledZ;for(const b in this._tiles){const E=this._tiles[b];if(c[b]||!E.hasData())continue;let S=E.tileID;for(;S.overscaledZ>v;){S=S.scaledTo(S.overscaledZ-1);const I=this._tiles[S.key];if(I&&I.hasData()&&_[S.key]){c[b]=E.tileID;break}}}for(const b in p)c[b]||(this._coveredTiles[b]=!0,c[b]=p[b])}for(const p in c)this._tiles[p].clearFadeHold();const d=function(p,_){const y=[];for(const v in p)v in _||y.push(v);return y}(this._tiles,c);for(const p of d){const _=this._tiles[p];_.hasSymbolBuckets&&!_.holdingForFade()?_.setHoldDuration(this.map._fadeDuration):_.hasSymbolBuckets&&!_.symbolFadeFinished()||this._removeTile(+p)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(+e)}_updateRetainedTiles(e){const i={};if(e.length===0)return i;const n={},o=e.reduce((_,y)=>Math.min(_,y.overscaledZ),1/0),l=e[0].overscaledZ,c=Math.max(l-Na.maxOverzooming,this._source.minzoom),d=Math.max(l+Na.maxUnderzooming,this._source.minzoom),p={};for(const _ of e){const y=this._addTile(_);i[_.key]=_,y.hasData()||o<this._source.maxzoom&&(p[_.key]=_)}this._retainLoadedChildren(p,o,d,i);for(const _ of e){let y=this._tiles[_.key];if(y.hasData())continue;if(_.canonical.z>=this._source.maxzoom){const b=_.children(this._source.maxzoom)[0],E=this.getTile(b);if(E&&E.hasData()){i[b.key]=b;continue}}else{const b=_.children(this._source.maxzoom);if(i[b[0].key]&&i[b[1].key]&&i[b[2].key]&&i[b[3].key])continue}let v=y.wasRequested();for(let b=_.overscaledZ-1;b>=c;--b){const E=_.scaledTo(b);if(n[E.key]||(n[E.key]=!0,y=this.getTile(E),!y&&v&&(y=this._addTile(E)),y&&(i[E.key]=E,v=y.wasRequested(),y.hasData())))break}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let n,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){n=this._loadedParentTiles[o.key];break}i.push(o.key);const l=o.scaledTo(o.overscaledZ-1);if(n=this._getLoadedTile(l),n)break;o=l}for(const l of i)this._loadedParentTiles[l]=n}}_addTile(e){let i=this._tiles[e.key];if(i)return i.isExtraShadowCaster!==!0||this._shadowCasterTiles[e.key]||this._reloadTile(e.key,"reloading"),i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const n=!!i;if(!n){const o=this.map?this.map.painter:null,l=this._source.tileSize*e.overscaleFactor();i=this._source.type==="raster-array"?new vy(e,l,this.transform.tileZoom,o,this._isRaster):new mp(e,l,this.transform.tileZoom,o,this._isRaster),this._loadTile(i,this._tileLoaded.bind(this,i,e.key,i.state))}return i?(i.uses++,this._tiles[e.key]=i,n||this._source.fire(new hr("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i):null}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const n=i.getExpiryTimeout();n&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},n))}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"||i.state==="empty"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(+e);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id
13)}tilesIn(e,i,n){const o=[],l=this.transform;if(!l)return o;const c=l.projection.name==="globe",d=Fn(l.center.lng);for(const p in this._tiles){const _=this._tiles[p];if(n&&_.clearQueryDebugViz(),_.holdingForFade())continue;let y;if(c){const v=_.tileID.canonical;if(v.z===0){const b=[Math.abs(ft(d,...fh(v,-1))-d),Math.abs(ft(d,...fh(v,1))-d)];y=[0,2*b.indexOf(Math.min(...b))-1]}else{const b=[Math.abs(ft(d,...fh(v,-1))-d),Math.abs(ft(d,...fh(v,0))-d),Math.abs(ft(d,...fh(v,1))-d)];y=[b.indexOf(Math.min(...b))-1]}}else y=[0];for(const v of y){const b=e.containsTile(_,l,i,v);b&&o.push(b)}}return o}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(e){return this._getRenderableCoordinates(e)}_getRenderableCoordinates(e,i){const n=this.getRenderableIds(e,i).map(l=>this._tiles[l].tileID),o=this.transform.projection.name==="globe";for(const l of n)l.projMatrix=this.transform.calculateProjMatrix(l.toUnwrapped()),l.expandedProjMatrix=o?this.transform.calculateProjMatrix(l.toUnwrapped(),!1,!0):l.projMatrix;return n}sortCoordinatesByDistance(e){const i=e.slice(),n=this.transform._camera.position,o=this.transform._camera.forward(),l={};for(const c of i){const d=1/(1<<c.canonical.z);l[c.key]=((c.canonical.x+.5)*d+c.wrap-n[0])*o[0]+((c.canonical.y+.5)*d-n[1])*o[1]-n[2]*o[2]}return i.sort((c,d)=>l[c.key]-l[d.key]),i}hasTransition(){if(this._source.hasTransition())return!0;if(fm(this._source.type))for(const e in this._tiles){const i=this._tiles[e];if(i.fadeEndTime!==void 0&&i.fadeEndTime>=Oi.now())return!0}return!1}setFeatureState(e,i,n){this._state.updateState(e=e||"_geojsonTileLayer",i,n)}removeFeatureState(e,i,n){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,n)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,n){const o=this._tiles[e];o&&o.setDependencies(i,n)}reloadTilesForDependencies(e,i){for(const n in this._tiles)this._tiles[n].hasDependency(e,i)&&this._reloadTile(+n,"reloading");this._cache.filter(n=>!n.hasDependency(e,i))}_preloadTiles(e,i){if(!this._sourceLoaded){const d=()=>{this._sourceLoaded&&(this._source.off("data",d),this._preloadTiles(e,i))};return void this._source.on("data",d)}const n=new Map,o=Array.isArray(e)?e:[e],l=this.map.painter.terrain,c=this.usedForTerrain&&l?l.getScaledDemTileSize():this._source.tileSize;for(const d of o){const p=d.coveringTiles({tileSize:c,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const _ of p)n.set(_.key,_);this.usedForTerrain&&d.updateElevation(!1)}ir(Array.from(n.values()),(d,p)=>{const _=new mp(d,this._source.tileSize*d.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(_,y=>{this._source.type==="raster-dem"&&_.dem&&this._backfillDEM(_),p(y,_)})},i)}}function by(t,e){const i=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-i||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function fm(t){return t==="raster"||t==="image"||t==="video"||t==="custom"}function fh(t,e){const i=1<<t.z;return[t.x/i+e,(t.x+1)/i+e]}Na.maxOverzooming=10,Na.maxUnderzooming=3;const wy=new class extends $e{possiblyEvaluate(t,e){return e=new st(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,transition:e.transition}),super.possiblyEvaluate(t,e)}evaluate(t,e,i,n){return e=Xi({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(t,e,i,n)}}(Yd.paint.properties["line-width"].specification);function Ty(t,e){return e>0?e+2*t:t}wy.useIntegerZoom=!0;const E1=new Gt({"symbol-placement":new Ee(he.layout_symbol["symbol-placement"]),"symbol-spacing":new Ee(he.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ee(he.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new $e(he.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ee(he.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Ee(he.layout_symbol["symbol-z-elevate"]),"icon-allow-overlap":new Ee(he.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Ee(he.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ee(he.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ee(he.layout_symbol["icon-rotation-alignment"]),"icon-size":new $e(he.layout_symbol["icon-size"]),"icon-text-fit":new $e(he.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new $e(he.layout_symbol["icon-text-fit-padding"]),"icon-image":new $e(he.layout_symbol["icon-image"]),"icon-rotate":new $e(he.layout_symbol["icon-rotate"]),"icon-padding":new Ee(he.layout_symbol["icon-padding"]),"icon-keep-upright":new Ee(he.layout_symbol["icon-keep-upright"]),"icon-offset":new $e(he.layout_symbol["icon-offset"]),"icon-anchor":new $e(he.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ee(he.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ee(he.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ee(he.layout_symbol["text-rotation-alignment"]),"text-field":new $e(he.layout_symbol["text-field"]),"text-font":new $e(he.layout_symbol["text-font"]),"text-size":new $e(he.layout_symbol["text-size"]),"text-max-width":new $e(he.layout_symbol["text-max-width"]),"text-line-height":new $e(he.layout_symbol["text-line-height"]),"text-letter-spacing":new $e(he.layout_symbol["text-letter-spacing"]),"text-justify":new $e(he.layout_symbol["text-justify"]),"text-radial-offset":new $e(he.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ee(he.layout_symbol["text-variable-anchor"]),"text-anchor":new $e(he.layout_symbol["text-anchor"]),"text-max-angle":new Ee(he.layout_symbol["text-max-angle"]),"text-writing-mode":new Ee(he.layout_symbol["text-writing-mode"]),"text-rotate":new $e(he.layout_symbol["text-rotate"]),"text-padding":new Ee(he.layout_symbol["text-padding"]),"text-keep-upright":new Ee(he.layout_symbol["text-keep-upright"]),"text-transform":new $e(he.layout_symbol["text-transform"]),"text-offset":new $e(he.layout_symbol["text-offset"]),"text-allow-overlap":new Ee(he.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Ee(he.layout_symbol["text-ignore-placement"]),"text-optional":new Ee(he.layout_symbol["text-optional"]),visibility:new Ee(he.layout_symbol.visibility)});var mm={paint:new Gt({"icon-opacity":new $e(he.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new $e(he.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new $e(he.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new $e(he.paint_symbol["text-emissive-strength"]),"icon-color":new $e(he.paint_symbol["icon-color"]),"icon-halo-color":new $e(he.paint_symbol["icon-halo-color"]),"icon-halo-width":new $e(he.paint_symbol["icon-halo-width"]),"icon-halo-blur":new $e(he.paint_symbol["icon-halo-blur"]),"icon-translate":new Ee(he.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ee(he.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new $e(he.paint_symbol["icon-image-cross-fade"]),"text-opacity":new $e(he.paint_symbol["text-opacity"]),"text-occlusion-opacity":new $e(he.paint_symbol["text-occlusion-opacity"]),"text-color":new $e(he.paint_symbol["text-color"],{runtimeType:br,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),"text-halo-color":new $e(he.paint_symbol["text-halo-color"]),"text-halo-width":new $e(he.paint_symbol["text-halo-width"]),"text-halo-blur":new $e(he.paint_symbol["text-halo-blur"]),"text-translate":new Ee(he.paint_symbol["text-translate"]),"text-translate-anchor":new Ee(he.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Ee(he.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Ee(he.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Ee(he.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Ee(he.paint_symbol["icon-color-brightness-max"])}),layout:E1};class Ey{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:zr,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}}N(Ey,"FormatSectionOverride",{omit:["defaultValue"]});class _p extends $i{constructor(e,i,n,o){super(e,mm,i,n,o),this._colorAdjustmentMatrix=s.ad.identity([]),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 n=this.layout.get("text-writing-mode");if(n){const o=[];for(const l of n)o.indexOf(l)<0&&o.push(l);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,i,n,o){return this._saturation===e&&this._contrast===i&&this._brightnessMin===n&&this._brightnessMax===o||(this._colorAdjustmentMatrix=function(l,c,d,p){l=Xo(l),c=ml(c);const _=s.ad.create(),y=l/3,v=1-2*y,b=[v,y,y,0,y,v,y,0,y,y,v,0,0,0,0,1],E=.5-.5*c,S=p-d;return s.ad.multiply(_,[S,0,0,0,0,S,0,0,0,0,S,0,d,d,d,1],[c,0,0,0,0,c,0,0,0,0,c,0,E,E,E,1]),s.ad.multiply(_,_,b),_}(e,i,n,o),this._saturation=e,this._contrast=i,this._brightnessMin=n,this._brightnessMax=o),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,i,n,o){const l=this.layout.get(e).evaluate(i,{},n,o),c=this._unevaluatedLayout._values[e];return c.isDataDriven()||P(c.value)||!l?l:function(d,p){return p.replace(/{([^{}]+)}/g,(_,y)=>y in d?String(d[y]):"")}(i.properties,l)}createBucket(e){return new hc(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of mm.paint.overridableProperties){if(!_p.hasPaintOverride(this.layout,e))continue;const i=this.paint.get(e),n=new Ey(i),o=new A(n,i.property.specification,this.scope,this.options);let l=null;l=i.value.kind==="constant"||i.value.kind==="source"?new R("source",o):new k("composite",o,i.value.zoomStops,i.value._interpolationType),this.paint._values[e]=new Ht(i.property,l,i.parameters)}}_handleOverridablePaintPropertyUpdate(e,i,n){return!(!this.layout||i.isDataDriven()||n.isDataDriven())&&_p.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,i){const n=e.get("text-field"),o=mm.paint.properties[i];let l=!1;const c=d=>{for(const p of d)if(o.overrides&&o.overrides.hasOverride(p))return void(l=!0)};if(n.value.kind==="constant"&&n.value.value instanceof Bi)c(n.value.value.sections);else if(n.value.kind==="source"){const d=_=>{l||(_ instanceof cn&&Si(_.value)===Kr?c(_.value.sections):_ instanceof pa?c(_.sections):_.eachChild(d))},p=n.value;p._styleExpression&&d(p._styleExpression.expression)}return l}getProgramIds(){const e=this.paint.get("icon-opacity").constantOr(1)!==0,i=this.paint.get("text-opacity").constantOr(1)!==0,n=[];return e&&n.push("symbolIcon"),i&&n.push("symbolSDF"),n}getDefaultProgramParams(e,i,n){return{config:new Pa(this,{zoom:i,lut:n}),overrideFog:!1}}}const S1=new Gt({visibility:new Ee(he.layout_background.visibility)});var M1={paint:new Gt({"background-color":new Ee(he.paint_background["background-color"]),"background-pattern":new Ee(he.paint_background["background-pattern"]),"background-opacity":new Ee(he.paint_background["background-opacity"]),"background-emissive-strength":new Ee(he.paint_background["background-emissive-strength"])}),layout:S1};const I1=new Gt({visibility:new Ee(he.layout_raster.visibility)});var A1={paint:new Gt({"raster-opacity":new Ee(he.paint_raster["raster-opacity"]),"raster-color":new Di(he.paint_raster["raster-color"]),"raster-color-mix":ne
vendor: 9,860 bytes, line 13
13w Ee(he.paint_raster["raster-color-mix"]),"raster-color-range":new Ee(he.paint_raster["raster-color-range"]),"raster-hue-rotate":new Ee(he.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ee(he.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ee(he.paint_raster["raster-brightness-max"]),"raster-saturation":new Ee(he.paint_raster["raster-saturation"]),"raster-contrast":new Ee(he.paint_raster["raster-contrast"]),"raster-resampling":new Ee(he.paint_raster["raster-resampling"]),"raster-fade-duration":new Ee(he.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new Ee(he.paint_raster["raster-emissive-strength"]),"raster-array-band":new Ee(he.paint_raster["raster-array-band"]),"raster-elevation":new Ee(he.paint_raster["raster-elevation"])}),layout:I1};function gp(t,e,i,n,o,l,c,d){const p=[t,e,1,i,n,1,o,l,1],_=[c,d,1],y=s.bC.adjoint([],p),[v,b,E]=s._.transformMat3(_,_,y);return s.bC.multiply(p,p,[v,0,0,0,b,0,0,0,E])}function Sy(t,e,i,n,o,l,c,d){const p=function(_,y,v,b,E,S,I,C){const D=gp(0,0,1,0,1,1,0,1),V=gp(_,y,v,b,E,S,I,C),U=s.bC.adjoint([],D);return s.bC.multiply(V,V,U)}(t,e,i,n,o,l,c,d);return[p[2]/p[8]/Ne,p[5]/p[8]/Ne]}function yp(t){return[t[0],Math.min(Math.max(t[1],-85.051129),_r)]}class My extends so{constructor(e,i,n,o){super(),this.id=e,this.dispatcher=n,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(o),this.options=i,this._dirty=!1}load(e,i){if(this._loaded=i||!1,this.fire(new hr("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=Kc(this.map._requestManager.transformRequest(this.url,xl.Image),(n,o)=>{this._imageRequest=null,this._loaded=!0,n?this.fire(new ln(n)):o&&(this.image=o instanceof HTMLImageElement?Oi.getImageData(o):o,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 dp(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 hr("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 dp||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],n=e[0][1];for(const l of e)l[1]>n&&(n=l[1]),l[1]<i&&(i=l[1]);const o=(n+i)/2;if(o>_r?this.onNorthPole=!0:o<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const l=e.map(Qi.fromLngLat);this.tileID=function(c){let d=1/0,p=1/0,_=-1/0,y=-1/0;for(const I of c)d=Math.min(d,I.x),p=Math.min(p,I.y),_=Math.max(_,I.x),y=Math.max(y,I.y);const v=Math.max(_-d,y-p),b=Math.max(0,Math.floor(-Math.log(v)/Math.LN2)),E=Math.pow(2,b);let S=Math.floor((d+_)/2*E);return S>1&&(S-=1),new Da(b,S,Math.floor((p+y)/2*E))}(l),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new hr("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const C in this.tiles){const D=this.tiles[C];D.state!=="loaded"&&(D.state="loaded",D.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const i=Ba(new Da(0,0,0),this.map.transform.projection),n=[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(C){const D=C[1].x-C[0].x,V=C[1].y-C[0].y,U=C[2].x-C[1].x,j=C[2].y-C[1].y,X=C[3].x-C[2].x,H=C[3].y-C[2].y,ie=C[0].x-C[3].x,ne=C[0].y-C[3].y,ue=D*j-U*V,ye=U*H-X*j,pe=X*ne-ie*H,Te=ie*V-D*ne;return ue>0&&ye>0&&pe>0&&Te>0||ue<0&&ye<0&&pe<0&&Te<0}(n))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const o=Ba(this.tileID,this.map.transform.projection),[l,c,d,p]=this.coordinates.map(C=>{const D=o.projection.project(C[0],C[1]);return ny(o,D)._round()});this.perspectiveTransform=Sy(l.x,l.y,c.x,c.y,d.x,d.y,p.x,p.y);const _=this._boundsArray=new _s;_.emplaceBack(l.x,l.y,0,0),_.emplaceBack(c.x,c.y,Ne,0),_.emplaceBack(p.x,p.y,0,Ne),_.emplaceBack(d.x,d.y,Ne,Ne),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(_,fp.members),this.boundsSegments=pi.simpleSegment(0,0,4,2);const y=[],v=function(C){return[yp(C[0]),yp(C[1]),yp(C[2]),yp(C[3])]}(this.coordinates),[b,E,S,I]=function(C){let D=C[0][0],V=D,U=C[0][1],j=U;for(let X=1;X<C.length;X++)C[X][0]<D?D=C[X][0]:C[X][0]>V&&(V=C[X][0]),C[X][1]<U?U=C[X][1]:C[X][1]>j&&(j=C[X][1]);return[D,U,V-D,j-U]}(v);{const C=new _s,[D,V,U,j]=function(xe){let Ce=xe[0].x,Re=Ce,Pe=xe[0].y,Ze=Pe;for(let De=1;De<xe.length;De++)xe[De].x<Ce?Ce=xe[De].x:xe[De].x>Re&&(Re=xe[De].x),xe[De].y<Pe?Pe=xe[De].y:xe[De].y>Ze&&(Ze=xe[De].y);return[Ce,Pe,Re-Ce,Ze-Pe]}(n),X=xe=>[(xe.x-D)/U,(xe.y-V)/j],[H,ie,ne,ue]=n.map(X),ye=function(xe,Ce,Re,Pe,Ze,De,Oe,Qe){const Je=gp(0,0,1,0,1,1,0,1),Ye=gp(xe,Ce,Re,Pe,Ze,De,Oe,Qe),ke=s.bC.adjoint([],Ye);return s.bC.multiply(Je,Je,ke)}(H[0],H[1],ie[0],ie[1],ne[0],ne[1],ue[0],ue[1]);this.elevatedGlobePerspectiveTransform=Sy(H[0],H[1],ie[0],ie[1],ne[0],ne[1],ue[0],ue[1]);const pe=(xe,Ce)=>{y.push(xe.lng);const Re=Math.round((xe.lng-b)/S*Ne),Pe=Math.round((xe.lat-E)/I*Ne),Ze=X(Ce),De=s._.transformMat3([],[Ze[0],Ze[1],1],ye),Oe=Math.round(De[0]/De[2]*Ne),Qe=Math.round(De[1]/De[2]*Ne);C.emplaceBack(Re,Pe,Oe,Qe)},Te=n[3].x-n[0].x,ze=n[3].y-n[0].y,be=n[2].x-n[1].x,Ae=n[2].y-n[1].y;for(let xe=0;xe<65;xe++){const Ce=xe/64,Re=[n[0].x+Ce*Te,n[0].y+Ce*ze],Pe=[n[1].x+Ce*be,n[1].y+Ce*Ae],Ze=Pe[0]-Re[0],De=Pe[1]-Re[1];for(let Oe=0;Oe<65;Oe++){const Qe=Oe/64,Je={x:Re[0]+Ze*Qe,y:Re[1]+De*Qe};pe(i.projection.unproject(Je.x,Je.y),Je)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(C,fp.members)}{this.maxLongitudeTriangleSize=0;let C=[],D=new Ri;const V=(U,j,X)=>{D.emplaceBack(U,j,X);const H=y[U],ie=y[j],ne=y[X],ue=Math.min(Math.min(H,ie),ne),ye=Math.max(Math.max(H,ie),ne)-ue;ye>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=ye),C.push(ue+ye/2)};for(let U=0;U<64;U++)for(let j=0;j<64;j++){const X=65*U+j,H=X+1,ie=X+65,ne=ie+1;V(X,ie,H),V(H,ie,ne)}[C,D]=function(U,j){const X=Array.from({length:U.length},(ne,ue)=>ue);X.sort((ne,ue)=>U[ne]-U[ue]);const H=[],ie=new Ri;for(let ne=0;ne<X.length;ne++){const ue=X[ne];H.push(U[ue]);const ye=3*ue,pe=ye+1;ie.emplaceBack(j.uint16[ye],j.uint16[pe],j.uint16[pe+1])}return[H,ie]}(C,D),this.elevatedGlobeTrianglesCenterLongitudes=C,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(D)}this.elevatedGlobeSegments=pi.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,S/Ne,0,I/Ne,0,0,E,b,0])}prepare(){const e=Object.keys(this.tiles).length!==0;if(this.tileID&&!e)return;const i=this.map.painter.context,n=i.gl;!this._dirty||this.texture instanceof dp||(this.texture?this.texture.update(this.image):(this.texture=new nn(i,this.image,n.RGBA),this.texture.bind(n.LINEAR,n.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 n=this.elevatedGlobeTrianglesCenterLongitudes;let o=(l=e+180)+360*Math.round((n[0]-l)/360);var l;const c=new pi,d=(v,b)=>{c.segments.push({vertexOffset:0,primitiveOffset:v,vertexLength:i.segments[0].vertexLength,primitiveLength:b,sortKey:void 0,vaos:{}})},p=.51*this.maxLongitudeTriangleSize;if(Math.abs(n[0]-o)<=p){const v=fl(n,0,n.length,o+p);return v===n.length||d(v,Ch(n,v+1,n.length,o+360-p)-v),c}o<n[0]&&(o+=360);const _=Ch(n,0,n.length,o-p);if(_===n.length)return d(0,n.length),c;d(0,_-0);const y=fl(n,_+1,n.length,o+p);return y!==n.length&&d(y,n.length-y),c}}const C1=(Math.pow(256,2)-1)/16907520;class Iy extends $i{constructor(e,i,n,o){super(e,A1,i,n,o),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 My&&(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())}
13updateColorRamp(e){if(!this.hasColorMap()||!this._curRampRange)return;const i=this._transitionablePaint._values["raster-color"].value.expression,[n,o]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(n)&&isNaN(o)||n===this._curRampRange[0]&&o===this._curRampRange[1]||(this.colorRamp=Xu({expression:i,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:n,end:o}],resolution:256}),this.colorRampTexture=null,this._curRampRange=[n,o])}}const P1=new Gt({visibility:new Ee(he["layout_raster-particle"].visibility)});var z1={paint:new Gt({"raster-particle-array-band":new Ee(he["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new Ee(he["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new Di(he["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new Ee(he["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new Ee(he["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new Ee(he["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new Ee(he["paint_raster-particle"]["raster-particle-reset-rate-factor"])}),layout:P1};class Ay extends $i{constructor(e,i,n,o){super(e,z1,i,n,o),this._updateColorRamp(),this.lastInvalidatedAt=Oi.now()}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return 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=Xu({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:i}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=Oi.now()}}class D1 extends $i{constructor(e,i){super(e,{},i,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(){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)}}const L1=new Gt({visibility:new Ee(he.layout_sky.visibility)});var R1={paint:new Gt({"sky-type":new Ee(he.paint_sky["sky-type"]),"sky-atmosphere-sun":new Ee(he.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new Ee(he.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new Ee(he.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new Ee(he.paint_sky["sky-gradient-radius"]),"sky-gradient":new Di(he.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new Ee(he.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new Ee(he.paint_sky["sky-atmosphere-color"]),"sky-opacity":new Ee(he.paint_sky["sky-opacity"])}),layout:L1};function _m(t,e,i){const n=[0,0,1],o=s.av.identity([]);return s.av.rotateY(o,o,i?-Pt(t)+Math.PI:Pt(t)),s.av.rotateX(o,o,-Pt(e)),s._.transformQuat(n,n,o),s._.normalize(n,n)}var k1={paint:new Gt({})};function Cy(t,e){const i=xp(t.projection,t.zoom,t.width,t.height),n=function(l,c,d,p,_){const y=new Bt(d.lng-180*Ls,d.lat),v=new Bt(d.lng+180*Ls,d.lat),b=l.project(y.lng,y.lat),E=l.project(v.lng,v.lat),S=-Math.atan2(E.y-b.y,E.x-b.x),I=Qi.fromLngLat(d);I.y=ft(I.y,-1+Ls,1-Ls);const C=I.toLngLat(),D=l.project(C.lng,C.lat),V=Qi.fromLngLat(C);V.x+=Ls;const U=V.toLngLat(),j=l.project(U.lng,U.lat),X=Dy(j.x-D.x,j.y-D.y,S),H=Qi.fromLngLat(C);H.y+=Ls;const ie=H.toLngLat(),ne=l.project(ie.lng,ie.lat),ue=Dy(ne.x-D.x,ne.y-D.y,S),ye=Math.abs(X.x)/Math.abs(ue.y),pe=s.ad.identity([]);s.ad.rotateZ(pe,pe,-S*(1-(_?0:p)));const Te=s.ad.identity([]);return s.ad.scale(Te,Te,[1,1-(1-ye)*p,1]),Te[4]=-ue.x/ue.y*p,s.ad.rotateZ(Te,Te,S),s.ad.multiply(Te,pe,Te),Te}
13(t.projection,0,t.center,i,e),o=Py(t);return s.ad.scale(n,n,[o,o,1]),n}function Py(t){const e=t.projection,i=xp(t.projection,t.zoom,t.width,t.height),n=zy(e,t.center),o=zy(e,Bt.convert(e.center));return Math.pow(2,n*i+(1-i)*o)}function xp(t,e,i,n,o=1/0){const l=t.range;if(!l)return 0;const c=Math.min(o,Math.max(i,n)),d=Math.log(c/1024)/Math.LN2;return Qs(l[0]+d,l[1]+d,e)}const Ls=1/4e4;function zy(t,e){const i=ft(e.lat,-85.051129,_r),n=new Bt(e.lng-180*Ls,i),o=new Bt(e.lng+180*Ls,i),l=t.project(n.lng,i),c=t.project(o.lng,i),d=Qi.fromLngLat(n),p=Qi.fromLngLat(o),_=c.x-l.x,y=c.y-l.y,v=p.x-d.x,b=p.y-d.y,E=Math.sqrt((v*v+b*b)/(_*_+y*y));return Math.log(E)/Math.LN2}function Dy(t,e,i){const n=Math.cos(i),o=Math.sin(i);return{x:t*n-e*o,y:t*o+e*n}}function Ly(t,e,i){s.ad.identity(t),s.ad.rotateZ(t,t,Pt(e[2])),s.ad.rotateX(t,t,Pt(e[0])),s.ad.rotateY(t,t,Pt(e[1])),s.ad.scale(t,t,i),s.ad.multiply(t,t,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function vp(t,e,i,n,o,l,c,d){const p=[i[0]-e[0],i[1]-e[1],0],_=[n[0]-e[0],n[1]-e[1],0];if(s._.length(p)<1e-12||s._.length(_)<1e-12)return s.av.identity(t);const y=s._.cross([],p,_);s._.normalize(y,y),s._.subtract(_,n,e),p[2]=(l-o)*d,_[2]=(c-o)*d;const v=p;return s._.cross(v,p,_),s._.normalize(v,v),s.av.rotationTo(t,y,v)}function gm(t,e,i=!1){const n=So(e.zoom),o=function(l,c,d){const p=c.worldSize,_=[l[12],l[13],l[14]],y=Fi(_[1]/p),v=mr(_[0]/p),b=s.ad.identity([]),E=lr(1,y)*p,S=lr(1,0)*p*La(y,c.zoom),I=1/Of(p);let C=S*I;if(d){const j=xp(c.projection,c.zoom,c.width,c.height,1024);C=I*c.projection.pixelSpaceConversion(c.center.lat,p,j)}const D=za(y,v);s._.add(D,D,s._.scale([],s._.normalize([],D),E*C*_[2]));const V=function(j){const X=[j[0],j[1],j[2]];let H=[0,1,0];const ie=s._.cross([],H,X);return s._.cross(H,X,ie),s._.squaredLength(H)===0&&(H=[0,1,0],s._.cross(ie,X,H)),s._.normalize(ie,ie),s._.normalize(H,H),s._.normalize(X,X),[ie[0],ie[1],ie[2],0,H[0],H[1],H[2],0,X[0],X[1],X[2],0,j[0],j[1],j[2],1]}(D);s.ad.scale(b,b,[C,C,C*E]),s.ad.translate(b,b,[-_[0],-_[1],-_[2]]);const U=s.ad.multiply([],c.globeMatrix,V);return s.ad.multiply(U,U,b),s.ad.multiply(U,U,l),U}(t,e,i);if(n>0){const l=function(c,d){const p=d.worldSize,_=lr(1,0)*p*La(d.center.lat,d.zoom)/Of(p),y=lr(1,d.center.lat)*p,v=s.ad.identity([]);return s.ad.rotateY(v,v,Pt(d.center.lng)),s.ad.rotateX(v,v,Pt(d.center.lat)),s.ad.translate(v,v,[0,0,ar]),s.ad.scale(v,v,[_,_,_*y]),s.ad.translate(v,v,[d.point.x-.5*p,d.point.y-.5*p,0]),s.ad.multiply(v,v,c),s.ad.multiply(v,d.globeMatrix,v)}(t,e);return function(c,d,p){const _=(S,I,C)=>{const D=s._.length(S),V=s._.length(I),U=Eo(S,I,C);return s._.scale(U,U,1/s._.length(U)*tt(D,V,C))},y=_([c[0],c[1],c[2]],[d[0],d[1],d[2]],p),v=_([c[4],c[5],c[6]],[d[4],d[5],d[6]],p),b=_([c[8],c[9],c[10]],[d[8],d[9],d[10]],p),E=Eo([c[12],c[13],c[14]],[d[12],d[13],d[14]],p);return[y[0],y[1],y[2],0,v[0],v[1],v[2],0,b[0],b[1],b[2],0,E[0],E[1],E[2],1]}(o,l,n)}return o}function Ry(t,e,i,n){const o=ui.projectAabbCorners(n,i);let l=Number.MAX_VALUE,c=-1;for(let _=0;_<o.length;++_){const y=o[_];y[0]=(.5*y[0]+.5)*e.width,y[1]=(.5-.5*y[1])*e.height,y[2]<l&&(c=_,l=y[2])}const d=_=>new Ge(o[_][0],o[_][1]);let p;switch(c){case 0:case 6:p=[d(1),d(5),d(4),d(7),d(3),d(2),d(1)];break;case 1:case 7:p=[d(0),d(4),d(5),d(6),d(2),d(3),d(0)];break;case 3:case 5:p=[d(1),d(0),d(4),d(7),d(6),d(2),d(1)];break;default:p=[d(1),d(5),d(6),d(7),d(3),d(0),d(1)]}if(Mf(t,p))return l}const O1=qt([{name:"a_pos_3f",components:3,type:"Float32"}]),B1=qt([{name:"a_color_3f",components:3,type:"Float32"}]),F1=qt([{name:"a_color_4f",components:4,type:"Float32"}]),N1=qt([{name:"a_uv_2f",components:2,type:"Float32"}]),V1=qt([{name:"a_normal_3f",components:3,type:"Float32"}]),U1=qt([{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"}]),j1=qt([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);class bp{constructor(e,i,n,o){this.message=(e?`${e}: `:"")+n,o&&(this.identifier=o),i!=null&&i.__line__&&(this.line=i.__line__)}}function ky(t,e){const i=t.indexOf("://")===-1;try{return new URL(t,i&&e?"http://example.com":void 0),!0}catch{return!1}}class Oy{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 By{constructor(){this.instancedDataArray=new cf,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}}class ym{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.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}updateFootprints(e,i){}populate(e,i,n,o){this.tileToMeter=Cd(n);const l=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:c,id:d,index:p,sourceLayerIndex:_}of e){const y=d??(c.properties&&c.properties.hasOwnProperty("id")?c.properties.id:void 0),v=To(c,l);if(!this.layers[0]._featureFilter.filter(new st(this.zoom),v,n))continue;const b={id:y,sourceLayerIndex:_,index:p,geometry:l?v.geometry:mn(c,n,o),properties:c.properties,type:c.type,patterns:{}},E=this.addFeature(b,b.geometry,v);E&&i.featureIndex.insert(c,b.geometry,p,_,this.index,this.instancesPerModel[E].instancedDataArray.length,Ne/32)}this.lookup=null}update(e,i,n,o){for(const l in this.instancesPerModel){const c=this.instancesPerModel[l];for(const d in e)c.idToFeaturesIndex.hasOwnProperty(d)&&(this.evaluate(c.features[c.idToFeaturesIndex[d]],e[d],c,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];for(const o of n.features){const l=this.layers[0],c=o.feature,d=this.canonical,p=l.paint.get("model-rotation").evaluate(c,{},d),_=l.paint.get("model-scale").evaluate(c,{},d),y=l.paint.get("model-translation").evaluate(c,{},d);s._.exactEquals(o.rotation,p)&&s._.exactEquals(o.scale,_)&&s._.exactEquals(o.translation,y)||(this.evaluate(o,o.featureStates,n,!0),e=!0)}}return e}updateReplacement(e,i,n){if(i.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=i.updateTime;const o=i.getReplacementRegionsForTile(e.toUnwrapped(),!0);if($f(this.activeReplacements,o))return!1;this.activeReplacements=o;let l=!1;for(const c in this.instancesPerModel){const d=this.instancesPerModel[c],p=d.instancedDataArray;for(const _ of d.features){const y=_.instancedDataOffset,v=_.instancedDataCount;for(let b=0;b<v;b++){const E=16*(b+y);let S=p.float32[E+0];S=S>Ne?S-Ne:S;const I=Math.floor(S),C=p.float32[E+1];let D=!1;for(const V of this.activeReplacements)if(!(V.order<n||V.order===1/0)&&V.clipMask&ig.Model&&!(V.min.x>I||I>V.max.x||V.min.y>C||C>V.max.y)&&(D=H_(W_(I,C,e.canonical,V.footprintTileId.canonical),V),D))break;p.float32[E]=D?S+Ne:S,l=l||D}}}return l}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 n=this.instancesPerModel[i];n.instancedDataArray.length<0||n.instancedDataArray.length===0||(n.instancedDataBuffer?n.instancedDataBuffer.updateData(n.instancedDataArray):n.instancedDataBuffer=e.createVertexBuffer(n.instancedDataArray,U1.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(){for(const i in this.instancesPerModel){const n=this.instancesPerModel[i];n.instancedDataArray.length!==0&&n.instancedDataBuffer&&n.instancedDataBuffer.destroy()}const e=this.layers[0].modelManager;if(e&&this.modelUris)for(const i of this.modelUris)e.removeModel(i,"")}addFeature(e,i,n){const o=this.layers[0],l=o.layout.get("model-id").evaluate(n,{},this.canonical);if(!l)return vi(`modelId is not evaluated for layer ${o.id} and it is not going to get rendered.`),l;ky(l,!1)&&(this.modelUris.includes(l)||this.modelUris.push(l)),this.instancesPerModel[l]||(this.instancesPerModel[l]=new By);const c=this.instancesPerModel[l],d=c.instancedDataArray,p=new Oy(n,d.length);for(const _ of i)for(const y of _){if(y.x<0||y.x>=Ne||y.y<0||y.y>=Ne)continue;const v=(this.lookupDim-1)/Ne,b=this.lookupDim*(y.y*v|0)+y.x*v|0;if(this.lookup){if(this.lookup[b]!==0)continue;this.lookup[b]=1}this.instanceCount++;const E=d.length;d.resize(E+1),c.instancesEvaluatedElevation.push(0),d.float32[16*E]=y.x,d.float32[16*E+1]=y.y}return p.instancedDataCount=c.instancedDataArray.length-p.instancedDataOffset,p.instancedDataCount>0&&(e.id&&(c.idToFeaturesIndex[e.id]=c.features.length),c.features.push(p),this.evaluate(p,{},c,!1)),l}getModelUris(){return this.modelUris}evaluate(e,i,n,o){const l=this.layers[0],c=e.feature,d=this.canonical,p=e.rotation=l.paint.get("model-rotation").evaluate(c,i,d),_=e.scale=l.paint.get("model-scale").evaluate(c,i,d),y=e.translation=l.paint.get("model-translation").evaluate(c,i,d),v=l.paint.get("model-color").evaluate(c,i,d);v.a=l.paint.get("model-color-mix-intensity").evaluate(c,i,d);const b=[];this.maxVerticalOffset<y[2]&&(this.maxVerticalOffset=y[2]),this.maxScale=Math.max(Math.max(this.maxScale,_[0]),Math.max(_[1],_[2])),Ly(b,p,_);const E=Math.round(100*v.a)+v.b/1.05;for(let S=0;S<e.instancedDataCount;++S){const I=e.instancedDataOffset+S,C=16*I,D=n.instancedDataArray.float32;let V=0;o&&(V=D[C+6]-n.instancesEvaluatedElevation[I]);const U=0|D[C+1];D[C]=(0|D[C])+v.r/1.05,D[C+1]=U+v.g/1.05,D[C+2]=E,D[C+3]=1/(d.z>10?this.tileToMeter:Cd(d,U)),D[C+4]=y[0],D[C+5]=y[1],D[C+6]=y[2]+V,D[C+7]=b[0],D[C+8]=b[1],D[C+9]=b[2],D[C+10]=b[4],D[C+11]=b[5],D[C+12]=b[6],D[C+13]=b[8],D[C+14]=b[9],D[C+15]=b[10],n.instancesEvaluatedElevation[I]=y[2]}}}N(ym,"ModelBucket",{omit:["layers"]}),N(By,"PerModelAttributes"),N(Oy,"ModelFeature");const G1=new Gt({visibility:new Ee(he.layout_model.visibility),"model-id":new $e(he.layout_model["model-id"])});var q1={paint:new Gt({"model-opacity":new Ee(he.paint_model["model-opacity"]),"model-rotation":new $e(he.paint_model["model-rotation"]),"model-scale":new $e(he.paint_model["model-scale"]),"model-translation":new $e(he.paint_model["model-translation"]),"model-color":new $e(he.paint_model["model-color"]),"model-color-mix-intensity":new $e(he.paint_model["model-color-mix-intensity"]),"model-type":new Ee(he.paint_model["model-type"]),"model-cast-shadows":new Ee(he.paint_model["model-cast-shadows"]),"model-receive-shadows":new Ee(he.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new Ee(he.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new $e(he.paint_model["model-emissive-strength"]),"model-roughness":new $e(he.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new $e(he.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new Ee(he.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new Ee(he.paint_model["model-front-cutoff"])}),layout:G1};const Va=64,pc={CoordinateSpaceTile:1,CoordinateSpaceYUp:2,HasMapbox
13MeshFeatures:4,HasMeshoptCompression:8};function Fy(t,e,i,n,o,l,c,d,p,_=!1){const y=i.zoom,v=i.project(n),b=La(n.lat,y),E=1/b;s.ad.identity(t),s.ad.translate(t,t,[v.x+c[0]*E,v.y+c[1]*E,c[2]]);let S=1,I=1;const C=i.worldSize;if(_){if(i.projection.name==="mercator"){let j=0;i.elevation&&(j=i.elevation.getAtPointOrZero(new Qi(v.x/C,v.y/C),0));const X=s.aA.transformMat4([],[v.x,v.y,j,1],i.projMatrix)[3]/i.cameraToCenterDistance;S=X,I=X*La(i.center.lat,y)}else if(i.projection.name==="globe"){const j=gm(t,i),X=s.ad.multiply([],i.projMatrix,j),H=[0,0,0,1];s.aA.transformMat4(H,H,X);const ie=H[3]/i.cameraToCenterDistance,ne=So(y),ue=i.projection.pixelsPerMeter(n.lat,C)*La(n.lat,y),ye=i.projection.pixelsPerMeter(i.center.lat,C)*La(i.center.lat,y);S=ie/tt(ue,i_(i.center.lat),ne),I=ie*b/ue,S*=ye,I*=ye}}else S=E;s.ad.scale(t,t,[S,S,I]);const D=[...t],V=e.orientation,U=[];if(Ly(U,[V[0]+o[0],V[1]+o[1],V[2]+o[2]],l),s.ad.multiply(t,D,U),d&&i.elevation){let j=0;const X=[];if(p&&i.elevation){j=function(ne,ue,ye,pe,Te){const ze=ue.elevation;if(!ze)return 0;const be=ui.projectAabbCorners(ye,pe),Ae=lr(1,Te.lat)*ue.worldSize,xe=function(et,_t){const ot=[0,0,1],bt=[{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 gt of bt){const Mt=et[gt.corners[0]],rt=et[gt.corners[1]],Yt=et[gt.corners[2]],Xt=[rt[0]-Mt[0],rt[1]-Mt[1],_t*(rt[2]-Mt[2])],Ut=s._.cross(Xt,Xt,[Yt[0]-Mt[0],Yt[1]-Mt[1],_t*(Yt[2]-Mt[2])]);s._.normalize(Ut,Ut),gt.dotProductWithUp=s._.dot(Ut,ot)}return bt.sort((gt,Mt)=>gt.dotProductWithUp-Mt.dotProductWithUp),bt[0].corners}(be,Ae),Ce=be[xe[0]],Re=be[xe[1]],Pe=be[xe[2]],Ze=be[xe[3]],De=ze.getAtPointOrZero(new Qi(Ce[0]/ue.worldSize,Ce[1]/ue.worldSize),0),Oe=ze.getAtPointOrZero(new Qi(Re[0]/ue.worldSize,Re[1]/ue.worldSize),0),Qe=ze.getAtPointOrZero(new Qi(Pe[0]/ue.worldSize,Pe[1]/ue.worldSize),0),Je=ze.getAtPointOrZero(new Qi(Ze[0]/ue.worldSize,Ze[1]/ue.worldSize),0),Ye=(De+Je)/2,ke=(Oe+Qe)/2;return Ye>ke?Oe<Qe?vp(ne,Re,Ze,Ce,Oe,Je,De,Ae):vp(ne,Pe,Ce,Ze,Qe,De,Je,Ae):De<Je?vp(ne,Ce,Re,Pe,De,Oe,Qe,Ae):vp(ne,Ze,Pe,Re,Je,Qe,Oe,Ae),Math.max(Ye,ke)}(X,i,e.aabb,t,n);const H=s.ad.fromQuat([],X),ie=s.ad.multiply([],H,U);s.ad.multiply(t,D,ie)}else j=i.elevation.getAtPointOrZero(new Qi(v.x/C,v.y/C),0);j!==0&&(t[14]+=j)}}function mh(t,e,i=!1){t.uploaded||(t.gfxTexture=new nn(e,t.image,i?e.gl.R8:e.gl.RGBA,{useMipmap:t.sampler.minFilter>=e.gl.NEAREST_MIPMAP_NEAREST}),t.uploaded=!0,t.image=null)}function Z1(t,e,i){t.indexBuffer=e.createIndexBuffer(t.indexArray,!1,!0),t.vertexBuffer=e.createVertexBuffer(t.vertexArray,O1.members,!1,!0),t.normalArray&&(t.normalBuffer=e.createVertexBuffer(t.normalArray,V1.members,!1,!0)),t.texcoordArray&&(t.texcoordBuffer=e.createVertexBuffer(t.texcoordArray,N1.members,!1,!0)),t.colorArray&&(t.colorBuffer=e.createVertexBuffer(t.colorArray,(t.colorArray.bytesPerElement===12?B1:F1).members,!1,!0)),t.featureArray&&(t.pbrBuffer=e.createVertexBuffer(t.featureArray,j1.members,!0)),t.segments=pi.simpleSegment(0,0,t.vertexArray.length,t.indexArray.length);const n=t.material;n.pbrMetallicRoughness.baseColorTexture&&mh(n.pbrMetallicRoughness.baseColorTexture,e),n.pbrMetallicRoughness.metallicRoughnessTexture&&mh(n.pbrMetallicRoughness.metallicRoughnessTexture,e),n.normalTexture&&mh(n.normalTexture,e),n.occlusionTexture&&mh(n.occlusionTexture,e,i),n.emissionTexture&&mh(n.emissionTexture,e)}function xm(t,e,i){if(t.meshes)for(const n of t.meshes)Z1(n,e,i);if(t.children)for(const n of t.children)xm(n,e,i)}function wp(t){if(t.meshes)for(const e of t.meshes)e.indexArray.destroy(),e.vertexArray.destroy(),e.colorArray&&e.colorArray.destroy(),e.normalArray&&e.normalArray.destroy(),e.texcoordArray&&e.texcoordArray.destroy(),e.featureArray&&e.featureArray.destroy();if(t.children)for(const e of t.children)wp(e)}function vm(t){if(t.meshes)for(const i of t.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(t.children)for(const i of t.children)vm(i)}class $1{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 W1{constructor(){this.tasks={},this.taskQueue=[],dl(["process"],this),this.invoker=new $1(this.process),this.nextId=0}add(e,i){const n=this.nextId++,o=function({type:l,isSymbolTile:c,zoom:d}){return d=d||0,l==="message"?0:l!=="maybePrepare"||c?l!=="parseTile"||c?l==="parseTile"&&c?300-d:l==="maybePrepare"&&c?400-d:500:200-d:100-d}(i);if(o===0){try{e()}finally{}return null}return this.tasks[n]={fn:e,metadata:i,priority:o,id:n},this.taskQueue.push(n),this.invoker.trigger(),{cancel:()=>{delete this.tasks[n]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(n=>!!this.tasks[n]),!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 o=0;o<this.taskQueue.length;o++){const l=this.tasks[this.taskQueue[o]];l.priority<i&&(i=l.priority,e=o)}if(e===null)return null;const n=this.taskQueue[e];return this.taskQueue.splice(e,1),n}remove(){this.invoker.remove()}}class Ny{constructor(e,i,n){this.target=e,this.parent=i,this.mapId=n,this.callbacks={},this.cancelCallbacks={},dl(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler
13=new W1}send(e,i,n,o,l=!1,c){const d=Math.round(1e18*Math.random()).toString(36).substring(0,10);n&&(n.metadata=c,this.callbacks[d]=n);const p=new Set;return this.target.postMessage({id:d,type:e,hasCallback:!!n,targetMapId:o,mustQueue:l,sourceMapId:this.mapId,data:de(i,p)},p),{cancel:()=>{n&&delete this.callbacks[d],this.target.postMessage({id:d,type:"<cancel>",targetMapId:o,sourceMapId:this.mapId})}}}receive(e){const i=e.data,n=i.id;if(n&&(!i.targetMapId||this.mapId===i.targetMapId))if(i.type==="<cancel>"){const o=this.cancelCallbacks[n];delete this.cancelCallbacks[n],o&&o.cancel()}else if(i.mustQueue||ea()){const o=this.callbacks[n],l=this.scheduler.add(()=>this.processTask(n,i),o&&o.metadata||{type:"message"});l&&(this.cancelCallbacks[n]=l)}else this.processTask(n,i)}processTask(e,i){if(delete this.cancelCallbacks[e],i.type==="<response>"){const n=this.callbacks[e];delete this.callbacks[e],n&&(i.error?n(se(i.error)):n(null,se(i.data)))}else{const n=new Set,o=i.hasCallback?(c,d)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:c?de(c):null,data:de(d,n)},n)}:c=>{},l=se(i.data);if(this.parent[i.type])this.parent[i.type](i.sourceMapId,l,o);else if(this.parent.getWorkerSource){const c=i.type.split(".");this.parent.getWorkerSource(i.sourceMapId,c[0],l.source,l.scope)[c[1]](l,o)}else o(new Error(`Could not find function ${i.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}class fc{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=ul();const n=this.workerPool.acquire(this.id);for(let o=0;o<n.length;o++){const l=new fc.Actor(n[o],i,this.id);l.name=`Worker ${o}`,this.actors.push(l)}this.ready=!1,this.broadcast("checkIfReady",null,()=>{this.ready=!0})}broadcast(e,i,n){ir(this.actors,(o,l)=>{o.send(e,i,l)},n=n||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)}}fc.Actor=Ny;var _h={workerUrl:"",workerClass:null,workerParams:void 0};function H1(){return _h.workerClass!=null?new _h.workerClass:new self.Worker(_h.workerUrl,_h.workerParams)}const bm="mapboxgl_preloaded_worker_pool";class gh{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<gh.workerCount;)this.workers.push(new H1);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[bm]}numActive(){return Object.keys(this.active).length}}let yh;function Tp(){return yh||(yh=new gh),yh}gh.workerCount=2;let Ep,wm,bn,mc,Tm,_c=null;function Vy(){return ea()&&self.worker&&self.worker.dracoUrl?self.worker.dracoUrl:wm||mt.DRACO_URL}function Uy(){if(ea()&&self.worker&&self.worker.meshoptUrl)return self.worker.meshoptUrl;if(mc)return mc;const t=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 mc=WebAssembly.validate(t)?mt.MESHOPT_SIMD_URL:mt.MESHOPT_URL,mc}const Sp={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},X1={5120:"DT_INT8",5121:"DT_UINT8",5122:"DT_INT16",5123:"DT_UINT16",5125:"DT_UINT32",5126:"DT_FLOAT32"},xh={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function jy(t,e,i){const n=i.json.bufferViews.length,o=i.buffers.length;e.bufferView=n,i.json.bufferViews[n]={buffer:o,byteLength:t.byteLength},i.buffers[o]=t}const Em="KHR_draco_mesh_compression";function Y1(t,e){const i=t.extensions&&t.extensions[Em];if(!i)return;const n=new bn.Decoder,o=$y(e,i.bufferView),l=new bn.Mesh;if(!n.DecodeArrayToMesh(o,o.byteLength,l))throw new Error("Failed to decode Draco mesh");const c=e.json.accessors[t.indices],d=Sp[c.componentType],p=c.count*d.BYTES_PER_ELEMENT,_=bn._malloc(p);d===Uint16Array?n.GetTrianglesUInt16Array(l,p,_):n.GetTrianglesUInt32Array(l,p,_),jy(bn.memory.buffer.slice(_,_+p),c,e),bn._free(_);for(const y of Object.keys(i.attributes)){const v=n.GetAttributeByUniqueId(l,i.attributes[y]),b=e.json.accessors[t.attributes[y]],E=X1[b.componentType],S=b.count*xh[b.type]*Sp[b.componentType].BYTES_PER_ELEMENT,I=bn._malloc(S);n.GetAttributeDataArrayForAllPoints(l,v,bn[E],S,I),jy(bn.memory.buffer.slice(I,I+S),b,e),bn._free(I)}n.destroy(),l.destroy(),delete t.extensions[Em]}const Mp="EXT_meshopt_compression";function K1(t,e){if(!t.extensions||!t.extensions[Mp])return;const i=t.extensions[Mp],n=new Uint8Array(e.buffers[i.buffer],i.byteOffset||0,i.byteLength||0),o=new Uint8Array(i.count*i.byteStride);Tm.decodeGltfBuffer(o,i.count,i.byteStride,n,i.mode,i.filter),t.buffer=e.buffers.length,t.byteOffset=0,e.buffers[t.buffer]=o.buffer,delete t.extensions[Mp]}const Gy=1179937895,qy=new TextDecoder("utf8");function Zy(t,e){return new URL(t,e).href}function J1(t,e,i,n){return fetch(Zy(t.uri,n)).then(o=>o.arrayBuffer()).then(o=>{e.buffers[i]=o})}function $y(t,e){const i=t.json.bufferViews[e];return new Uint8Array(t.buffers[i.buffer],i.byteOffset||0,i.byteLength)}
13function Q1(t,e,i,n){if(t.uri){const o=Zy(t.uri,n);return fetch(o).then(l=>l.blob()).then(l=>createImageBitmap(l)).then(l=>{e.images[i]=l})}if(t.bufferView!==void 0){const o=$y(e,t.bufferView),l=new Blob([o],{type:t.mimeType});return createImageBitmap(l).then(c=>{e.images[i]=c})}}function Wy(t,e=0,i){const n={json:null,images:[],buffers:[]};if(new Uint32Array(t,e,1)[0]===Gy){const y=new Uint32Array(t,e);let v=2;const b=(y[v++]>>2)-3,E=y[v++]>>2;if(v++,n.json=JSON.parse(qy.decode(y.subarray(v,v+E))),v+=E,v<b){const S=y[v++];v++;const I=e+(v<<2);n.buffers[0]=t.slice(I,I+S)}}else n.json=JSON.parse(qy.decode(new Uint8Array(t,e)));const{buffers:o,images:l,meshes:c,extensionsUsed:d,bufferViews:p}=n.json;let _=Promise.resolve();if(o){const y=[];for(let v=0;v<o.length;v++){const b=o[v];b.uri?y.push(J1(b,n,v,i)):n.buffers[v]||(n.buffers[v]=null)}_=Promise.all(y)}return _.then(()=>{const y=[],v=d&&d.includes(Em),b=d&&d.includes(Mp);if(v&&y.push(function(){if(!bn)return Ep||(Ep=function(E){let S,I=null;function C(){S=new Uint8Array(I.buffer)}function D(){throw new Error("Unexpected Draco error.")}const V={a:{a:D,d:function(U,j,X){return S.copyWithin(U,j,j+X)},c:function(U){const j=S.length,X=Math.max(U>>>0,Math.ceil(1.2*j)),H=Math.ceil((X-j)/65536);try{return I.grow(H),C(),!0}catch{return!1}},b:D}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(E,V):E.then(U=>U.arrayBuffer()).then(U=>WebAssembly.instantiate(U,V))).then(U=>{const{Rb:j,Qb:X,P:H,T:ie,X:ne,Ja:ue,La:ye,Qa:pe,Va:Te,Wa:ze,eb:be,jb:Ae,f:xe,e:Ce,yb:Re,zb:Pe,Ab:Ze,Bb:De,Db:Oe,Gb:Qe}=U.instance.exports;I=Ce;const Je=(()=>{let Ye=0,ke=0,et=0,_t=0;return ot=>{et&&(j(_t),j(Ye),ke+=et,et=Ye=0),Ye||(ke+=128,Ye=X(ke));const bt=ot.length+7&-8;let gt=Ye;bt>=ke&&(et=bt,gt=_t=X(bt));for(let Mt=0;Mt<ot.length;Mt++)S[gt+Mt]=ot[Mt];return gt}})();return C(),xe(),{memory:Ce,_free:j,_malloc:X,Mesh:class{constructor(){this.ptr=H()}destroy(){ie(this.ptr)}},Decoder:class{constructor(){this.ptr=ue()}destroy(){Ae(this.ptr)}DecodeArrayToMesh(Ye,ke,et){const _t=Je(Ye),ot=ye(this.ptr,_t,ke,et.ptr);return!!ne(ot)}GetAttributeByUniqueId(Ye,ke){return{ptr:pe(this.ptr,Ye.ptr,ke)}}GetTrianglesUInt16Array(Ye,ke,et){Te(this.ptr,Ye.ptr,ke,et)}GetTrianglesUInt32Array(Ye,ke,et){ze(this.ptr,Ye.ptr,ke,et)}GetAttributeDataArrayForAllPoints(Ye,ke,et,_t,ot){be(this.ptr,Ye.ptr,ke.ptr,et,_t,ot)}},DT_INT8:Re(),DT_UINT8:Pe(),DT_INT16:Ze(),DT_UINT16:De(),DT_UINT32:Oe(),DT_FLOAT32:Qe()}})}(fetch(Vy())),Ep.then(E=>{bn=E,Ep=void 0}))}()),b&&y.push(function(){if(Tm)return;const E=function(S){let I;const C=WebAssembly.instantiateStreaming(S,{}).then(U=>{I=U.instance,I.exports.__wasm_call_ctors()}),D={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},V={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:C,supported:!0,decodeGltfBuffer(U,j,X,H,ie,ne){(function(ue,ye,pe,Te,ze,be,Ae){const xe=ue.exports.sbrk,Ce=Te+3&-4,Re=xe(Ce*ze),Pe=xe(be.length),Ze=new Uint8Array(ue.exports.memory.buffer);Ze.set(be,Pe);const De=ye(Re,Te,ze,Pe,be.length);if(De===0&&Ae&&Ae(Re,Ce,ze),pe.set(Ze.subarray(Re,Re+Te*ze)),xe(Re-xe(0)),De!==0)throw new Error(`Malformed buffer data: ${De}`)})(I,I.exports[V[ie]],U,j,X,H,I.exports[D[ne]])}}}(fetch(Uy()));return E.ready.then(()=>{Tm=E})}()),l)for(let E=0;E<l.length;E++)y.push(Q1(l[E],n,E,i));return(y.length?Promise.all(y):Promise.resolve()).then(()=>{if(v&&c)for(const{primitives:E}of c)for(const S of E)Y1(S,n);if(b&&c&&p)for(const E of p)K1(E,n);return n})})}function Ua(t,e){const i=t.json.bufferViews[e.bufferView],n=Sp[e.componentType];return new n(t.buffers[i.buffer],(e.byteOffset||0)+(i.byteOffset||0),e.count*(i.byteStride&&i.byteStride!==xh[e.type]*n.BYTES_PER_ELEMENT?i.byteStride/n.BYTES_PER_ELEMENT:xh[e.type]))}function Sm(t,e,i,n){const o=Sp[e.componentType],l=function(y){switch(y){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(o),c=t.json.bufferViews[e.bufferView],d=c.byteStride?c.byteStride/o.BYTES_PER_ELEMENT:xh[e.type],p=i.float32,_=p.length/i.capacity;for(let y=0,v=0;y<e.count*d;y+=d,v+=_)for(let b=0;b<_;b++)p[v+b]=n[y+b]*l;i._trim()}function eb(t,e,i){const n=t.indices,o=t.attributes,l={};l.indexArray=new Ri;const c=e.json.accessors[n],d=c.count/3;l.indexArray.reserve(d);const p=Ua(e,c);for(let b=0;b<d;b++)l.indexArray.emplaceBack(p[3*b],p[3*b+1],p[3*b+2]);l.indexArray._trim(),l.vertexArray=new ys;const _=e.json.accessors[o.POSITION];l.vertexArray.reserve(_.count);const y=Ua(e,_);for(let b=0;b<_.count;b++)l.vertexArray.emplaceBack(y[3*b],y[3*b+1],y[3*b+2]);if(l.vertexArray._trim(),l.aabb=new ui(_.min,_.max),l.centroid=function(b,E){const S=[0,0,0],I=b.length;if(I>0){for(let C=0;C<I;C++){const D=3*b[C];S[0]+=E[D],S[1]+=E[D+1],S[2]+=E[D+2]}S[0]/=I,S[1]/=I,S[2]/=I}return S}(p,y),o.COLOR_0!==void 0){const b=e.json.accessors[o.COLOR_0],E=xh[b.type],S=Ua(e,b);l.colorArray=E===3?new ys:new gs,l.colorArray.resize(b.count),Sm(e,b,l.colorArray,S)}if(o.NORMAL!==void 0){l.normalArray=new ys;const b=e.json.accessors[o.NORMAL];l.normalArray.resize(b.count);const E=Ua(e,b);Sm(e,b,l.normalArray,E)}if(o.TEXCOORD_0!==void 0&&i.length>0){l.texcoordArray=new $l;const b=e.json.accessors[o.TEXCOORD_0];l.texcoordArray.resize(b.count);const E=Ua(e,b);Sm(e,b,l.texcoordArray,E)}if(o._FEATURE_ID_RGBA4444!==void 0){const b=e.json.accessors[o._FEATURE_ID_RGBA4444];e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression")&&(l.featureData=Ua(e,b))}o._FEATURE_RGBA4444!==void 0&&(l.featureData=new Uint32Array(Ua(e,e.json.accessors[o._FEATURE_RGBA4444]).buffer));const v=t.material;return l.material=function(b,E){const{emissiveFactor:S=[0,0,0],alphaMode:I="OPAQUE",alphaCutoff:C=.5,normalTexture:D,occlusionTexture:V,emissiveTexture:U,doubleSided:j}=b,{baseColorFactor:X=[1,1,1,1],metallicFactor:H=1,roughnessFactor:ie=1,baseColorTexture:ne,metallicRoughnessTexture:ue}=b.pbrMetallicRoughness||{},ye=V?E[V.index]:void 0;if(V&&V.extensions&&V.extensions.KHR_texture_transform&&ye){const pe=V.extensions.KHR_texture_transform;ye.offsetScale=[pe.offset[0],pe.offset[1],pe.scale[0],pe.scale[1]]}return{pbrMetallicRoughness:{baseColorFactor:new Nt(...X),metallicFactor:H,roughnessFactor:ie,baseColorTexture:ne?E[ne.index]:void 0,metallicRoughnessTexture:ue?E[ue.index]:void 0},doubleSided:j,emissiveFactor:S,alphaMode:I,alphaCutoff:C,normalTexture:D?E[D.index]:void 0,occlusionTexture:ye,emissionTexture:U?E[U.index]:void 0,defined:b.defined===void 0}}(v!==void 0?e.json.materials[v]:{defined:!1},i),l}function Hy(t,e,i){const{matrix:n,rotation:o,translation:l,scale:c,mesh:d,extras:
13p,children:_}=t,y={};if(y.matrix=n||s.ad.fromRotationTranslationScale([],o||[0,0,0,1],l||[0,0,0],c||[1,1,1]),d!==void 0){y.meshes=i[d];const v=y.anchor=[0,0];for(const b of y.meshes){const{min:E,max:S}=b.aabb;v[0]+=E[0]+S[0],v[1]+=E[1]+S[1]}v[0]=Math.floor(v[0]/y.meshes.length/2),v[1]=Math.floor(v[1]/y.meshes.length/2)}if(p&&(p.id&&(y.id=p.id),p.lights&&(y.lights=function(v){if(!v.length)return[];const b=function(D){const V=atob(D),U=new Uint8Array(V.length);for(let j=0;j<V.length;j++)U[j]=V.codePointAt(j);return U}(v),E=[],S=b.length/24,I=new Uint16Array(b.buffer),C=new Float32Array(b.buffer);for(let D=0;D<S;D++){const V=I[2*D*6]/30,U=I[2*D*6+1]/30,j=I[2*D*6+10]/100,X=C[6*D+1],H=C[6*D+2],ie=C[6*D+3],ne=C[6*D+4],ue=ie-X,ye=ne-H,pe=Math.hypot(ue,ye);E.push({pos:[X+.5*ue,H+.5*ye,U],normal:[ye/pe,-ue/pe,0],width:pe,height:V,depth:j,points:[X,H,ie,ne]})}return E}(p.lights))),_){const v=[];for(const b of _)v.push(Hy(e.json.nodes[b],e,i));y.children=v}return y}function tb(t){if(t.vertices.length===0||t.indices.length===0)return null;const e=new Gf(t.vertices,t.indices,8,256),[i,n]=[e.min.clone(),e.max.clone()];return{vertices:t.vertices,indices:t.indices,grid:e,min:i,max:n}}function ib(t){if(!t.extras||!t.extras.ground)return null;const e=t.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 n=[];for(const c of i){if(!Array.isArray(c)||c.length!==2)continue;const d=c[0],p=c[1];typeof d=="number"&&typeof p=="number"&&n.push(new Ge(d,p))}if(n.length<3)return null;n.length>1&&n[n.length-1].equals(n[0])&&n.pop();let o=0;for(let c=0;c<n.length;c++){const d=n[c],p=n[(c+1)%n.length],_=n[(c+2)%n.length];o+=(d.x-p.x)*(_.y-p.y)-(_.x-p.x)*(d.y-p.y)}o>0&&n.reverse();const l=Yu(n.flatMap(c=>[c.x,c.y]),[]);return l.length===0?null:{vertices:n,indices:l}}function rb(t,e){const i=[],n=[];let o=0;const l=[];for(const c of t){o=i.length;const d=c.vertexArray.float32,p=c.indexArray.uint16;for(let _=0;_<c.vertexArray.length;_++)l[0]=d[3*_+0],l[1]=d[3*_+1],l[2]=d[3*_+2],s._.transformMat4(l,l,e),i.push(new Ge(l[0],l[1]));for(let _=0;_<3*c.indexArray.length;_++)n.push(p[_]+o)}if(n.length%3!=0)return null;for(let c=0;c<n.length;c+=3){const d=i[n[c+0]],p=i[n[c+1]],_=i[n[c+2]];(d.x-p.x)*(_.y-p.y)-(_.x-p.x)*(d.y-p.y)>0&&([n[c+1],n[c+2]]=[n[c+2],n[c+1]])}return{vertices:i,indices:n}}function Xy(t){const e=function(p,_){const y=[],v=WebGL2RenderingContext;if(p.json.textures)for(const b of p.json.textures){const E={magFilter:v.LINEAR,minFilter:v.NEAREST,wrapS:v.REPEAT,wrapT:v.REPEAT};b.sampler!==void 0&&Object.assign(E,p.json.samplers[b.sampler]),y.push({image:_[b.source],sampler:E,uploaded:!1})}return y}(t,t.images),i=function(p,_){const y=[];for(const v of p.json.meshes){const b=[];for(const E of v.primitives)b.push(eb(E,p,_));y.push(b)}return y}(t,e),{scenes:n,scene:o,nodes:l}=t.json,c=n?n[o||0].nodes:l,d=[];for(const p of c)d.push(Hy(l[p],t,i));return function(p,_,y){const v={},b=new Set;for(let E=0;E<p.length;E++){const S=y[_[E]];if(!S.extras)continue;const I=S.extras["mapbox:footprint:version"],C=S.extras["mapbox:footprint:id"];(I||C)&&b.add(E),I==="1.0.0"&&C&&(v[C]=E)}for(let E=0;E<p.length;E++){if(b.has(E))continue;const S=p[E],I=y[_[E]];if(!I.extras)continue;let C=null;S.id in v&&(C=rb(p[v[S.id]].meshes,S.matrix)),C||(C=ib(I)),C&&(S.footprint=tb(C))}if(b.size>0){const E=Array.from(b.values()).sort((S,I)=>S-I);for(let S=E.length-1;S>=0;S--)p.splice(E[S],1)}}(d,c,t.json.nodes),d}function nb(t){t.heightmap=new Float32Array(4096),t.heightmap.fill(-1);const e=t.vertexArray.float32,i=t.aabb.min[0]-1,n=t.aabb.min[1]-1,o=Va/(t.aabb.max[0]-i+2),l=Va/(t.aabb.max[1]-n+2);for(let c=0;c<e.length;c+=3){const d=e[c+2],p=(e[c+0]-i)*o|0,_=(e[c+1]-n)*l|0;d>t.heightmap[_*Va+p]&&(t.heightmap[_*Va+p]=d)}}function ob(t,e){const i={};i.indexArray=new Ri,i.indexArray.reserve(4*t.length),i.vertexArray=new ys,i.vertexArray.reserve(10*t.length),i.colorArray=new gs,i.vertexArray.reserve(10*t.length);let n=0;for(const c of t){const d=Math.min(10,Math.max(4,1.3*c.height))*e,p=[-c.normal[1],c.normal[0],0],_=Math.min(.29,.1*c.width/c.depth),y=c.width-2*c.depth*e*(_+.01),v=s._.scaleAndAdd([],c.pos,p,y/2),b=s._.scaleAndAdd([],c.pos,p,-y/2),E=[v[0],v[1],v[2]+c.height],S=[b[0],b[1],b[2]+c.height],I=s._.scaleAndAdd([],c.normal,p,_);s._.scale(I,I,d);const C=s._.scaleAndAdd([],c.normal,p,-_);s._.scale(C,C,d),s._.add(I,v,I),s._.add(C,b,C),v[2]+=.1,b[2]+=.1,i.vertexArray.emplaceBack(I[0],I[1],I[2]),i.vertexArray.emplaceBack(C[0],C[1],C[2]),i.vertexArray.emplaceBack(v[0],v[1],v[2]),i.vertexArray.emplaceBack(b[0],b[1],b[2]),i.vertexArray.emplaceBack(E[0],E[1],E[2]),i.vertexArray.emplaceBack(S[0],S[1],S[2]),i.vertexArray.emplaceBack(v[0],v[1],v[2]),i.vertexArray.emplaceBack(b[0],b[1],b[2]),i.vertexArray.emplaceBack(I[0],I[1],I[2]),i.vertexArray.emplaceBack(C[0],C[1],C[2]);const D=y/d/2;i.colorArray.emplaceBack(-D-_,-1,D,.8),i.colorArray.emplaceBack(D+_,-1,D,.8),i.colorArray.emplaceBack(-D,0,D,1.3),i.colorArray.emplaceBack(D,0,D,1.3),i.colorArray.emplaceBack(D+_,-.8,D,.7),i.colorArray.emplaceBack(D+_,-.8,D,.7),i.colorArray.emplaceBack(0,0,D,1.3),i.colorArray.emplaceBack(0,0,D,1.3),i.colorArray.emplaceBack(D+_,-1.2,D,.8),i.colorArray.emplaceBack(D+_,-1.2,D,.8),i.indexArray.emplaceBack(6+n,4+n,8+n),i.indexArray.emplaceBack(7+n,9+n,5+n),i.indexArray.emplaceBack(0+n,1+n,2+n),i.indexArray.emplaceBack(1+n,3+n,2+n),n+=10}const o={defined:!0,emissiveFactor:[0,0,0]},l={};return l.baseColorFactor=Nt.white,o.pbrMetallicRoughness=l,i.material=o,i.aabb=new ui([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),i}const Mm=new Float32Array(262144),ja=new Uint8Array(262144);function Yy(t){let e=0;if(t.meshes)for(const i of t.meshes)e=Math.max(e,i.aabb.max[2]);if(t.children)for(const i of t.children)e=Math.max(e,Yy(i));return e}function Ky(t,e,i){if(t.meshes)for(const n of t.meshes)n.aabb.min[0]!==1/0&&i.insert(e,n.aabb.min[0],n.aabb.min[1],n.aabb.max[0],n.aabb.max[1]);if(t.children)for(const n of t.children)Ky(n,e,i)}const Jy=["","wall","door","roof","window","lamp","logo"];class Qy{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.feature={type:"Point",id:e.id,geometry:[],properties:{height:Yy(e)}},this.aabb=this._getLocalBounds()}_getLocalBounds(){if(!this.node.meshes)return new ui([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const i=new ui([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const n of this.node.meshes)this.node.lightMeshIndex!==e&&(n.transformedAabb=ui.applyTransformFast(n.aabb,this.node.matrix),i.encapsulate(n.transformedAabb)),e++;this.aabb=i}return this.aabb}}class Ip{constructor(e,i,n,o,l,c){this.id=i,this.modelTraits|=pc.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,n&&(this.modelTraits|=pc.HasMapbox
13MeshFeatures),o&&(this.modelTraits|=pc.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=l,this.dirty=!0,this.needsUpload=!1,this.nodesInfo=[];for(const d of e)this.nodesInfo.push(new Qy(d)),Ky(d,c.featureIndexArray.length,c.grid),c.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,c.bucketLayerIDs.length-1,0)}updateFootprints(e,i){for(const n of this.getNodesInfo()){const o=n.node;o.footprint&&i.push({footprint:o.footprint,id:e})}}update(){console.log("Update 3D model bucket")}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 n of i){const o=n.node;this.uploaded?this.updatePbrBuffer(o):xm(o,e,!0)}for(const n of i)wp(n.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let i=!1;if(!e.meshes)return i;for(const n of e.meshes)n.pbrBuffer&&(n.pbrBuffer.updateData(n.featureArray),i=!0);return i}needsReEvaluation(e,i,n){const o=e.transform.projectionOptions,l=e.style.getBrightness(),c=this.brightness!==l;return!!(!this.uploaded||this.dirty||o.name!==this.projection.name||vh(n.paint.get("model-color").value,c)||vh(n.paint.get("model-color-mix-intensity").value,c)||vh(n.paint.get("model-roughness").value,c)||vh(n.paint.get("model-emissive-strength").value,c)||vh(n.paint.get("model-height-based-emissive-strength-multiplier").value,c))&&(this.projection=o,this.brightness=l,!0)}evaluateScale(e,i){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const n=this.getNodesInfo(),o=this.id.canonical;for(const l of n){const c=l.feature;l.evaluatedScale=i.paint.get("model-scale").evaluate(c,{},o)}}evaluate(e){const i=this.getNodesInfo();for(const n of i){if(!n.node.meshes)continue;const o=n.feature,l=n.node.meshes&&n.node.meshes[0].featureData,c=n.evaluatedColor[2],d=n.evaluatedRMEA[2],p=this.id.canonical;if(n.hasTranslucentParts=!1,l){for(let _=0;_<Jy.length;_++){const y=Jy[_];y.length&&(o.properties.part=y);const v=e.paint.get("model-color").evaluate(o,{},p).toRenderColor(null),b=e.paint.get("model-color-mix-intensity").evaluate(o,{},p);n.evaluatedColor[_]=[v.r,v.g,v.b,b],n.evaluatedRMEA[_][0]=e.paint.get("model-roughness").evaluate(o,{},p),n.evaluatedRMEA[_][2]=e.paint.get("model-emissive-strength").evaluate(o,{},p),n.evaluatedRMEA[_][3]=v.a,n.emissionHeightBasedParams[_]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(o,{},p),!n.hasTranslucentParts&&v.a<1&&(n.hasTranslucentParts=!0)}delete o.properties.part,ab(n,c!==n.evaluatedColor[2]||d!==n.evaluatedRMEA[2],this.modelTraits)}else n.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(o,{},p);n.evaluatedScale=e.paint.get("model-scale").evaluate(o,{},p),this.updatePbrBuffer(n.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,i,n,o){const l=e.findDEMTileFor(n);if(l&&(l.tileID.canonical!==this.terrainTile||i!==this.terrainExaggeration)){if(l.dem&&l.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=l.tileID.overscaledZ;const c=tc.create(e,n,l);if(!c)return;this.modelTraits&pc.HasMapboxMeshFeatures&&this.updateDEM(e,c,n,o);for(const d of this.getNodesInfo()){const p=d.node;if(!p.footprint||!p.footprint.vertices||!p.footprint.vertices.length)continue;const _=p.footprint.vertices;let y=c.getElevationAt(_[0].x,_[0].y,!0,!0);for(let v=1;v<_.length;v++)y=Math.min(y,c.getElevationAt(_[v].x,_[v].y,!0,!0));p.elevation=y}}this.terrainTile=l.tileID.canonical,this.terrainExaggeration=i}}updateDEM(e,i,n,o){let l=i._dem._modifiedForSources[o];if(l===void 0&&(i._dem._modifiedForSources[o]=[],l=i._dem._modifiedForSources[o]),l.includes(n.canonical))return;const c=i._dem.dim;l.push(n.canonical);let d=!1;for(const p of this.getNodesInfo()){const _=p.node;if(!_.footprint||!_.footprint.grid)continue;const y=_.footprint.grid,v=i.tileCoordToPixel(y.min.x,y.min.y),b=i.tileCoordToPixel(y.max.x,y.max.y),E=Math.min(Math.min(c-b.y,v.x),Math.min(v.y,c-b.x));if(E<0)continue;const S=ft(E,2,5);let I=Math.max(0,v.x-S),C=Math.max(0,v.y-S),D=Math.min(b.x+S,c-1),V=Math.min(b.y+S,c-1);for(let H=C;H<=V;++H)for(let ie=I;ie<=D;++ie)ja[H*c+ie]=255;let U=0,j=0;for(let H=0;H<y.cellsY;++H)for(let ie=0;ie<y.cellsX;++ie){if(!y.cells[H*y.cellsX+ie])continue;const ne=i.tileCoordToPixel(y.min.x+ie/y.xScale,y.min.y+H/y.yScale),ue=i.tileCoordToPixel(y.min.x+(ie+1)/y.xScale,y.min.y+(H+1)/y.yScale);for(let ye=ne.y;
13ye<=Math.min(ue.y+1,c-1);++ye)for(let pe=ne.x;pe<=Math.min(ue.x+1,c-1);++pe)ja[ye*c+pe]===255&&(ja[ye*c+pe]=0,U+=i.getElevationAtPixel(pe,ye),j++)}const X=U/j;I=Math.max(1,v.x-S),C=Math.max(1,v.y-S),D=Math.min(b.x+S,c-2),V=Math.min(b.y+S,c-2),d=!0;for(let H=C;H<=V;++H)for(let ie=I;ie<=D;++ie)ja[H*c+ie]===0&&(Mm[H*c+ie]=i._dem.set(ie,H,X));for(let H=1;H<S;++H){I=Math.max(1,v.x-H),C=Math.max(1,v.y-H),D=Math.min(b.x+H,c-2),V=Math.min(b.y+H,c-2);for(let ie=C;ie<=V;++ie)for(let ne=I;ne<=D;++ne){const ue=ie*c+ne;if(ja[ue]===255){let ye=0,pe=0,Te=-1,ze=-1;for(let be=-1;be<=1;++be)for(let Ae=-1;Ae<=1;++Ae){const xe=(ie+be)*c+ne+Ae;if(ja[xe]>=H)continue;const Ce=Mm[xe],Re=Math.abs(Ce);Re>pe&&(ye=Ce,pe=Re,Te=Ae,ze=be)}if(pe>.1){const be=1-(H+.5*Math.abs(Te*ze))/S;let Ae=i._dem.get(ne,ie)+ye*be;const xe=i._dem.get(ne+Te,ie+ze),Ce=i._dem.get(ne-Te,ie-ze,!0);(Ae-xe)*(Ae-Ce)>0&&(Ae=(xe+Ce)/2),Mm[ue]=i._dem.set(ne,ie,Ae),ja[ue]=H}}}}}d&&(i._demTile.needsDEMTextureUpload=!0,i._dem._timestamp=Oi.now())}getNodesInfo(){return this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const i of e)wp(i.node),vm(i.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,i){if(i.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=i.updateTime;const n=i.getReplacementRegionsForTile(e.toUnwrapped()),o=this.getNodesInfo();for(let l=0;l<this.nodesInfo.length;l++){const c=o[l].node;o[l].hiddenByReplacement=!!c.footprint&&!n.find(d=>d.footprint===c.footprint)}}getHeightAtTileCoord(e,i){const n=this.getNodesInfo(),o=[],l=[0,0,0],c=s.ad.identity([]);for(let d=0;d<this.nodesInfo.length;d++){const p=n[d],_=p.node.meshes[0],y=_.transformedAabb;if(e<y.min[0]||i<y.min[1]||e>y.max[0]||i>y.max[1])continue;if(p.node.hidden===!0)return{height:0,maxHeight:p.feature.properties.height,hidden:!1,verticalScale:p.evaluatedScale[2]};s.ad.invert(c,p.node.matrix),l[0]=e,l[1]=i,s._.transformMat4(l,l,c);const v=(l[0]-_.aabb.min[0])/(_.aabb.max[0]-_.aabb.min[0])*Va|0,b=Math.min(63,(l[1]-_.aabb.min[1])/(_.aabb.max[1]-_.aabb.min[1])*Va|0)*Va+Math.min(63,v),E=_.heightmap[b];if(!(E<0&&p.node.footprint))return p.hiddenByReplacement?void 0:{height:E,maxHeight:p.feature.properties.height,hidden:!1,verticalScale:p.evaluatedScale[2]};if(p.node.footprint.grid.query(new Ge(e,i),new Ge(e,i),o),o.length>0)return{height:void 0,maxHeight:p.feature.properties.height,hidden:p.hiddenByReplacement,verticalScale:p.evaluatedScale[2]}}}}function vh(t,e){return!t.isLightConstant&&e}function sb(t,e,i,n,o,l,c,d){let p=(61440&e|(61440&e)>>4)>>8,_=(3840&e|(3840&e)>>4)>>4,y=240&e|(240&e)>>4;i[3]>0&&(p=tt(p,255*i[0],i[3]),_=tt(_,255*i[1],i[3]),y=tt(y,255*i[2],i[3]));const v=p<<8|_,b=y<<8|Math.floor(255*n[3]),E=function(H){const ie=ft(H,0,2);return Math.min(Math.round(.5*ie*255),255)}(n[2])<<8|15*n[0]<<4|15*n[1],S=ft(o[0],0,1),I=ft(o[1],0,1),C=ft(o[2],0,1),D=ft(o[3],0,1);let V,U,j,X;if(S!==I&&c!==l&&I!==S){const H=c-l;U=1/(H*(I-S)),j=-(l+H*S)/(H*(I-S));const ie=ft(o[4],-1,1);X=Math.pow(10,ie),V=255*C<<8|255*D}else V=65535,U=0,j=1,X=1;if(t.emplaceBack(v,b,E,V,U,j,X),d){const H=d.length;d.clear();for(let ie=0;ie<H;ie++)d.emplaceBack(v,b,E,V,U,j,X)}}function ab(t,e,i){const n=t.node;let o=0;const l=i&pc.HasMeshoptCompression;for(const c of n.meshes){if(n.lights&&n.lightMeshIndex===o||!c.featureData)continue;c.featureArray=new Md,c.featureArray.reserve(c.featureData.length);let d=e;for(const p of c.featureData){const _=l?65535&p:p>>16&65535,y=l?p>>16&65535:65535&p,v=(15&y)<8?15&y:0,b=t.evaluatedRMEA[v],E=t.evaluatedColor[v],S=t.emissionHeightBasedParams[v];let I;if(d&&v===2&&n.lights&&(I=new Md,I.resize(10*n.lights.length)),sb(c.featureArray,_,E,b,S,c.aabb.min[2],c.aabb.max[2],I),I&&d){d=!1;const C=n.meshes[n.lightMeshIndex];C.featureArray=I,C.featureArray._trim()}}c.featureArray._trim(),o++}}function e0(t,e,i,n){const o=1<<t.z;e.lat=Fi((n/Ne+t.y)/o),e.lng=mr((i/Ne+t.x)/o)}N(Ip,"Tiled3dModelBucket",{omit:["layers"]}),N(Qy,"Tiled3dModelFeature");const lb={circle:class extends $i{constructor(t,e,i,n){super(t,V0,e,i,n)}createBucket(t){return new Sf(t)}queryRadius(t){const e=t;
vendor: 4,633 bytes, line 13
13return Jl("circle-radius",this,e)+Jl("circle-stroke-width",this,e)+Dd(this.paint.get("circle-translate"))}queryIntersectsFeature(t,e,i,n,o,l,c,d){const p=h_(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),_=this.paint.get("circle-radius").evaluate(e,i)+this.paint.get("circle-stroke-width").evaluate(e,i);return M_(t,n,l,c,d,this.paint.get("circle-pitch-alignment")==="map",this.paint.get("circle-pitch-scale")==="map",p,_)}getProgramIds(){return["circle"]}getDefaultProgramParams(t,e,i){const n=S_(this);return{config:new Pa(this,{zoom:e,lut:i}),defines:n,overrideFog:!1}}},heatmap:class extends $i{createBucket(t){return new A_(t)}constructor(t,e,i,n){super(t,K0,e,i,n),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Xu({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(t){return Jl("heatmap-radius",this,t)}queryIntersectsFeature(t,e,i,n,o,l,c,d){const p=this.paint.get("heatmap-radius").evaluate(e,i);return M_(t,n,l,c,d,!0,!0,new Ge(0,0),p)}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(t,e,i){return t==="heatmap"?{config:new Pa(this,{zoom:e,lut:i}),overrideFog:!1}:{}}},hillshade:class extends $i{constructor(t,e,i,n){super(t,Q0,e,i,n)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(t,e,i){return{overrideFog:!1}}},fill:class extends $i{constructor(t,e,i,n){super(t,px,e,i,n)}getProgramIds(){const t=this.paint.get("fill-pattern"),e=t&&t.constantOr(1),i=[e?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&i.push(e&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),i}getDefaultProgramParams(t,e,i){return{config:new Pa(this,{zoom:e,lut:i}),overrideFog:!1}}recalculate(t,e){super.recalculate(t,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(t){return new Ud(t)}queryRadius(){return Dd(this.paint.get("fill-translate"))}queryIntersectsFeature(t,e,i,n,o,l){return!t.queryGeometry.isAboveHorizon&&s_(u_(t.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),n)}isTileClipped(){return!0}},"fill-extrusion":class extends $i{constructor(t,e,i,n){super(t,Gx,e,i,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(t){return new Hd(t)}queryRadius(){return Dd(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}hasShadowPass(){return!0}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(t,e,i,n,o,l,c,d,p){const _=h_(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),y=this.paint.get("fill-extrusion-height").evaluate(e,i),v=this.paint.get("fill-extrusion-base").evaluate(e,i),b=[0,0],E=d&&l.elevation,S=l.elevation?l.elevation.exaggeration():1,I=t.tile.getBucket(this);if(E&&I instanceof Hd){const j=I.centroidVertexArray,X=p+1;X<j.length&&(b[0]=j.geta_centroid_pos0(X),b[1]=j.geta_centroid_pos1(X))}if(b[0]===0&&b[1]===1)return!1;l.projection.name==="globe"&&(n=mg([n],[new Ge(0,0),new Ge(Ne,Ne)],t.tileID.canonical).map(j=>j.polygon).flat());const C=E?d:null,[D,V]=function(j,X,H,ie,ne,ue,ye,pe,Te,ze,be){return j.projection.name==="globe"?function(Ae,xe,Ce,Re,Pe,Ze,De,Oe,Qe,Je,Ye){const ke=[],et=[],_t=Ae.projection.upVectorScale(Ye,Ae.center.lat,Ae.worldSize).metersToTile,ot=[0,0,0,1],bt=[0,0,0,1],gt=(rt,Yt,Xt,Ut)=>{rt[0]=Yt,rt[1]=Xt,rt[2]=Ut,rt[3]=1},Mt=fg();Ce>0&&(Ce+=Mt),Re+=Mt;for(const rt of xe){const Yt=[],Xt=[];for(const Ut of rt){const Rt=Ut.x+Pe.x,jt=Ut.y+Pe.y,ni=Ae.projection.projectTilePoint(Rt,jt,Ye),ei=Ae.projection.upVector(Ye,Ut.x,Ut.y);let _i=Ce,fi=Re;if(De){const er=gg(Rt,jt,Ce,Re,De,Oe,Qe,Je);_i+=er.base,fi+=er.top}Ce!==0?gt(ot,ni.x+ei[0]*_t*_i,ni.y+ei[1]*_t*_i,ni.z+ei[2]*_t*_i):gt(ot,ni.x,ni.y,ni.z),gt(bt,ni.x+e
13i[0]*_t*fi,ni.y+ei[1]*_t*fi,ni.z+ei[2]*_t*fi),s._.transformMat4(ot,ot,Ze),s._.transformMat4(bt,bt,Ze),Yt.push(new ka(ot[0],ot[1],ot[2])),Xt.push(new ka(bt[0],bt[1],bt[2]))}ke.push(Yt),et.push(Xt)}return[ke,et]}(j,X,H,ie,ne,ue,ye,pe,Te,ze,be):ye?function(Ae,xe,Ce,Re,Pe,Ze,De,Oe,Qe){const Je=[],Ye=[],ke=[0,0,0,1];for(const et of Ae){const _t=[],ot=[];for(const bt of et){const gt=bt.x+Re.x,Mt=bt.y+Re.y,rt=gg(gt,Mt,xe,Ce,Ze,De,Oe,Qe);ke[0]=gt,ke[1]=Mt,ke[2]=rt.base,ke[3]=1,s.aA.transformMat4(ke,ke,Pe),ke[3]=Math.max(ke[3],1e-5);const Yt=new ka(ke[0]/ke[3],ke[1]/ke[3],ke[2]/ke[3]);ke[0]=gt,ke[1]=Mt,ke[2]=rt.top,ke[3]=1,s.aA.transformMat4(ke,ke,Pe),ke[3]=Math.max(ke[3],1e-5);const Xt=new ka(ke[0]/ke[3],ke[1]/ke[3],ke[2]/ke[3]);_t.push(Yt),ot.push(Xt)}Je.push(_t),Ye.push(ot)}return[Je,Ye]}(X,H,ie,ne,ue,ye,pe,Te,ze):function(Ae,xe,Ce,Re,Pe){const Ze=[],De=[],Oe=Pe[8]*xe,Qe=Pe[9]*xe,Je=Pe[10]*xe,Ye=Pe[11]*xe,ke=Pe[8]*Ce,et=Pe[9]*Ce,_t=Pe[10]*Ce,ot=Pe[11]*Ce;for(const bt of Ae){const gt=[],Mt=[];for(const rt of bt){const Yt=rt.x+Re.x,Xt=rt.y+Re.y,Ut=Pe[0]*Yt+Pe[4]*Xt+Pe[12],Rt=Pe[1]*Yt+Pe[5]*Xt+Pe[13],jt=Pe[2]*Yt+Pe[6]*Xt+Pe[14],ni=Pe[3]*Yt+Pe[7]*Xt+Pe[15],ei=Ut+Oe,_i=Rt+Qe,fi=jt+Je,er=Math.max(ni+Ye,1e-5),bi=Ut+ke,di=Rt+et,Ai=jt+_t,Ni=Math.max(ni+ot,1e-5);gt.push(new ka(ei/er,_i/er,fi/er)),Mt.push(new ka(bi/Ni,di/Ni,Ai/Ni))}Ze.push(gt),De.push(Mt)}return[Ze,De]}(X,H,ie,ne,ue)}(l,n,v,y,_,c,C,b,S,l.center.lat,t.tileID.canonical),U=t.queryGeometry;return function(j,X,H){let ie=1/0;s_(H,X)&&(ie=_g(H,X[0]));for(let ne=0;ne<X.length;ne++){const ue=X[ne],ye=j[ne];for(let pe=0;pe<ue.length-1;pe++){const Te=ue[pe],ze=[Te,ue[pe+1],ye[pe+1],ye[pe],Te];Mf(H,ze)&&(ie=Math.min(ie,_g(H,ze)))}}return ie!==1/0&&ie}(D,V,U.isPointQuery()?U.screenBounds:U.screenGeometry)}},line:class extends $i{constructor(t,e,i,n){super(t,Yd,e,i,n),Yd.layout&&(this.layout=new ii(Yd.layout)),this.gradientVersion=0}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof po,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(t,e){super.recalculate(t,e),this.paint._values["line-floorwidth"]=wy.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Xd(t)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(t,e,i){const n=Sg(this);return{config:new Pa(this,{zoom:e,lut:i}),defines:n,overrideFog:!1}}queryRadius(t){const e=t,i=Ty(Jl("line-width",this,e),Jl("line-gap-width",this,e)),n=Jl("line-offset",this,e);return i/2+Math.abs(n)+Dd(this.paint.get("line-translate"))}queryIntersectsFeature(t,e,i,n,o,l){if(t.queryGeometry.isAboveHorizon)return!1;const c=u_(t.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),l.angle,t.pixelToTileUnitsFactor),d=t.pixelToTileUnitsFactor/2*Ty(this.paint.get("line-width").evaluate(e,i),this.paint.get("line-gap-width").evaluate(e,i)),p=this.paint.get("line-offset").evaluate(e,i);return p&&(n=function(_,y){const v=[],b=new Ge(0,0);for(let E=0;E<_.length;E++){const S=_[E],I=[];for(let C=0;C<S.length;C++){const D=S[C],V=S[C+1],U=C===0?b:D.sub(S[C-1])._unit()._perp(),j=C===S.length-1?b:V.sub(D)._unit()._perp(),X=U._add(j)._unit();X._mult(1/(X.x*j.x+X.y*j.y)),I.push(X._mult(y)._add(D))}v.push(I)}return v}(n,p*t.pixelToTileUnitsFactor)),function(_,y,v){for(let b=0;b<y.length;b++){const E=y[b];if(_.length>=3){for(let S=0;S<E.length;S++)if(Es(_,E[S]))return!0}if(O0(_,E,v))return!0}return!1}(c,n,d)}isTileClipped(){return!0}isDraped(t){const e=this.layout.get("line-z-offset");return e.isConstant()&&!e.constantOr(0)}},symbol:_p,background:class extends $i{constructor(t,e,i,n){super(t,M1,e,i,n)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(t,e,i){return{overrideFog:!1}}},raster:Iy,"raster-particle":Ay,sky:class extends $i{constructor(t,e,i,n){super(t,R1,e,i,n),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="sky-gradient"?this._updateColorRamp():t!=="sky-atmosphere-sun"&&t!=="sky-atmosphere-halo-color"&&t!=="sky-atmosphere-color"&&t!=="sky-atmosphere-sun-intensity"||(this._skyboxInvali
13dated=!0)}_updateColorRamp(){this.colorRamp=Xu({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(t){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const e=t.style.light.properties.get("position");return this._lightPosition.azimuthal!==e.azimuthal||this._lightPosition.polar!==e.polar}return!1}getCenter(t,e){if(this.paint.get("sky-type")==="atmosphere"){const n=this.paint.get("sky-atmosphere-sun"),o=!n,l=t.style.light,c=l.properties.get("position");return o&&l.properties.get("anchor")==="viewport"&&vi("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),o?_m(c.azimuthal,90-c.polar,e):_m(n[0],90-n[1],e)}const i=this.paint.get("sky-gradient-center");return _m(i[0],90-i[1],e)}isSky(){return!0}markSkyboxValid(t){this._skyboxInvalidated=!1,this._lightPosition=t.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const t=this.paint.get("sky-type");return t==="atmosphere"?["skyboxCapture","skybox"]:t==="gradient"?["skyboxGradient"]:null}},slot:class extends $i{constructor(t,e,i,n){super(t,k1,e,null)}},model:class extends $i{constructor(t,e,i,n){super(t,q1,e,i,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(t){return new ym(t)}getProgramIds(){return["model"]}is3D(){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(t){return t instanceof Ip?Ne-1:0}queryIntersectsFeature(t,e,i,n,o,l){if(!this.modelManager)return!1;const c=this.modelManager,d=t.tile.getBucket(this);if(!(d&&d instanceof ym))return!1;const p=d;for(const _ in p.instancesPerModel){const y=p.instancesPerModel[_],v=e.id!==void 0?e.id:e.properties&&e.properties.hasOwnProperty("id")?e.properties.id:void 0;if(y.idToFeaturesIndex.hasOwnProperty(v)){const b=y.features[y.idToFeaturesIndex[v]],E=c.getModel(_,this.scope);if(!E)return!1;let S=s.ad.create();const I=new Bt(0,0),C=p.canonical;let D=Number.MAX_VALUE;for(let V=0;V<b.instancedDataCount;++V){const U=16*(b.instancedDataOffset+V),j=y.instancedDataArray.float32,X=[j[U+4],j[U+5],j[U+6]];e0(C,I,j[U],0|j[U+1]),Fy(S,E,l,I,b.rotation,b.scale,X,!1,!1,!1),l.projection.name==="globe"&&(S=gm(S,l));const H=s.ad.multiply([],l.projMatrix,S),ie=t.queryGeometry,ne=Ry(ie.isPointQuery()?ie.screenBounds:ie.screenGeometry,l,H,E.aabb);ne!=null&&(D=Math.min(ne,D))}return D!==Number.MAX_VALUE&&D}}return!1}_handleOverridablePaintPropertyUpdate(t,e,i){return!(!this.layout||e.isDataDriven()||i.isDataDriven()||t!=="model-color"&&t!=="model-color-mix-intensity"&&t!=="model-rotation"&&t!=="model-scale"&&t!=="model-translation"&&t!=="model-emissive-strength")}_isPropertyZoomDependent(t){const e=this._transitionablePaint._values[t];return e!=null&&e.value!=null&&e.value.expression!=null&&e.value.expression instanceof k}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}queryIntersectsMatchingFeature(t,e,i,n){const o=t.tile,l=o.getBucket(this);let c=null,d=Number.MAX_VALUE;if(!(l&&l instanceof Ip))return{queryFeature:c,intersectionZ:d};const p=l.getNodesInfo()[e];if(p.hiddenByReplacement||!p.node.meshes||!i.filter(new st(o.tileID.overscaledZ),p.feature,o.tileID.canonical))return{queryFeature:c,intersectionZ:d};const _=p.node,y=n.calculatePosMatrix(o.tileID.toUnwrapped(),n.worldSize),v=p.evaluatedScale;let b=0;n.elevation&&_.elevation&&(b=_.elevation*n.elevation.exaggeration()),s.ad.translate(y,y,[(_.anchor?_.anchor[0]:0)*(v[0]-1),(_.anchor?_.anchor[1]:0)*(v[1]-1),b]),s.ad.scale(y,y,v),s.ad.multiply(y,y,_.matrix);const E=t.queryGeometry,S=E.isPointQuery()?E.screenBounds:E.screenGeometry,I=function(D){const V=s.ad.multiply([],y,D.matrix),U=s.ad.multiply(V,n.expandedFarZProjMatrix,V);for(let j=0;j<D.meshes.length;++j){const X=D.meshes[j];if(j===D.lightMeshIndex)continue;const H=Ry(S,n,U,X.aabb);H!=null&&(d=Math.min(H,d))}if(D.children)for(const j of D.children)I(j)};if(I(_),d===Number.MAX_VALUE)return{queryFeature:c,intersectionZ:d};const C=new Bt(0,0);return e0(o.tileID.canonical,C,p.node.anchor[0],p.node.anchor[1]),c={type:"Feature",geometry:{type:"Point",coordinates:[C.lng,C.lat]},properties:p.feature.properties,id:p.feature.id,state:{},layer:this.serialize()},{queryFeature:c,intersectionZ:d}}},clip:class extends $i{constructor(t,e,i,n){super(t,mx,e,i,n)}recalculate(t,e){super.recalculate(t,e)}createBucket(t){return new O_(t)}isTileClipped(){return!0}is3D(){return!0}}};N(xy,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]});const t0=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array
13];class Im{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[i,n]=new Uint8Array(e,0,2);if(i!==219)throw new Error("Data does not appear to be in a KDBush format.");const o=n>>4;if(o!==1)throw new Error(`Got v${o} data when expected v1.`);const l=t0[15&n];if(!l)throw new Error("Unrecognized array type.");const[c]=new Uint16Array(e,2,1),[d]=new Uint32Array(e,4,1);return new Im(d,c,l,e)}constructor(e,i=64,n=Float64Array,o){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=n,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const l=t0.indexOf(this.ArrayType),c=2*e*this.ArrayType.BYTES_PER_ELEMENT,d=e*this.IndexArrayType.BYTES_PER_ELEMENT,p=(8-d%8)%8;if(l<0)throw new Error(`Unexpected typed array class: ${n}.`);o&&o instanceof ArrayBuffer?(this.data=o,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+p,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+c+d+p),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+d+p,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+l]),new Uint16Array(this.data,2,1)[0]=i,new Uint32Array(this.data,4,1)[0]=e)}add(e,i){const n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=e,this.coords[this._pos++]=i,n}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Am(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,i,n,o){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:c,nodeSize:d}=this,p=[0,l.length-1,0],_=[];for(;p.length;){const y=p.pop()||0,v=p.pop()||0,b=p.pop()||0;if(v-b<=d){for(let C=b;C<=v;C++){const D=c[2*C],V=c[2*C+1];D>=e&&D<=n&&V>=i&&V<=o&&_.push(l[C])}continue}const E=b+v>>1,S=c[2*E],I=c[2*E+1];S>=e&&S<=n&&I>=i&&I<=o&&_.push(l[E]),(y===0?e<=S:i<=I)&&(p.push(b),p.push(E-1),p.push(1-y)),(y===0?n>=S:o>=I)&&(p.push(E+1),p.push(v),p.push(1-y))}return _}within(e,i,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:o,coords:l,nodeSize:c}=this,d=[0,o.length-1,0],p=[],_=n*n;for(;d.length;){const y=d.pop()||0,v=d.pop()||0,b=d.pop()||0;if(v-b<=c){for(let C=b;C<=v;C++)r0(l[2*C],l[2*C+1],e,i)<=_&&p.push(o[C]);continue}const E=b+v>>1,S=l[2*E],I=l[2*E+1];r0(S,I,e,i)<=_&&p.push(o[E]),(y===0?e-n<=S:i-n<=I)&&(d.push(b),d.push(E-1),d.push(1-y)),(y===0?e+n>=S:i+n>=I)&&(d.push(E+1),d.push(v),d.push(1-y))}return p}}function Am(t,e,i,n,o,l){if(o-n<=i)return;const c=n+o>>1;i0(t,e,c,n,o,l),Am(t,e,i,n,c-1,1-l),Am(t,e,i,c+1,o,1-l)}function i0(t,e,i,n,o,l){for(;o>n;){if(o-n>600){const _=o-n+1,y=i-n+1,v=Math.log(_),b=.5*Math.exp(2*v/3),E=.5*Math.sqrt(v*b*(_-b)/_)*(y-_/2<0?-1:1);i0(t,e,i,Math.max(n,Math.floor(i-y*b/_+E)),Math.min(o,Math.floor(i+(_-y)*b/_+E)),l)}const c=e[2*i+l];let d=n,p=o;for(bh(t,e,n,i),e[2*o+l]>c&&bh(t,e,n,o);d<p;){for(bh(t,e,d,p),d++,p--;e[2*d+l]<c;)d++;for(;e[2*p+l]>c;)p--}e[2*n+l]===c?bh(t,e,n,p):(p++,bh(t,e,p,o)),p<=i&&(n=p+1),i<=p&&(o=p-1)}}function bh(t,e,i,n){Cm(t,i,n),Cm(e,2*i,2*n),Cm(e,2*i+1,2*n+1)}function Cm(t,e,i){const n=t[e];t[e]=t[i],t[i]=n}function r0(t,e,i,n){const o=t-i,l=e-n;return o*o+l*l}s.$=Qs,s.A=Ea,s.B=Ta,s.C=Nt,s.D=Ki,s.E=so,s.G=Li,s.H=h,s.I=Fa,s.J=u,s.K=function(t){const e=t.value;let i=[];if(!e)return i;const n=lo(e);return n!=="string"?(i=i.concat([new bp(t.key,e,`string expected, "${n}" found`)]),i):(ky(e,!0)||(i=i.concat([new bp(t.key,e,`invalid url "${e}"`)])),i)},s.L=he,s.M=class{constructor(t,e,i,n){this.id=t,this.position=e!=null?new Bt(e[0],e[1]):new Bt(0,0),this.orientation=i??[0,0,0],this.nodes=n,this.uploaded=!1,this.aabb=new ui([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(t,e){if(s.ad.multiply(t.matrix,e,t.matrix),t.meshes)for(const i of t.meshes){const n=ui.applyTransformFast(i.aabb,t.matrix);this.aabb.encapsulate(n)}if(t.children)for(const i of t.children)this._applyTransformations(i,t.matrix)}computeBoundsAndApplyParent(){const t=s.ad.identity([]);for(const e of this.nodes)this._applyTransformations(e,t)}computeModelMatrix(t,e,i,n,o,l,c=!1){Fy(this.matrix,this,t.transform,this.position,e,i,n,o,l,c)}upload(t){if(!this.uploaded){for(const e of this.nodes)xm(e,t);for(const e of this.nodes)wp(e);this.uploaded=!0}}destroy(){for(const t of this.nodes)vm(t)}},s.N=Gt,s.O=Ee,s.P=Ge,s.Q=class{constructor(t){this.specification=t}possiblyEvaluate(t,e){return Yi(t.expression.evaluate(e))}interpolate(t,e,i){return{x:tt(t.x,e.x,i),y:tt(t.y,e.y,i),z:tt(t.z,e.z,i),azimuthal:tt(t.azimuthal,e.azimuthal,i),polar:tt(t.polar,e.polar,i)}}},s.R=xl,s.S=uf,s.T=nn,s.U=At,s.V=bp,s.W=Xi,s.X=st,s.Y=Qi,s.Z=k,s.a=Er,s.a$=function(t){const{x:e,y:i}=t.point,{lng:n,lat:o}=t._center;return w_(e,i,t.worldSize,n,o)},s.a0=ii,s.a1=So,s.a2=tt,s.a3=Ne,s.a4=Gh,s.a5=class{constructor(t){this.specification=t}possiblyEvaluate(t,e){return function([i,n]){const o=Yi([1,i,n]);return{x:o.x,y:o.y,z:o.z}}(t.expression.evaluate(e))}interpolate(t,e,i){return{x:tt(t.x,e.x,i),y:tt(t.y,e.y,i),z:tt(t.z,e.z,i)}}},s.a6=ju,s.a7=Ad,s.a8=bo,s.a9=Ym,s.aB=function(t,e){const{x:i,y:n}=t.point,o=w_(i,n,t.worldSize/t._pixelsPerMercatorPixel,0,0);return s.ad.multiply(o,o,kf(Vn(e)))}
13,s.aD=oc,s.aE=Nr,s.aF=Qd,s.aG=function(t,e,i,n,o){const l=5*e+2;t.float32[l+0]=i,t.float32[l+1]=n,t.float32[l+2]=o},s.aH=hp,s.aI=Bt,s.aJ=cy,s.aK=e_,s.aL=Ci,s.aM=Df,s.aN=Py,s.aO=Da,s.aP=x_,s.aQ=function(t,e,i,n,o,l,c,d,p){if(p.name==="globe")return x_(t,e,new Da(i,n,o),!1);const _=Ba({z:i,x:n,y:o},p);return new ui([(l+_.x/_.scale)*e,e*(_.y/_.scale),c],[(l+_.x2/_.scale)*e,e*(_.y2/_.scale),d])},s.aR=function(t,e,i){let n=0;for(let o=0;o<2;++o)t[o]>0&&(n+=(t[o]-0)*(t[o]-0)),e[o]<0&&(n+=(0-e[o])*(0-e[o]));return n},s.aS=_r,s.aT=Pf,s.aU=Jm,s.aV=function(t){const e=s.ad.identity(new Float64Array(16));s.ad.multiply(e,t.pixelMatrix,t.globeMatrix);const i=[0,tn,0],n=[0,rn,0];return s._.transformMat4(i,i,e),s._.transformMat4(n,n,e),[i[0]>0&&i[0]<=t.width&&i[1]>0&&i[1]<=t.height&&!Bf(t,new Bt(t.center.lat,90)),n[0]>0&&n[0]<=t.width&&n[1]>0&&n[1]<=t.height&&!Bf(t,new Bt(t.center.lat,-90))]},s.aW=function(t,e){const{scale:i}=t.tileTransform,n=i*Ne/(t.tileSize*Math.pow(2,e.zoom-t.tileID.overscaledZ+t.tileID.canonical.z));return s.aC.scale(new Float32Array(4),e.inverseAdjustmentMatrix,[n,n])},s.aX=xp,s.aY=Cy,s.aZ=function(t){const e=Cy(t,!0);return s.aC.invert([],[e[0],e[1],e[4],e[5]])},s.a_=zf,s.aa=sr,s.ab=Pt,s.ac=function(t,e,i){const n=Math.sqrt(t*t+e*e+i*i),o=n>0?Math.acos(i/n)*cl:0;let l=t!==0||e!==0?Math.atan2(-e,-t)*cl+90:0;return l<0&&(l+=360),[n,l,o]},s.ae=uc,s.af=yn,s.ag=sm,s.ah=function(t,e){const i={};for(let n=0;n<e.length;n++){const o=e[n];o in t&&(i[o]=t[o])}return i},s.ai=Ts,s.aj=Fn,s.ak=Nn,s.al=ql,s.am=function(t){Wc++,Wc>zh&&(t.getActor().send("enforceCacheSizeLimit",Zc),Wc=0)},s.an=eu,s.ao=class{constructor(t){this.entries={},this.scheduler=t}request(t,e,i,n){const o=this.entries[t]=this.entries[t]||{callbacks:[]};if(o.result){const[l,c]=o.result;return this.scheduler?this.scheduler.add(()=>{n(l,c)},e):n(l,c),()=>{}}return o.callbacks.push(n),o.cancel||(o.cancel=i((l,c)=>{o.result=[l,c];for(const d of o.callbacks)this.scheduler?this.scheduler.add(()=>{d(l,c)},e):d(l,c);setTimeout(()=>delete this.entries[t],3e3)})),()=>{o.result||(o.callbacks=o.callbacks.filter(l=>l!==n),o.callbacks.length||(o.cancel(),delete this.entries[t]))}}},s.ap=function(t,e,i){const n=JSON.stringify(t.request);return t.data&&(this.deduped.entries[n]={result:[null,t.data]}),this.deduped.request(n,{type:"parseTile",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},o=>{const l=Dn(t.request,(c,d,p,_)=>{c?o(c):d&&o(null,{vectorTile:i?void 0:new qf(new nc(d)),rawData:d,cacheControl:p,expires:_})});return()=>{l.cancel(),o()}},e)},s.aq=ff,s.ar=class extends vo{constructor(t){super(t),this.current=w0}set(t,e,i){if(this.fetchUniformLocation(t,e)){for(let n=0;n<9;n++)if(i[n]!==this.current[n]){this.current=i,this.gl.uniformMatrix3fv(this.location,!1,i);break}}}},s.as=mf,s.at=ft,s.au=Qn,s.aw=ta,s.ax=lr,s.ay=Fi,s.az=function(t,e,i){t[4*e+0]=i[0],t[4*e+1]=i[1],t[4*e+2]=i[2],t[4*e+3]=i[3]},s.b=pi,s.b$=Is,s.b0=Hi,s.b1=yf,s.b2=function(t){const e=Math.round((t+45+360)%360/90)%4;return Ih[e]},s.b3=45,s.b4=bf,s.b5=Cd,s.b6=ui,s.b7=Yi,s.b8=function(t){return[Math.pow(t[0],1/2.2),Math.pow(t[1],1/2.2),Math.pow(t[2],1/2.2)]},s.b9=Js,s.bA=function(t,e){return[Math.pow(t[0],2.2)*e,Math.pow(t[1],2.2)*e,Math.pow(t[2],2.2)*e]},s.bB=wg,s.bD=b_,s.bE=Xo,s.bF=ml,s.bG=256,s.bH=function(t,e){const i=[0,0,0],n=Hu(Vn(e.canonical));return s._.transformMat4(i,i,n),s._.transformMat4(i,i,t),i},s.bI=t=>({u_camera_to_center_distance:new sr(t),u_extrude_scale:new _f(t),u_device_pixel_ratio:new sr(t),u_matrix:new ju(t),u_inv_rot_matrix:new ju(t),u_merc_center:new bo(t),u_tile_id:new ff(t),u_zoom_transition:new sr(t),u_up_dir:new ff(t),u_emissive_strength:new sr(t)}),s.bJ=t=>({u_matrix:new ju(t),u_pixels_to_tile_units:new _f(t),u_device_pixel_ratio:new sr(t),u_units_to_pixels:new bo(t),u_dash_image:new Ad(t),u_gradient_image:new Ad(t),u_image_height:new sr(t),u_texsize:new bo(t),u_tile_units_to_pixels:new sr(t),u_alpha_discard_threshold:new sr(t),u_trim_offset:new bo(t),u_trim_fade_range:new bo(t),u_trim_color:new mf(t),u_emissive_strength:new sr(t)}),s.bK=t=>({u_matrix:new ju(t),u_texsize:new bo(t),u_pixels_to_tile_units:new _f(t),u_device_pixel_ratio:new sr(t),u_image:new Ad(t),u_units_to_pixels:new bo(t),u_tile_units_to_pixels:new sr(t),u_alpha_discard_threshold:new sr(t),u_trim_offset:new bo(t)}),s.bL=rf,s.bM=iv,s.bN=Wi,s.bO=vv,s.bP=ey,s.bQ=Qf,s.bR=S_,s.bS=(t,e,
13i,n,o,l)=>{const c=t.transform,d=c.projection.name==="globe";let p;if(l.paint.get("circle-pitch-alignment")==="map")if(d){const y=b_(c.zoom,e.canonical)*c._pixelsPerMercatorPixel;p=Float32Array.from([y,0,0,y])}else p=c.calculatePixelsToTileUnitsMatrix(i);else p=new Float32Array([c.pixelsToGLUnits[0],0,0,c.pixelsToGLUnits[1]]);const _={u_camera_to_center_distance:t.transform.getCameraToCenterDistance(c.projection),u_matrix:t.translatePosMatrix(e.projMatrix,i,l.paint.get("circle-translate"),l.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Oi.devicePixelRatio,u_extrude_scale:p,u_inv_rot_matrix:$0,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:l.paint.get("circle-emissive-strength")};if(d){_.u_inv_rot_matrix=n,_.u_merc_center=o,_.u_tile_id=[e.canonical.x,e.canonical.y,1<<e.canonical.z],_.u_zoom_transition=So(c.zoom);const y=o[0]*Ne,v=o[1]*Ne;_.u_up_dir=c.projection.upVector(new Da(0,0,0),y,v)}return _},s.bT=Sg,s.bU=(t,e,i,n,o,l)=>{const c=t.transform;return{u_matrix:Eg(t,e,i,n),u_texsize:e.imageAtlasTexture?e.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:c.calculatePixelsToTileUnitsMatrix(e),u_device_pixel_ratio:o,u_image:0,u_tile_units_to_pixels:Tg(e,c),u_units_to_pixels:[1/c.pixelsToGLUnits[0],1/c.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:l}},s.bV=(t,e,i,n,o,l,c)=>{const d=t.transform,p=d.calculatePixelsToTileUnitsMatrix(e);return{u_matrix:Eg(t,e,i,n),u_pixels_to_tile_units:p,u_device_pixel_ratio:l,u_units_to_pixels:[1/d.pixelsToGLUnits[0],1/d.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:o,u_texsize:Mg(i)&&e.lineAtlasTexture?e.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Tg(e,t.transform),u_alpha_discard_threshold:0,u_trim_offset:c,u_trim_fade_range:i.paint.get("line-trim-fade-range"),u_trim_color:i.paint.get("line-trim-color").toRenderColor(i.lut).toArray01(),u_emissive_strength:i.paint.get("line-emissive-strength")}},s.bW=Oc,s.bX=Xu,s.bY=fg,s.bZ=P0,s.b_=Hd,s.ba=function(t,e,i){const n=So(i.zoom),o=t.style.map._antialias,l=e.options.extStandardDerivativesForceOff||t.terrain&&t.terrain.exaggeration()>0;return n===0&&!o&&!l},s.bb=function(t){const e=t.pixelsPerMeter,i=e/lr(1,t.center.lat),n=s.ad.identity(new Float64Array(16));return s.ad.translate(n,n,[t.point.x,t.point.y,0]),s.ad.scale(n,n,[i,i,e]),Float32Array.from(n)},s.bc=kd,s.bd=function(t){const e=_r-5;t=ft(t,-80.051129,e)/e*90;const i=Math.pow(Math.abs(Math.sin(Pt(t))),3);return Math.round(i*(xf.length-1))},s.be=function(t,e,i,n){const o=e.getNorth(),l=e.getSouth(),c=e.getWest(),d=e.getEast(),p=1<<t.z,_=d-c,y=o-l,v=_/Hl,b=-y/xf[i],E=[0,v,0,b,0,0,o,c,0];if(t.z>0){const S=180/n;s.bC.multiply(E,E,[S/_+1,0,0,0,S/y+1,0,-.5*S/v,.5*S/b,1])}return E[2]=p,E[5]=t.x,E[8]=t.y,E},s.bf=Hu,s.bg=Vn,s.bh=function(t,e,i){const n=s.ad.identity(new Float64Array(16)),o=(e/(1<<t)-.5)*Math.PI*2;return s.ad.rotateY(n,i.globeMatrix,o),Float32Array.from(n)},s.bi=_l,s.bj=function(t){return t<=1?1:Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},s.bk=Iy,s.bl=Ay,s.bm=My,s.bn=function(t,e){const i=document.createElement("video");i.muted=!0,i.onloadstart=function(){e(null,i)};for(let n=0;n<t.length;n++){const o=document.createElement("source");Rh(t[n])||(i.crossOrigin="Anonymous"),o.src=t[n],i.appendChild(o)}return{cancel:()=>{}}},s.bo=dp,s.bp=dl,s.bq=class{isDataAvailableAtPoint(t){const e=this._source();if(this.isUsingMockSource()||!e||t.y<0||t.y>1)return!1;const i=e.getSource().maxzoom,n=1<<i,o=Math.floor(t.x),l=Math.floor((t.x-o)*n),c=Math.floor(t.y*n),d=this.findDEMTileFor(new Ci(i,o,i,l,c));return!(!d||!d.dem)}getAtPointOrZero(t,e=0){return this.getAtPoint(t,e)||0}getAtPoint(t,e,i=!0){if(this.isUsingMockSource())return null;e==null&&(e=null);const n=this._source();if(!n||t.y<0||t.y>1)return e;const o=n.getSource().maxzoom,l=1<<o,c=Math.floor(t.x),d=t.x-c,p=new Ci(o,c,o,Math.floor(d*l),Math.floor(t.y*l)),_=this.findDEMTileFor(p);if(!_||!_.dem)return e;const y=_.dem,v=1<<_.tileID.canonical.z,b=(d*v-_.tileID.canonical.x)*y.dim,E=(t.y*v-_.tileID.canonical.y)*y.dim,S=Math.floor(b),I=Math.floor(E);return(i?this.exaggeration():1)*tt(tt(y.get(S,I),y.get(S,I+1),E-I),tt(y.get(S+1,I),y.get(S+1,I+1),E-I),b-S)}getAtTileOffset(t,e,i){const n=1<<t.canonical.z;return this.getAtPointOrZero(new Qi(t.wrap+(t.canonical.x+e/Ne)/n,(t.canonical.y+i/Ne)/n))}getAtTileOffsetFunc(t,e,i,n){return o=>{const l=this.getAtTileOffset(t,o.x,o.y),c=n.upVector(t.canonical,o.x,o.y),d=n.upVectorScale(t.canonical,e,i).metersToTile;return s._.scale(c,c,l*d),c}}getForTilePoints(t,e,i,n){if(this.isUsingMockSource())return!1;const o=tc.create(this,t,n);return!!o&&(e.forEach(l=>{l[2]=this.exaggeration()*o.getElevationAt(l[0],l[1],i)}),!0)}getMinMaxForTile(t){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(t);if(!e||!e.dem)return null;const i=e.dem.tree,n=e.tileID,o=1<<t.canonical.z-n.canonical.z;let l=t.canonical.x/o-n.canonical.x,c=t.canonical.y/o-n.canonical.y,d=0;for(let p=0;p<t.canonical.z-n.canonical.z&&!i.leaves[d];p++){l*=2,c*=2;const _=2*Math.floor(c)+Math.floor(l);d=i.childOffsets[d]+_,l%=1,c%=1}return{min:this.exaggeration()*i.minimums[d],max:this.exaggeration()*i.maximums[d]}}getMinElevationBelowMSL(){throw new Error("Pure virtual method called.")}raycast(t,e,i){throw new Error("Pure virtual method called.")}pointCoordinate(t){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(t){throw new Error("Pure virtual method called.")}get visibleDemTiles(){throw new Error("Getter must be implemented in subclass.")}getMinMaxForVisibleTiles(){const t=this.visibleDemTiles;if(t.length===0)return null;let e=!1,i=Number.MAX_VALUE,n=Number.MIN_VALUE;for(const o of t){const l=this.getMinMaxForTile(o.tileID);l&&(i=Math.min(i,l.min),n=Math.max(n,l.max),e=!0)}return e?{min:i,max:n}:null}},s.br=$u,s.bs=Rd,s.bt=pn,s.bu=Ri,s.bv=Na,s.bw=fc,s.bx=Tp,s.by=mp,s.bz=z_,
vendor: 7,264 bytes, line 13
13s.c=Xy,s.c$=oa,s.c0=450,s.c1=7,s.c2=C1,s.c3=vy,s.c4=256,s.c5=g_,s.c6=kf,s.c7=qt,s.c8=ys,s.c9=Ca,s.cA=function(t){let e=1/0,i=1/0,n=-1/0,o=-1/0;for(const l of t)e=Math.min(e,l.x),i=Math.min(i,l.y),n=Math.max(n,l.x),o=Math.max(o,l.y);return{min:new Ge(e,i),max:new Ge(n,o)}},s.cB=Es,s.cC=n_,s.cD=ar,s.cE=["type","source","source-layer","minzoom","maxzoom","filter","layout"],s.cF=Wg,s.cG=Mf,s.cH=W_,s.cI=H_,s.cJ=rm,s.cK=Im,s.cL=function(t){return t({pluginStatus:ve,pluginURL:He}),ht.on("pluginStateChange",t),t},s.cM=ac,s.cN=tm,s.cO=Xc,s.cP=yt,s.cQ=Dt,s.cR=Gc,s.cS=la,s.cT=Hr,s.cU=function(t){const e=t.indexOf(ms);return e>=0?t.slice(0,e):t},s.cV=function(t){return t.indexOf(ms)>=0},s.cW=function(t){const e=t.indexOf(ms);return e>=0?t.slice(e+1):""},s.cX=function(t){const e=[],i=t.id;return i===void 0&&e.push({message:`layers.${i}: missing required property "id"`}),t.render===void 0&&e.push({message:`layers.${i}: missing required method "render"`}),t.renderingMode&&t.renderingMode!=="2d"&&t.renderingMode!=="3d"&&e.push({message:`layers.${i}: property "renderingMode" must be either "2d" or "3d"`}),e},s.cY=function(t,e,i,n){return t.type==="custom"?new D1(t,e):new lb[t.type](t,e,i,n)},s.cZ=Fc,s.c_=ht,s.ca=1,s.cb=uh,s.cc=0,s.cd=af,s.ce=function(t,e,i,n,o){return ft((t-e)/(i-e)*(o-n)+n,n,o)},s.cf=Ou,s.cg=La,s.ch=class{constructor(t,e,i,n){this.context=t,this.format=n,this.size=i,this.texture=t.gl.createTexture();const[o,l,c]=this.size,{gl:d}=t;d.bindTexture(d.TEXTURE_3D,this.texture),t.pixelStoreUnpackFlipY.set(!1),t.pixelStoreUnpack.set(1),t.pixelStoreUnpackPremultiplyAlpha.set(!1);let p=this.format,_=d.UNSIGNED_BYTE;this.format===d.DEPTH_COMPONENT&&(p=d.DEPTH_COMPONENT16,_=d.UNSIGNED_SHORT),this.format===d.R8&&(n=d.RED),this.format===d.R32F&&(_=d.FLOAT,n=d.RED),d.texImage3D(d.TEXTURE_3D,0,p,o,l,c,0,n,_,e.data)}bind(t,e){const{context:i}=this,{gl:n}=i;n.bindTexture(n.TEXTURE_3D,this.texture),t!==this.minFilter&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MAG_FILTER,t),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_MIN_FILTER,t),this.minFilter=t),e!==this.wrapS&&(n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_S,e),n.texParameteri(n.TEXTURE_3D,n.TEXTURE_WRAP_T,e),this.wrapS=e)}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}},s.ci=gm,s.cj=[1,1,1],s.ck=tc,s.cl=pc,s.cm=vs,s.cn=$l,s.co=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new Ge(1/0,1/0),max:new Ge(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(t,e=!1){const i=q_(new Ge(0,0),new Ge(Ne,Ne),t),n=[];if(e&&!Zf(i,this._globalClipBounds))return n;for(const o of this._activeRegions){if(o.hiddenByOverlap||!Zf(i,o))continue;const l=Cx(o.min,o.max,t);n.push({min:l.min,max:l.max,sourceId:this._sourceIds[o.priority],footprint:o.footprint,footprintTileId:o.tileId,order:o.order,clipMask:o.clipMask})}return n}setSources(t){this._setSources(t.map(e=>({getSourceId:()=>e.cache.id,getFootprints:()=>{const i=[];for(const n of e.cache.getVisibleCoordinates()){const o=e.cache.getTile(n).buckets[e.layer];o&&o.updateFootprints(n.toUnwrapped(),i)}return i},getOrder:()=>e.order,getClipMask:()=>e.clipMask})))}_addSource(t){const e=t.getFootprints();if(e.length===0)return;const i=t.getOrder(),n=t.getClipMask();for(const o of e){if(!o.footprint)continue;const l=q_(o.footprint.min,o.footprint.max,o.id);this._activeRegions.push({min:l.min,max:l.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:o.id,footprint:o.footprint,order:i,clipMask:n})}this._sourceIds.push(t.getSourceId())}_computeReplacement(){this._activeRegions.sort((e,i)=>e.priority-i.priority||Zd(e.min,i.min)||Zd(e.max,i.max));let t=this._activeRegions.length!==this._prevRegions.length;if(!t){let e=0;for(;!t&&e!==this._activeRegions.length;){const i=this._activeRegions[e],n=this._prevRegions[e];t=i.priority!==n.priority||!G_(i,n)||i.order!==n.order||i.clipMask!==n.clipMask,++e}}if(t){++this._updateTime;for(const i of this._activeRegions)i.order!==1/0&&(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 n=this._activeRegions;if(i>=n.length)return i;const o=n[i].priority;for(;i<n.length&&n[i].priority===o;)++i;return i};if(this._sourceIds.length>1){let i=0,n=e(i);for(;i!==n;){let o=i;const l=i;for(;o!==n;){const c=this._activeRegions[o];c.hiddenByOverlap=!1;for(let d=0;d<l;d++){const p=this._activeRegions[d];if(!p.hiddenByOverlap&&c.order===1/0&&Zf(c,p)&&(c.hiddenByOverlap=$_(c.footprint,c.tileId,p.footprint,p.tileId),c.hiddenByOverlap))break}++o}i=n,n=e(i)}}}}_setSources(t){[this._prevRegions,this._activeRegions]=[this._activeRegions,[]],this._sourceIds=[];for(let e=t.length-1;e>=0;e--)this._addSource(t[e]);this._computeReplacement()}},s.cp=_s,s.cq=fp,s.cr=Vu,s.cs=class{constructor(t){this._createGrid(t),this._createPoles(t)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const t of this._poleSegments)t.destroy();for(const t of this._gridSegments)t.withSkirts.destroy(),t.withoutSkirts.destroy()}_fillGridMeshWithLods(t,e){const i=new pn,n=new Ri,o=[],l=t+1+2,c=e[0]+1,d=e[0]+1+(1+e.length),p=(_,y,v)=>{let b=_===l-1?_-2:_===0?_:_-1;return b+=v?24575:0,[b,y]};for(let _=0;_<l;++_)i.emplaceBack(...p(_,0,!0));for(let _=0;_<c;++_)for(let y=0;y<l;++y)i.emplaceBack(...p(y,_,(y===0||y===l-1)&&!0));for(let _=0;_<e.length;++_){const y=e[_];for(let v=0;v<l;++v)i.emplaceBack(...p(v,y,!0))}for(let _=0;_<e.length;++_){const y=n.length,v=e[_]+1+2,b=new Ri;for(let I=0;I<v-1;I++){const C=I===v-2,D=C?l*(d-e.length+_-I):l;for(let V=0;V<l-1;V++){const U=I*l+V;I===0||C||V===0||V===l-2?(b.emplaceBack(U+1,U,U+D),b.emplaceBack(U+D,U+D+1,U+1)):(n.emplaceBack(U+1,U,U+D),n.emplaceBack(U+D,U+D+1,U+1))}}const E=pi.simpleSegment(0,y,i.length,n.length-y);for(let I=0;I<b.uint16.length;I+=3)n.emplaceBack(b.uint16[I],b.uint16[I+1],b.uint16[I+2]);const S=pi.simpleSegment(0,y,i.length,n.length-y);o.push({withoutSkirts:E,withSkirts:S})}return{vertices:i,indices:n,segments:o}}_createGrid(t){const e=this._fillGridMeshWithLods(Hl,xf);this._gridSegments=e.segments,this._gridBuffer=t.createVertexBuffer(e.vertices,$u.members),this._gridIndexBuffer=t.createIndexBuffer(e.indices,!0)}_createPoles(t){const e=new Ri;for(let c=0;c<=Hl;c++)e.emplaceBack(0,c+1,c+2);this._poleIndexBuffer=t.createIndexBuffer(e,!0);const i=new Ca,n=new Ca,o=new Ca,l=new Ca;this._poleSegments=[];for(let c=0,d=0;c<yf;c++){const p=360/(1<<c);i.emplaceBack(0,-ar,0,.5,0),n.emplaceBack(0,-ar,0,.5,1),o.emplaceBack(0,-ar,0,.5,.5),l.emplaceBack(0,-ar,0,.5,.5);for(let _=0;_<=Hl;_++){let y=_/Hl,v=0;const b=tt(0,p,y),[E,S,I]=Xl(q0,Z0,b,ar);i.emplaceBack(E,S,I,y,v),n.emplaceBack(E,S,I,y,1-v);const C=Pt(b);y=.5+.5*Math.sin(C),v=.5+.5*Math.cos(C),o.emplaceBack(E,S,I,y,v),l.emplaceBack(E,S,I,y,1-v)}
13this._poleSegments.push(pi.simpleSegment(d,0,66,64)),d+=66}this._poleNorthVertexBuffer=t.createVertexBuffer(i,Ld,!1),this._poleSouthVertexBuffer=t.createVertexBuffer(n,Ld,!1),this._texturedPoleNorthVertexBuffer=t.createVertexBuffer(o,Ld,!1),this._texturedPoleSouthVertexBuffer=t.createVertexBuffer(l,Ld,!1)}getGridBuffers(t,e){return[this._gridBuffer,this._gridIndexBuffer,e?this._gridSegments[t].withSkirts:this._gridSegments[t].withoutSkirts]}getPoleBuffers(t,e){return[e?this._texturedPoleNorthVertexBuffer:this._poleNorthVertexBuffer,e?this._texturedPoleSouthVertexBuffer:this._poleSouthVertexBuffer,this._poleIndexBuffer,this._poleSegments[t]]}},s.ct=function(t){return oo.has(t)},s.cu=ig,s.cv=function(t,e,i=0,n=!0){const o=new Ge(i,i),l=t.sub(o),c=e.add(o),d=[l,new Ge(c.x,l.y),c,new Ge(l.x,c.y)];return n&&d.push(l.clone()),d},s.cw=function(t,e){const i=[];for(let n=0;n<t.length;n++){const o=Qn(n-1,-1,t.length-1),l=Qn(n+1,-1,t.length-1),c=t[n],d=t[l],p=t[o].sub(c).unit(),_=d.sub(c).unit(),y=_.angleWithSep(p.x,p.y),v=p.add(_).unit().mult(-1*e/Math.sin(y/2));i.push(c.add(v))}return i},s.cx=ny,s.cy=c_,s.cz=function(t,e,i=0){return s._.fromValues(((e.x-i)*t.scale-t.x)*Ne,(e.y*t.scale-t.y)*Ne,t_(e.z,e.y))},s.d=ln,s.d$=ll,s.d0=Jn,s.d1=function(){return!!document.fullscreenElement||!!document.webkitFullscreenElement},s.d2=Rp,s.d3=r_,s.d4=za,s.d5=function([t,e,i]){const n=Math.hypot(t,e,i),o=Math.atan2(t,i),l=.5*Math.PI-Math.acos(-e/n);return new Bt(Hi(o),Hi(l))},s.d6=mr,s.d7=Yl,s.d8=mt,s.d9=Bf,s.dA=function(t){const e=$c();if(!e)return;const i=e.delete(qc);t&&i.catch(t).then(()=>t())},s.dB=_h,s.dC=Vy,s.dD=function(t){wm=Oi.resolveURL(t),_c||(_c=new fc(Tp(),new so)),_c.broadcast("setDracoUrl",wm)},s.dE=Uy,s.dF=function(t){mc=Oi.resolveURL(t),_c||(_c=new fc(Tp(),new so)),_c.broadcast("setMeshoptUrl",mc)},s.dG=kc,s.dH=N,s.dI=Ss,s.dJ=gn,s.dK=Ba,s.dL=df,s.dM=Ig,s.dN=Rg,s.dO=vg,s.dP=Pn,s.dQ=Xg,s.dR=hc,s.dS=function(t,e,i,n,o,l,c,d,p,_,y){t.createArrays(),t.tilePixelRatio=Ne/(512*t.overscaling),t.compareText={},t.iconsNeedLinear=!1;const v=t.layers[0].layout,b=t.layers[0]._unevaluatedLayout._values,E={};if(t.textSizeData.kind==="composite"){const{minZoom:D,maxZoom:V}=t.textSizeData;E.compositeTextSizes=[b["text-size"].possiblyEvaluate(new st(D),d),b["text-size"].possiblyEvaluate(new st(V),d)]}if(t.iconSizeData.kind==="composite"){const{minZoom:D,maxZoom:V}=t.iconSizeData;E.compositeIconSizes=[b["icon-size"].possiblyEvaluate(new st(D),d),b["icon-size"].possiblyEvaluate(new st(V),d)]}E.layoutTextSize=b["text-size"].possiblyEvaluate(new st(p+1),d),E.layoutIconSize=b["icon-size"].possiblyEvaluate(new st(p+1),d),E.textMaxSize=b["text-size"].possiblyEvaluate(new st(18),d);const S=v.get("text-rotation-alignment")==="map"&&v.get("symbol-placement")!=="point",I=v.get("text-size");let C=!1;for(const D of t.features)if(D.icon&&D.icon.nameSecondary){C=!0;break}for(const D of t.features){const V=v.get("text-font").evaluate(D,{},d).join(","),U=I.evaluate(D,{},d),j=E.layoutTextSize.evaluate(D,{},d),X=(E.layoutIconSize.evaluate(D,{},d),{horizontal:{},vertical:void 0}),H=D.text;let ie,ne=[0,0];if(H){const pe=H.toString(),Te=v.get("text-letter-spacing").evaluate(D,{},d)*Wi,ze=v.get("text-line-height").evaluate(D,{},d)*Wi,be=Me(pe)?Te:0,Ae=v.get("text-anchor").evaluate(D,{},d),xe=v.get("text-variable-anchor");if(!xe){const De=v.get("text-radial-offset").evaluate(D,{},d);ne=De?ey(Ae,[De*Wi,im]):v.get("text-offset").evaluate(D,{},d).map(Oe=>Oe*Wi)}let Ce=S?"center":v.get("text-justify").evaluate(D,{},d);const Re=v.get("symbol-placement")==="point",Pe=Re?v.get("text-max-width").evaluate(D,{},d)*Wi:1/0,Ze=De=>{t.allowVerticalPlacement&&fe(pe)&&(X.vertical=Jf(H,e,i,o,V,Pe,ze,Ae,De,be,ne,Nr.vertical,!0,j,U))};if(!S&&xe){const De=Ce==="auto"?xe.map(Qe=>rm(Qe)):[Ce];let Oe=!1;for(let Qe=0;Qe<De.length;Qe++){const Je=De[Qe];if(!X.horizontal[Je])if(Oe)X.horizontal[Je]=X.horizontal[0];else{const Ye=Jf(H,e,i,o,V,Pe,ze,"center",Je,be,ne,Nr.horizontal,!1,j,U);Ye&&(X.horizontal[Je]=Ye,Oe=Ye.positionedLines.length===1)}}Ze("left")}else{if(Ce==="auto"&&(Ce=rm(Ae)),Re||v.get("text-writing-mode").indexOf("horizontal")>=0||!fe(pe)){const De=Jf(H,e,i,o,V,Pe,ze,Ae,Ce,be,ne,Nr.horizontal,!1,j,U);De&&(X.horizontal[Ce]=De)}
13Ze(Re?"left":Ce)}}let ue=!1;if(D.icon&&D.icon.namePrimary){const pe=n[D.icon.namePrimary];pe&&(ie=Pv(o[D.icon.namePrimary],D.icon.nameSecondary?o[D.icon.nameSecondary]:void 0,v.get("icon-offset").evaluate(D,{},d),v.get("icon-anchor").evaluate(D,{},d)),ue=pe.sdf,t.sdfIcons===void 0?t.sdfIcons=pe.sdf:t.sdfIcons!==pe.sdf&&vi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(pe.pixelRatio!==t.pixelRatio||v.get("icon-rotate").constantOr(1)!==0)&&(t.iconsNeedLinear=!0))}const ye=iy(X.horizontal)||X.vertical;t.iconsInText||(t.iconsInText=!!ye&&ye.iconsInText),(ye||ie)&&Bv(t,D,X,ie,n,E,j,0,ne,ue,c,d,_,y,C)}l&&t.generateCollisionDebugBuffers(p,t.collisionBoxArray)},s.dT=Xd,s.dU=Ud,s.dV=qf,s.dW=nc,s.dX=$d,s.dY=pm,s.dZ=Gd,s.d_=jd,s.da=T_,s.db=function(t){const e=[0,0,0],i=s.ad.identity(new Float64Array(16));return s.ad.multiply(i,t.pixelMatrix,t.globeMatrix),s._.transformMat4(e,e,i),new Ge(e[0],e[1])},s.dc=$a,s.dd=En,s.de=function(t){const e=t.navigator?t.navigator.userAgent:null;return!!function(i){if(zn==null){const n=i.navigator?i.navigator.userAgent:null;zn=!!i.safari||!(!n||!(/\b(iPad|iPhone|iPod)\b/.test(n)||n.match("Safari")&&!n.match("Chrome")))}return zn}(t)&&e&&(e.match("Version/15.4")||e.match("Version/15.5")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},s.df=ul,s.dg=class{constructor(t,e,i){this._transformRequestFn=t,this._customAccessToken=e,this._silenceAuthErrors=!!i,this._createSkuToken()}_createSkuToken(){const t=function(){let e="";for(let i=0;i<10;i++)e+="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[Math.floor(62*Math.random())];return{token:["1",Jc,e].join(""),tokenExpiresAt:Date.now()+432e5}}();this._skuToken=t.token,this._skuTokenExpiresAt=t.tokenExpiresAt}_isSkuTokenExpired(){return Date.now()>this._skuTokenExpiresAt}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeStyleURL(t,e){if(!Dt(t))return t;const i=Pr(t);return i.params.push(`sdk=js-${xt}`),i.path=`/styles/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeGlyphsURL(t,e){if(!Dt(t))return t;const i=Pr(t);return i.path=`/fonts/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeModelURL(t,e){if(!Dt(t))return t;const i=Pr(t);return i.path=`/models/v1${i.path}`,this._makeAPIURL(i,this._customAccessToken||e)}normalizeSourceURL(t,e,i,n){if(!Dt(t))return t;const o=Pr(t);return o.path=`/v4/${o.authority}.json`,o.params.push("secure"),i&&o.params.push(`language=${i}`),n&&o.params.push(`worldview=${n}`),this._makeAPIURL(o,this._customAccessToken||e)}normalizeSpriteURL(t,e,i,n){const o=Pr(t);return Dt(t)?(o.path=`/styles/v1${o.path}/sprite${e}${i}`,this._makeAPIURL(o,this._customAccessToken||n)):(o.path+=`${e}${i}`,no(o))}normalizeTileURL(t,e,i){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!Dt(t))return t;const n=Pr(t);n.path=n.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${e||i&&n.authority!=="raster"&&i===512?"@2x":""}${ra.supported?".webp":"$1"}`),n.authority==="raster"?n.path=`/${mt.RASTER_URL_PREFIX}${n.path}`:n.authority==="rasterarrays"?n.path=`/${mt.RASTERARRAYS_URL_PREFIX}${n.path}`:n.authority==="3dtiles"?n.path=`/${mt.TILES3D_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\/v4\//,"/"),n.path=`/${mt.TILE_URL_VERSION}${n.path}`);const o=this._customAccessToken||function(l){for(const c of l){const d=c.match(/^access_token=(.*)$/);if(d)return d[1]}return null}(n.params)||mt.ACCESS_TOKEN;return mt.REQUIRE_ACCESS_TOKEN&&o&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,o)}canonicalizeTileURL(t,e){const i=Pr(t);if(!i.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!i.path.match(/\.[\w]+$/))return t;let n="mapbox://";i.path.match(/^\/raster\/v1\//)?n+=`raster/${i.path.replace(`/${mt.RASTER_URL_PREFIX}/`,"")}`:i.path.match(/^\/rasterarrays\/v1\//)?n+=`rasterarrays/${i.path.replace(`/${mt.RASTERARRAYS_URL_PREFIX}/`,"")}`:n+=`tiles/${i.path.replace(`/${mt.TILE_URL_VERSION}/`,"")}`;let o=i.params;return e&&(o=o.filter(l=>!l.match(/^access_token=/))),o.length&&(n+=`?${o.join("&")}`),n}canonicalizeTileset(t,e){const i=!!e&&Dt(e),n=[];for(const o of t.tiles||[])Tn(o)?n.push(this.canonicalizeTileURL(o,i)):n.push(o);return n}_makeAPIURL(t,e){const i="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",n=Pr(mt.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,t.protocol==="http"){const o=t.params.indexOf("secure");o>=0&&t.params.splice(o,1)}if(n.path!=="/"&&(t.path=`${n.path}${t.path}`),!mt.REQUIRE_ACCESS_TOKEN)return no(t);if(e=e||mt.ACCESS_TOKEN,!this._silenceAuthErrors){if(!e)throw new Error(`An API access token is required to use Mapbox GL. ${i}`);if(e[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${i}`)}return t.params=t.params.filter(o=>o.indexOf("access_token")===-1),t.params.push(`access_token=${e||""}`),no(t)}},s.dh=function(t,e){e?oo.add(t):oo.delete(t)},s.di=ra,s.dj=El,s.dk=Vh,s.dl=Qc,s.dm=kp,s.dn=tu,s.dp=function(t){oo.delete(t)},s.dq=Ko,s.dr=Tl,s.ds=ir,s.dt=xt,s.du=function(t,e){Zc=t,zh=e}
13,s.dv=function(t,e,i=!1){if(ve===Ue||ve===qe||ve===je)throw new Error("setRTLTextPlugin cannot be called multiple times.");He=Oi.resolveURL(t),ve=Ue,Be=e,it(),i||oi()},s.dw=It,s.dx=function(){Tp().acquire(bm)},s.dy=function(){const t=yh;t&&(t.isPreloaded()&&t.numActive()===1?(t.release(bm),yh=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.dz=gh,s.e=Oi,s.e0=Ag,s.e1=Gr,s.e2=Dn,s.e3=function(t){let e=0;if(new Uint32Array(t,0,1)[0]!==Gy){const i=new Uint32Array(t,0,7),[,,n,o,l,c]=i;e=i.byteLength+o+l+c+l,(n!==t.byteLength||e>=t.byteLength)&&vi("Invalid b3dm header information.")}return Wy(t,e)},s.e4=function(t,e){const i=Xy(t);for(const n of i){for(const o of n.meshes)nb(o);n.lights&&(n.lightMeshIndex=n.meshes.length,n.meshes.push(ob(n.lights,e)))}return i},s.e5=Ip,s.e6=Ny,s.e7=St,s.e8=function(t){ia(),an&&an.then(e=>{e.keys().then(i=>{for(let n=0;n<i.length-t;n++)e.delete(i[n])})})},s.f=hr,s.g=function(t,e){return oa(Xi(t,{type:"json"}),e)},s.h=Kc,s.i=Fr,s.j=Hg,s.k=em,s.l=function(t){return fetch(t).then(e=>e.arrayBuffer()).then(e=>Wy(e,0,t))},s.m=class extends bp{},s.n=lo,s.o=ou,s.p=Yv,s.q=Fu,s.r=r,s.s=a,s.t=P,s.u=Ji,s.v=qi,s.w=vi,s.x=O,s.y=z,s.z=Ol}),Pp(["./shared"],function(s){function xt(oe){const L=oe?oe.url.toString():void 0;return L?performance.getEntriesByName(L):[]}function Ir(oe){if(typeof oe=="number"||typeof oe=="boolean"||typeof oe=="string"||oe==null)return JSON.stringify(oe);if(Array.isArray(oe)){let F="[";for(const W of oe)F+=`${Ir(W)},`;return`${F}]`}let L="{";for(const F of Object.keys(oe).sort())L+=`${F}:${Ir(oe[F])},`;return`${L}}`}function mt(oe){let L="";for(const F of s.cE)L+=`/${Ir(oe[F])}`;return L}class Tn{constructor(L){this.keyCache={},this._layers={},this._layerConfigs={},L&&this.replace(L)}replace(L,F){this._layerConfigs={},this._layers={},this.update(L,[],F)}update(L,F,W){this._options=W;for(const ee of L)this._layerConfigs[ee.id]=ee,(this._layers[ee.id]=s.cY(ee,this.scope,null,this._options)).compileFilter(),this.keyCache[ee.id]&&delete this.keyCache[ee.id];for(const ee of F)delete this.keyCache[ee],delete this._layerConfigs[ee],delete this._layers[ee];this.familiesBySource={};const J=function(ee,ce){const me={};for(let ge=0;ge<ee.length;ge++){const Fe=ce&&ce[ee[ge].id]||mt(ee[ge]);ce&&(ce[ee[ge].id]=Fe);let Le=me[Fe];Le||(Le=me[Fe]=[]),Le.push(ee[ge])}const ae=[];for(const ge in me)ae.push(me[ge]);return ae}(s.dG(this._layerConfigs),this.keyCache);for(const ee of J){const ce=ee.map(Ke=>this._layers[Ke.id]),me=ce[0];if(me.visibility==="none")continue;const ae=me.source||"";let ge=this.familiesBySource[ae];ge||(ge=this.familiesBySource[ae]={});const Fe=me.sourceLayer||"_geojsonTileLayer";let Le=ge[Fe];Le||(Le=ge[Fe]=[]),Le.push(ce)}}}const Dt=1*s.dJ;class ur{constructor(L){const F={},W=[];for(const me in L){const ae=L[me],ge=F[me]={};for(const Fe in ae.glyphs){const Le=ae.glyphs[+Fe];if(!Le||Le.bitmap.width===0||Le.bitmap.height===0)continue;const Ke=Le.metrics.localGlyph?Dt:1,nt={x:0,y:0,w:Le.bitmap.width+2*Ke,h:Le.bitmap.height+2*Ke};W.push(nt),ge[Fe]=nt}}const{w:J,h:ee}=s.j(W),ce=new s.dI({width:J||1,height:ee||1});for(const me in L){const ae=L[me];for(const ge in ae.glyphs){const Fe=ae.glyphs[+ge];if(!Fe||Fe.bitmap.width===0||Fe.bitmap.height===0)continue;const Le=F[me][ge],Ke=Fe.metrics.localGlyph?Dt:1;s.dI.copy(Fe.bitmap,ce,{x:0,y:0},{x:Le.x+Ke,y:Le.y+Ke},Fe.bitmap)}}this.image=ce,this.positions=F}}s.dH(ur,"GlyphAtlas");class Ur{constructor(L){this.tileID=new s.aL(L.tileID.overscaledZ,L.tileID.wrap,L.tileID.canonical.z,L.tileID.canonical.x,L.tileID.canonical.y),this.tileZoom=L.tileZoom,this.uid=L.uid,this.zoom=L.zoom,this.lut=L.lut,this.canonical=L.tileID.canonical,this.pixelRatio=L.pixelRatio,this.tileSize=L.tileSize,this.source=L.source,this.scope=L.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=L.showCollisionBoxes,this.collectResourceTiming=!!L.collectResourceTiming,this.promoteId=L.promoteId,this.isSymbolTile=L.isSymbolTile,this.tileTransform=s.dK(L.tileID.canonical,L.projection),this.projection=L.projection,this.brightness=L.brightness,this.extraShadowCaster=!!L.extraShadowCaster,this.tessellationStep=L.tessellationStep}parse(L,F,W,J,ee){this.status="parsing",this.data=L,this.collisionBoxArray=new s.dL;const ce=new s.dM(Object.keys(L.layers).sort()),me=new s.dN(this.tileID,this.promoteId);me.bucketLayerIDs=[];const ae={},ge=new s.dO(256,256),Fe={featureIndex:me,iconDependencies:{},patternDependencies:{},glyphDependencies:{},lineAtlas:ge,availableImages:W,brightness:this.brightness},Le=F.familiesBySource[this.source];for(const Xe in Le){const ai=L.layers[Xe];if(!ai)continue;let Wt=!1,kt=!1,wi=!1;for(const ji of Le[Xe])ji[0].type==="symbol"?Wt=!0:kt=!0,ji[0].is3D()&&ji[0].type!=="model"&&(wi=!0);if(this.extraShadowCaster&&!wi||this.isSymbolTile===!0&&!Wt||this.isSymbolTile===!1&&!kt)continue;ai.version===1&&s.w(`Vector tile source "${this.source}" layer "${Xe}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const li=ce.encode(Xe),Ii=[];for(let ji=0;ji<ai.length;ji++){const Gi=ai.feature(ji),Kn=me.getId(Gi,Xe);Ii.push({feature:Gi,id:Kn,index:ji,sourceLayerIndex:li})}for(const ji of Le[Xe]){const Gi=ji[0];(!this.extraShadowCaster||Gi.is3D()&&Gi.type!=="model")&&(this.isSymbolTile!==void 0&&Gi.type==="symbol"!==this.isSymbolTile||Gi.minzoom&&this.zoom<Math.floor(Gi.minzoom)||Gi.maxzoom&&this.zoom>=Gi.maxzoom||Gi.visibility!=="none"&&(jr(ji,this.zoom,Fe.brightness,W),(ae[Gi.id]=Gi.createBucket({index:me.bucketLayerIDs.length,layers:ji,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:li,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep})).populate(Ii,Fe,this.tileID.canonical,this.tileTransform),me.bucketLayerIDs.push(ji.map(Kn=>Kn.id))))}}let Ke,nt,wt,Tt;ge.trim();const pt={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},Lt=()=>{if(Ke)return this.status="done",ee(Ke);if(this.extraShadowCaster)this.status="done",ee(null,{buckets:s.dG(ae).filter(Xe=>!Xe.isEmpty()),featureIndex:me,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:Fe.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(nt&&wt&&Tt){const Xe=new ur(nt),ai=new s.dQ(wt,Tt,this.lut);for(const Wt in ae){const kt=ae[Wt];kt instanceof s.dR?(jr(kt.layers,this.zoom,Fe.brightness,W),s.dS(kt,nt,Xe.positions,wt,ai.iconPositions,this.showCollisionBoxes,W,this.tileID.canonical,this.tileZoom,this.projection,this.brightness)):kt.hasPattern&&(kt instanceof s.dT||kt instanceof s.dU||kt instanceof s.b_)&&(jr(kt.layers,this.zoom,Fe.brightness,W),kt.addFeatures(Fe,this.tileID.canonical,ai.patternPositions,W,this.tileTransform,this.brightness))}this.status="done",ee(null,{buckets:s.dG(ae).filter(Wt=>!Wt.isEmpty()),featureIndex:me,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Xe.image,lineAtlas:ge,imageAtlas:ai,brightness:Fe.brightness})}};if(!this.extraShadowCaster){const Xe=s.dP(Fe.glyphDependencies,kt=>Object.keys(kt).map(Number));Object.keys(Xe).length?J.send("getGlyphs",{uid:this.uid,stacks:Xe,scope:this.scope},(kt,wi)=>{Ke||(Ke=kt,nt=wi,Lt())},void 0,!1,pt):nt={};const ai=Object.keys(Fe.iconDependencies);ai.length?J.send("getImages",{icons:ai,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(kt,wi)=>{Ke||(Ke=kt,wt=wi,Lt())},void 0,!1,pt):wt={};const Wt=Object.keys(Fe.patternDependencies);Wt.length?J.send("getImages",{icons:Wt,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(kt,wi)=>{Ke||(Ke=kt,Tt=wi,Lt())},void 0,!1,pt):Tt={}}Lt()}}function jr(oe,L,F,W){const J=new s.X(L,{brightness:F});for(const ee of oe)ee.recalculate(J,W)}class En extends s.E{constructor(L,F,W,J,ee,ce){super(),this.actor=L,this.layerIndex=F,this.availableImages=W,this.loadVectorData=ee||s.ap,this.loading={},this.loaded={},this.deduped=new s.ao(L.scheduler),this.isSpriteLoaded=J,this.scheduler
13=L.scheduler,this.brightness=ce}loadTile(L,F){const W=L.uid,J=L&&L.request,ee=J&&J.collectResourceTiming,ce=this.loading[W]=new Ur(L);ce.abort=this.loadVectorData(L,(me,ae)=>{const ge=!this.loading[W];if(delete this.loading[W],ge||me||!ae)return ce.status="done",ge||(this.loaded[W]=ce),F(me);const Fe=ae.rawData,Le={};ae.expires&&(Le.expires=ae.expires),ae.cacheControl&&(Le.cacheControl=ae.cacheControl),ce.vectorTile=ae.vectorTile||new s.dV(new s.dW(Fe));const Ke=()=>{ce.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.actor,(nt,wt)=>{if(nt||!wt)return F(nt);const Tt={};if(ee){const pt=xt(J);pt.length>0&&(Tt.resourceTiming=JSON.parse(JSON.stringify(pt)))}F(null,s.W({rawTileData:Fe.slice(0)},wt,Le,Tt))})};this.isSpriteLoaded?Ke():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(Ke,{type:"parseTile",isSymbolTile:L.isSymbolTile,zoom:L.tileZoom}):Ke()}),this.loaded=this.loaded||{},this.loaded[W]=ce})}reloadTile(L,F){const W=this.loaded,J=L.uid;if(W&&W[J]){const ee=W[J];ee.showCollisionBoxes=L.showCollisionBoxes,ee.projection=L.projection,ee.brightness=L.brightness,ee.tileTransform=s.dK(L.tileID.canonical,L.projection),ee.extraShadowCaster=L.extraShadowCaster,ee.lut=L.lut;const ce=(me,ae)=>{const ge=ee.reloadCallback;ge&&(delete ee.reloadCallback,ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor,ge)),F(me,ae)};ee.status==="parsing"?ee.reloadCallback=ce:ee.status==="done"&&(ee.vectorTile?ee.parse(ee.vectorTile,this.layerIndex,this.availableImages,this.actor,ce):ce())}else F(null,void 0)}abortTile(L,F){const W=L.uid,J=this.loading[W];J&&(J.abort&&J.abort(),delete this.loading[W]),F()}removeTile(L,F){const W=this.loaded,J=L.uid;W&&W[J]&&delete W[J],F()}}class $a{loadTile(L,F){const{uid:W,encoding:J,rawImageData:ee,padding:ce}=L,me=ImageBitmap&&ee instanceof ImageBitmap?this.getImageData(ee,ce):ee;F(null,new s.dX(W,me,J,ce<1))}getImageData(L,F){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(L.width,L.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=L.width,this.offscreenCanvas.height=L.height,this.offscreenCanvasContext.drawImage(L,0,0,L.width,L.height);const W=this.offscreenCanvasContext.getImageData(-F,-F,L.width+2*F,L.height+2*F);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),W}}class Wa{decodeRasterArray({task:L,buffer:F},W){s.dY.performDecoding(F,L).then(J=>{W(null,J)},J=>{W(J)})}}const Gr=s.dZ.prototype.toGeoJSON;let xi=class{constructor(oe){this._feature=oe,this.extent=s.a3,this.type=oe.type,this.properties=oe.tags,"id"in oe&&!isNaN(oe.id)&&(this.id=parseInt(oe.id,10))}loadGeometry(){if(this._feature.type===1){const oe=[];for(const L of this._feature.geometry)oe.push([new s.P(L[0],L[1])]);return oe}{const oe=[];for(const L of this._feature.geometry){const F=[];for(const W of L)F.push(new s.P(W[0],W[1]));oe.push(F)}return oe}}toGeoJSON(oe,L,F){return Gr.call(this,oe,L,F)}},mi=class{constructor(oe){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=s.a3,this.length=oe.length,this._features=oe}feature(oe){return new xi(this._features[oe])}};const qr=64/4096;class Bs{constructor(){this.features=new Map}clear(){this.features.clear()}load(L=[],F){for(const W of L){const J=W.id;if(J==null)continue;let ee=this.features.get(J);ee&&this.updateCache(ee,F),W.geometry?(ee=vc(W),this.updateCache(ee,F),this.features.set(J,ee)):this.features.delete(J),this.updateCache(ee,F)}}updateCache(L,F){for(const{canonical:W,uid:J}of Object.values(F)){const{z:ee,x:ce,y:me}=W;Fs(L,Math.pow(2,ee),ce,me)&&delete F[J]}}getTile(L,F,W){const J=Math.pow(2,L),ee=[];for(const ce of this.features.values())Fs(ce,J,F,W)&&ee.push(Ha(ce,J,F,W));return{features:ee}}getFeatures(){return[...this.features.values()]}}function Fs({minX:oe,minY:L,maxX:F,maxY:W},J,ee,ce){return oe<(ee+1+qr)/J&&L<(ce+1+qr)/J&&F>(ee-qr)/J&&W>(ce-qr)/J}function vc(oe){const{id:L,geometry:F,properties:W}=oe;if(!F)return;if(F.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:J,coordinates:ee}=F,ce={id:L,type:1,geometry:[],tags:W,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},me=ce.geometry;if(J==="Point")Qt(ee,me,ce);else if(J==="MultiPoint")for(const ae of ee)Qt(ae,me,ce);else if(J==="LineString")ce.type=2,Co(ee,me,ce);else if(J==="MultiLineString")ce.type=2,Ft(ee,me,ce);else if(J==="Polygon")ce.type=3,Ft(ee,me,ce,!0);else{if(J!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");ce.type=3;for(const ae of ee)Ft(ae,me,ce,!0)}return ce}function Qt([oe,L],F,W){const J=s.aj(oe);let ee=s.ak(L);ee=ee<0?0:ee>1?1:ee,F.push(J,ee),W.minX=Math.min(W.minX,J),W.minY=Math.min(W.minY,ee),W.maxX=Math.max(W.maxX,J),W.maxY=Math.max(W.maxY,ee)}function Co(oe,L,F,W=!1,J=!1){const ee=[];for(const ce of oe)Qt(ce,ee,F);L.push(ee),W&&function(ce,me){let ae=0;
13for(let ge=0,Fe=ce.length,Le=Fe-2;ge<Fe;Le=ge,ge+=2)ae+=(ce[ge]-ce[Le])*(ce[ge+1]+ce[Le+1]);if(ae>0===me)for(let ge=0,Fe=ce.length;ge<Fe/2;ge+=2){const Le=ce[ge],Ke=ce[ge+1];ce[ge]=ce[Fe-2-ge],ce[ge+1]=ce[Fe-1-ge],ce[Fe-2-ge]=Le,ce[Fe-1-ge]=Ke}}(ee,J)}function Ft(oe,L,F,W=!1){for(let J=0;J<oe.length;J++)Co(oe[J],L,F,W,J===0)}function Ha(oe,L,F,W){const{id:J,type:ee,geometry:ce,tags:me}=oe,ae=[];if(ee===1)Ns(ce,L,F,W,ae);else for(const ge of ce)ae.push(Ns(ge,L,F,W));return{id:J,type:ee,geometry:ae,tags:me}}function Ns(oe,L,F,W,J=[]){for(let ee=0;ee<oe.length;ee+=2)J.push(Xa(oe[ee],oe[ee+1],L,F,W));return J}function Xa(oe,L,F,W,J){return[Math.round(s.a3*(oe*F-W)),Math.round(s.a3*(L*F-J))]}var Kt={exports:{}},Vs=s.d$,gr=s.d_.VectorTileFeature,Ya=Us;function Us(oe,L){this.options=L||{},this.features=oe,this.length=oe.length}function Zn(oe,L){this.id=typeof oe.id=="number"?oe.id:void 0,this.type=oe.type,this.rawGeometry=oe.type===1?[oe.geometry]:oe.geometry,this.properties=oe.tags,this.extent=L||4096}Us.prototype.feature=function(oe){return new Zn(this.features[oe],this.options.extent)},Zn.prototype.loadGeometry=function(){var oe=this.rawGeometry;this.geometry=[];for(var L=0;L<oe.length;L++){for(var F=oe[L],W=[],J=0;J<F.length;J++)W.push(new Vs(F[J][0],F[J][1]));this.geometry.push(W)}return this.geometry},Zn.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var oe=this.geometry,L=1/0,F=-1/0,W=1/0,J=-1/0,ee=0;ee<oe.length;ee++)for(var ce=oe[ee],me=0;me<ce.length;me++){var ae=ce[me];L=Math.min(L,ae.x),F=Math.max(F,ae.x),W=Math.min(W,ae.y),J=Math.max(J,ae.y)}return[L,W,F,J]},Zn.prototype.toGeoJSON=gr.prototype.toGeoJSON;var $t=s.e0,Po=Ya;function Ui(oe){var L=new $t;return function(F,W){for(var J in F.layers)W.writeMessage(3,Ka,F.layers[J])}(oe,L),L.finish()}function Ka(oe,L){var F;L.writeVarintField(15,oe.version||1),L.writeStringField(1,oe.name||""),L.writeVarintField(5,oe.extent||4096);var W={keys:[],values:[],keycache:{},valuecache:{}};for(F=0;F<oe.length;F++)W.feature=oe.feature(F),L.writeMessage(2,Ja,W);var J=W.keys;for(F=0;F<J.length;F++)L.writeStringField(3,J[F]);var ee=W.values;for(F=0;F<ee.length;F++)L.writeMessage(4,el,ee[F])}function Ja(oe,L){var F=oe.feature;F.id!==void 0&&L.writeVarintField(1,F.id),L.writeMessage(2,Qa,oe),L.writeVarintField(3,F.type),L.writeMessage(4,si,F)}function Qa(oe,L){var F=oe.feature,W=oe.keys,J=oe.values,ee=oe.keycache,ce=oe.valuecache;for(var me in F.properties){var ae=F.properties[me],ge=ee[me];if(ae!==null){ge===void 0&&(W.push(me),ee[me]=ge=W.length-1),L.writeVarint(ge);var Fe=typeof ae;Fe!=="string"&&Fe!=="boolean"&&Fe!=="number"&&(ae=JSON.stringify(ae));var Le=Fe+":"+ae,Ke=ce[Le];Ke===void 0&&(J.push(ae),ce[Le]=Ke=J.length-1),L.writeVarint(Ke)}}}function lt(oe,L){return(L<<3)+(7&oe)}function zo(oe){return oe<<1^oe>>31}function si(oe,L){for(var F=oe.loadGeometry(),W=oe.type,J=0,ee=0,ce=F.length,me=0;me<ce;me++){var ae=F[me],ge=1;W===1&&(ge=ae.length),L.writeVarint(lt(1,ge));for(var Fe=W===3?ae.length-1:ae.length,Le=0;Le<Fe;Le++){Le===1&&W!==1&&L.writeVarint(lt(2,Fe-1));var Ke=ae[Le].x-J,nt=ae[Le].y-ee;L.writeVarint(zo(Ke)),L.writeVarint(zo(nt)),J+=Ke,ee+=nt}W===3&&L.writeVarint(lt(7,1))}}function el(oe,L){var F=typeof oe;F==="string"?L.writeStringField(1,oe):F==="boolean"?L.writeBooleanField(7,oe):F==="number"&&(oe%1!=0?L.writeDoubleField(3,oe):oe<0?L.writeSVarintField(6,oe):L.writeVarintField(5,oe))}Kt.exports=Ui,Kt.exports.fromVectorTileJs=Ui,Kt.exports.fromGeojsonVt=function(oe,L){L=L||{};var F={};for(var W in oe)F[W]=new Po(oe[W].features,L),F[W].name=W,F[W].version=L.version,F[W].extent=L.extent;return Ui({layers:F})},Kt.exports.GeoJSONWrapper=Po;var tl=s.e1(Kt.exports);const il={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:oe=>oe},js=Math.fround||(Do=new Float32Array(1),oe=>(Do[0]=+oe,Do[0]));var Do;const Ar=3,Cr=5,Gs=6;class at{constructor(L){this.options=Object.assign(Object.create(il),L),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(L){const{log:F,minZoom:W,maxZoom:J}=this.options;F&&console.time("total time");const ee=`prepare ${L.length} points`;F&&console.time(ee),this.points=L;const ce=[];for(let ae=0;ae<L.length;ae++){const ge=L[ae];if(!ge.geometry)continue;const[Fe,Le]=ge.geometry.coordinates,Ke=js(tr(Fe)),nt=js($n(Le));
vendor: 12,412 bytes, line 13
13ce.push(Ke,nt,1/0,ae,-1,1),this.options.reduce&&ce.push(0)}let me=this.trees[J+1]=this._createTree(ce);F&&console.timeEnd(ee);for(let ae=J;ae>=W;ae--){const ge=+Date.now();me=this.trees[ae]=this._createTree(this._cluster(me,ae)),F&&console.log("z%d: %d clusters in %dms",ae,me.numItems,+Date.now()-ge)}return F&&console.timeEnd("total time"),this}getClusters(L,F){let W=((L[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,L[1]));let ee=L[2]===180?180:((L[2]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,L[3]));if(L[2]-L[0]>=360)W=-180,ee=180;else if(W>ee){const Le=this.getClusters([W,J,180,ce],F),Ke=this.getClusters([-180,J,ee,ce],F);return Le.concat(Ke)}const me=this.trees[this._limitZoom(F)],ae=me.range(tr(W),$n(ce),tr(ee),$n(J)),ge=me.data,Fe=[];for(const Le of ae){const Ke=this.stride*Le;Fe.push(ge[Ke+Cr]>1?ct(ge,Ke,this.clusterProps):this.points[ge[Ke+Ar]])}return Fe}getChildren(L){const F=this._getOriginId(L),W=this._getOriginZoom(L),J="No cluster with the specified id.",ee=this.trees[W];if(!ee)throw new Error(J);const ce=ee.data;if(F*this.stride>=ce.length)throw new Error(J);const me=this.options.radius/(this.options.extent*Math.pow(2,W-1)),ae=ee.within(ce[F*this.stride],ce[F*this.stride+1],me),ge=[];for(const Fe of ae){const Le=Fe*this.stride;ce[Le+4]===L&&ge.push(ce[Le+Cr]>1?ct(ce,Le,this.clusterProps):this.points[ce[Le+Ar]])}if(ge.length===0)throw new Error(J);return ge}getLeaves(L,F,W){const J=[];return this._appendLeaves(J,L,F=F||10,W=W||0,0),J}getTile(L,F,W){const J=this.trees[this._limitZoom(L)],ee=Math.pow(2,L),{extent:ce,radius:me}=this.options,ae=me/ce,ge=(W-ae)/ee,Fe=(W+1+ae)/ee,Le={features:[]};return this._addTileFeatures(J.range((F-ae)/ee,ge,(F+1+ae)/ee,Fe),J.data,F,W,ee,Le),F===0&&this._addTileFeatures(J.range(1-ae/ee,ge,1,Fe),J.data,ee,W,ee,Le),F===ee-1&&this._addTileFeatures(J.range(0,ge,ae/ee,Fe),J.data,-1,W,ee,Le),Le.features.length?Le:null}getClusterExpansionZoom(L){let F=this._getOriginZoom(L)-1;for(;F<=this.options.maxZoom;){const W=this.getChildren(L);if(F++,W.length!==1)break;L=W[0].properties.cluster_id}return F}_appendLeaves(L,F,W,J,ee){const ce=this.getChildren(F);for(const me of ce){const ae=me.properties;if(ae&&ae.cluster?ee+ae.point_count<=J?ee+=ae.point_count:ee=this._appendLeaves(L,ae.cluster_id,W,J,ee):ee<J?ee++:L.push(me),L.length===W)break}return ee}_createTree(L){const F=new s.cK(L.length/this.stride|0,this.options.nodeSize,Float32Array);for(let W=0;W<L.length;W+=this.stride)F.add(L[W],L[W+1]);return F.finish(),F.data=L,F}_addTileFeatures(L,F,W,J,ee,ce){for(const me of L){const ae=me*this.stride,ge=F[ae+Cr]>1;let Fe,Le,Ke;if(ge)Fe=Lo(F,ae,this.clusterProps),Le=F[ae],Ke=F[ae+1];else{const Tt=this.points[F[ae+Ar]];Fe=Tt.properties;const[pt,Lt]=Tt.geometry.coordinates;Le=tr(pt),Ke=$n(Lt)}const nt={type:1,geometry:[[Math.round(this.options.extent*(Le*ee-W)),Math.round(this.options.extent*(Ke*ee-J))]],tags:Fe};let wt;wt=ge||this.options.generateId?F[ae+Ar]:this.points[F[ae+Ar]].id,wt!==void 0&&(nt.id=wt),ce.features.push(nt)}}_limitZoom(L){return Math.max(this.options.minZoom,Math.min(Math.floor(+L),this.options.maxZoom+1))}_cluster(L,F){const{radius:W,extent:J,reduce:ee,minPoints:ce}=this.options,me=W/(J*Math.pow(2,F)),ae=L.data,ge=[],Fe=this.stride;for(let Le=0;Le<ae.length;Le+=Fe){if(ae[Le+2]<=F)continue;ae[Le+2]=F;const Ke=ae[Le],nt=ae[Le+1],wt=L.within(ae[Le],ae[Le+1],me),Tt=ae[Le+Cr];let pt=Tt;for(const Lt of wt){const Xe=Lt*Fe;ae[Xe+2]>F&&(pt+=ae[Xe+Cr])}if(pt>Tt&&pt>=ce){let Lt,Xe=Ke*Tt,ai=nt*Tt,Wt=-1;const kt=(Le/Fe<<5)+(F+1)+this.points.length;for(const wi of wt){const li=wi*Fe;if(ae[li+2]<=F)continue;ae[li+2]=F;const Ii=ae[li+Cr];Xe+=ae[li]*Ii,ai+=ae[li+1]*Ii,ae[li+4]=kt,ee&&(Lt||(Lt=this._map(ae,Le,!0),Wt=this.clusterProps.length,this.clusterProps.push(Lt)),ee(Lt,this._map(ae,li)))}ae[Le+4]=kt,ge.push(Xe/pt,ai/pt,1/0,kt,-1,pt),ee&&ge.push(Wt)}else{for(let Lt=0;Lt<Fe;Lt++)ge.push(ae[Le+Lt]);if(pt>1)for(const Lt of wt){const Xe=Lt*Fe;if(!(ae[Xe+2]<=F)){ae[Xe+2]=F;for(let ai=0;ai<Fe;ai++)ge.push(ae[Xe+ai])}}}}return ge}_getOriginId(L){return L-this.points.length>>5}_getOriginZoom(L){return(L-this.points.length)%32}_map(L,F,W){if(L[F+Cr]>1){const ce=this.clusterProps[L[F+Gs]];return W?Object.assign({},ce):ce}const J=this.points[L[F+Ar]].properties,ee=this.options.map(J);return W&&ee===J?Object.assign({},ee):ee}}function ct(oe,L,F){return{type:"Feature",id:oe[L+Ar],properties:Lo(oe,L,F),geometry:{type:"Point",coordinates:[(W=oe[L],360*(W-.5)),Ro(oe[L+1])]}};var W}function Lo(oe,L,F){const W=oe[L+Cr],J=W>=1e4?`${Math.round(W/1e3)}k`:W>=1e3?Math.round(W/100)/10+"k":W,ee=oe[L+Gs],ce=ee===-1?{}:Object.assign({},F[ee]);return Object.assign(ce,{cluster:!0,cluster_id:oe[L+Ar],point_count:W,point_count_abbreviated:J})}function tr(oe){return oe/360+.5}function $n(oe){const L=Math.sin(oe*Math.PI/180),F=.5-.25*Math.log((1+L)/(1-L))/Math.PI;return F<0?0:F>1?1:F}function Ro(oe){const L=(180-360*oe)*Math.PI/180;return 360*Math.atan(Math.exp(L))/Math.PI-90}function ko(oe,L,F,W){let J=W;const ee=L+(F-L>>1);let ce,me=F-L;const ae=oe[L],ge=oe[L+1],Fe=oe[F],Le=oe[F+1];for(let Ke=L+3;Ke<F;Ke+=3){const nt=qs(oe[Ke],oe[Ke+1],ae,ge,Fe,Le);if(nt>J)ce=Ke,J=nt;else if(nt===J){const wt=Math.abs(Ke-ee);wt<me&&(ce=Ke,me=wt)}}J>W&&(ce-L>3&&ko(oe,L,ce,W),oe[ce+2]=J,F-ce>3&&ko(oe,ce,F,W))}function qs(oe,L,F,W,J,ee){let ce=J-F,me=ee-W;if(ce!==0||me!==0){const ae=((oe-F)*ce+(L-W)*me)/(ce*ce+me*me);ae>1?(F=J,W=ee):ae>0&&(F+=ce*ae,W+=me*ae)}return ce=oe-F,me=L-W,ce*ce+me*me}function Sn(oe,L,F,W){const J={id:oe??null,type:L,geometry:F,tags:W,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(L==="Point"||L==="MultiPoint"||L==="LineString")Wn(J,F);else if(L==="Polygon")Wn(J,F[0]);else if(L==="MultiLineString")for(const ee of F)Wn(J,ee);else if(L==="MultiPolygon")for(const ee of F)Wn(J,ee[0]);return J}function Wn(oe,L){for(let F=0;F<L.length;F+=3)oe.minX=Math.min(oe.minX,L[F]),oe.minY=Math.min(oe.minY,L[F+1]),oe.maxX=Math.max(oe.maxX,L[F]),oe.maxY=Math.max(oe.maxY,L[F+1])}function Hn(oe,L,F,W){if(!L.geometry)return;const J=L.geometry.coordinates;if(J&&J.length===0)return;const ee=L.geometry.type,ce=Math.pow(F.tolerance/((1<<F.maxZoom)*F.extent),2);let me=[],ae=L.id;if(F.promoteId?ae=L.properties[F.promoteId]:F.generateId&&(ae=W||0),ee==="Point")Zs(J,me);else if(ee==="MultiPoint")for(const ge of J)Zs(ge,me);else if(ee==="LineString")Oo(J,me,ce,!1);else if(ee==="MultiLineString"){if(F.lineMetrics){for(const ge of J)me=[],Oo(ge,me,ce,!1),oe.push(Sn(ae,"LineString",me,L.properties));return}Bo(J,me,ce,!1)}else if(ee==="Polygon")Bo(J,me,ce,!0);else{if(ee!=="MultiPolygon"){if(ee==="GeometryCollection"){for(const ge of L.geometry.geometries)Hn(oe,{id:ae,geometry:ge,properties:L.properties},F,W);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ge of J){const Fe=[];Bo(ge,Fe,ce,!0),me.push(Fe)}}oe.push(Sn(ae,ee,me,L.properties))}function Zs(oe,L){L.push(yr(oe[0]),rl(oe[1]),0)}function Oo(oe,L,F,W){let J,ee,ce=0;for(let ae=0;ae<oe.length;ae++){const ge=yr(oe[ae][0]),Fe=rl(oe[ae][1]);L.push(ge,Fe,0),ae>0&&(ce+=W?(J*Fe-ge*ee)/2:Math.sqrt(Math.pow(ge-J,2)+Math.pow(Fe-ee,2))),J=ge,ee=Fe}const me=L.length-3;L[2]=1,ko(L,0,me,F),L[me+2]=1,L.size=Math.abs(ce),L.start=0,L.end=L.size}function Bo(oe,L,F,W){for(let J=0;J<oe.length;J++){const ee=[];Oo(oe[J],ee,F,W),L.push(ee)}}function yr(oe){return oe/360+.5}function rl(oe){const L=Math.sin(oe*Math.PI/180),F=.5-.25*Math.log((1+L)/(1-L))/Math.PI;return F<0?0:F>1?1:F}function ut(oe,L,F,W,J,ee,ce,me){if(W/=L,ee>=(F/=L)&&ce<W)return oe;if(ce<F||ee>=W)return null;const ae=[];for(const ge of oe){const Fe=ge.geometry;let Le=ge.type;const Ke=J===0?ge.minX:ge.minY,nt=J===0?ge.maxX:ge.maxY;if(Ke>=F&&nt<W){ae.push(ge);continue}if(nt<F||Ke>=W)continue;let wt=[];if(Le==="Point"||Le==="MultiPoint")$s(Fe,wt,F,W,J);else if(Le==="LineString")gi(Fe,wt,F,W,J,!1,me.lineMetrics);else if(Le==="MultiLineString")Xn(Fe,wt,F,W,J,!1);else if(Le==="Polygon")Xn(Fe,wt,F,W,J,!0);else if(Le==="MultiPolygon")for(const Tt of Fe){const pt=[];Xn(Tt,pt,F,W,J,!0),pt.length&&wt.push(pt)}if(wt.length){if(me.lineMetrics&&Le==="LineString"){for(const Tt of wt)ae.push(Sn(ge.id,Le,Tt,ge.tags));continue}Le!=="LineString"&&Le!=="MultiLineString"||(wt.length===1?(Le="LineString",wt=wt[0]):Le="MultiLineString"),Le!=="Point"&&Le!=="MultiPoint"||(Le=wt.length===3?"Point":"MultiPoint"),ae.push(Sn(ge.id,Le,wt,ge.tags))}}return ae.length?ae:null}function $s(oe,L,F,W,J){for(let ee=0;ee<oe.length;ee+=3){const ce=oe[ee+J];ce>=F&&ce<=W&&Zr(L,oe[ee],oe[ee+1],oe[ee+2])}}function gi(oe,L,F,W,J,ee,ce){let me=Fo(oe);const ae=J===0?$r:Ws;let ge,Fe,Le=oe.start;for(let pt=0;pt<oe.length-3;pt+=3){const Lt=oe[pt],Xe=oe[pt+1],ai=oe[pt+2],Wt=oe[pt+3],kt=oe[pt+4],wi=J===0?Lt:Xe,li=J===0?Wt:kt;let Ii=!1;ce&&(ge=Math.sqrt(Math.pow(Lt-Wt,2)+Math.pow(Xe-kt,2))),wi<F?li>F&&(Fe=ae(me,Lt,Xe,Wt,kt,F),ce&&(me.start=Le+ge*Fe)):wi>W?li<W&&(Fe=ae(me,Lt,Xe,Wt,kt,W),ce&&(me.start=Le+ge*Fe)):Zr(me,Lt,Xe,ai),li<F&&wi>=F&&(Fe=ae(me,Lt,Xe,Wt,kt,F),Ii=!0),li>W&&wi<=W&&(Fe=ae(me,Lt,Xe,Wt,kt,W),Ii=!0),!ee&&Ii&&(ce&&(me.end=Le+ge*Fe),L.push(me),me=Fo(oe)),ce&&(Le+=ge)}let Ke=oe.length-3;const nt=oe[Ke],wt=oe[Ke+1],Tt=J===0?nt:wt;Tt>=F&&Tt<=W&&Zr(me,nt,wt,oe[Ke+2]),Ke=me.length-3,ee&&Ke>=3&&(me[Ke]!==me[0]||me[Ke+1]!==me[1])&&Zr(me,me[0],me[1],me[2]),me.length&&L.push(me)}function Fo(oe){const L=[];return L.size=oe.size,L.start=oe.start,L.end=oe.end,L}function Xn(oe,L,F,W,J,ee){for(const ce of oe)gi(ce,L,F,W,J,ee,!1)}function Zr(oe,L,F,W){oe.push(L,F,W)}function $r(oe,L,F,W,J,ee){const ce=(ee-L)/(W-L);return Zr(oe,ee,F+(J-F)*ce,1),ce}function Ws(oe,L,F,W,J,ee){const ce=(ee-F)/(J-F);return Zr(oe,L+(W-L)*ce,ee,1),ce}function Mn(oe,L){const F=[];for(let W=0;W<oe.length;W++){const J=oe[W],ee=J.type;let ce;if(ee==="Point"||ee==="MultiPoint"||ee==="LineString")ce=In(J.geometry,L);else if(ee==="MultiLineString"||ee==="Polygon"){ce=[];for(const me of J.geometry)ce.push(In(me,L))}else if(ee==="MultiPolygon"){ce=[];for(const me of J.geometry){const ae=[];for(const ge of me)ae.push(In(ge,L));ce.push(ae)}}F.push(Sn(J.id,ee,ce,J.tags))}return F}function In(oe,L){const F=[];F.size=oe.size,oe.start!==void 0&&(F.start=oe.start,F.end=oe.end);for(let W=0;W<oe.length;W+=3)F.push(oe[W]+L,oe[W+1],oe[W+2]);return F}function No(oe,L){if(oe.transformed)return oe;const F=1<<oe.z,W=oe.x,J=oe.y;for(const ee of oe.features){const ce=ee.geometry,me=ee.type;if(ee.geometry=[],me===1)for(let ae=0;ae<ce.length;ae+=2)ee.geometry.push(Vo(ce[ae],ce[ae+1],L,F,W,J));else for(let ae=0;ae<ce.length;ae++){const ge=[];for(let Fe=0;Fe<ce[ae].length;Fe+=2)ge.push(Vo(ce[ae][Fe],ce[ae][Fe+1],L,F,W,J));ee.geometry.push(ge)}}return oe.transformed=!0,oe}function Vo(oe,L,F,W,J,ee){return[Math.round(F*(oe*W-J)),Math.round(F*(L*W-ee))]}function nl(oe,L,F,W,J){const ee=L===J.maxZoom?0:J.tolerance/((1<<L)*J.extent),ce={features:[],numPoints:0,numSimplified:0,numFeatures:oe.length,source:null,x:F,y:W,z:L,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const me of oe)Uo(ce,me,ee,J);return ce}function Uo(oe,L,F,W){const J=L.geometry,ee=L.type,ce=[];if(oe.minX=Math.min(oe.minX,L.minX),oe.minY=Math.min(oe.minY,L.minY),oe.maxX=Math.max(oe.maxX,L.maxX),oe.maxY=Math.max(oe.maxY,L.maxY),ee==="Point"||ee==="MultiPoint")for(let me=0;me<J.length;me+=3)ce.push(J[me],J[me+1]),oe.numPoints++,oe.numSimplified++;else if(ee==="LineString")xr(ce,J,oe,F,!1,!1);else if(ee==="MultiLineString"||ee==="Polygon")for(let me=0;me<J.length;me++)xr(ce,J[me],oe,F,ee==="Polygon",me===0);else if(ee==="MultiPolygon")for(let me=0;me<J.length;me++){const ae=J[me];for(let ge=0;ge<ae.length;ge++)xr(ce,ae[ge],oe,F,!0,ge===0)}if(ce.length){let me=L.tags||null;if(ee==="LineString"&&W.lineMetrics){me={};for(const ge in L.tags)me[ge]=L.tags[ge];me.mapbox_clip_start=J.start/J.size,me.mapbox_clip_end=J.end/J.size}const ae={geometry:ce,type:ee==="Polygon"||ee==="MultiPolygon"?3:ee==="LineString"||ee==="MultiLineString"?2:1,tags:me};L.id!==null&&(ae.id=L.id),oe.features.push(ae)}}function xr(oe,L,F,W,J,ee){const ce=W*W;if(W>0&&L.size<(J?ce:W))return void(F.numPoints+=L.length/3);const me=[];for(let ae=0;ae<L.length;ae+=3)(W===0||L[ae+2]>ce)&&(F.numSimplified++,me.push(L[ae],L[ae+1])),F.numPoints++;J&&function(ae,ge){let Fe=0;for(let Le=0,Ke=ae.length,nt=Ke-2;Le<Ke;nt=Le,Le+=2)Fe+=(ae[Le]-ae[nt])*(ae[Le+1]+ae[nt+1]);if(Fe>0===ge)for(let Le=0,Ke=ae.length;Le<Ke/2;Le+=2){const nt=ae[Le],wt=ae[Le+1];
13ae[Le]=ae[Ke-2-Le],ae[Le+1]=ae[Ke-1-Le],ae[Ke-2-Le]=nt,ae[Ke-1-Le]=wt}}(me,ee),oe.push(me)}const An={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class vr{constructor(L,F){const W=(F=this.options=function(ee,ce){for(const me in ce)ee[me]=ce[me];return ee}(Object.create(An),F)).debug;if(W&&console.time("preprocess data"),F.maxZoom<0||F.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(F.promoteId&&F.generateId)throw new Error("promoteId and generateId cannot be used together.");let J=function(ee,ce){const me=[];if(ee.type==="FeatureCollection")for(let ae=0;ae<ee.features.length;ae++)Hn(me,ee.features[ae],ce,ae);else Hn(me,ee.type==="Feature"?ee:{geometry:ee},ce);return me}(L,F);this.tiles={},this.tileCoords=[],W&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",F.indexMaxZoom,F.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function(ee,ce){const me=ce.buffer/ce.extent;let ae=ee;const ge=ut(ee,1,-1-me,me,0,-1,2,ce),Fe=ut(ee,1,1-me,2+me,0,-1,2,ce);return(ge||Fe)&&(ae=ut(ee,1,-me,1+me,0,-1,2,ce)||[],ge&&(ae=Mn(ge,1).concat(ae)),Fe&&(ae=ae.concat(Mn(Fe,-1)))),ae}(J,F),J.length&&this.splitTile(J,0,0,0),W&&(J.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(L,F,W,J,ee,ce,me){const ae=[L,F,W,J],ge=this.options,Fe=ge.debug;for(;ae.length;){J=ae.pop(),W=ae.pop(),F=ae.pop(),L=ae.pop();const Le=1<<F,Ke=ki(F,W,J);let nt=this.tiles[Ke];if(!nt&&(Fe>1&&console.time("creation"),nt=this.tiles[Ke]=nl(L,F,W,J,ge),this.tileCoords.push({z:F,x:W,y:J}),Fe)){Fe>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",F,W,J,nt.numFeatures,nt.numPoints,nt.numSimplified),console.timeEnd("creation"));const Ii=`z${F}`;this.stats[Ii]=(this.stats[Ii]||0)+1,this.total++}if(nt.source=L,ee==null){if(F===ge.indexMaxZoom||nt.numPoints<=ge.indexMaxPoints)continue}else{if(F===ge.maxZoom||F===ee)continue;if(ee!=null){const Ii=ee-F;if(W!==ce>>Ii||J!==me>>Ii)continue}}if(nt.source=null,L.length===0)continue;Fe>1&&console.time("clipping");const wt=.5*ge.buffer/ge.extent,Tt=.5-wt,pt=.5+wt,Lt=1+wt;let Xe=null,ai=null,Wt=null,kt=null,wi=ut(L,Le,W-wt,W+pt,0,nt.minX,nt.maxX,ge),li=ut(L,Le,W+Tt,W+Lt,0,nt.minX,nt.maxX,ge);L=null,wi&&(Xe=ut(wi,Le,J-wt,J+pt,1,nt.minY,nt.maxY,ge),ai=ut(wi,Le,J+Tt,J+Lt,1,nt.minY,nt.maxY,ge),wi=null),li&&(Wt=ut(li,Le,J-wt,J+pt,1,nt.minY,nt.maxY,ge),kt=ut(li,Le,J+Tt,J+Lt,1,nt.minY,nt.maxY,ge),li=null),Fe>1&&console.timeEnd("clipping"),ae.push(Xe||[],F+1,2*W,2*J),ae.push(ai||[],F+1,2*W,2*J+1),ae.push(Wt||[],F+1,2*W+1,2*J),ae.push(kt||[],F+1,2*W+1,2*J+1)}}getTile(L,F,W){L=+L,F=+F,W=+W;const J=this.options,{extent:ee,debug:ce}=J;if(L<0||L>24)return null;const me=1<<L,ae=ki(L,F=F+me&me-1,W);if(this.tiles[ae])return No(this.tiles[ae],ee);ce>1&&console.log("drilling down to z%d-%d-%d",L,F,W);let ge,Fe=L,Le=F,Ke=W;for(;!ge&&Fe>0;)Fe--,Le>>=1,Ke>>=1,ge=this.tiles[ki(Fe,Le,Ke)];return ge&&ge.source?(ce>1&&(console.log("found parent tile z%d-%d-%d",Fe,Le,Ke),console.time("drilling down")),this.splitTile(ge.source,Fe,Le,Ke,L,F,W),ce>1&&console.timeEnd("drilling down"),this.tiles[ae]?No(this.tiles[ae],ee):null):null}}function ki(oe,L,F){return 32*((1<<oe)*F+L)+oe}function ol(oe,L){const F=oe.tileID.canonical;if(!this._geoJSONIndex)return L(null,null);const W=this._geoJSONIndex.getTile(F.z,F.x,F.y);if(!W)return L(null,null);const J=new mi(W.features);let ee=tl(J);ee.byteOffset===0&&ee.byteLength===ee.buffer.byteLength||(ee=new Uint8Array(ee)),L(null,{vectorTile:J,rawData:ee.buffer})}class Yn extends En{constructor(L,F,W,J,ee,ce){super(L,F,W,J,ol,ce),ee&&(this.loadGeoJSON=ee),this._dynamicIndex=new Bs}loadData(L,F){const W=L&&L.request,J=W&&W.collectResourceTiming;this.loadGeoJSON(L,(ee,ce)=>{if(ee||!ce)return F(ee);if(typeof ce!="object")return F(new Error(`Input data given to '${L.source}' is not a valid GeoJSON object.`));{try{if(L.filter){const ae=s.y(L.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ae.result==="error")throw new Error(ae.value.map(ge=>`${ge.key}: ${ge.message}`).join(", "));ce.features=ce.features.filter(ge=>ae.value.evaluate({zoom:0},ge))}L.dynamic?(ce.type==="Feature"&&(ce={type:"FeatureCollection",features:[ce]}),L.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(ce.features,this.loaded),L.cluster&&(ce.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=L.cluster?new at(function({superclusterOptions:ae,clusterProperties:ge}){if(!ge||!ae)return ae;const Fe={},Le={},Ke={accumulated:null,zoom:0},nt={properties:null},wt=Object.keys(ge);for(const Tt of wt){const[pt,Lt]=ge[Tt],Xe=s.y(Lt),ai=s.y(typeof pt=="string"?[pt,["accumulated"],["get",Tt]]:pt);Fe[Tt]=Xe.value,Le[Tt]=ai.value}return ae.map=Tt=>{nt.properties=Tt;const pt={};for(const Lt of wt)pt[Lt]=Fe[Lt].evaluate(Ke,nt);return pt},ae.reduce=(Tt,pt)=>{nt.properties=pt;
13for(const Lt of wt)Ke.accumulated=Tt[Lt],Tt[Lt]=Le[Lt].evaluate(Ke,nt)},ae}(L)).load(ce.features):L.dynamic?this._dynamicIndex:function(ae,ge){return new vr(ae,ge)}(ce,L.geojsonVtOptions)}catch(ae){return F(ae)}const me={};if(J){const ae=xt(W);ae&&(me.resourceTiming={},me.resourceTiming[L.source]=JSON.parse(JSON.stringify(ae)))}F(null,me)}})}reloadTile(L,F){const W=this.loaded;return W&&W[L.uid]?L.partial?F(null,void 0):super.reloadTile(L,F):this.loadTile(L,F)}loadGeoJSON(L,F){if(L.request)s.g(L.request,F);else{if(typeof L.data!="string")return F(new Error(`Input data given to '${L.source}' is not a valid GeoJSON object.`));try{return F(null,JSON.parse(L.data))}catch{return F(new Error(`Input data given to '${L.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(L,F){try{F(null,this._geoJSONIndex.getClusterExpansionZoom(L.clusterId))}catch(W){F(W)}}getClusterChildren(L,F){try{F(null,this._geoJSONIndex.getChildren(L.clusterId))}catch(W){F(W)}}getClusterLeaves(L,F){try{F(null,this._geoJSONIndex.getLeaves(L.clusterId,L.limit,L.offset))}catch(W){F(W)}}}class jo{constructor(L,F){this.tileID=new s.aL(L.tileID.overscaledZ,L.tileID.wrap,L.tileID.canonical.z,L.tileID.canonical.x,L.tileID.canonical.y),this.tileZoom=L.tileZoom,this.uid=L.uid,this.zoom=L.zoom,this.canonical=L.tileID.canonical,this.pixelRatio=L.pixelRatio,this.tileSize=L.tileSize,this.source=L.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=L.projection,this.brightness=F}parse(L,F,W,J){this.status="parsing";const ee=new s.aL(W.tileID.overscaledZ,W.tileID.wrap,W.tileID.canonical.z,W.tileID.canonical.x,W.tileID.canonical.y),ce={},me=F.familiesBySource[W.source],ae=new s.dN(ee,W.promoteId);return ae.bucketLayerIDs=[],ae.is3DTile=!0,s.e3(L).then(ge=>{if(!ge)return J(new Error("Could not parse tile"));const Fe=s.e4(ge,1/s.b5(W.tileID.canonical)),Le=ge.json.extensionsUsed&&ge.json.extensionsUsed.includes("MAPBOX_mesh_features")||ge.json.asset.extras&&ge.json.asset.extras.MAPBOX_mesh_features,Ke=ge.json.extensionsUsed&&ge.json.extensionsUsed.includes("EXT_meshopt_compression"),nt=new s.X(this.zoom,{brightness:this.brightness});for(const wt in me)for(const Tt of me[wt]){const pt=Tt[0];ae.bucketLayerIDs.push(Tt.map(Xe=>Xe.id)),pt.recalculate(nt,[]);const Lt=new s.e5(Fe,ee,Le,Ke,this.brightness,ae);Le||(Lt.needsUpload=!0),ce[pt.fqid]=Lt,Lt.evaluate(pt)}this.status="done",J(null,{buckets:ce,featureIndex:ae})}).catch(ge=>J(new Error(ge.message)))}}class Hs{constructor(L,F,W,J,ee,ce){this.actor=L,this.layerIndex=F,this.brightness=ce,this.loading={},this.loaded={}}loadTile(L,F){const W=L.uid,J=this.loading[W]=new jo(L,this.brightness);s.e2(L.request,(ee,ce)=>{const me=!this.loading[W];return delete this.loading[W],me||ee?(J.status="done",me||(this.loaded[W]=J),F(ee)):ce&&ce.byteLength!==0?void J.parse(ce,this.layerIndex,L,(ae,ge)=>{J.status="done",this.loaded=this.loaded||{},this.loaded[W]=J,ae||!ge?F(ae):F(null,ge)}):(J.status="done",this.loaded[W]=J,F())})}reloadTile(L,F){const W=this.loaded,J=L.uid;if(W&&W[J]){const ee=W[J];ee.projection=L.projection,ee.brightness=L.brightness;const ce=(me,ae)=>{ee.reloadCallback&&(delete ee.reloadCallback,this.loadTile(L,F)),F(me,ae)};ee.status==="parsing"?ee.reloadCallback=ce:ee.status==="done"&&this.loadTile(L,F)}}abortTile(L,F){const W=L.uid;this.loading[W]&&delete this.loading[W],F()}removeTile(L,F){const W=this.loaded,J=L.uid;W&&W[J]&&delete W[J],F()}}class Go{constructor(L){this.self=L,this.actor=new s.e6(L,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=s.aJ({name:"mercator"}),this.workerSourceTypes={vector:En,geojson:Yn,"batched-model":Hs},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(F,W)=>{if(this.workerSourceTypes[F])throw new Error(`Worker source with name "${F}" already registered.`);this.workerSourceTypes[F]=W},this.self.registerRTLTextPlugin=F=>{if(s.e7.isParsed())throw new Error("RTL text plugin already registered.");s.e7.applyArabicShaping=F.applyArabicShaping,s.e7.processBidirectionalText=F.processBidirectionalText,s.e7.processStyledBidirectionalText=F.processStyledBidirectionalText}}clearCaches(L,F,W){delete this.layerIndexes[L],delete this.availableImages[L],delete this.workerSources[L],delete this.demWorkerSources[L],delete this.rasterArrayWorkerSource,W()}checkIfReady(L,F,W){W()}setReferrer(L,F){this.referrer=F}spriteLoaded(L,{scope:F,isLoaded:W}){if(this.isSpriteLoaded[L]||(this.isSpriteLoaded[L]={}),this.isSpriteLoaded[L][F]=W,this.workerSources[L]&&this.workerSources[L][F])for(const J in this.workerSources[L][F]){const ee=this.workerSources[L][F][J];for(const ce in ee){const me=ee[ce];me instanceof En&&(me.isSpriteLoaded=W,me.fire(new s.f("isSpriteLoaded")))}}}setImages(L,{scope:F,images:W},J){if(this.availableImages[L]||(this.availableImages[L]={}),this.availableImages[L][F]=W,this.workerSources[L]&&this.workerSources[L][F]){for(const ee in this.workerSources[L][F]){const ce=this.workerSources[L][F][ee];for(const me in ce)ce[me].availableImages=W}J()}else J()}setProjection(L,F){this.projections[L]=s.aJ(F)}setBrightness(L,F,W){this.brightness=F,W()}setLayers(L,F,W){this.getLayerIndex(L,F.scope).replace(F.layers,F.options),W()}updateLayers(L,F,W){this.getLayerIndex(L,F.scope).update(F.layers,F.removedIds,F.options),W()}loadTile(L,F,W){F.projection=this.projections[L]||this.defaultProjection,this.getWorkerSource(L,F.type,F.source,F.scope).loadTile(F,W)}loadDEMTile(L,F,W){this.getDEMWorkerSource(L,F.source,F.scope).loadTile(F,W)}decodeRasterArray(L,F,W){this.getRasterArrayWorkerSource().decodeRasterArray(F,W)}reloadTile(L,F,W){F.projection=this.projections[L]||this.defaultProjection,this.getWorkerSource(L,F.type,F.source,F.scope).reloadTile(F,W)}abortTile(L,F,W){this.getWorkerSource(L,F.type,F.source,F.scope).abortTile(F,W)}removeTile(L,F,W){this.getWorkerSource(L,F.type,F.source,F.scope).removeTile(F,W)}removeSource(L,F,W){if(!(this.workerSources[L]&&this.workerSources[L][F.scope]&&this.workerSources[L][F.scope][F.type]&&this.workerSources[L][F.scope][F.type][F.source]))return;const J=this.workerSources[L][F.scope][F.type][F.source];delete this.workerSources[L][F.scope][F.type][F.source],J.removeSource!==void 0?J.removeSource(F,W):W()}loadWorkerSource(L,F,W){try{this.self.importScripts(F.url),W()}catch(J){W(J.toString())}}syncRTLPluginState(L,F,W){try{s.e7.setState(F);const J=s.e7.getPluginURL();if(s.e7.isLoaded()&&!s.e7.isParsed()&&J!=null){this.self.importScripts(J);const ee=s.e7.isParsed();W(ee?void 0:new Error(`RTL Text Plugin failed to import scripts from ${J}`),ee)}}catch(J){W(J.toString())}}setDracoUrl(L,F){this.dracoUrl=F}getAvailableImages(L,F){this.availableImages[L]||(this.availableImages[L]={});let W=this.availableImages[L][F];return W||(W=[]),W}getLayerIndex(L,F){this.layerIndexes[L]||(this.layerIndexes[L]={});let W=this.layerIndexes[L][F];return W||(W=this.layerIndexes[L][F]=new Tn,W.scope=F),W}getWorkerSource(L,F,W,J){return this.workerSources[L]||(this.workerSources[L]={}),this.workerSources[L][J]||(this.workerSources[L][J]={}),this.workerSources[L][J][F]||(this.workerSources[L][J][F]={}),this.isSpriteLoaded[L]||(this.isSpriteLoaded[L]={}),this.workerSources[L][J][F][W]||(this.workerSources[L][J][F][W]=new this.workerSourceTypes[F]({send:(ee,ce,me,ae,ge,Fe)=>{this.actor.send(ee,ce,me,L,ge,Fe)},scheduler:this.actor.scheduler},this.getLayerIndex(L,J),this.getAvailableImages(L,J),this.isSpriteLoaded[L][J],void 0,this.brightness)),this.workerSources[L][J][F][W]}getDEMWorkerSource(L,F,W){return this.demWorkerSources[L]||(this.demWorkerSources[L]={}),this.demWorkerSources[L][W]||(this.demWorkerSources[L][W]={}),this.demWorkerSources[L][W][F]||(this.demWorkerSources[L][W][F]=new $a),this.demWorkerSources[L][W][F]}getRasterArrayWorkerSource(){return this.rasterArrayWorkerSource||(this.rasterArrayWorkerSource=new Wa),this.rasterArrayWorkerSource}enforceCacheSizeLimit(L,F){s.e8(F)}getWorkerPerformanceMetrics(L,F,W){W(void 0,void 0)}}return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope&&(self.worker=new Go(self)),Go}),Pp(["./shared"],function(s){function xt(u,r){if(Array.isArray(u)){if(!Array.isArray(r)||u.length!==r.length)return!1;for(let a=0;a<u.length;a++)if(!xt(u[a],r[a]))return!1;return!0}if(typeof u=="object"&&u!==null&&r!==null){if(typeof r!="object"||Object.keys(u).length!==Object.keys(r).length)return!1;for(const a in u)if(!xt(u[a],r[a]))return!1;return!0}return u===r}var Ir=mt;function mt(u){return!function(r){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var h,f,m=new Blob([""],{type:"text/javascript"}),g=URL.createObjectURL(m);try{f=new Worker(g),h=!0}catch{h=!1}return f&&f.terminate(),URL.revokeObjectURL(g),h}()?function(){var h=document.createElement("canvas");h.width=h.height=1;var f=h.getContext("2d");if(!f)return!1;var m=f.getImageData(0,0,1,1);return m&&m.width===h.width}()?(Tn[a=r&&r.failIfMajorPerformanceCaveat]===void 0&&(Tn[a]=function(h){var f,m=function(g){var x=document.createElement("canvas"),w=Object.create(mt.webGLContextAttributes);return w.failIfMajorPerformanceCaveat=g,x.getContext("webgl2",w)}(h);if(!m)return!1;try{f=m.createShader(m.VERTEX_SHADER)}catch{return!1}return!(!f||m.isContextLost())&&(m.shaderSource(f,"void main() {}"),m.compileShader(f),m.getShaderParameter(f,m.COMPILE_STATUS)===!0)}(a)),Tn[a]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var a}(u)}var Tn={};function Dt(u,r,a){const h=document.createElement(u);return r!=null&&(h.className=r),a&&a.appendChild(h),h}function ur(u,r,a){const h=document.createElementNS("http://www.w3.org/2000/svg",u);for(const f of Object.keys(r))h.setAttributeNS(null,f,String(r[f]));return a&&a.appendChild(h),h}mt.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0};const Ur=typeof document<"u"?document.documentElement&&document.documentElement.style:null,jr=Ur&&Ur.userSelect!==void 0?"userSelect":"WebkitUserSelect";let En;function $a(){Ur&&jr&&(En=Ur[jr],Ur[jr]="none")}function Wa(){Ur&&jr&&(Ur[jr]=En)}function Gr(u){u.preventDefault(),u.stopPropagation(),window.removeEventListener("click",Gr,!0)}function xi(){window.addEventListener("click",Gr,!0),window.setTimeout(()=>{window.removeEventListener("click",Gr,!0)},0)}function mi(u,r){const a=u.getBoundingClientRect();return Fs(u,a,r)}function qr(u,r){const a=u.getBoundingClientRect(),h=[];for(let f=0;f<r.length;f++)h.push(Fs(u,a,r[f]));return h}function Bs(u){return window.InstallTrigger!==void 0&&u.button===2&&u.ctrlKey&&window.navigator.platform.toUpperCase().indexOf("MAC")>=0?0:u.button}function Fs(u,r,a){const h=u.offsetWidth===r.width?1:u.offsetWidth/r.width;return new s.P((a.clientX-r.left)*h,(a.clientY-r.top)*h)}class vc{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages=new Set}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(r,a){this._updatedSourceCaches[r]=a,this.setDirty()}discardSourceCacheUpdate(r){delete this._updatedSourceCaches[r]}updateLayer(r){const a=r.scope;this._updatedLayers[a]=this._updatedLayers[a]||new Set,this._updatedLayers[a].add(r.id),this.setDirty()}removeLayer(r){const a=r.scope;this._removedLayers[a]=this._removedLayers[a]||{},this._updatedLayers[a]=this._updatedLayers[a]||new Set,this._removedLayers[a][r.id]=r,this._updatedLayers[a].delete(r.id),this._updatedPaintProps.delete(r.fqid),this.setDirty()}getRemovedLayer(r){return this._removedLayers[r.scope]?this._removedLayers[r.scope][r.id]:null}discardLayerRemoval(r){this._removedLayers[r.scope]&&delete this._removedLayers[r.scope][r.id]}getLayerUpdatesByScope(){const r={};for(const a in this._updatedLayers)r[a]=r[a]||{},r[a].updatedIds=Array.from(this._updatedLayers[a].values());for(const a in this._removedLayers)r[a]=r[a]||{},r[a].removedIds=Object.keys(this._removedLayers[a]);return r}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(r){this._updatedPaintProps.add(r.fqid),this.setDirty()}getUpdatedImages(){return Array.from(this._updatedImages.values())}updateImage(r){this._updatedImages.add(r),this.setDirty()}resetUpdatedImages(){this._updatedImages.clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages.clear()}}const Qt={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Co{constructor(r,a,h,f,m,g){this.length=a.length,this.attributes=h,this.itemSize=a.bytesPerElement,this.dynamicDraw=f,this.instanceCount=g,this.context=r;const x=r.gl;this.buffer=x.createBuffer(),r.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,a.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||m||a.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(r){const a=this.context.gl;this.bind(),a.bufferSubData(a.ARRAY_BUFFER,0,r.arrayBuffer)}
vendor: 7,273 bytes, line 13
13enableAttributes(r,a){for(let h=0;h<this.attributes.length;h++){const f=a.attributes[this.attributes[h].name];f!==void 0&&r.enableVertexAttribArray(f)}}setVertexAttribPointers(r,a,h){for(let f=0;f<this.attributes.length;f++){const m=this.attributes[f],g=a.attributes[m.name];g!==void 0&&r.vertexAttribPointer(g,m.components,r[Qt[m.type]],!1,this.itemSize,m.offset+this.itemSize*(h||0))}}setVertexAttribDivisor(r,a,h){for(let f=0;f<this.attributes.length;f++){const m=a.attributes[this.attributes[f].name];m!==void 0&&this.instanceCount&&this.instanceCount>0&&r.vertexAttribDivisor(m,h)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Ft{constructor(r){this.gl=r.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(r){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Ha extends Ft{getDefault(){return s.C.transparent}set(r){const a=this.current;(r.r!==a.r||r.g!==a.g||r.b!==a.b||r.a!==a.a||this.dirty)&&(this.gl.clearColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class Ns extends Ft{getDefault(){return 1}set(r){(r!==this.current||this.dirty)&&(this.gl.clearDepth(r),this.current=r,this.dirty=!1)}}class Xa extends Ft{getDefault(){return 0}set(r){(r!==this.current||this.dirty)&&(this.gl.clearStencil(r),this.current=r,this.dirty=!1)}}class Kt extends Ft{getDefault(){return[!0,!0,!0,!0]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||r[3]!==a[3]||this.dirty)&&(this.gl.colorMask(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Vs extends Ft{getDefault(){return!0}set(r){(r!==this.current||this.dirty)&&(this.gl.depthMask(r),this.current=r,this.dirty=!1)}}class gr extends Ft{getDefault(){return 255}set(r){(r!==this.current||this.dirty)&&(this.gl.stencilMask(r),this.current=r,this.dirty=!1)}}class Ya extends Ft{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(r){const a=this.current;(r.func!==a.func||r.ref!==a.ref||r.mask!==a.mask||this.dirty)&&(this.gl.stencilFunc(r.func,r.ref,r.mask),this.current=r,this.dirty=!1)}}class Us extends Ft{getDefault(){const r=this.gl;return[r.KEEP,r.KEEP,r.KEEP]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||this.dirty)&&(this.gl.stencilOp(r[0],r[1],r[2]),this.current=r,this.dirty=!1)}}class Zn extends Ft{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.STENCIL_TEST):a.disable(a.STENCIL_TEST),this.current=r,this.dirty=!1}}class $t extends Ft{getDefault(){return[0,1]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||this.dirty)&&(this.gl.depthRange(r[0],r[1]),this.current=r,this.dirty=!1)}}class Po extends Ft{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.DEPTH_TEST):a.disable(a.DEPTH_TEST),this.current=r,this.dirty=!1}}class Ui extends Ft{getDefault(){return this.gl.LESS}set(r){(r!==this.current||this.dirty)&&(this.gl.depthFunc(r),this.current=r,this.dirty=!1)}}class Ka extends Ft{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.BLEND):a.disable(a.BLEND),this.current=r,this.dirty=!1}}class Ja extends Ft{getDefault(){const r=this.gl;return[r.ONE,r.ZERO,r.ONE,r.ZERO]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||r[3]!==a[3]||this.dirty)&&(this.gl.blendFuncSeparate(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Qa extends Ft{getDefault(){return s.C.transparent}set(r){const a=this.current;(r.r!==a.r||r.g!==a.g||r.b!==a.b||r.a!==a.a||this.dirty)&&(this.gl.blendColor(r.r,r.g,r.b,r.a),this.current=r,this.dirty=!1)}}class lt extends Ft{getDefault(){return this.gl.FUNC_ADD}set(r){(r!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(r,r),this.current=r,this.dirty=!1)}}class zo extends Ft{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;r?a.enable(a.CULL_FACE):a.disable(a.CULL_FACE),this.current=r,this.dirty=!1}}class si extends Ft{getDefault(){return this.gl.BACK}set(r){(r!==this.current||this.dirty)&&(this.gl.cullFace(r),this.current=r,this.dirty=!1)}}class el extends Ft{getDefault(){return this.gl.CCW}set(r){(r!==this.current||this.dirty)&&(this.gl.frontFace(r),this.current=r,this.dirty=!1)}}let tl=class extends Ft{getDefault(){return null}set(u){(u!==this.current||this.dirty)&&(this.gl.useProgram(u),this.current=u,this.dirty=!1)}};class il extends Ft{getDefault(){return this.gl.TEXTURE0}set(r){(r!==this.current||this.dirty)&&(this.gl.activeTexture(r),this.current=r,this.dirty=!1)}}class js extends Ft{getDefault(){const r=this.gl;return[0,0,r.drawingBufferWidth,r.drawingBufferHeight]}set(r){const a=this.current;(r[0]!==a[0]||r[1]!==a[1]||r[2]!==a[2]||r[3]!==a[3]||this.dirty)&&(this.gl.viewport(r[0],r[1],r[2],r[3]),this.current=r,this.dirty=!1)}}class Do extends Ft{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindFramebuffer(a.FRAMEBUFFER,r),this.current=r,this.dirty=!1}}class Ar extends Ft{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindRenderbuffer(a.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class Cr extends Ft{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindTexture(a.TEXTURE_2D,r),this.current=r,this.dirty=!1}}class Gs extends Ft{getDefault(){return null}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.bindBuffer(a.ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class at extends Ft{getDefault(){return null}set(r){const a=this.gl;a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,r),this.current=r,this.dirty=!1}}class ct extends Ft{getDefault(){return null}set(r){this.gl&&(r!==this.current||this.dirty)&&(this.gl.bindVertexArray(r),this.current=r,this.dirty=!1)}}class Lo extends Ft{getDefault(){return 4}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_ALIGNMENT,r),this.current=r,this.dirty=!1}}class tr extends Ft{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r),this.current=r,this.dirty=!1}}class $n extends Ft{getDefault(){return!1}set(r){if(r===this.current&&!this.dirty)return;const a=this.gl;a.pixelStorei(a.UNPACK_FLIP_Y_WEBGL,r),this.current=r,this.dirty=!1}}class Ro extends Ft{constructor(r,a){super(r),this.context=r,this.parent=a}getDefault(){return null}}class ko extends Ro{setDirty(){this.dirty=!0}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}class qs extends Ro{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferRenderbuffer(a.FRAMEBUFFER,this.attachment(),a.RENDERBUFFER,r),this.current=r,this.dirty=!1}}class Sn extends Ro{attachment(){return this.gl.DEPTH_ATTACHMENT}set(r){if(r===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const a=this.gl;a.framebufferTexture2D(a.FRAMEBUFFER,this.attachment(),a.TEXTURE_2D,r,0),this.current=r,this.dirty=!1}}
13class Wn extends qs{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}class Hn{constructor(r,a,h,f,m){this.context=r,this.width=a,this.height=h;const g=this.framebuffer=r.gl.createFramebuffer();f&&(this.colorAttachment=new ko(r,g)),m&&(this.depthAttachmentType=m,this.depthAttachment=m==="renderbuffer"?new qs(r,g):new Sn(r,g))}destroy(){const r=this.context.gl;if(this.colorAttachment){const a=this.colorAttachment.get();a&&r.deleteTexture(a)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const a=this.depthAttachment.get();a&&r.deleteRenderbuffer(a)}else{const a=this.depthAttachment.get();a&&r.deleteTexture(a)}r.deleteFramebuffer(this.framebuffer)}}class Zs{constructor(r,a){this.gl=r,this.clearColor=new Ha(this),this.clearDepth=new Ns(this),this.clearStencil=new Xa(this),this.colorMask=new Kt(this),this.depthMask=new Vs(this),this.stencilMask=new gr(this),this.stencilFunc=new Ya(this),this.stencilOp=new Us(this),this.stencilTest=new Zn(this),this.depthRange=new $t(this),this.depthTest=new Po(this),this.depthFunc=new Ui(this),this.blend=new Ka(this),this.blendFunc=new Ja(this),this.blendColor=new Qa(this),this.blendEquation=new lt(this),this.cullFace=new zo(this),this.cullFaceSide=new si(this),this.frontFace=new el(this),this.program=new tl(this),this.activeTexture=new il(this),this.viewport=new js(this),this.bindFramebuffer=new Do(this),this.bindRenderbuffer=new Ar(this),this.bindTexture=new Cr(this),this.bindVertexBuffer=new Gs(this),this.bindElementBuffer=new at(this),this.bindVertexArrayOES=new ct(this),this.pixelStoreUnpack=new Lo(this),this.pixelStoreUnpackPremultiplyAlpha=new tr(this),this.pixelStoreUnpackFlipY=new $n(this),this.options=a?{...a}:{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=r.getExtension("EXT_texture_filter_anisotropic")||r.getExtension("MOZ_EXT_texture_filter_anisotropic")||r.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=r.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=r.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=r.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=r.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=r.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=r.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=r.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=r.getParameter(r.MAX_TEXTURE_SIZE),this.maxPointSize=r.getParameter(r.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(r,a,h){return new s.I(this,r,a,h)}createVertexBuffer(r,a,h,f,m){return new Co(this,r,a,h,f,m)}createRenderbuffer(r,a,h){const f=this.gl,m=f.createRenderbuffer();return this.bindRenderbuffer.set(m),f.renderbufferStorage(f.RENDERBUFFER,r,a,h),this.bindRenderbuffer.set(null),m}createFramebuffer(r,a,h,f){return new Hn(this,r,a,h,f)}clear({color:r,depth:a,stencil:h,colorMask:f}){const m=this.gl;let g=0;r&&(g|=m.COLOR_BUFFER_BIT,this.clearColor.set(r),this.colorMask.set(f||[!0,!0,!0,!0])),a!==void 0&&(g|=m.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(a),this.depthMask.set(!0)),h!==void 0&&(g|=m.STENCIL_BUFFER_BIT,this.clearStencil.set(h),this.stencilMask.set(255)),m.clear(g)}setCullFace(r){r.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(r.mode),this.frontFace.set(r.frontFace))}setDepthMode(r){r.func!==this.gl.ALWAYS||r.mask?(this.depthTest.set(!0),this.depthFunc.set(r.func),this.depthMask.set(r.mask),this.depthRange.set(r.range)):this.depthTest.set(!1)}setStencilMode(r){r.test.func!==this.gl.ALWAYS||r.mask?(this.stencilTest.set(!0),this.stencilMask.set(r.mask),this.stencilOp.set([r.fail,r.depthFail,r.pass]),this.stencilFunc.set({func:r.test.func,ref:r.ref,mask:r.test.mask})):this.stencilTest.set(!1)}setColorMode(r){xt(r.blendFunction,s.a.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(r.blendFunction),this.blendColor.set(r.blendColor),r.blendEquation?this.blendEquation.set(r.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(r.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}class Oo{constructor(r){this._gl=r.gl,this._query=this._gl.createQuery(),this._isFree=!0}begin(){this._gl.beginQuery(this._gl.ANY_SAMPLES_PASSED,this._query),this._isFree=!1}end(){this._gl.endQuery(this._gl.ANY_SAMPLES_PASSED)}isResultAvailable(){return this._gl.getQueryParameter(this._query,this._gl.QUERY_RESULT_AVAILABLE)}consumeResult(){const r=this._gl.getQueryParameter(this._query,this._gl.QUERY_RESULT);return this._isFree=!0,r}isFree(){return this._isFree}destroy(){this._gl.deleteQuery(this._query)}}class Bo{constructor(r){this.useOcclusionQueries=!0,this.visualizeOcclusions="none",this.occlusionQueryFrameWindow=5,this.occluderSize=32,this.fadeSpeed=7,this.depthOffset=-1e-4,r.registerParameter(this,["Symbols"],"useOcclusionQueries"),r.registerParameter(this,["Symbols"],"visualizeOcclusions",{options:{none:"none",zPass:"zPass",zTest:"zTest"}}),r.registerParameter(this,["Symbols"],"occlusionQueryFrameWindow",{min:1,max:30,step:1}),r.registerParameter(this,["Symbols"],"occluderSize",{min:1,max:100,step:1}),r.registerParameter(this,["Symbols"],"fadeSpeed",{min:.1,max:50,step:.1}),r.registerParameter(this,["Symbols"],"depthOffset",{min:-.001,max:0,step:1e-4})}}class yr{constructor(r,a,h,f){const m={width:h[0],height:h[1],data:null},g=r.gl;this.targetColorTexture=new s.T(r,m,g.RGBA,{useMipmap:!1}),this.backgroundColorTexture=new s.T(r,m,g.RGBA,{useMipmap:!1}),this.context=r,this.updateParticleTexture(a,f),this.lastInvalidatedAt=0}updateParticleTexture(r,a){if(this.particleTextureDimension===a.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const h=this.context.gl,f=a.width*a.height;this.particleTexture0=new s.T(this.context,a,h.RGBA,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new s.T(this.context,a,h.RGBA,{premultiply:!1,useMipmap:!1});const m=new s.S;m.reserve(f);for(let g=0;g<f;g++)m.emplaceBack(g);this.particleIndexBuffer=this.context.createVertexBuffer(m,s.p.members,!0),this.particleSegment=s.b.simpleSegment(0,0,this.particleIndexBuffer.length,0),this.particleTextureDimension=a.width}update(r){return!(this.lastInvalidatedAt<r&&(this.lastInvalidatedAt=s.e.now(),1))}destroy(){this.targetColorTexture.destroy(),this.backgroundColorTexture.destroy(),this.particleIndexBuffer.destroy(),this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleSegment.destroy()}}class rl extends s.E{constructor(r){super(),this.requestManager=r,this.models={"":{}},this.numModelsLoading={}}loadModel(r,a){return s.l(this.requestManager.transformRequest(a,s.R.Model).url).then(h=>{if(!h)return;const f=s.c(h),m=new s.M(r,void 0,void 0,f);return m.computeBoundsAndApplyParent(),m}).catch(h=>{if(h&&h.status===404)return null;this.fire(new s.d(new Error(`Could not load model ${r} from ${a}: ${h.message}`)))})}load(r,a){this.models[a]||(this.models[a]={});const h=Object.keys(r);this.numModelsLoading[a]=(this.numModelsLoading[a]||0)+h.length;const f=[];for(const m of h)f.push(this.loadModel(m,r[m]));Promise.allSettled(f).then(m=>{for(let g=0;g<m.length;g++){const{status:x,value:w}=m[g];x==="fulfilled"&&w&&(this.models[a][h[g]]={model:w,numReferences:1})}this.numModelsLoading[a]-=h.length,this.fire(new s.f("data",{dataType:"style"}))}).catch(m=>{this.fire(new s.d(new Error(`Could not load models: ${m.message}`)))})}isLoaded(){for(const r in this.numModelsLoading)if(this.numModelsLoading[r]>0)return!1;return!0}hasModel(r,a){return!!this.getModel(r,a)}getModel(r,a){return this.models[a]||(this.models[a]={}),this.models[a][r]?this.models[a][r].model:void 0}
13addModel(r,a,h){this.models[h]||(this.models[h]={}),this.hasModel(r,h)&&this.models[h][r].numReferences++,this.load({[r]:this.requestManager.normalizeModelURL(a)},h)}addModels(r,a){this.models[a]||(this.models[a]={});const h={};for(const f in r)this.models[a][f]={},h[f]=this.requestManager.normalizeModelURL(r[f]);this.load(h,a)}addModelsFromBucket(r,a){this.models[a]||(this.models[a]={});const h={};for(const f of r)this.hasModel(f,a)?this.models[a][f].numReferences++:h[f]=this.requestManager.normalizeModelURL(f);this.load(h,a)}removeModel(r,a){if(this.models[a]&&this.models[a][r]&&(this.models[a][r].numReferences--,this.models[a][r].numReferences===0)){const h=this.models[a][r].model;delete this.models[a][r],h.destroy()}}listModels(r){return this.models[r]||(this.models[r]={}),Object.keys(this.models[r])}upload(r,a){this.models[a]||(this.models[a]={});for(const h in this.models[a])this.models[a][h].model&&this.models[a][h].model.upload(r.context)}}function ut(u){const{userImage:r}=u;return!!(r&&r.render&&r.render())&&(u.data.replace(new Uint8Array(r.data.buffer)),!0)}class $s extends s.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded={},this.requestors=[],this.patterns={},this.atlasImage={},this.atlasTexture={},this.dirty=!0}createScope(r){this.images[r]={},this.loaded[r]=!1,this.updatedImages[r]={},this.patterns[r]={},this.callbackDispatchedThisFrame[r]={},this.atlasImage[r]=new s.i({width:1,height:1})}isLoaded(){for(const r in this.loaded)if(!this.loaded[r])return!1;return!0}setLoaded(r,a){if(this.loaded[a]!==r&&(this.loaded[a]=r,r)){for(const{ids:h,callback:f}of this.requestors)this._notify(h,a,f);this.requestors=[]}}hasImage(r,a){return!!this.getImage(r,a)}getImage(r,a){return this.images[a][r]}addImage(r,a,h){this._validate(r,h)&&(this.images[a][r]=h)}_validate(r,a){let h=!0;return this._validateStretch(a.stretchX,a.data&&a.data.width)||(this.fire(new s.d(new Error(`Image "${r}" has invalid "stretchX" value`))),h=!1),this._validateStretch(a.stretchY,a.data&&a.data.height)||(this.fire(new s.d(new Error(`Image "${r}" has invalid "stretchY" value`))),h=!1),this._validateContent(a.content,a)||(this.fire(new s.d(new Error(`Image "${r}" has invalid "content" value`))),h=!1),h}_validateStretch(r,a){if(!r)return!0;let h=0;for(const f of r){if(f[0]<h||f[1]<f[0]||a<f[1])return!1;h=f[1]}return!0}_validateContent(r,a){return!(r&&(r.length!==4||r[0]<0||a.data.width<r[0]||r[1]<0||a.data.height<r[1]||r[2]<0||a.data.width<r[2]||r[3]<0||a.data.height<r[3]||r[2]<r[0]||r[3]<r[1]))}updateImage(r,a,h){h.version=this.images[a][r].version+1,this.images[a][r]=h,this.updatedImages[a][r]=!0}removeImage(r,a){const h=this.images[a][r];delete this.images[a][r],delete this.patterns[a][r],h.userImage&&h.userImage.onRemove&&h.userImage.onRemove()}listImages(r){return Object.keys(this.images[r])}getImages(r,a,h){let f=!0;const m=!!this.loaded[a];if(!m)for(const g of r)this.images[a][g]||(f=!1);m||f?this._notify(r,a,h):this.requestors.push({ids:r,scope:a,callback:h})}getUpdatedImages(r){return this.updatedImages[r]}_notify(r,a,h){const f={};for(const m of r){this.images[a][m]||this.fire(new s.f("styleimagemissing",{id:m}));const g=this.images[a][m];g?f[m]={data:g.data.clone(),pixelRatio:g.pixelRatio,sdf:g.sdf,version:g.version,stretchX:g.stretchX,stretchY:g.stretchY,content:g.content,hasRenderCallback:!!(g.userImage&&g.userImage.render)}:s.w(`Image "${m}" 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.`)}h(null,f)}getPixelSize(r){const{width:a,height:h}=this.atlasImage[r];return{width:a,height:h}}getPattern(r,a,h){const f=this.patterns[a][r],m=this.getImage(r,a);if(!m)return null;if(f&&f.position.version===m.version)return f.position;if(f)f.position.version=m.version;else{const g={w:m.data.width+2,h:m.data.height+2,x:0,y:0},x=new s.k(g,m);this.patterns[a][r]={bin:g,position:x}}return this._updatePatternAtlas(a,h),this.patterns[a][r].position}bind(r,a){const h=r.gl;let f=this.atlasTexture[a];f?this.dirty&&(f.update(this.atlasImage[a]),this.dirty=!1):(f=new s.T(r,this.atlasImage[a],h.RGBA),this.atlasTexture[a]=f),f.bind(h.LINEAR,h.CLAMP_TO_EDGE)}_updatePatternAtlas(r,a){const h=[];for(const x in this.patterns[r])h.push(this.patterns[r][x].bin);const{w:f,h:m}=s.j(h),g=this.atlasImage[r];g.resize({width:f||1,height:m||1});for(const x in this.patterns[r]){const{bin:w}=this.patterns[r][x],T=w.x+1,M=w.y+1,A=this.images[r][x].data,P=A.width,z=A.height;s.i.copy(A,g,{x:0,y:0},{x:T,y:M},{width:P,height:z},a),s.i.copy(A,g,{x:0,y:z-1},{x:T,y:M-1},{width:P,height:1},a),s.i.copy(A,g,{x:0,y:0},{x:T,y:M+z},{width:P,height:1},a),s.i.copy(A,g,{x:P-1,y:0},{x:T-1,y:M},{width:1,height:z},a),s.i.copy(A,g,{x:0,y:0},{x:T+P,y:M},{width:1,height:z},a)}this.dirty=!0}beginFrame(){for(const r in this.images)this.callbackDispatchedThisFrame[r]={}}
13dispatchRenderCallbacks(r,a){for(const h of r){if(this.callbackDispatchedThisFrame[a][h])continue;this.callbackDispatchedThisFrame[a][h]=!0;const f=this.images[a][h];ut(f)&&this.updateImage(h,a,f)}}}function gi(u){const r=u.key,a=u.value,h=u.valueSpec||{},f=u.objectElementValidators||{},m=u.style,g=u.styleSpec;let x=[];const w=s.n(a);if(w!=="object")return[new s.V(r,a,`object expected, ${w} found`)];for(const T in a){const M=T.split(".")[0];let A;f[M]?A=f[M]:h[M]?A=L:f["*"]?A=f["*"]:h["*"]&&(A=L),A?x=x.concat(A({key:(r&&`${r}.`)+T,value:a[T],valueSpec:h[M]||h["*"],style:m,styleSpec:g,object:a,objectKey:T},a)):x.push(new s.m(r,a[T],`unknown property "${T}"`))}for(const T in h)f[T]||h[T].required&&h[T].default===void 0&&a[T]===void 0&&x.push(new s.V(r,a,`missing required property "${T}"`));return x}function Fo(u){const r=u.value,a=u.valueSpec,h=u.style,f=u.styleSpec,m=u.key,g=u.arrayElementValidator||L;if(s.n(r)!=="array")return[new s.V(m,r,`array expected, ${s.n(r)} found`)];if(a.length&&r.length!==a.length)return[new s.V(m,r,`array length ${a.length} expected, length ${r.length} found`)];if(a["min-length"]&&r.length<a["min-length"])return[new s.V(m,r,`array length at least ${a["min-length"]} expected, length ${r.length} found`)];let x={type:a.value,values:a.values,minimum:a.minimum,maximum:a.maximum,function:void 0};f.$version<7&&(x.function=a.function),s.n(a.value)==="object"&&(x=a.value);let w=[];for(let T=0;T<r.length;T++)w=w.concat(g({array:r,arrayIndex:T,value:r[T],valueSpec:x,style:h,styleSpec:f,key:`${m}[${T}]`},!0));return w}function Xn(u){const r=u.key,a=u.value,h=u.valueSpec;let f=s.n(a);if(f==="number"&&a!=a&&(f="NaN"),f!=="number")return[new s.V(r,a,`number expected, ${f} found`)];if("minimum"in h){let m=h.minimum;if(s.n(h.minimum)==="array"&&(m=h.minimum[u.arrayIndex]),a<m)return[new s.V(r,a,`${a} is less than the minimum value ${m}`)]}if("maximum"in h){let m=h.maximum;if(s.n(h.maximum)==="array"&&(m=h.maximum[u.arrayIndex]),a>m)return[new s.V(r,a,`${a} is greater than the maximum value ${m}`)]}return[]}function Zr(u){const r=u.valueSpec,a=s.u(u.value.type);let h,f,m,g={};const x=a!=="categorical"&&u.value.property===void 0,w=!x,T=s.n(u.value.stops)==="array"&&s.n(u.value.stops[0])==="array"&&s.n(u.value.stops[0][0])==="object",M=gi({key:u.key,value:u.value,valueSpec:u.styleSpec.function,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{stops:function(z){if(a==="identity")return[new s.V(z.key,z.value,'identity function may not have a "stops" property')];let R=[];const k=z.value;return R=R.concat(Fo({key:z.key,value:k,valueSpec:z.valueSpec,style:z.style,styleSpec:z.styleSpec,arrayElementValidator:A})),s.n(k)==="array"&&k.length===0&&R.push(new s.V(z.key,k,"array must have at least one stop")),R},default:function(z){return L({key:z.key,value:z.value,valueSpec:r,style:z.style,styleSpec:z.styleSpec})}}});return a==="identity"&&x&&M.push(new s.V(u.key,u.value,'missing required property "property"')),a==="identity"||u.value.stops||M.push(new s.V(u.key,u.value,'missing required property "stops"')),a==="exponential"&&u.valueSpec.expression&&!s.s(u.valueSpec)&&M.push(new s.V(u.key,u.value,"exponential functions not supported")),u.styleSpec.$version>=8&&(w&&!s.q(u.valueSpec)?M.push(new s.V(u.key,u.value,"property functions not supported")):x&&!s.r(u.valueSpec)&&M.push(new s.V(u.key,u.value,"zoom functions not supported"))),a!=="categorical"&&!T||u.value.property!==void 0||M.push(new s.V(u.key,u.value,'"property" property is required')),M;function A(z){let R=[];const k=z.value,O=z.key;if(s.n(k)!=="array")return[new s.V(O,k,`array expected, ${s.n(k)} found`)];if(k.length!==2)return[new s.V(O,k,`array length 2 expected, length ${k.length} found`)];if(T){if(s.n(k[0])!=="object")return[new s.V(O,k,`object expected, ${s.n(k[0])} found`)];if(k[0].zoom===void 0)return[new s.V(O,k,"object stop key must have zoom")];if(k[0].value===void 0)return[new s.V(O,k,"object stop key must have value")];const B=s.u(k[0].zoom);if(typeof B!="number")return[new s.V(O,k[0].zoom,"stop zoom values must be numbers")];if(m&&m>B)return[new s.V(O,k[0].zoom,"stop zoom values must appear in ascending order")];B!==m&&(m=B,f=void 0,g={}),R=R.concat(gi({key:`${O}[0]`,value:k[0],valueSpec:{zoom:{}},style:z.style,styleSpec:z.styleSpec,objectElementValidators:{zoom:Xn,value:P}}))}else R=R.concat(P({key:`${O}[0]`,value:k[0],style:z.style,styleSpec:z.styleSpec},k));return s.t(s.v(k[1]))?R.concat([new s.V(`${O}[1]`,k[1],"expressions are not allowed in function stops.")]):R.concat(L({key:`${O}[1]`,value:k[1],valueSpec:r,style:z.style,styleSpec:z.styleSpec}))}function P(z,R){const k=s.n(z.value),O=s.u(z.value),B=z.value!==null?z.value:R;if(h){if(k!==h)return[new s.V(z.key,B,`${k} stop domain type must match previous stop domain type ${h}`)]}else h=k;if(k!=="number"&&k!=="string"&&k!=="boolean"&&typeof O!="number"&&typeof O!="string"&&typeof O!="boolean")return[new s.V(z.key,B,"stop domain value must be a number, string, or boolean")];if(k!=="number"&&a!=="categorical"){let G=`number expected, ${k} found`;return s.q(r)&&a===void 0&&(G+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new s.V(z.key,B,G)]}return a!=="categorical"||k!=="number"||typeof O=="number"&&isFinite(O)&&Math.floor(O)===O?a!=="categorical"&&k==="number"&&typeof O=="number"&&typeof f=="number"&&f!==void 0&&O<f?[new s.V(z.key,B,"stop domain values must appear in ascending order")]:(f=O,a==="categorical"&&O in g?[new s.V(z.key,B,"stop domain values must be unique")]:(g[O]=!0,[])):[new s.V(z.key,B,`integer expected, found ${String(O)}`)]}}function $r(u){const r=(u.expressionContext==="property"?s.x:s.y)(s.v(u.value),u.valueSpec);if(r.result==="error")return r.value.map(h=>new s.V(`${u.key}${h.key}`,u.value,h.message));const a=r.value.expression||r.value._styleExpression.expression;if(u.expressionContext==="property"&&u.propertyKey==="text-font"&&!a.outputDefined())return[new s.V(u.key,u.value,`Invalid data expression for "${u.propertyKey}". Output values must be contained as literals within the expression.`)];if(u.expressionContext==="property"&&u.propertyType==="layout"&&!s.z(a))return[new s.V(u.key,u.value,'"feature-state" data expressions are not supported with layout properties.')];if(u.expressionContext==="filter")return Ws(a,u);if(u.expressionContext&&u.expressionContext.indexOf("cluster")===0){if(!s.A(a,["zoom","feature-state"]))return[new s.V(u.key,u.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(u.expressionContext==="cluster-initial"&&!s.B(a))return[new s.V(u.key,u.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ws(u,r){const a=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(r.valueSpec&&r.valueSpec.expression)for(const f of r.valueSpec.expression.parameters)a.delete(f);if(a.size===0)return[];const h=[];return u instanceof s.D&&a.has(u.name)?[new s.V(r.key,r.value,`["${u.name}"] expression is not supported in a filter for a ${r.object.type}
13 layer with id: ${r.object.id}`)]:(u.eachChild(f=>{h.push(...Ws(f,r))}),h)}function Mn(u){const r=u.key,a=u.value,h=u.valueSpec,f=[];return Array.isArray(h.values)?h.values.indexOf(s.u(a))===-1&&f.push(new s.V(r,a,`expected one of [${h.values.join(", ")}], ${JSON.stringify(a)} found`)):Object.keys(h.values).indexOf(s.u(a))===-1&&f.push(new s.V(r,a,`expected one of [${Object.keys(h.values).join(", ")}], ${JSON.stringify(a)} found`)),f}function In(u){return s.G(s.v(u.value))?$r(s.o({},u,{expressionContext:"filter",valueSpec:u.styleSpec[`filter_${u.layerType||"fill"}`]})):No(u)}function No(u){const r=u.value,a=u.key;if(s.n(r)!=="array")return[new s.V(a,r,`array expected, ${s.n(r)} found`)];const h=u.styleSpec;let f,m=[];if(r.length<1)return[new s.V(a,r,"filter array must have at least 1 element")];switch(m=m.concat(Mn({key:`${a}[0]`,value:r[0],valueSpec:h.filter_operator,style:u.style,styleSpec:u.styleSpec})),s.u(r[0])){case"<":case"<=":case">":case">=":r.length>=2&&s.u(r[1])==="$type"&&m.push(new s.V(a,r,`"$type" cannot be use with operator "${r[0]}"`));case"==":case"!=":r.length!==3&&m.push(new s.V(a,r,`filter array for operator "${r[0]}" must have 3 elements`));case"in":case"!in":r.length>=2&&(f=s.n(r[1]),f!=="string"&&m.push(new s.V(`${a}[1]`,r[1],`string expected, ${f} found`)));for(let g=2;g<r.length;g++)f=s.n(r[g]),s.u(r[1])==="$type"?m=m.concat(Mn({key:`${a}[${g}]`,value:r[g],valueSpec:h.geometry_type,style:u.style,styleSpec:u.styleSpec})):f!=="string"&&f!=="number"&&f!=="boolean"&&m.push(new s.V(`${a}[${g}]`,r[g],`string, number, or boolean expected, ${f} found`));break;case"any":case"all":case"none":for(let g=1;g<r.length;g++)m=m.concat(No({key:`${a}[${g}]`,value:r[g],style:u.style,styleSpec:u.styleSpec}));break;case"has":case"!has":f=s.n(r[1]),r.length!==2?m.push(new s.V(a,r,`filter array for "${r[0]}" operator must have 2 elements`)):f!=="string"&&m.push(new s.V(`${a}[1]`,r[1],`string expected, ${f} found`))}return m}function Vo(u,r){const a=u.key,h=u.style,f=u.layer,m=u.styleSpec,g=u.value,x=u.objectKey,w=m[`${r}_${u.layerType}`];if(!w)return[];const T=x.match(/^(.*)-transition$/);if(r==="paint"&&T&&w[T[1]]&&w[T[1]].transition)return L({key:a,value:g,valueSpec:m.transition,style:h,styleSpec:m});const M=u.valueSpec||w[x];if(!M)return[new s.m(a,g,`unknown property "${x}"`)];let A;if(s.n(g)==="string"&&s.q(M)&&!M.tokens&&(A=/^{([^}]+)}$/.exec(g))){const z=`\`{ "type": "identity", "property": ${A?JSON.stringify(A[1]):'"_"'} }\``;return[new s.V(a,g,`"${x}" does not support interpolation syntax
14Use an identity property function instead: ${z}.`)]}const P=[];if(u.layerType==="symbol")x!=="text-field"||!h||h.glyphs||h.imports||P.push(new s.V(a,g,'use of "text-field" requires a style "glyphs" property')),x==="text-font"&&s.H(s.v(g))&&s.u(g.type)==="identity"&&P.push(new s.V(a,g,'"text-font" does not support identity functions'));else if(u.layerType==="model"&&r==="paint"&&f&&f.layout&&f.layout.hasOwnProperty("model-id")&&s.q(M)&&(s.J(M)||s.r(M))){const z=s.x(s.v(g),M),R=z.value.expression||z.value._styleExpression.expression;R&&!s.A(R,["measure-light"])&&(x==="model-emissive-strength"&&s.B(R)&&s.z(R)||P.push(new s.V(a,g,`${x} does not support measure-light expressions when the model layer source is vector tile or GeoJSON.`)))}return P.concat(L({key:u.key,value:g,valueSpec:M,style:h,styleSpec:m,expressionContext:"property",propertyType:r,propertyKey:x}))}function nl(u){return Vo(u,"paint")}function Uo(u){return Vo(u,"layout")}function xr(u){let r=[];const a=u.value,h=u.key,f=u.style,m=u.styleSpec;a.type||a.ref||r.push(new s.V(h,a,'either "type" or "ref" is required'));let g=s.u(a.type);const x=s.u(a.ref);if(a.id){const w=s.u(a.id);for(let T=0;T<u.arrayIndex;T++){const M=f.layers[T];s.u(M.id)===w&&r.push(new s.V(h,a.id,`duplicate layer id "${a.id}", previously used at line ${M.id.__line__}`))}}if("ref"in a){let w;["type","source","source-layer","filter","layout"].forEach(T=>{T in a&&r.push(new s.V(h,a[T],`"${T}" is prohibited for ref layers`))}),f.layers.forEach(T=>{s.u(T.id)===x&&(w=T)}),w?w.ref?r.push(new s.V(h,a.ref,"ref cannot reference another ref layer")):g=s.u(w.type):typeof x=="str
14ing"&&r.push(new s.V(h,a.ref,`ref layer "${x}" not found`))}else if(g!=="background"&&g!=="sky"&&g!=="slot")if(a.source){const w=f.sources&&f.sources[a.source],T=w&&s.u(w.type);w?T==="vector"&&g==="raster"?r.push(new s.V(h,a.source,`layer "${a.id}" requires a raster source`)):T==="raster"&&g!=="raster"?r.push(new s.V(h,a.source,`layer "${a.id}" requires a vector source`)):T!=="vector"||a["source-layer"]?T==="raster-dem"&&g!=="hillshade"?r.push(new s.V(h,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):T!=="raster-array"||["raster","raster-particle"].includes(g)?g!=="line"||!a.paint||!a.paint["line-gradient"]&&!a.paint["line-trim-offset"]||T==="geojson"&&w.lineMetrics?g==="raster-particle"&&T!=="raster-array"&&r.push(new s.V(h,a.source,`layer "${a.id}" requires a 'raster-array' source.`)):r.push(new s.V(h,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):r.push(new s.V(h,a.source,"raster-array source can only be used with layer type 'raster'.")):r.push(new s.V(h,a,`layer "${a.id}" must specify a "source-layer"`)):r.push(new s.V(h,a.source,`source "${a.source}" not found`))}else r.push(new s.V(h,a,'missing required property "source"'));return r=r.concat(gi({key:h,value:a,valueSpec:m.layer,style:u.style,styleSpec:u.styleSpec,objectElementValidators:{"*":()=>[],type:()=>L({key:`${h}.type`,value:a.type,valueSpec:m.layer.type,style:u.style,styleSpec:u.styleSpec,object:a,objectKey:"type"}),filter:w=>In(s.o({layerType:g},w)),layout:w=>gi({layer:a,key:w.key,value:w.value,valueSpec:{},style:w.style,styleSpec:w.styleSpec,objectElementValidators:{"*":T=>Uo(s.o({layerType:g},T))}}),paint:w=>gi({layer:a,key:w.key,value:w.value,valueSpec:{},style:w.style,styleSpec:w.styleSpec,objectElementValidators:{"*":T=>nl(s.o({layerType:g,layer:a},T))}})}})),r}function An(u){const r=u.value,a=u.key,h=s.n(r);return h!=="string"?[new s.V(a,r,`string expected, ${h} found`)]:[]}const vr={promoteId:function({key:u,value:r}){if(s.n(r)==="string")return An({key:u,value:r});{const a=[];for(const h in r)a.push(...An({key:`${u}.${h}`,value:r[h]}));return a}}};function ki(u){const r=u.value,a=u.key,h=u.styleSpec,f=u.style;if(!r.type)return[new s.V(a,r,'"type" is required')];const m=s.u(r.type);let g=[];switch(["vector","raster","raster-dem","raster-array"].includes(m)&&(r.url||r.tiles||g.push(new s.m(a,r,'Either "url" or "tiles" is required.'))),m){case"vector":case"raster":case"raster-dem":case"raster-array":return g=g.concat(gi({key:a,value:r,valueSpec:h[`source_${m.replace("-","_")}`],style:u.style,styleSpec:h,objectElementValidators:vr})),g;case"geojson":if(g=gi({key:a,value:r,valueSpec:h.source_geojson,style:f,styleSpec:h,objectElementValidators:vr}),r.cluster)for(const x in r.clusterProperties){const[w,T]=r.clusterProperties[x],M=typeof w=="string"?[w,["accumulated"],["get",x]]:w;g.push(...$r({key:`${a}.${x}.map`,value:T,expressionContext:"cluster-map"})),g.push(...$r({key:`${a}.${x}.reduce`,value:M,expressionContext:"cluster-reduce"}))}return g;case"video":return gi({key:a,value:r,valueSpec:h.source_video,style:f,styleSpec:h});case"image":return gi({key:a,value:r,valueSpec:h.source_image,style:f,styleSpec:h});case"canvas":return[new s.V(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Mn({key:`${a}.type`,value:r.type,valueSpec:{values:ol(h)}})}}function ol(u){return u.source.reduce((r,a)=>{const h=u[a];return h.type.type==="enum"&&(r=r.concat(Object.keys(h.type.values))),r},[])}function Yn(u){const r=u.value,a=u.styleSpec,h=a.light,f=u.style;let m=[];const g=s.n(r);if(r===void 0)return m;if(g!=="object")return m=m.concat([new s.V("light",r,`object expected, ${g} found`)]),m;for(const x in r){const w=x.match(/^(.*)-transition$/);m=m.concat(w&&h[w[1]]&&h[w[1]].transition?L({key:x,value:r[x],valueSpec:a.transition,style:f,styleSpec:a}):h[x]?L({key:x,value:r[x],valueSpec:h[x],style:f,styleSpec:a}):[new s.V(x,r[x],`unknown property "${x}"`)])}return m}function jo(u){const r=u.value;let a=[];if(!r)return a;const h=s.n(r);if(h!=="object")return a=a.concat([new s.V("light-3d",r,`object expected, ${h} found`)]),a;const f=u.styleSpec,m=f["light-3d"],g=u.key,x=u.style,w=u.style.lights;for(const A of["type","id"])if(!(A in r))return a=a.concat([new s.V("light-3d",r,`missing property ${A} on light`)]),a;if(r.type&&w)for(let A=0;A<u.arrayIndex;A++){const P=s.u(r.type),z=w[A];s.u(z.type)===P&&a.push(new s.V(g,r.id,`duplicate light type "${r.type}", previously defined at line ${z.id.__line__}`))}const T=`properties_light_${r.type}`;if(!(T in f))return a=a.concat([new s.V("light-3d",r,`Invalid light type ${r.type}`)]),a;const M=f[T];for(const A in r)if(A==="properties"){const P=r[A],z=s.n(P);if(z!=="object")return a=a.concat([new s.V("properties",P,`object expected, ${z} found`)]),a;for(const R in P)a=a.concat(M[R]?L({key:R,value:P[R],valueSpec:M[R],style:x,styleSpec:f}):[new s.m(u.key,P[R],`unknown property "${R}"`)])}else{const P=A.match(/^(.*)-transition$/);
14a=a.concat(P&&m[P[1]]&&m[P[1]].transition?L({key:A,value:r[A],valueSpec:f.transition,style:x,styleSpec:f}):m[A]?L({key:A,value:r[A],valueSpec:m[A],style:x,styleSpec:f}):[new s.m(A,r[A],`unknown property "${A}"`)])}return a}function Hs(u){const r=u.value,a=u.key,h=u.style,f=u.styleSpec,m=f.terrain;let g=[];const x=s.n(r);if(r===void 0||x==="null")return g;if(x!=="object")return g=g.concat([new s.V("terrain",r,`object expected, ${x} found`)]),g;for(const w in r){const T=w.match(/^(.*)-transition$/);g=g.concat(T&&m[T[1]]&&m[T[1]].transition?L({key:w,value:r[w],valueSpec:f.transition,style:h,styleSpec:f}):m[w]?L({key:w,value:r[w],valueSpec:m[w],style:h,styleSpec:f}):[new s.m(w,r[w],`unknown property "${w}"`)])}if(r.source){const w=h.sources&&h.sources[r.source],T=w&&s.u(w.type);w?T!=="raster-dem"&&g.push(new s.V(a,r.source,`terrain cannot be used with a source of type ${String(T)}, it only be used with a "raster-dem" source type`)):g.push(new s.V(a,r.source,`source "${r.source}" not found`))}else g.push(new s.V(a,r,'terrain is missing required property "source"'));return g}function Go(u){const r=u.value,a=u.style,h=u.styleSpec,f=h.fog;let m=[];const g=s.n(r);if(r===void 0)return m;if(g!=="object")return m=m.concat([new s.V("fog",r,`object expected, ${g} found`)]),m;for(const x in r){const w=x.match(/^(.*)-transition$/);m=m.concat(w&&f[w[1]]&&f[w[1]].transition?L({key:x,value:r[x],valueSpec:h.transition,style:a,styleSpec:h}):f[x]?L({key:x,value:r[x],valueSpec:f[x],style:a,styleSpec:h}):[new s.m(x,r[x],`unknown property "${x}"`)])}return m}const oe={"*":()=>[],array:Fo,boolean:function(u){const r=u.value,a=u.key,h=s.n(r);return h!=="boolean"?[new s.V(a,r,`boolean expected, ${h} found`)]:[]},number:Xn,color:function(u){const r=u.key,a=u.value,h=s.n(a);return h!=="string"?[new s.V(r,a,`color expected, ${h} found`)]:s.F(a)===null?[new s.V(r,a,`color expected, "${a}" found`)]:[]},enum:Mn,filter:In,function:Zr,layer:xr,object:gi,source:ki,model:s.K,light:Yn,"light-3d":jo,terrain:Hs,fog:Go,string:An,formatted:function(u){return An(u).length===0?[]:$r(u)},resolvedImage:function(u){return An(u).length===0?[]:$r(u)},projection:function(u){const r=u.value,a=u.styleSpec,h=a.projection,f=u.style;let m=[];const g=s.n(r);if(g==="object")for(const x in r)m=m.concat(L({key:x,value:r[x],valueSpec:h[x],style:f,styleSpec:a}));else g!=="string"&&(m=m.concat([new s.V("projection",r,`object or string expected, ${g} found`)]));return m},import:function(u){const{value:r,styleSpec:a}=u,{data:h,...f}=r;Object.defineProperty(f,"__line__",{value:r.__line__,enumerable:!1});let m=gi(s.o({},u,{value:f,valueSpec:a.import}));return s.u(f.id)===""&&m.push(new s.V(`${u.key}.id`,f,"import id can't be an empty string")),h&&(m=m.concat(W(h,a,{key:`${u.key}.data`}))),m}};function L(u,r=!1){const a=u.value,h=u.valueSpec,f=u.styleSpec;if(h.expression&&s.H(s.u(a)))return Zr(u);if(h.expression&&s.t(s.v(a)))return $r(u);if(h.type&&oe[h.type]){const m=oe[h.type](u);return r===!0&&m.length>0&&s.n(u.value)==="array"?$r(u):m}return gi(s.o({},u,{valueSpec:h.type?f[h.type]:h}))}function F(u){const r=u.value,a=u.key,h=An(u);return h.length||(r.indexOf("{fontstack}")===-1&&h.push(new s.V(a,r,'"glyphs" url must include a "{fontstack}" token')),r.indexOf("{range}")===-1&&h.push(new s.V(a,r,'"glyphs" url must include a "{range}" token'))),h}function W(u,r=s.L,a={}){return L({key:a.key||"",value:u,valueSpec:r.$root,styleSpec:r,style:u,objectElementValidators:{glyphs:F,"*":()=>[]}})}function J(u,r=s.L){return Tt(W(u,r))}const ee=u=>Tt(ki(u)),ce=u=>Tt(Yn(u)),me=u=>Tt(jo(u)),ae=u=>Tt(Hs(u)),ge=u=>Tt(Go(u)),Fe=u=>Tt(xr(u)),Le=u=>Tt(In(u)),Ke=u=>Tt(nl(u)),nt=u=>Tt(Uo(u)),wt=u=>Tt(s.K(u));function Tt(u){return u.slice().sort((r,a)=>r.line&&a.line?r.line-a.line:0)}function pt(u,r){let a=!1;if(r&&r.length)for(const h of r)h instanceof s.m?s.w(h.message):(u.fire(new s.d(new Error(h.message))),a=!0);return a}const Lt=new s.N({anchor:new s.O(s.L.light.anchor),position:new s.Q(s.L.light.position),color:new s.O(s.L.light.color),intensity:new s.O(s.L.light.intensity)});class Xe extends s.E{constructor(r,a="flat"){super(),this._transitionable=new s.U(Lt),this.setLight(r,a),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(r,a,h={}
14){this._validate(ce,r,h)||(this._transitionable.setTransitionOrValue(r),this.id=a)}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,a,h){return(!h||h.validate!==!1)&&pt(this,r.call(J,s.W({value:a,style:{glyphs:!0,sprite:!0},styleSpec:s.L})))}}const ai=new s.N({source:new s.O(s.L.terrain.source),exaggeration:new s.O(s.L.terrain.exaggeration)});let Wt=class extends s.E{constructor(u,r,a,h){super(),this.scope=a,this._transitionable=new s.U(ai,a,h),this._transitionable.setTransitionOrValue(u,h),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=r}get(){return this._transitionable.serialize()}set(u,r){this._transitionable.setTransitionOrValue(u,r)}updateTransitions(u){this._transitioning=this._transitionable.transitioned(u,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(u){this.properties=this._transitioning.possiblyEvaluate(u)}getExaggeration(u){return this._transitioning.possiblyEvaluate(new s.X(u)).get("exaggeration")}isZoomDependent(){const u=this._transitionable._values.exaggeration;return u!=null&&u.value!=null&&u.value.expression!=null&&u.value.expression instanceof s.Z}};const kt=45,wi=65,li=.05;function Ii(u,r,a,h){const f=s.$(kt,wi,a),[m,g]=ji(u,h);let x=1-Math.min(1,Math.exp((r-m)/(g-m)*-6));return x*=x*x,x=Math.min(1,1.00747*x),x*f*u.alpha}function ji(u,r){const a=.5/Math.tan(.5*r);return[u.range[0]+a,u.range[1]+a]}function Gi(u,r,a,h,f){const m=s._.transformMat4([],[r,a,h],f.mercatorFogMatrix);return Ii(u,s._.length(m),f.pitch,f._fov)}function Kn(u,r,a,h,f,m,g){const x=[[a,h,0],[f,h,0],[f,m,0],[a,m,0]];let w=Number.MAX_VALUE,T=-Number.MAX_VALUE;for(const M of x){const A=s._.transformMat4([],M,r),P=s._.length(A);w=Math.min(w,P),T=Math.max(T,P)}return[Ii(u,w,g.pitch,g._fov),Ii(u,T,g.pitch,g._fov)]}const bc=new s.N({range:new s.O(s.L.fog.range),color:new s.O(s.L.fog.color),"high-color":new s.O(s.L.fog["high-color"]),"space-color":new s.O(s.L.fog["space-color"]),"horizon-blend":new s.O(s.L.fog["horizon-blend"]),"star-intensity":new s.O(s.L.fog["star-intensity"]),"vertical-range":new s.O(s.L.fog["vertical-range"])});class wh extends s.E{constructor(r,a,h,f){super(),this._transitionable=new s.U(bc,h,new Map(f)),this.set(r,f),this._transitioning=this._transitionable.untransitioned(),this._transform=a,this.properties=new s.a0(bc),this.scope=h}get state(){const r=this._transform,a=r.projection.name==="globe",h=s.a1(r.zoom),f=this.properties.get("range"),m=[.5,3];return{range:a?[s.a2(m[0],f[0],h),s.a2(m[1],f[1],h)]:f,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(r,a,h={}){if(this._validate(ge,r,h))return;const f=s.W({},r);for(const m of Object.keys(s.L.fog))f[m]===void 0&&(f[m]=s.L.fog[m].default);this._options=f,this._transitionable.setTransitionOrValue(this._options,a)}getOpacity(r){if(!this._transform.projection.supportsFog)return 0;const a=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:s.$(kt,wi,r))*a.a}getOpacityAtLatLng(r,a){return this._transform.projection.supportsFog?function(h,f,m){const g=s.Y.fromLngLat(f),x=m.elevation?m.elevation.getAtPointOrZero(g):0;return Gi(h,g.x,g.y,x,m)}(this.state,r,a):0}getOpacityForTile(r){if(!this._transform.projection.supportsFog)return[1,1];const a=this._transform.calculateFogTileMatrix(r.toUnwrapped());return Kn(this.state,a,0,0,s.a3,s.a3,this._transform)}getOpacityForBounds(r,a,h,f,m){return this._transform.projection.supportsFog?Kn(this.state,r,a,h,f,m,this._transform):[1,1]}getFovAdjustedRange(r){return this._transform.projection.supportsFog?ji(this.state,r):[0,1]}isVisibleOnFrustum(r){if(!this._transform.projection.supportsFog)return!1;const a=[4,5,6,7];for(const h of a){const f=r.points[h];let m;if(f[2]>=0)m=f;else{const g=r.points[h-4];m=s.a4(g,f,g[2]/(g[2]-f[2]))}if(Gi(this.state,m[0],m[1],0,this._transform)>=li)return!0}return!1}updateConfig(r){this._transitionable.setTransitionOrValue(this._options,new Map(r))}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}_validate(r,a,h){return(!h||h.validate!==!1)&&pt(this,r.call(J,s.W({value:a,style:{glyphs:!0,sprite:!0},styleSpec:s.L})))}}class Xs extends s.E{constructor(r,a,h,f){super(),this.scope=h,this._options=r,this.properties=new s.a0(a),this._transitionable=new s.U(a,h,new Map(f)),this._transitionable.setTransitionOrValue(r.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(r){this._transitionable.setTransitionOrValue(this._options.properties,new Map(r))}updateTransitions(r){this._transitioning=this._transitionable.transitioned(r,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(r){this.properties=this._transitioning.possiblyEvaluate(r)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(r,a){this._options=r,this._transitionable.setTransitionOrValue(r.properties,a)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}const vt=new s.N({color:new s.O(s.L.properties_light_ambient.color),intensity:new s.O(s.L.properties_light_ambient.intensity)}),wc=new s.N({direction:new s.a5(s.L.properties_light_directional.direction),color:new s.O(s.L.properties_light_directional.color),intensity:new s.O(s.L.properties_light_directional.intensity),"cast-shadows":new s.O(s.L.properties_light_directional["cast-shadows"]),"shadow-intensity":new s.O(s.L.properties_light_directional["shadow-intensity"])});var Cn=`
15#define EPSILON 0.0000001
16#define PI 3.141592653589793
17#ifdef RENDER_CUTOFF
18float 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);}
19#endif`,Tc=`
20out vec4 glFragColor;highp float unpack_depth(highp vec4 rgba_depth)
21{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;}
22#ifdef INDICATOR_CUTOUT
23uniform vec2 u_indicator_cutout_centers;uniform vec4 u_indicator_cutout_params;
24#endif
25vec4 applyCutout(vec4 color) {
26#ifdef INDICATOR_CUTOUT
27float holeMinOpacity=u_indicator_cutout_params.x;float holeRadius=max(u_indicator_cutout_params.y,0.0);float holeAspectRatio=u_indicator_cutout_params.z;
27float 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);
28#else
29return color;
30#endif
31}
32#ifdef DEBUG_WIREFRAME
33#define HANDLE_WIREFRAME_DEBUG \\
34glFragColor=vec4(0.7,0.0,0.0,0.7); \\
35gl_FragDepth=gl_FragCoord.z-0.0001;
36#else
37#define HANDLE_WIREFRAME_DEBUG
38#endif
39#ifdef RENDER_CUTOFF
40uniform highp vec4 u_cutoff_params;in float v_cutoff_opacity;
41#endif
42vec4 textureLodCustom(sampler2D image,vec2 pos,vec2 lod_coord) {vec2 size=vec2(textureSize(image,0));vec2 dx=dFdx(lod_coord.xy*size);vec2 dy=dFdy(lod_coord.xy*size);float delta_max_sqr=max(dot(dx,dx),dot(dy,dy));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;}`,Ec=`
43#define EXTENT 8192.0
44#define RAD_TO_DEG 180.0/PI
45#define DEG_TO_RAD PI/180.0
46#define GLOBE_RADIUS EXTENT/PI/2.0
47float 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;}
48#ifdef PROJECTION_GLOBE_VIEW
49vec3 mercator_tile_position(mat4 matrix,vec2 tile_anchor,vec3 tile_id,vec2 mercator_center) {
50#ifndef PROJECTED_POS_ON_VIEWPORT
51float 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;
52#else
53return vec3(0.0);
54#endif
55}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);}
56#endif
57vec2 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(
58unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
59);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}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);}
60#ifdef RENDER_CUTOFF
61uniform vec4 u_cutoff_params;out float v_cutoff_opacity;
62#endif
63const vec4 AWAY=vec4(-1000.0,-1000.0,-1000.0,1);const float skirtOffset=24575.0;vec3 decomposeToPosAndSkirt(vec2 posWithComposedSkirt)
64{float skirt=float(posWithComposedSkirt.x >=skirtOffset);vec2 pos=posWithComposedSkirt-vec2(skirt*skirtOffset,0.0);return vec3(pos,skirt);}`,Sc="in highp vec3 a_pos_3f;uniform lowp mat4 u_matrix;out highp vec3 v_uv;
64void 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=`
65#define ELEVATION_SCALE 7.0
66#define ELEVATION_OFFSET 450.0
67#ifdef PROJECTION_GLOBE_VIEW
68uniform 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(
69mix(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;}
70#else
71vec3 elevationVector(vec2 pos) { return vec3(0,0,1); }
72#endif
73#ifdef TERRAIN
74uniform 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;uniform highp sampler2D u_depth;uniform vec2 u_depth_size_inv;uniform vec2 u_depth_range_unpack;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) {
75#ifdef TERRAIN_DEM_FLOAT_FORMAT
76vec2 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;
77#else
78float 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);
79#endif
80}float prevElevation(vec2 apos) {
81#ifdef TERRAIN_DEM_FLOAT_FORMAT
82vec2 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;
83#else
84float 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);
85#endif
86}
87#ifdef TERRAIN_VERTEX_MORPHING
88float elevation(vec2 apos) {
89#ifdef ZERO_EXAGGERATION
90return 0.0;
91#endif
92float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);}
93#else
94float elevation(vec2 apos) {
95#ifdef ZERO_EXAGGERATION
96return 0.0;
97#endif
98return currentElevation(apos);}
99#endif
100#ifdef TERRAIN_DEPTH_D24
101float 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);}
102#else
103highp float unpack_depth_rgba(highp vec4 rgba_depth)
104{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;}
105#endif
106bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w;
107#ifdef TERRAIN_DEPTH_D24
108float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r);
109#else
110float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5));
111#endif
112return coord.z > depth+0.0005;}float occlusionFade(vec4 frag) {vec3 coord=frag.xyz/frag.w;vec3 df=vec3(5.0*u_depth_size_inv,0.0);vec2 uv=0.5*coord.xy+0.5;
113#ifdef TERRAIN_DEPTH_D24
114vec4 depth=vec4(
115texture(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
116);depth=unpack_depth4(depth);
117#else
118vec4 depth=vec4(
119unpack_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))
120);
121#endif
122return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z-0.001)-depth),0.0,1.0));}vec4 fourSample(vec2 pos,vec2 off) {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);}
123#else
124float elevation(vec2 pos) { return 0.0; }bool isOccluded(vec4 frag) { return false; }float occlusionFade(vec4 frag) { return 1.0; }
125#endif`,Ic=`#ifdef FOG
126uniform 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);}
127#endif`,Ac=`highp vec3 hash(highp vec2 p) {highp vec3 p3=fract(p.xyx*vec3(443.8975,397.2973,491.1871));p3+=dot(p3,p3.yxz+19.19);return fract((p3.xxy+p3.yzz)*p3.zyx);}
127vec3 dither(vec3 color,highp vec2 seed) {vec3 rnd=hash(seed)+hash(seed+0.59374)-0.5;return color+rnd/255.0;}
128#ifdef FOG
129uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(
130mix(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;}vec3 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) {
131#ifdef FOG_DITHERING
132vec2 dither_seed=gl_FragCoord.xy+u_fog_temporal_offset;return dither(color,dither_seed);
133#else
134return color;
135#endif
136}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);}
137#endif`,Cc=`#ifdef RASTER_ARRAY
138uniform 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)
139);}
139vec2 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)
140);}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);}
141#endif`,Pc=`#ifdef RASTER_ARRAY
142uniform 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;}
143#endif
144uniform 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;}`,zc=`#ifdef RENDER_SHADOWS
145uniform 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) {float dotScale=min(1.0-dot(normal,u_shadow_direction),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];}
146#endif//RENDER_SHADOWS`,Th=`#ifdef RENDER_SHADOWS
147#ifdef DEPTH_TEXTURE
148uniform highp sampler2D u_shadowmap_0;uniform highp sampler2D u_shadowmap_1;
149#else
150uniform sampler2D u_shadowmap_0;uniform sampler2D u_shadowmap_1;
151#endif
152uniform float u_shadow_intensity;uniform float u_shadow_map_resolution;uniform float u_shadow_texel_size;uniform highp vec3 u_shadow_normal_offset;uniform vec2 u_fade_range;uniform mediump vec3 u_shadow_direction;uniform highp vec3 u_shadow_bias;highp float shadow_sample_1(highp vec2 uv,highp float compare) {highp float shadow_depth;
153#ifdef DEPTH_TEXTURE
154shadow_depth=texture(u_shadowmap_1,uv).r;
155#else
156shadow_depth=unpack_depth(texture(u_shadowmap_1,uv))*0.5+0.5;
157#endif
158return step(shadow_depth,compare);}highp float shadow_sample_0(highp vec2 uv,highp float compare) {highp float shadow_depth;
159#ifdef DEPTH_TEXTURE
160shadow_depth=texture(u_shadowmap_0,uv).r;
161#else
162shadow_depth=unpack_depth(texture(u_shadowmap_0,uv))*0.5+0.5;
163#endif
164return step(shadow_depth,compare);}
164float shadow_occlusion_1(highp vec4 pos,highp float bias) {highp vec2 uv=pos.xy;return shadow_sample_1(uv,pos.z-bias);}float shadow_occlusion_0(highp vec4 pos,highp float bias) {highp float compare0=pos.z-bias;
165#ifdef NATIVE
166highp vec2 uv=pos.xy;highp vec4 samples=textureGather(u_shadowmap_0,uv,0);lowp vec4 stepSamples=step(samples,vec4(compare0));
167#else
168highp vec2 uv00=pos.xy-vec2(0.5*u_shadow_texel_size);highp vec2 uv10=uv00+vec2(u_shadow_texel_size,0.0);highp vec2 uv01=uv00+vec2(0.0,u_shadow_texel_size);highp vec2 uv11=uv01+vec2(u_shadow_texel_size,0.0);lowp vec4 stepSamples=vec4(
169shadow_sample_0(uv01,compare0),shadow_sample_0(uv11,compare0),shadow_sample_0(uv10,compare0),shadow_sample_0(uv00,compare0)
170);
171#endif
172vec2 f=fract(pos.xy*u_shadow_map_resolution-vec2(0.5));lowp vec2 lerpx=mix(stepSamples.wx,stepSamples.zy,f.xx);return mix(lerpx.x,lerpx.y,f.y);}float shadow_occlusion(highp vec4 light_view_pos0,highp vec4 light_view_pos1,float view_depth,highp float bias) {
173#ifdef SHADOWS_SINGLE_CASCADE
174light_view_pos0.xyz=light_view_pos0.xyz/light_view_pos0.w*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);
175#else
176light_view_pos0.xyz/=light_view_pos0.w;light_view_pos1.xyz/=light_view_pos1.w;vec4 uv=vec4(light_view_pos0.xy,light_view_pos1.xy);vec4 abs_bounds=abs(uv);if (abs_bounds.x < 1.0 && abs_bounds.y < 1.0) {light_view_pos0.xyz=light_view_pos0.xyz*0.5+0.5;return shadow_occlusion_0(light_view_pos0,bias);}if (abs_bounds.z >=1.0 || abs_bounds.w >=1.0) {return 0.0;}light_view_pos1.xyz=light_view_pos1.xyz*0.5+0.5;float occlusion1=shadow_occlusion_1(light_view_pos1,bias);return mix(occlusion1,0.0,smoothstep(u_fade_range.x,u_fade_range.y,view_depth));
177#endif
178}highp float calculate_shadow_bias(float NDotL) {
179#ifdef NORMAL_OFFSET
180return 0.5*u_shadow_bias.x;
181#else
182return 0.5*(u_shadow_bias.x+clamp(u_shadow_bias.y*tan(acos(NDotL)),0.0,u_shadow_bias.z));
183#endif
184}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));}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);}
185#endif`;const qo=[];Zo(Cn,qo),Zo(Ec,qo),Zo(Tc,qo);const sl={"_prelude_fog.vertex.glsl":Ic,"_prelude_terrain.vertex.glsl":Mc,"_prelude_shadow.vertex.glsl":zc,"_prelude_fog.fragment.glsl":Ac,"_prelude_shadow.fragment.glsl":Th,"_prelude_lighting.glsl":`
186#ifdef LIGHTING_3D_MODE
187uniform 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
187));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);}
188#endif//LIGHTING_3D_MODE`,"_prelude_raster_array.glsl":Cc,"_prelude_raster_particle.glsl":Pc},al={};Ct("",Mc),Ct(Ac,Ic),Ct(Th,zc),Ct(Cc,""),Ct(Pc,"");const Eh=Ct(Tc,Ec),Sh=Cn;var Mh={background:Ct(`#include "_prelude_fog.fragment.glsl"
189#include "_prelude_lighting.glsl"
190uniform vec4 u_color;uniform float u_opacity;
191#ifdef LIGHTING_3D_MODE
192in vec4 v_color;
193#endif
194void main() {vec4 out_color;
195#ifdef LIGHTING_3D_MODE
196out_color=v_color;
197#else
198out_color=u_color;
199#endif
200#ifdef FOG
201out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
202#endif
203glFragColor=out_color*u_opacity;
204#ifdef OVERDRAW_INSPECTOR
205glFragColor=vec4(1.0);
206#endif
207HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
208#include "_prelude_lighting.glsl"
209in vec2 a_pos;uniform mat4 u_matrix;
210#ifdef LIGHTING_3D_MODE
211uniform mediump vec4 u_color;out vec4 v_color;uniform float u_emissive_strength;
212#endif
213void main() {gl_Position=u_matrix*vec4(a_pos,0,1);
214#ifdef LIGHTING_3D_MODE
215v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength);
216#endif
217#ifdef FOG
218v_fog_pos=fog_position(a_pos);
219#endif
220}`),backgroundPattern:Ct(`#include "_prelude_fog.fragment.glsl"
221#include "_prelude_lighting.glsl"
222uniform 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 vec2 v_pos;void main() {vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos);
223#ifdef LIGHTING_3D_MODE
224out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
225#endif
226#ifdef FOG
227out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
228#endif
229glFragColor=out_color*u_opacity;
230#ifdef OVERDRAW_INSPECTOR
231glFragColor=vec4(1.0);
232#endif
233HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
234uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos;out 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_tile_units_to_pixels,a_pos);
235#ifdef FOG
236v_fog_pos=fog_position(a_pos);
237#endif
238}`),circle:Ct(`#include "_prelude_fog.fragment.glsl"
239#include "_prelude_lighting.glsl"
240in vec3 v_data;in float v_visibility;
241#pragma mapbox: define highp vec4 color
242#pragma mapbox: define mediump float radius
243#pragma mapbox: define lowp float blur
244#pragma mapbox: define lowp float opacity
245#pragma mapbox: define highp vec4 stroke_color
246#pragma mapbox: define mediump float stroke_width
247#pragma mapbox: define lowp float stroke_opacity
248uniform float u_emissive_strength;void main() {
249#pragma mapbox: initialize highp vec4 color
250#pragma mapbox: initialize mediump float radius
251#pragma mapbox: initialize lowp float blur
252#pragma mapbox: initialize lowp float opacity
253#pragma mapbox: initialize highp vec4 stroke_color
254#pragma mapbox: initialize mediump float stroke_width
255#pragma mapbox: initialize lowp float stroke_opacity
256vec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(
257antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width)
258);vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t);
259#ifdef LIGHTING_3D_MODE
260out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
261#endif
262#ifdef FOG
263out_color=fog_apply_premultiplied(out_color,v_fog_pos);
264#endif
265glFragColor=out_color*(v_visibility*opacity_t);
266#ifdef OVERDRAW_INSPECTOR
267glFragColor=vec4(1.0);
268#endif
269}`,`#include "_prelude_fog.vertex.glsl"
270#include "_prelude_terrain.vertex.glsl"
271#define NUM_VISIBILITY_RINGS 2
272#define INV_SQRT2 0.70710678
273#define ELEVATION_BIAS 0.0001
274#define NUM_SAMPLES_PER_RING 16
275uniform 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;
276#ifdef PROJECTION_GLOBE_VIEW
277in 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;
278#endif
279out vec3 v_data;out float v_visibility;
280#pragma mapbox: define highp vec4 color
281#pragma mapbox: define mediump float radius
282#pragma mapbox: define lowp float blur
283#pragma mapbox: define lowp float opacity
284#pragma mapbox: define highp vec4 stroke_color
285#pragma mapbox: define mediump float stroke_width
286#pragma mapbox: define lowp float stroke_opacity
287vec2 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) {
288#if defined(TERRAIN)
289return elevation(pos)+ELEVATION_BIAS;
290#else
291return 0.0;
292#endif
293}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);
294#ifdef PITCH_WITH_MAP
295#ifdef PROJECTION_GLOBE_VIEW
296return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) );
297#else
298return u_matrix*( world_center+vec4(sample_offset,0,0) );
299#endif
300#else
301return projected_center+vec4(sample_offset,0,0);
302#endif
303}float get_sample_step() {
304#ifdef PITCH_WITH_MAP
305return 2.0*PI/float(NUM_SAMPLES_PER_RING);
306#else
307return PI/float(NUM_SAMPLES_PER_RING);
308#endif
309}void main(void) {
310#pragma mapbox: initialize highp vec4 color
311#pragma mapbox: initialize mediump float radius
312#pragma mapbox: initialize lowp float blur
313#pragma mapbox: initialize lowp float opacity
314#pragma mapbox: initialize highp vec4 stroke_color
315#pragma mapbox: initialize mediump float stroke_width
316#pragma mapbox: initialize lowp float stroke_opacity
317vec2 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;
318#ifdef PROJECTION_GLOBE_VIEW
319vec3 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);
320#else 
321surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1);
322#endif
323vec4 projected_center=u_matrix*world_center;float view_scale=0.0;
324#ifdef PITCH_WITH_MAP
325#ifdef SCALE_WITH_MAP
326view_scale=1.0;
327#else
328view_scale=projected_center.w/u_camera_to_center_distance;
329#endif
330#else
331#ifdef SCALE_WITH_MAP
332view_scale=u_camera_to_center_distance;
333#else
334view_scale=projected_center.w;
335#endif
336#endif
337gl_Position=project_vertex(extrude,world_center,projected_center,radiu
337s,stroke_width,view_scale,surface_vectors);float visibility=0.0;
338#ifdef TERRAIN
339float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center;
340#ifdef PITCH_WITH_MAP
341float 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;
342#else
343occlusion_world_center=world_center;occlusion_projected_center=projected_center;
344#endif
345for(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);
346#else
347visibility=1.0;
348#endif
349#ifdef PROJECTION_GLOBE_VIEW
350visibility=1.0;
351#endif
352v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);
353#ifdef FOG
354v_fog_pos=fog_position(world_center.xyz);
355#endif
356}`),clippingMask:Ct("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:Ct(`#include "_prelude_fog.fragment.glsl"
357uniform highp float u_intensity;in vec2 v_extrude;
358#pragma mapbox: define highp float weight
359#define GAUSS_COEF 0.3989422804014327
360void main() {
361#pragma mapbox: initialize highp float weight
362float 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);
363#ifdef FOG
364if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);}
365#endif
366#ifdef OVERDRAW_INSPECTOR
367glFragColor=vec4(1.0);
368#endif
369HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
370#include "_prelude_fog.vertex.glsl"
371uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos;
372#ifdef PROJECTION_GLOBE_VIEW
373in 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;
374#endif
375out vec2 v_extrude;
376#pragma mapbox: define highp float weight
377#pragma mapbox: define mediump float radius
378const highp float ZERO=1.0/255.0/16.0;
379#define GAUSS_COEF 0.3989422804014327
380void main(void) {
381#pragma mapbox: initialize highp float weight
382#pragma mapbox: initialize mediump float radius
383vec2 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;
384#ifdef PROJECTION_GLOBE_VIEW
385vec3 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);
386#else
387pos=vec3(tilePos+extrude,elevation(tilePos));
388#endif
389gl_Position=u_matrix*vec4(pos,1);
390#ifdef FOG
391v_fog_pos=fog_position(pos);
392#endif
393}`),heatmapTexture:Ct(`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;
394#ifdef OVERDRAW_INSPECTOR
395glFragColor=vec4(0.0);
396#endif
397HANDLE_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:Ct("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"
398in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in float a_size_scale;in vec2 a_padding;in float a_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;out float v_placed;out float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_pos+elevationVector(a_anchor_pos)*(a_z_offset+elevation(a_anchor_pos)),1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(
3990.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:Ct("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(
400mix(-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(
4010.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:Ct("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"
402in vec2 a_pos;
403#ifdef PROJECTION_GLOBE_VIEW
404in vec3 a_pos_3;
405#endif
406out 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;
407#ifdef PROJECTION_GLOBE_VIEW
408gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1);
409#else
410gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1);
411#endif
412}`),fill:Ct(`#include "_prelude_fog.fragment.glsl"
413#include "_prelude_lighting.glsl"
414#pragma mapbox: define highp vec4 color
415#pragma mapbox: define lowp float opacity
416uniform float u_emissive_strength;void main() {
417#pragma mapbox: initialize highp vec4 color
418#pragma mapbox: initialize lowp float opacity
419vec4 out_color=color;
420#ifdef LIGHTING_3D_MODE
421out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
422#endif
423#ifdef FOG
424out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
425#endif
426glFragColor=out_color*opacity;
427#ifdef OVERDRAW_INSPECTOR
428glFragColor=vec4(1.0);
429#endif
430HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
431in vec2 a_pos;uniform mat4 u_matrix;
432#pragma mapbox: define highp vec4 color
433#pragma mapbox: define lowp float opacity
434void main() {
435#pragma mapbox: initialize highp vec4 color
436#pragma mapbox: initialize lowp float opacity
437gl_Position=u_matrix*vec4(a_pos,0,1);
438#ifdef FOG
439v_fog_pos=fog_position(a_pos);
440#endif
441}`),fillOutline:Ct(`#include "_prelude_fog.fragment.glsl"
442#include "_prelude_lighting.glsl"
443in highp vec2 v_pos;uniform float u_emissive_strength;
444#pragma mapbox: define highp vec4 outline_color
445#pragma mapbox: define lowp float opacity
446void main() {
447#pragma mapbox: initialize highp vec4 outline_color
448#pragma mapbox: initialize lowp float opacity
449float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color;
450#ifdef LIGHTING_3D_MODE
451out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
452#endif
453#ifdef FOG
454out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
455#endif
456glFragColor=out_color*(alpha*opacity);
457#ifdef OVERDRAW_INSPECTOR
458glFragColor=vec4(1.0);
459#endif
460HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
461in vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos;
462#pragma mapbox: define highp vec4 outline_color
463#pragma mapbox: define lowp float opacity
464void main() {
465#pragma mapbox: initialize highp vec4 outline_color
466#pragma mapbox: initialize lowp float opacity
467gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
468#ifdef FOG
469v_fog_pos=fog_position(a_pos);
470#endif
471}`),fillOutlinePattern:Ct(`#include "_prelude_fog.fragment.glsl"
472#include "_prelude_lighting.glsl"
473uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_emissive_strength;in highp vec2 v_pos;in highp vec2 v_pos_world;
474#pragma mapbox: define lowp float opacity
475#pragma mapbox: define lowp vec4 pattern
476void main() {
477#pragma mapbox: initialize lowp float opacity
478#pragma mapbox: initialize mediump vec4 pattern
479vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);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);
480#ifdef LIGHTING_3D_MODE
481out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
482#endif
483#ifdef FOG
484out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
485#endif
486glFragColor=out_color*(alpha*opacity);
487#ifdef OVERDRAW_INSPECTOR
488glFragColor=vec4(1.0);
489#endif
490HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
491uniform 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;out highp vec2 v_pos;out highp vec2 v_pos_world;
492#pragma mapbox: define lowp float opacity
493#pragma mapbox: define lowp vec4 pattern
494#pragma mapbox: define lowp float pixel_ratio
495void main() {
496#pragma mapbox: initialize lowp float opacity
497#pragma mapbox: initialize mediump vec4 pattern
498#pragma mapbox: initialize lowp float pixel_ratio
499vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
500#ifdef FOG
501v_fog_pos=fog_position(a_pos);
502#endif
503}`),fillPattern:Ct(`#include "_prelude_fog.fragment.glsl"
504#include "_prelude_lighting.glsl"
505uniform vec2 u_texsize;uniform sampler2D u_image;in vec2 v_pos;uniform float u_emissive_strength;
506#pragma mapbox: define lowp float opacity
507#pragma mapbox: define lowp vec4 pattern
508void main() {
509#pragma mapbox: initialize lowp float opacity
510#pragma mapbox: initialize mediump vec4 pattern
511vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
512#ifdef LIGHTING_3D_MODE
513out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
514#endif
515#ifdef FOG
516out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
517#endif
518glFragColor=out_color*opacity;
519#ifdef OVERDRAW_INSPECTOR
520glFragColor=vec4(1.0);
521#endif
522HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
523uniform 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;out vec2 v_pos;
524#pragma mapbox: define lowp float opacity
525#pragma mapbox: define lowp vec4 pattern
526#pragma mapbox: define lowp float pixel_ratio
527void main() {
528#pragma mapbox: initialize lowp float opacity
529#pragma mapbox: initialize mediump vec4 pattern
530#pragma mapbox: initialize lowp float pixel_ratio
531vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos);
532#ifdef FOG
533v_fog_pos=fog_position(a_pos);
534#endif
535}`),fillExtrusion:Ct(`#include "_prelude_fog.fragment.glsl"
536#include "_prelude_shadow.fragment.glsl"
537#include "_prelude_lighting.glsl"
538in vec4 v_color;in vec4 v_flat;
539#ifdef RENDER_SHADOWS
540in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;
541#endif
542uniform lowp float u_opacity;
543#ifdef FAUX_AO
544uniform lowp vec2 u_ao;in vec2 v_ao;
545#endif
546#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
547in vec4 v_roof_color;
548#endif
549#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
550in highp vec3 v_normal;
551#endif
552uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor;
553#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
554in float v_flood_radius;in float v_has_floodlight;
555#endif
556uniform float u_emissive_strength;in float v_height;void main() {
557#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
558vec3 normal=normalize(v_normal);
559#endif
560float z;vec4 color=v_color;
561#ifdef ZERO_ROOF_RADIUS
562z=float(normal.z > 0.00001);
563#ifdef LIGHTING_3D_MODE
564normal=mix(normal,vec3(0.0,0.0,1.0),z);
565#else
566color=mix(v_color,v_roof_color,z);
567#endif
568#endif
569float h=max(0.0,v_height);float ao_shade=1.0;
570#ifdef FAUX_AO
571float 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;
572#ifdef ZERO_ROOF_RADIUS
573concave*=(1.0-z);
574#endif
575float 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);
576#ifdef LIGHTING_3D_MODE
577#ifdef FLOOD_LIGHT
578color.rgb*=mix(ao_shade,1.0,v_has_floodlight);
579#else
580color.rgb*=ao_shade;
581#endif
582#else
583color.rgb*=ao_shade;
584#endif
585#endif
586#ifdef LIGHTING_3D_MODE
587float flood_radiance=0.0;
588#ifdef FLOOD_LIGHT
589flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight;
590#endif
591#ifdef RENDER_SHADOWS
592#ifdef FLOOD_LIGHT
593float 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);
594#else
595float shadowed_lighting_factor;
596#ifdef RENDER_CUTOFF
597shadowed_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;}
598#else
599shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);
600#endif
601color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor);
602#endif
603#else
604color.rgb=apply_lighting(color.rgb,normal);
605#ifdef FLOOD_LIGHT
606color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance);
607#endif
608#endif
609color.rgb=mix(color.rgb,v_flat.rgb,u_emissive_strength);color*=u_opacity;
610#endif
611#ifdef FOG
612color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h));
613#endif
614#ifdef INDICATOR_CUTOUT
615color=applyCutout(color);
616#endif
617glFragColor=color;
618#ifdef OVERDRAW_INSPECTOR
619glFragColor=vec4(1.0);
620#endif
621HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
622#include "_prelude_terrain.vertex.glsl"
623#include "_prelude_shadow.vertex.glsl"
624#include "_prelude_lighting.glsl"
625uniform 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;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
626#ifdef PROJECTION_GLOBE_VIEW
627in 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;
628#endif
629uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat;
630#ifdef RENDER_SHADOWS
631uniform 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;
632#endif
633#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
634out vec4 v_roof_color;
635#endif
636#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
637out highp vec3 v_normal;
638#endif
639#ifdef FAUX_AO
640uniform lowp vec2 u_ao;out vec2 v_ao;
641#endif
642#if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT)
643out float v_flood_radius;out float v_has_floodlight;
644#endif
645out float v_height;
646#pragma mapbox: define highp float base
647#pragma mapbox: define highp float height
648#pragma mapbox: define highp vec4 color
649#pragma mapbox: define highp float flood_light_wall_radius
650void main() {
651#pragma mapbox: initialize highp float base
652#pragma mapbox: initialize highp float height
653#pragma mapbox: initialize highp vec4 color
654#pragma mapbox: initialize highp float flood_light_wall_radius
655base*=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));
656#if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE)
657v_normal=normal;
658#endif
659base=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);
660#if defined(HAS_CENTROID) || defined(TERRAIN)
661centroid_pos=a_centroid_pos;
662#endif
663float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos;
664#ifdef TERRAIN
665bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);pos=vec3(pos_nx.xy,h);
666#else
667h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h);
668#endif
669#ifdef PROJECTION_GLOBE_VIEW
670float 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);
671#endif
672float cutoff=1.0;vec3 scaled_pos=pos;
673#ifdef RENDER_CUTOFF
674vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0);cutoff=cutoff_opacity(u_cutoff_params,ground.z);if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale);
675#endif
676float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0));gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h;
677#ifdef RENDER_SHADOWS
678vec3 shd_pos0=pos;vec3 shd_pos1=pos;
679#ifdef NORMAL_OFFSET
680vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1();
681#endif
682v_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);
683#endif
684float NdotL=0.0;float colorvalue=0.0;
685#ifndef LIGHTING_3D_MODE
686colorvalue=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*=(
687(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
688#endif
689#ifdef FAUX_AO
690float 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;
691#ifdef TERRAIN
692top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
692ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
693#endif
694v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
695#ifdef PROJECTION_GLOBE_VIEW
696top_height+=u_height_lift;
697#endif
698gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
699#endif
700#ifdef LIGHTING_3D_MODE
701#ifdef FLOOD_LIGHT
702float 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;
703#endif
704v_color=vec4(color.rgb,1.0);v_flat=vec4(linearProduct(color.rgb,vec3(calculate_NdotL(normal))),1.0);
705#else
706v_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;
707#endif
708#if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE)
709float 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;
710#endif
711#ifdef FOG
712v_fog_pos=fog_position(pos);
713#endif
714}`),fillExtrusionDepth:Ct(`in highp float v_depth;void main() {
715#ifndef DEPTH_TEXTURE
716glFragColor=pack_depth(v_depth);
717#endif
718}`,`#include "_prelude_terrain.vertex.glsl"
719uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_vertical_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
720#pragma mapbox: define highp float base
721#pragma mapbox: define highp float height
722out highp float v_depth;void main() {
723#pragma mapbox: initialize highp float base
724#pragma mapbox: initialize highp float height
725base*=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);
726#if defined(HAS_CENTROID) || defined(TERRAIN)
727centroid_pos=a_centroid_pos;
728#endif
729vec3 pos;
730#ifdef TERRAIN
731bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;float ele=elevation(pos_nx.xy);float c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;float h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base);pos=vec3(pos_nx.xy,h);
732#else
733pos=vec3(pos_nx.xy,t > 0.0 ? height : base);
734#endif
735float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Ct(`#include "_prelude_fog.fragment.glsl"
736#include "_prelude_lighting.glsl"
737uniform vec2 u_texsize;uniform sampler2D u_image;
738#ifdef FAUX_AO
739uniform lowp vec2 u_ao;in vec3 v_ao;
740#endif
741#ifdef LIGHTING_3D_MODE
742in vec3 v_normal;
743#endif
744in vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity;
745#pragma mapbox: define highp float base
746#pragma mapbox: define highp float height
747#pragma mapbox: define mediump vec4 pattern
748#pragma mapbox: define highp float pixel_ratio
749void main() {
750#pragma mapbox: initialize highp float base
751#pragma mapbox: initialize highp float height
752#pragma mapbox: initialize mediump vec4 pattern
753#pragma mapbox: initialize highp float pixel_ratio
754vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 imagecoord=mod(v_pos,1.0);vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos);
755#ifdef LIGHTING_3D_MODE
756out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity;
757#else
758out_color=out_color*v_lighting;
759#endif
760#ifdef FAUX_AO
761float 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),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;
762#endif
763#ifdef FOG
764out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
765#endif
766#ifdef INDICATOR_CUTOUT
767out_color=applyCutout(out_color);
768#endif
769glFragColor=out_color;
770#ifdef OVERDRAW_INSPECTOR
771glFragColor=vec4(1.0);
772#endif
773HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
774#include "_prelude_terrain.vertex.glsl"
775#include "_prelude_lighting.glsl"
776uniform 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 vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos;
777#ifdef PROJECTION_GLOBE_VIEW
778in 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;
779#endif
780out vec2 v_pos;out vec4 v_lighting;
781#ifdef FAUX_AO
782uniform lowp vec2 u_ao;out vec3 v_ao;
783#endif
784#ifdef LIGHTING_3D_MODE
785out vec3 v_normal;
786#endif
787#pragma mapbox: define highp float base
788#pragma mapbox: define highp float height
789#pragma mapbox: define mediump vec4 pattern
790#pragma mapbox: define highp float pixel_ratio
791void main() {
792#pragma mapbox: initialize highp float base
793#pragma mapbox: initialize highp float height
794#pragma mapbox: initialize mediump vec4 pattern
795#pragma mapbox: initialize highp float pixel_ratio
796vec2 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);
797#if defined(HAS_CENTROID) || defined(TERRAIN)
798centroid_pos=a_centroid_pos;
799#endif
800float ele=0.0;float h=z;vec3 p;float c_ele;
801#ifdef TERRAIN
802bool flat_roof=centroid_pos.x !=0.0 && t > 0.0;ele=elevation(pos_nx.xy);c_ele=flat_roof ? centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos) : ele;h=flat_roof ? max(c_ele+height,ele+base+2.0) : ele+(t > 0.0 ? height : base==0.0 ?-5.0 : base);p=vec3(pos_nx.xy,h);
803#else
804p=vec3(pos_nx.xy,z);
805#endif
806#ifdef PROJECTION_GLOBE_VIEW
807float 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);
808#endif
809float hidden=float(centroid_pos.x==0.0 && centroid_pos.y==1.0);gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0
810? pos_nx.xy
811: 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;
812#ifdef LIGHTING_3D_MODE
813NdotL=calculate_NdotL(normal);
814#else
815NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL);
816#endif
817if (normal.y !=0.0) {float r=0.84;
818#ifndef LIGHTING_3D_MODE
819r=mix(0.7,0.98,1.0-u_lightintensity);
820#endif
821NdotL*=(
822(1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));}
823#ifdef FAUX_AO
824float 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;
825#ifdef TERRAIN
826top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(ce
826ntroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height);
827#endif
828v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]);
829#ifdef PROJECTION_GLOBE_VIEW
830top_height+=u_height_lift;
831#endif
832gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w;
833#endif
834#ifdef LIGHTING_3D_MODE
835v_normal=normal;
836#else
837v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;
838#endif 
839#ifdef FOG
840v_fog_pos=fog_position(p);
841#endif
842}`),groundShadow:Ct(`#include "_prelude_shadow.fragment.glsl"
843precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
844#ifdef FOG
845in float v_fog_opacity;
846#endif
847void main() {float light=shadowed_light_factor(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);
848#ifdef RENDER_CUTOFF
849shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w));
850#endif
851#ifdef FOG
852shadow=mix(shadow,vec3(1.0),v_fog_opacity);
853#endif
854#ifdef INDICATOR_CUTOUT
855shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0)).r);
856#endif
857glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl"
858uniform 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;
859#ifdef FOG
860out float v_fog_opacity;
861#endif
862void 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);
863#ifdef FOG
864v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos);
865#endif
866}`),fillExtrusionGroundEffect:Ct(`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;
867#ifdef SDF_SUBPASS
868in 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);}
869#ifdef FOG
870in highp float v_fog;
871#endif
872#endif
873void main() {
874#ifdef CLEAR_SUBPASS
875vec4 color=vec4(1.0);
876#ifdef CLEAR_FROM_TEXTURE
877color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size));
878#endif
879glFragColor=color;
880#else
881#ifdef SDF_SUBPASS
882highp 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;
883#ifdef FOG
884fog=v_fog;
885#endif
886#ifdef RENDER_CUTOFF
887fog*=v_cutoff_opacity;
888#endif
889glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog));
890#else
891vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass);
892#ifdef OVERDRAW_INSPECTOR
893color=vec4(1.0);
894#endif
895glFragColor=color;
896#endif
897HANDLE_WIREFRAME_DEBUG;
898#endif
899}`,`#include "_prelude_fog.vertex.glsl"
900in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark;
901#ifdef SDF_SUBPASS
902out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao;
903#ifdef FOG
904out highp float v_fog;
905#endif
906#endif
907uniform 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 vec2 u_ao;
908#pragma mapbox: define highp float flood_light_ground_radius
909const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() {
910#pragma mapbox: initialize highp float flood_light_ground_radius
911vec2 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;
911float 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(1.0,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;
912#ifdef SDF_SUBPASS
913v_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);
914#ifdef FOG
915v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos);
916#endif
917#endif
918float hidden_by_landmark=0.0;
919#ifdef HAS_CENTROID
920hidden_by_landmark=a_hidden_by_landmark;
921#endif
922float 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));
923#ifdef RENDER_CUTOFF
924v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
925#endif
926}`),hillshadePrepare:Ct(`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(
927(c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c)
928)/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4(
929deriv.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:Ct(`#include "_prelude_fog.fragment.glsl"
930#include "_prelude_lighting.glsl"
931uniform 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;
932#ifdef LIGHTING_3D_MODE
933glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength);
934#endif
935#ifdef FOG
936glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos));
937#endif
938#ifdef OVERDRAW_INSPECTOR
939glFragColor=vec4(1.0);
940#endif
941HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
942uniform 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;
943#ifdef FOG
944v_fog_pos=fog_position(a_pos);
945#endif
946}`),line:Ct(`#include "_prelude_fog.fragment.glsl"
947#include "_prelude_lighting.glsl"
948uniform lowp float u_device_pixel_ratio;
948uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform lowp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec4 v_uv;
949#ifdef RENDER_LINE_DASH
950uniform sampler2D u_dash_image;in vec2 v_tex;
951#endif
952#ifdef RENDER_LINE_GRADIENT
953uniform sampler2D u_gradient_image;
954#endif
955float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;}uniform float u_emissive_strength;
956#pragma mapbox: define highp vec4 color
957#pragma mapbox: define lowp float floorwidth
958#pragma mapbox: define lowp vec4 dash
959#pragma mapbox: define lowp float blur
960#pragma mapbox: define lowp float opacity
961#pragma mapbox: define lowp float border_width
962#pragma mapbox: define lowp vec4 border_color
963float linearstep(float edge0,float edge1,float x) {return  clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() {
964#pragma mapbox: initialize highp vec4 color
965#pragma mapbox: initialize lowp float floorwidth
966#pragma mapbox: initialize lowp vec4 dash
967#pragma mapbox: initialize lowp float blur
968#pragma mapbox: initialize lowp float opacity
969#pragma mapbox: initialize lowp float border_width
970#pragma mapbox: initialize lowp vec4 border_color
971float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);
972#ifdef RENDER_LINE_DASH
973float sdfdist=texture(u_dash_image,v_tex).r;
973float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;alpha*=linearstep(0.5-sdfgamma/floorwidth,0.5+sdfgamma/floorwidth,sdfdist);
974#endif
975highp vec4 out_color;
976#ifdef RENDER_LINE_GRADIENT
977out_color=texture(u_gradient_image,v_uv.xy);
978#else
979out_color=color;
980#endif
981float trim_alpha=1.0;
982#ifdef RENDER_LINE_TRIM_OFFSET
983highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/clamp(u_trim_fade_range[0],1e-4,1.0)));float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/clamp(u_trim_fade_range[1],1e-4,1.0)));float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=out_color.a;}
984#endif
985if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}}
986#ifdef RENDER_LINE_BORDER
987float edgeBlur=(border_width+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.rgb=mix(border_color.rgb*border_color.a*trim_alpha,out_color.rgb,smoothAlpha);}}
988#endif
989#ifdef LIGHTING_3D_MODE
990out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength);
991#endif
992#ifdef FOG
993out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos));
994#endif
995out_color*=(alpha*opacity);
996#ifdef INDICATOR_CUTOUT
997out_color=applyCutout(out_color);
998#endif
999glFragColor=out_color;
1000#ifdef OVERDRAW_INSPECTOR
1001glFragColor=vec4(1.0);
1002#endif
1003HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1004#include "_prelude_terrain.vertex.glsl"
1005#define EXTRUDE_SCALE 0.015873016
1006in vec2 a_pos_normal;in vec4 a_data;
1007#if defined(ELEVATED)
1008in float a_z_offset;
1009#endif
1010#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1011in highp vec4 a_packed;
1012#endif
1013#ifdef RENDER_LINE_DASH
1014in float a_linesofar;
1015#endif
1016uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec4 v_uv;
1017#ifdef RENDER_LINE_DASH
1018uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex;
1019#endif
1020#ifdef RENDER_LINE_GRADIENT
1021uniform float u_image_height;
1022#endif
1023#pragma mapbox: define highp vec4 color
1024#pragma mapbox: define lowp float floorwidth
1025#pragma mapbox: define lowp vec4 dash
1026#pragma mapbox: define lowp float blur
1027#pragma mapbox: define lowp float opacity
1028#pragma mapbox: define mediump float gapwidth
1029#pragma mapbox: define lowp float offset
1030#pragma mapbox: define mediump float width
1031#pragma mapbox: define lowp float border_width
1032#pragma mapbox: define lowp vec4 border_color
1033void main() {
1034#pragma mapbox: initialize highp vec4 color
1035#pragma mapbox: initialize lowp float floorwidth
1036#pragma mapbox: initialize lowp vec4 dash
1037#pragma mapbox: initialize lowp float blur
1038#pragma mapbox: initialize lowp float opacity
1039#pragma mapbox: initialize mediump float gapwidth
1040#pragma mapbox: initialize lowp float offset
1041#pragma mapbox: initialize mediump float width
1042#pragma mapbox: initialize lowp float border_width
1043#pragma mapbox: initialize lowp vec4 border_color
1044float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*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);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);
1045#if defined(ELEVATED)
1046vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 halfCellProgress=normal.yx*32.0;float ele0=elevation(pos);float ele_line=max(ele0,max(elevation(pos+halfCellProgress),elevation(pos-halfCellProgress)));float ele1=elevation(pos+offsetTile);float ele2=elevation(pos-offsetTile);float ele_max=max(ele_line,0.5*(ele1+ele2));float ele=ele_max-ele0+ele1+a_z_offset ;gl_Position=u_matrix*vec4(pos+offsetTile,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)*0.1*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);
1047#else
1048gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;
1049#endif
1050#ifndef RENDER_TO_TEXTURE
1051float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
1052#else
1053v_gamma_scale=1.0;
1054#endif
1055#if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET)
1056float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];
1057#ifdef RENDER_LINE_GRADIENT
1058highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec4(a_uv_x,a_split_index*texel_height-half_texel_height,a_clip_start,a_clip_end);
1059#else
1060v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);
1061#endif
1062#endif
1063#ifdef RENDER_LINE_DASH
1064float 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,(-normal.y*height+dash.x+0.5)/u_texsize.y);
1065#endif
1066v_width2=vec2(outset,inset);
1067#ifdef FOG
1068v_fog_pos=fog_position(pos);
1069#endif
1070}`),linePattern:Ct(`#include "_prelude_fog.fragment.glsl"
1071#include "_prelude_lighting.glsl"
1072uniform highp float u_device_pixel_ratio;
1072uniform 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 sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width;
1073#ifdef RENDER_LINE_TRIM_OFFSET
1074in highp vec4 v_uv;
1075#endif
1076#ifdef LINE_JOIN_NONE
1077in vec2 v_pattern_data;
1078#endif
1079#pragma mapbox: define mediump vec4 pattern
1080#pragma mapbox: define mediump float pixel_ratio
1081#pragma mapbox: define mediump float blur
1082#pragma mapbox: define mediump float opacity
1083void main() {
1084#pragma mapbox: initialize mediump vec4 pattern
1085#pragma mapbox: initialize mediump float pixel_ratio
1086#pragma mapbox: initialize mediump float blur
1087#pragma mapbox: initialize mediump float opacity
1088vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;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=(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;float x=mod(pattern_x,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));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);
1089#ifdef RENDER_LINE_TRIM_OFFSET
1090highp float start=v_uv[2];highp float end=v_uv[3];highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=(start+(v_uv.x)*(end-start));if (trim_end > trim_start) {if (line_progress <=trim_end && line_progress >=trim_start) {color=vec4(0,0,0,0);}}
1091#endif
1092#ifdef LINE_JOIN_NONE
1093float pattern_len=pattern_size/aspect;float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;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);}
1094#endif
1095#ifdef LIGHTING_3D_MODE
1096color=apply_lighting_ground(color);
1097#endif
1098#ifdef FOG
1099color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
1100#endif
1101color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}}
1102#ifdef INDICATOR_CUTOUT
1103color=applyCutout(color);
1104#endif
1105glFragColor=color;
1106#ifdef OVERDRAW_INSPECTOR
1107glFragColor=vec4(1.0);
1108#endif
1109HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1110#include "_prelude_terrain.vertex.glsl"
1111#define scale 0.015873016
1112in vec2 a_pos_normal;in vec4 a_data;
1113#if defined(ELEVATED)
1114in float a_z_offset;
1115#endif
1116#ifdef RENDER_LINE_TRIM_OFFSET
1117in highp vec4 a_packed;
1118#endif
1119in highp float a_linesofar;
1120#ifdef LINE_JOIN_NONE
1121in highp vec3 a_pattern_data;out vec2 v_pattern_data;
1122#endif
1123uniform 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;out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width;
1124#ifdef RENDER_LINE_TRIM_OFFSET
1125out highp vec4 v_uv;
1126#endif
1127#pragma mapbox: define mediump float blur
1128#pragma mapbox: define mediump float opacity
1129#pragma mapbox: define mediump float offset
1130#pragma mapbox: define mediump float gapwidth
1131#pragma mapbox: define mediump float width
1132#pragma mapbox: define mediump float floorwidth
1133#pragma mapbox: define mediump vec4 pattern
1134#pragma mapbox: define mediump float pixel_ratio
1135void main() {
1136#pragma mapbox: initialize mediump float blur
1137#pragma mapbox: initialize mediump float opacity
1138#pragma mapbox: initialize mediump float offset
1139#pragma mapbox: initialize mediump float gapwidth
1140#pragma mapbox: initialize mediump float width
1141#pragma mapbox: initialize mediump float floorwidth
1142#pragma mapbox: initialize mediump vec4 pattern
1143#pragma mapbox: initialize mediump float pixel_ratio
1144float 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=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);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);vec4 projected_extrude=u_matrix*vec4(dist*u_pixels_to_tile_units,0.0,0.0);
1145#if defined(ELEVATED)
1146vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 halfCellProgress=normal.yx*32.0;float ele0=elevation(pos);float ele_line=max(ele0,max(elevation(pos+halfCellProgress),elevation(pos-halfCellProgress)));float ele1=elevation(pos+offsetTile);float ele2=elevation(pos-offsetTile);float ele_max=max(ele_line,0.5*(ele1+ele2));float ele=ele_max-ele0+ele1+a_z_offset ;gl_Position=u_matrix*vec4(pos+offsetTile,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)*0.1*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);
1147#else
1148gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude;
1149#endif
1150#ifndef RENDER_TO_TEXTURE
1151float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
1152#else
1153v_gamma_scale=1.0;
1154#endif
1155#ifdef RENDER_LINE_TRIM_OFFSET
1156float a_uv_x=a_packed[0];highp float a_clip_start=a_packed[2];highp float a_clip_end=a_packed[3];v_uv=vec4(a_uv_x,0.0,a_clip_start,a_clip_end);
1157#endif
1158v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;
1159#ifdef LINE_JOIN_NONE
1160v_width=floorwidth+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);
1161#endif
1162#ifdef FOG
1163v_fog_pos=fog_position(pos);
1164#endif
1165}`),raster:Ct(`#include "_prelude_fog.fragment.glsl"
1166#include "_prelude_lighting.glsl"
1167#include "_prelude_raster_array.glsl"
1168uniform 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;
1169#ifdef PROJECTION_GLOBE_VIEW
1170in float v_split_fade;
1171#endif
1172uniform 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;
1173#ifndef RASTER_ARRAY
1174uniform sampler2D u_image0;uniform sampler2D u_image1;
1175#endif
1176#ifdef RASTER_COLOR
1177uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res;
1178#endif
1179void main() {vec4 color0,color1,color;vec2 value;
1180#ifdef RASTER_COLOR
1181#ifdef RASTER_ARRAY
1182#ifdef RASTER_ARRAY_LINEAR
1183value=mix(
1184raTexture2D_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
1185);
1186#else
1187value=mix(
1188raTexture2D_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
1189);
1190#endif
1191if (value.y > 0.0) value.x/=value.y;
1192#else
1193color=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);
1194#endif
1195color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y;
1196#else
1197color0=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);
1198#endif
1199color.a*=u_opacity;
1200#ifdef GLOBE_POLES
1201color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition);
1202#endif
1203vec3 rgb=color.rgb;rgb=vec3(
1204dot(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);
1205#ifdef LIGHTING_3D_MODE
1206out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb;
1207#endif
1208#ifdef FOG
1209highp 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));
1210#endif
1211glFragColor=vec4(out_color*color.a,color.a);
1212#ifdef PROJECTION_GLOBE_VIEW
1213glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade));
1214#endif
1215#ifdef RENDER_CUTOFF
1216glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth);
1217#endif
1218#ifdef OVERDRAW_INSPECTOR
1219glFragColor=vec4(1.0);
1220#endif
1221HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1222uniform 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;
1223#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
1224#ifdef GLOBE_POLES
1225in vec3 a_globe_pos;in vec2 a_uv;
1226#else
1227in vec2 a_pos;in vec2 a_texture_pos;
1228#endif
1229out vec2 v_pos0;out vec2 v_pos1;out float v_depth;
1230#ifdef PROJECTION_GLOBE_VIEW
1231out float v_split_fade;
1232#endif
1233void main() {vec2 uv;
1234#ifdef GLOBE_POLES
1235vec3 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;
1236#ifdef FOG
1237v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz);
1238#endif
1239#else
1240float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0;
1241#ifdef PROJECTION_GLOBE_VIEW
1242vec3 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]);    
1243v_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];
1243if (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;
1244#ifdef FOG
1245v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
1246#endif
1247#else
1248gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
1249#ifdef FOG
1250v_fog_pos=fog_position(a_pos);
1251#endif
1252#endif
1253#endif
1254v_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;
1255#ifdef RENDER_CUTOFF
1256v_depth=gl_Position.z;
1257#endif
1258}`),rasterParticle:Ct(`#include "_prelude_fog.fragment.glsl"
1259#include "_prelude_lighting.glsl"
1260uniform 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;
1261#ifdef LIGHTING_3D_MODE
1262out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),0.0).rgb;
1263#endif
1264#ifdef FOG
1265highp 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));
1266#endif
1267glFragColor=vec4(out_color*color.a,color.a);
1268#ifdef OVERDRAW_INSPECTOR
1269glFragColor=vec4(1.0);
1270#endif
1271HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1272uniform 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;
1273#define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8
1274in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv;
1275#ifdef PROJECTION_GLOBE_VIEW
1276vec3 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;
1277#ifdef FOG
1278v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
1279#endif
1280#else
1281uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w);
1282#ifdef FOG
1283v_fog_pos=fog_position(a_pos);
1284#endif
1285#endif
1286v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Ct("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"
1287in 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(
1288mod(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:Ct("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Ct(`#include "_prelude_raster_particle.glsl"
1289uniform 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;
1289vec2 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(
1290linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4)
1291);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);}"),symbolIcon:Ct(`#include "_prelude_lighting.glsl"
1292uniform sampler2D u_texture;
1293#ifdef ICON_TRANSITION
1294uniform float u_icon_transition;
1295#endif
1296in float v_fade_opacity;in vec2 v_tex_a;
1297#ifdef ICON_TRANSITION
1298in vec2 v_tex_b;
1299#endif
1300#ifdef COLOR_ADJUSTMENT
1301uniform mat4 u_color_adj_mat;
1302#endif
1303#pragma mapbox: define lowp float opacity
1304#pragma mapbox: define lowp float emissive_strength
1305void main() {
1306#pragma mapbox: initialize lowp float opacity
1307#pragma mapbox: initialize lowp float emissive_strength
1308lowp float alpha=opacity*v_fade_opacity;vec4 out_color;
1309#ifdef ICON_TRANSITION
1310vec4 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);
1311#else
1312out_color=texture(u_texture,v_tex_a);
1313#endif
1314#ifdef COLOR_ADJUSTMENT
1315out_color=u_color_adj_mat*out_color;
1316#endif
1317out_color*=alpha;
1318#ifdef LIGHTING_3D_MODE
1319out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
1320#endif
1321glFragColor=out_color;
1322#ifdef OVERDRAW_INSPECTOR
1323glFragColor=vec4(1.0);
1324#endif
1325HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
1326in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;
1327#ifdef OCCLUSION_QUERIES
1328in float a_occlusion_query_opacity;
1329#endif
1330#ifdef Z_OFFSET
1331in float a_z_offset;
1332#endif
1333#ifdef PROJECTION_GLOBE_VIEW
1334in vec3 a_globe_anchor;in vec3 a_globe_normal;
1335#endif
1336#ifdef ICON_TRANSITION
1337in vec2 a_texb;
1338#endif
1339uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform vec3 u_up_vector;
1340#ifdef PROJECTION_GLOBE_VIEW
1341uniform 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;
1342#endif
1343out vec2 v_tex_a;
1344#ifdef ICON_TRANSITION
1345out vec2 v_tex_b;
1346#endif
1347out float v_fade_opacity;
1348#pragma mapbox: define lowp float opacity
1349#pragma mapbox: define lowp float emissive_strength
1350#pragma mapbox: define lowp float occlusion_opacity
1351void main() {
1352#pragma mapbox: initialize lowp float opacity
1353#pragma mapbox: initialize lowp float emissive_strength
1354#pragma mapbox: initialize lowp float occlusion_opacity
1355vec2 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=elevation(tile_anchor);
1356#ifdef Z_OFFSET
1357e+=a_z_offset;
1358#endif
1359vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;
1360#ifdef PROJECTION_GLOBE_VIEW
1361mercator_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;
1362#else
1363world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
1364#endif
1365vec4 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 ?
1366camera_to_anchor_distance/u_camera_to_center_distance :
1367u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
13680.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;
1369#ifdef PROJECTION_GLOBE_VIEW
1370vec3 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;
1371#else
1372offsetProjected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;
1373#endif
1374vec2 b=offsetProjected_point.xy/offsetProjected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
1375#ifdef PROJECTION_GLOBE_VIEW
1376vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
1377#else
1378projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
1379#endif
1380highp 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);
1381#ifdef TERRAIN
1382#ifdef PITCH_WITH_MAP_TERRAIN
1383vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
1384#endif
1385#endif
1386float occlusion_fade=globe_occlusion_fade;
1387#ifdef SYMBOL_OCCLUSION_BY_TERRAIN_DEPTH
1388occlusion_fade*=occlusionFade(projected_point);
1389#endif
1390float projection_transition_fade=1.0;
1391#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)
1392projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
1393#endif
1394vec2 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))*projection_transition_fade;float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);
1395#ifdef PROJECTION_GLOBE_VIEW
1396vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);
1397#else
1398gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);
1399#endif
1400v_tex_a=a_tex/u_texsize;
1401#ifdef ICON_TRANSITION
1402v_tex_b=a_texb/u_texsize;
1403#endif
1404v_fade_opacity=out_fade_opacity;
1405#ifdef OCCLUSION_QUERIES
1406float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);v_fade_opacity*=occludedFadeMultiplier;
1407#endif
1408}`),symbolSDF:Ct(`#include "_prelude_lighting.glsl"
1409#define SDF_PX 8.0
1410uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;in float v_draw_halo;in vec2 v_data0;in vec3 v_data1;
1411#pragma mapbox: define highp vec4 fill_color
1412#pragma mapbox: define highp vec4 halo_color
1413#pragma mapbox: define lowp float opacity
1414#pragma mapbox: define lowp float halo_width
1415#pragma mapbox: define lowp float halo_blur
1416#pragma mapbox: define lowp float emissive_strength
1417void main() {
1418#pragma mapbox: initialize highp vec4 fill_color
1419#pragma mapbox: initialize highp vec4 halo_color
1420#pragma mapbox: initialize lowp float opacity
1421#pragma mapbox: initialize lowp float halo_width
1422#pragma mapbox: initialize lowp float halo_blur
1423#pragma mapbox: initialize lowp float emissive_strength
1424float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity);
1425#ifdef LIGHTING_3D_MODE
1426out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
1427#endif
1428glFragColor=out_color;
1429#ifdef OVERDRAW_INSPECTOR
1430glFragColor=vec4(1.0);
1431#endif
1432HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
1433in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity;
1434#ifdef Z_OFFSET
1435in float a_z_offset;
1436#endif
1437#ifdef PROJECTION_GLOBE_VIEW
1438in vec3 a_globe_anchor;in vec3 a_globe_normal;
1439#endif
1440#ifdef OCCLUSION_QUERIES
1441in float a_occlusion_query_opacity;
1442#endif
1443uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform 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 bool u_is_halo;
1444#ifdef PROJECTION_GLOBE_VIEW
1445uniform 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;
1446#endif
1447out float v_draw_halo;out vec2 v_data0;out vec3 v_data1;
1448#pragma mapbox: define highp vec4 fill_color
1449#pragma mapbox: define highp vec4 halo_color
1450#pragma mapbox: define lowp float opacity
1451#pragma mapbox: define lowp float halo_width
1452#pragma mapbox: define lowp float halo_blur
1453#pragma mapbox: define lowp float emissive_strength
1454#pragma mapbox: define lowp float occlusion_opacity
1455void main() {
1456#pragma mapbox: initialize highp vec4 fill_color
1457#pragma mapbox: initialize highp vec4 halo_color
1458#pragma mapbox: initialize lowp float opacity
1459#pragma mapbox: initialize lowp float halo_width
1460#pragma mapbox: initialize lowp float halo_blur
1461#pragma mapbox: initialize lowp float emissive_strength
1462#pragma mapbox: initialize lowp float occlusion_opacity
1463vec2 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;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=elevation(tile_anchor);
1464#ifdef Z_OFFSET
1465e+=a_z_offset;
1466#endif
1467vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe;
1468#ifdef PROJECTION_GLOBE_VIEW
1469mercator_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;
1470#else
1471world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
1472#endif
1473vec4 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 ?
1474camera_to_anchor_distance/u_camera_to_center_distance :
1475u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
14760.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a;
1477#ifdef PROJECTION_GLOBE_VIEW
1478vec3 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;
1479#else
1480offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w;
1481#endif
1482vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
1483#ifdef PROJECTION_GLOBE_VIEW
1484vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
1485#else
1486projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
1487#endif
1488highp 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*fontScale+a_pxoffset);
1489#ifdef TERRAIN
1490#ifdef PITCH_WITH_MAP_TERRAIN
1491vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
1492#endif
1493#endif
1494float occlusion_fade=globe_occlusion_fade;
1495#ifdef SYMBOL_OCCLUSION_BY_TERRAIN_DEPTH
1496occlusion_fade*=occlusionFade(projected_point);
1497#endif
1498float projection_transition_fade=1.0;
1499#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)
1500projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
1501#endif
1502vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;
1503#ifdef OCCLUSION_QUERIES
1504float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;
1505#endif
1506float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);
1507#ifdef PROJECTION_GLOBE_VIEW
1508vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);
1509#else
1510gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);
1511#endif
1512float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,out_fade_opacity);}`),symbolTextAndIcon:Ct(`#include "_prelude_lighting.glsl"
1513#define SDF_PX 8.0
1514#define SDF 1.0
1515#define ICON 0.0
1516uniform 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_halo;in float v_draw_halo;in vec4 v_data0;in ve
1516c4 v_data1;
1517#pragma mapbox: define highp vec4 fill_color
1518#pragma mapbox: define highp vec4 halo_color
1519#pragma mapbox: define lowp float opacity
1520#pragma mapbox: define lowp float halo_width
1521#pragma mapbox: define lowp float halo_blur
1522#pragma mapbox: define lowp float emissive_strength
1523void main() {
1524#pragma mapbox: initialize highp vec4 fill_color
1525#pragma mapbox: initialize highp vec4 halo_color
1526#pragma mapbox: initialize lowp float opacity
1527#pragma mapbox: initialize lowp float halo_width
1528#pragma mapbox: initialize lowp float halo_blur
1529#pragma mapbox: initialize lowp float emissive_strength
1530float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha;
1531#ifdef OVERDRAW_INSPECTOR
1532glFragColor=vec4(1.0);
1533#endif
1534return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);vec4 out_color=color*(alpha*opacity*fade_opacity);
1535#ifdef LIGHTING_3D_MODE
1536out_color=apply_lighting_with_emission_ground(out_color,emissive_strength);
1537#endif
1538glFragColor=out_color;
1539#ifdef OVERDRAW_INSPECTOR
1540glFragColor=vec4(1.0);
1541#endif
1542HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl"
1543in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_projected_pos;in float a_fade_opacity;
1544#ifdef OCCLUSION_QUERIES
1545in float a_occlusion_query_opacity;
1546#endif
1547#ifdef Z_OFFSET
1548in float a_z_offset;
1549#endif
1550#ifdef PROJECTION_GLOBE_VIEW
1551in vec3 a_globe_anchor;in vec3 a_globe_normal;
1552#endif
1553uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform 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;
1554#ifdef PROJECTION_GLOBE_VIEW
1555uniform 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;
1556#endif
1557out float v_draw_halo;out vec4 v_data0;out vec4 v_data1;
1558#pragma mapbox: define highp vec4 fill_color
1559#pragma mapbox: define highp vec4 halo_color
1560#pragma mapbox: define lowp float opacity
1561#pragma mapbox: define lowp float halo_width
1562#pragma mapbox: define lowp float halo_blur
1563#pragma mapbox: define lowp float emissive_strength
1564#pragma mapbox: define lowp float occlusion_opacity
1565void main() {
1566#pragma mapbox: initialize highp vec4 fill_color
1567#pragma mapbox: initialize highp vec4 halo_color
1568#pragma mapbox: initialize lowp float opacity
1569#pragma mapbox: initialize lowp float halo_width
1570#pragma mapbox: initialize lowp float halo_blur
1571#pragma mapbox: initialize lowp float emissive_strength
1572#pragma mapbox: initialize lowp float occlusion_opacity
1573vec2 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);float is_sdf=a_size[0]-2.0*a_size_min;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=elevation(tile_anchor);
1574#ifdef Z_OFFSET
1575e+=a_z_offset;
1576#endif
1577vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;
1578#ifdef PROJECTION_GLOBE_VIEW
1579mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos=mix_globe_mercator(a_globe_anchor+h,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;
1580#else
1581world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0;
1582#endif
1583vec4 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 ?
1584camera_to_anchor_distance/u_camera_to_center_distance :
1585u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(
15860.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offset_projected_point=u_matrix*vec4(a_pos+vec2(1,0),0,1);vec2 a=projected_point.xy/projected_point.w;vec2 b=offset_projected_point.xy/offset_projected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos;
1587#ifdef PROJECTION_GLOBE_VIEW
1588vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz+h,mercator_pos,u_zoom_transition);projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0);
1589#else
1590projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0);
1591#endif
1592highp 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*font_scale);
1593#ifdef TERRAIN
1594#ifdef PITCH_WITH_MAP_TERRAIN
1595vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy);
1596#endif
1597#endif
1598float occlusion_fade=globe_occlusion_fade;
1599#ifdef SYMBOL_OCCLUSION_BY_TERRAIN_DEPTH
1600occlusion_fade*=occlusionFade(projected_point);
1601#endif
1602vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change));float projection_transition_fade=1.0;
1603#if defined(PROJECTED_POS_ON_VIEWPORT) && defined(PROJECTION_GLOBE_VIEW)
1604projection_transition_fade=1.0-step(EPSILON,u_zoom_transition);
1605#endif
1606float out_fade_opacity=interpolated_fade_opacity*projection_transition_fade;
1607#ifdef OCCLUSION_QUERIES
1608float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier;
1609#endif
1610float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);
1611#ifdef PROJECTION_GLOBE_VIEW
1612vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);gl_Position=mix(u_coord_matrix*vec4(projected_pos.xyz/projected_pos.w+ xAxis*offset.x+yAxis*offset.y,1.0),AWAY,hidden);
1613#else
1614gl_Position=mix(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+offset,z,1.0),AWAY,hidden);
1615#endif
1616float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,out_fade_opacity,is_sdf);}`),terrainRaster:Ct(`#include "_prelude_fog.fragment.glsl"
1617#include "_prelude_shadow.fragment.glsl"
1618#include "_prelude_lighting.glsl"
1619uniform sampler2D u_image0;in vec2 v_pos0;
1620#ifdef FOG
1621in float v_fog_opacity;
1622#endif
1623#ifdef RENDER_SHADOWS
1624in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;
1625#endif
1626uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color;
1627#ifdef LIGHTING_3D_MODE
1628const vec3 normal=vec3(0.0,0.0,1.0);
1629#ifdef RENDER_SHADOWS
1630float cutoffOpacity=1.0;
1631#ifdef RENDER_CUTOFF
1632cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w);
1633#endif
1634#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
1635vec3 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;
1636#else
1637float 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));
1638#endif
1639#else
1640float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor);
1641#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
1642color.rgb=mix(color.rgb,image_color.rgb,image_color.a);color.a=1.0;
1643#endif
1644#endif
1645#else
1646color=image_color;
1647#endif
1648#ifdef FOG
1649#ifdef ZERO_EXAGGERATION
1650color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
1651#else
1652color=fog_dither(fog_apply_from_vert(color,v_fog_opacity));
1653#endif
1654#endif
1655glFragColor=color;
1656#ifdef OVERDRAW_INSPECTOR
1657glFragColor=vec4(1.0);
1658#endif
1659HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1660#include "_prelude_terrain.vertex.glsl"
1661uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0;
1662#ifdef FOG
1663out float v_fog_opacity;
1664#endif
1665#ifdef RENDER_SHADOWS
1666uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth;
1667#endif
1668void 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);
1669#ifdef FOG
1670#ifdef ZERO_EXAGGERATION
1671v_fog_pos=fog_position(decodedPos);
1672#else
1673v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation)));
1674#endif
1675#endif
1676#ifdef RENDER_SHADOWS
1677vec3 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.);
1678#endif
1679}`),terrainDepth:Ct("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl"
1680uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Ct(`#include "_prelude_fog.fragment.glsl"
1681in 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(
1682cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(e
1682nd-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;
1683#ifdef FOG
1684sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color);
1685#endif
1686sky_color.rgb=dither(sky_color.rgb,gl_FragCoord.xy+u_temporal_offset);sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity);
1687#ifdef OVERDRAW_INSPECTOR
1688glFragColor=vec4(1.0);
1689#endif
1690}`,Sc),skyboxGradient:Ct(`#include "_prelude_fog.fragment.glsl"
1691in 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));
1692#ifdef FOG
1693color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a;
1694#endif
1695color*=u_opacity;color.rgb=dither(color.rgb,gl_FragCoord.xy+u_temporal_offset);glFragColor=color;
1696#ifdef OVERDRAW_INSPECTOR
1697glFragColor=vec4(1.0);
1698#endif
1699}`,Sc),skyboxCapture:Ct
vendor: 3,792 bytes, lines 1699-1710
1699(`
1700in 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;
1701#define BETA_R                  vec3(5.5e-6,13.0e-6,22.4e-6)
1702#define BETA_M                  vec3(21e-6,21e-6,21e-6)
1703#define MIE_G                   0.76
1704#define DENSITY_HEIGHT_SCALE_R  8000.0
1705#define DENSITY_HEIGHT_SCALE_M  1200.0
1706#define PLANET_RADIUS           6360e3
1707#define ATMOSPHERE_RADIUS       6420e3
1708#define SAMPLE_STEPS            10
1709#define DENSITY_STEPS           4
1710float 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
1710Raster:Ct(`#include "_prelude_fog.fragment.glsl"
1711#include "_prelude_lighting.glsl"
1712uniform sampler2D u_image0;uniform float u_far_z_cutoff;in vec2 v_pos0;
1713#ifndef FOG
1714uniform 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;
1715#endif
1716void main() {vec4 color;
1717#ifdef CUSTOM_ANTIALIASING
1718vec2 uv=gl_FragCoord.xy/u_viewport;highp vec3 ray_dir=mix(
1719mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);vec3 dir=normalize(ray_dir);vec3 closest_point=dot(u_globe_pos,dir)*dir;float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0);
1720#ifdef LIGHTING_3D_MODE
1721#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
1722raster=apply_lighting_with_emission_ground(raster,raster.a);color=vec4(raster.rgb*antialias,antialias);
1723#else
1724raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias);
1725#endif
1726#else
1727color=vec4(raster.rgb*antialias,raster.a*antialias);
1728#endif
1729#else
1730color=texture(u_image0,v_pos0);
1731#ifdef LIGHTING_3D_MODE
1732#ifdef LIGHTING_3D_ALPHA_EMISSIVENESS
1733color=apply_lighting_with_emission_ground(color,color.a);color.a=1.0;
1734#else
1735color=apply_lighting_ground(color);
1736#endif
1737#endif
1738#endif
1739#ifdef FOG
1740color=fog_dither(fog_apply_premultiplied(color,v_fog_pos));
1741#endif
1742color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color;
1743#ifdef OVERDRAW_INSPECTOR
1744glFragColor=vec4(1.0);
1745#endif
1746HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
1747#include "_prelude_terrain.vertex.glsl"
1748uniform 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;
1749#ifdef GLOBE_POLES
1750in vec3 a_globe_pos;in vec2 a_uv;
1751#else
1752in vec2 a_pos;
1753#endif
1754out vec2 v_pos0;void main() {
1755#ifdef GLOBE_POLES
1756vec3 globe_pos=a_globe_pos;vec2 uv=a_uv;
1757#else
1758float 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);
1759#endif
1760v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale;
1761#ifdef GLOBE_POLES
1762vec3 up_vector=globe_derived_up_vector;
1763#else
1764vec3 up_vector=elevationVector(tile_pos);
1765#endif
1766float height=elevation(tile_pos);globe_pos+=up_vector*height;
1767#ifndef GLOBE_POLES
1768globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z;
1769#endif
1770#ifdef GLOBE_POLES
1771vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0);
1772#else
1773vec4 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);
1774#endif
1775gl_Position=u_proj_matrix*interpolated_pos;
1776#ifdef FOG
1777v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz);
1778#endif
1779}`),globeAtmosphere:Ct(`#include "_prelude_fog.fragment.glsl"
1780uniform 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;
1781#ifdef PROJECTION_GLOBE_VIEW
1782globe_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) {
1783#ifdef ALPHA_PASS
1784glFragColor=vec4(0,0,0,0);return;
1785#else
1786#ifdef NATIVE
1787glFragColor=vec4(1,1,1,1);
1788#else
1789glFragColor=vec4(0,0,0,1);
1790#endif
1791return;
1792#endif
1793}
1794#endif
1795highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ?
17960.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle;
1797#ifdef PROJECTION_GLOBE_VIEW
1798highp 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 ?
1799PI-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);
1800#else
1801horizon_angle=horizon_angle_mercator;
1802#endif
1803horizon_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;
1803vec3 color_stop_2=u_space_color.rgb;
1804#ifdef ALPHA_PASS
1805float 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);
1806#else
1807vec3 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;
1808#ifndef NATIVE
1809c=dither(c,gl_FragCoord.xy+u_temporal_offset);
1810#endif
1811glFragColor=vec4(c*t,t);
1812#endif
1813}`,`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(
1814mix(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(
1815mix(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:Ct(`#include "_prelude_fog.fragment.glsl"
1816#include "_prelude_shadow.fragment.glsl"
1817#include "_prelude_lighting.glsl"
1818uniform 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;
1819#ifdef RENDER_SHADOWS
1820in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1;in float v_depth_shadows;
1821#endif
1822#ifdef OCCLUSION_TEXTURE_TRANSFORM
1823uniform vec4 u_occlusionTextureTransform;
1824#endif
1825#pragma mapbox: define-attribute highp vec3 normal_3f
1826#pragma mapbox: define-attribute highp vec3 color_3f
1827#pragma mapbox: define-attribute highp vec4 color_4f
1828#pragma mapbox: define-attribute highp vec2 uv_2f
1829#pragma mapbox: initialize-attribute highp vec3 normal_3f
1830#pragma mapbox: initialize-attribute highp vec3 color_3f
1831#pragma mapbox: initialize-attribute highp vec4 color_4f
1832#pragma mapbox: initialize-attribute highp vec2 uv_2f
1833#ifdef HAS_ATTRIBUTE_a_pbr
1834in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params;
1835#endif
1836#ifdef HAS_TEXTURE_u_baseColorTexture
1837uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff;
1838#endif
1839#ifdef HAS_TEXTURE_u_metallicRoughnessTexture
1840uniform sampler2D u_metallicRoughnessTexture;
1841#endif
1842#ifdef HAS_TEXTURE_u_occlusionTexture
1843uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity;
1844#endif
1845#ifdef HAS_TEXTURE_u_normalTexture
1846uniform sampler2D u_normalTexture;
1847#endif
1848#ifdef HAS_TEXTURE_u_emissionTexture
1849uniform sampler2D u_emissionTexture;
1850#endif
1851#ifdef APPLY_LUT_ON_GPU
1852uniform highp sampler3D u_lutTexture;
1853#endif
1854#ifdef TERRAIN_FRAGMENT_OCCLUSION
1855in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform vec2 u_inv_depth_size;uniform vec2 u_depth_range_unpack;
1856#ifdef TERRAIN_DEPTH_D24
1857float unpack_depth(float depth) {return  depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}
1858#else
1859highp float unpack_depth_rgba(highp vec4 rgba_depth)
1860{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;}
1861#endif
1862bool isOccluded() {vec2 coord=gl_FragCoord.xy*u_inv_depth_size;
1863#ifdef TERRAIN_DEPTH_D24
1864highp float depth=unpack_depth(texture(u_depthTexture,coord).r);
1865#else
1866highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord));
1867#endif
1868return v_depth > depth+0.0005;}
1869#endif
1870#define saturate(_x) clamp(_x,0.,1.)
1871vec3 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)
1872{
1873#ifdef LIGHTING_3D_MODE
1874vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor;
1875#ifdef RENDER_SHADOWS
1876lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
1877#else
1878lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir));
1879#endif
1880return apply_lighting(albedo,transformed_normal,lighting_factor);
1881#else
1882vec3 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
1882Color),vec3(1.0));return c3;
1883#endif
1884}vec4 getBaseColor() {vec4 albedo=u_baseColorFactor;
1885#ifdef HAS_ATTRIBUTE_a_color_3f
1886albedo*=vec4(color_3f,1.0);
1887#endif
1888#ifdef HAS_ATTRIBUTE_a_pbr
1889#else
1890#ifdef HAS_ATTRIBUTE_a_color_4f
1891albedo*=color_4f;
1892#endif
1893#endif
1894#if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f)
1895vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}}
1896#ifdef UNPREMULT_TEXTURE_IN_SHADER
1897if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0;
1898#endif
1899if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;}
1900#endif
1901vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a);
1902#ifdef APPLY_LUT_ON_GPU
1903color=applyLUT(u_lutTexture,color);
1904#endif
1905return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) {
1906#ifdef HAS_TEXTURE_u_normalTexture
1907highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y;highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res;
1908#else
1909return mat3(1.0);
1910#endif
1911}highp vec3 getNormal(){highp vec3 n;
1912#ifdef HAS_ATTRIBUTE_a_normal_3f
1913n=normalize(normal_3f);
1914#else
1915highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z));n=normalize(cross(fdx,fdy))*-1.0;
1916#endif
1917#if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
1918vec3 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);
1919#endif
1920return 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;
1921#ifdef HAS_ATTRIBUTE_a_pbr
1922mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w;
1923#endif
1924#if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) 
1925vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b;
1926#endif
1927const 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)
1928{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)
1929{return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH)
1930{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)
1931{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)
1932{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)
1933{
1934#ifdef LIGHTING_3D_MODE
1935return mat.diffuseColor;
1936#else
1937return mat.diffuseColor/PI;
1938#endif
1939}vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV)
1940{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)
1941{vec3 env_light=vec3(0.65,0.65,0.65);
1942#ifdef LIGHTING_3D_MODE
1943float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor;
1944#endif
1945vec3 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)
1946{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;
1947#ifdef RENDER_SHADOWS
1948lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows);
1949#else
1950lighting_factor=NdotL;
1951#endif
1952vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*light
1952Color;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0;
1953#if !defined(LIGHTING_3D_MODE)
1954const 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);
1955#endif
1956color*=intensityFactor;return color;}void main() {
1957#ifdef TERRAIN_FRAGMENT_OCCLUSION
1958if (isOccluded()) {discard;}
1959#endif
1960vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor;
1961#ifdef LIGHTING_3D_MODE
1962lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color;
1963#endif
1964vec4 finalColor;
1965#ifdef DIFFUSE_SHADED
1966vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor);
1967#ifdef HAS_TEXTURE_u_occlusionTexture
1968float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao;
1969#endif
1970finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity;
1971#else
1972Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0;
1973#if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
1974#ifdef OCCLUSION_TEXTURE_TRANSFORM
1975vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy;
1976#else
1977vec2 uv=uv_2f;
1978#endif
1979ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao;
1980#endif
1981vec4 emissive=u_emissiveFactor;
1982#if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f)
1983emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb);
1984#endif
1985#ifdef APPLY_LUT_ON_GPU
1986float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength;
1987#endif
1988color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity;
1989#ifdef HAS_ATTRIBUTE_a_pbr
1990float 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;
1991#ifdef APPLY_LUT_ON_GPU
1992color_mix=applyLUT(u_lutTexture,color_mix);
1993#endif
1994color=mix(color,color_mix,min(1.0,resEmission));
1995#ifdef HAS_ATTRIBUTE_a_color_4f
1996float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.
1996y));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);
1997#endif
1998#endif
1999vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity);
2000#endif
2001#ifdef FOG
2002finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w));
2003#endif
2004#ifdef RENDER_CUTOFF
2005finalColor*=v_cutoff_opacity;
2006#endif
2007#ifdef INDICATOR_CUTOUT
2008finalColor=applyCutout(finalColor);
2009#endif
2010glFragColor=finalColor;
2011#ifdef OVERDRAW_INSPECTOR
2012glFragColor=vec4(1.0);
2013#endif
2014HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl"
2015#include "_prelude_shadow.vertex.glsl"
2016in vec3 a_pos_3f;
2017#pragma mapbox: define-attribute highp vec3 normal_3f
2018#pragma mapbox: define-attribute highp vec2 uv_2f
2019#pragma mapbox: define-attribute highp vec3 color_3f
2020#pragma mapbox: define-attribute highp vec4 color_4f
2021#pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr
2022#pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength
2023uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix;
2024#ifdef INSTANCED_ARRAYS
2025in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2026#else
2027uniform highp mat4 u_normal_matrix;
2028#endif
2029#ifdef RENDER_SHADOWS
2030uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1;out float v_depth_shadows;
2031#endif
2032out vec4 v_position_height;out lowp vec4 v_color_mix;
2033#ifdef TERRAIN_FRAGMENT_OCCLUSION
2034out highp float v_depth;
2035#endif
2036#ifdef HAS_ATTRIBUTE_a_pbr
2037out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params;
2038#endif
2039vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() {
2040#pragma mapbox: initialize-attribute highp vec3 normal_3f
2041#pragma mapbox: initialize-attribute highp vec2 uv_2f
2042#pragma mapbox: initialize-attribute highp vec3 color_3f
2043#pragma mapbox: initialize-attribute highp vec4 color_4f
2044#pragma mapbox: initialize-attribute-custom highp vec4 pbr
2045#pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength
2046highp mat4 normal_matrix;
2047#ifdef INSTANCED_ARRAYS
2048normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2049#else
2050normal_matrix=u_normal_matrix;
2051#endif
2052vec3 local_pos;mat3 rs;
2053#ifdef MODEL_POSITION_ON_GPU
2054vec3 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;
2055#else
2056local_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);
2057#endif
2058v_position_height.w=a_pos_3f.z;
2059#ifdef HAS_ATTRIBUTE_a_pbr
2060vec4 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;
2061#endif
2062#ifdef FOG
2063v_fog_pos=fog_position(local_pos);
2064#endif
2065#ifdef RENDER_CUTOFF
2066v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z);
2067#endif
2068#ifdef TERRAIN_FRAGMENT_OCCLUSION
2069v_depth=gl_Position.z/gl_Position.w;
2070#endif
2071#ifdef HAS_ATTRIBUTE_a_normal_3f
2072#ifdef MODEL_POSITION_ON_GPU
2073float 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);
2074#else
2075normal_3f=vec3(normal_matrix*vec4(normal_3f,0));
2076#endif
2077#endif
2078#ifdef HAS_ATTRIBUTE_a_pbr
2079#ifdef HAS_ATTRIBUTE_a_color_4f
2080v_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);
2081#endif
2082#endif
2083#ifdef RENDER_SHADOWS
2084vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0);
2085#ifdef NORMAL_OFFSET
2086#ifdef HAS_ATTRIBUTE_a_normal_3f
2087#ifdef MODEL_POSITION_ON_GPU
2088vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2089#else
2090vec3 offset=shadow_normal_offset_model(normalize(normal_3f));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0();
2091#endif
2092#endif
2093#endif
2094v_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;
2095#endif
2096}`),modelDepth:Ct(`in highp float v_depth;void main() {
2097#ifndef DEPTH_TEXTURE
2098glFragColor=pack_depth(v_depth);
2099#endif
2100}`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;
2101#ifdef MODEL_POSITION_ON_GPU
2102#ifdef INSTANCED_ARRAYS
2103in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3;
2104#else
2105uniform highp mat4 u_instance;
2106#endif
2107uniform highp mat4 u_node_matrix;
2108#endif
2109void main() {
2110#ifdef MODEL_POSITION_ON_GPU
2111highp mat4 instance;
2112#ifdef INSTANCED_ARRAYS
2113instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3);
2114#else
2115instance=u_instance;
2116#endif
2117vec3 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;
2117rs[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);
2118#else
2119gl_Position=u_matrix*vec4(a_pos_3f,1);
2120#endif
2121v_depth=gl_Position.z/gl_Position.w;}`),stars:Ct(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv)
2122{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;}`,`
2123in 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);}`),occlusion:Ct("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl"
2124in 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;
2125#ifdef TERRAIN
2126float e=elevation(world_pos.xy);world_pos.z+=e;
2127#endif
2128vec4 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 Zo(u,r){const a=u.replace(/\s*\/\/[^\n]*\n/g,`
2129`).split(`
2130`);for(let h of a)if(h=h.trim(),h[0]==="#"&&h.includes("if")&&!h.includes("endif")){h=h.replace("#","").replace(/ifdef|ifndef|elif|if/g,"").replace(/!|defined|\(|\)|\|\||&&/g,"").replace(/\s+/g," ").trim();const f=h.split(" ");for(const m of f)r.includes(m)||r.push(m)}}function Ct(u,r){const a=/#include\s+"([^"]+)"/g,h=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g;let f=r.match(/(attribute(\S*)|(^\s*|;)in) (highp |mediump |lowp )?([\w]+) ([\w]+)/gm);f&&(f=f.map(T=>{const M=T.split(" ");return M[M.length-1]}),f=[...new Set(f)]);const m={},g=[],x=[];if(u=u.replace(a,(T,M)=>(x.push(M),"")),(r=r.replace(a,(T,M)=>(g.push(M),""))).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 w=[...qo];Zo(u,w),Zo(r,w);for(const T of[...g,...x])sl[T]||console.error(`Undefined include: ${T}`),al[T]||(al[T]=[],Zo(sl[T],al[T])),w=[...w,...al[T]];return{fragmentSource:u=u.replace(h,(T,M,A,P,z)=>(m[z]=!0,M==="define"?`
2131#ifndef HAS_UNIFORM_u_${z}
2132in ${A} ${P} ${z};
2133#else
2134uniform ${A} ${P} u_${z};
2135#endif
2136`:M==="initialize"?`
2137#ifdef HAS_UNIFORM_u_${z}
2138    ${A} ${P} ${z} = u_${z};
2139#endif
2140`:M==="define-attribute"?`
2141#ifdef HAS_ATTRIBUTE_a_${z}
2142    in ${A} ${P} ${z};
2143#endif
2144`:M==="initialize-attribute"?"":void 0)),vertexSource:r=r.replace(h,(T,M,A,P,z)=>{const R=P==="float"?"vec2":P,k=z.match(/color/)?"color":R;return M==="define-attribute-vertex-shader-only"?`
2145#ifdef HAS_ATTRIBUTE_a_${z}
2146in ${A} ${P} a_${z};
2147#endif
2148`:m[z]?M==="define"?`
2149#ifndef HAS_UNIFORM_u_${z}
2150uniform lowp float u_${z}_t;
2151in ${A} ${R} a_${z};
2152out ${A} ${P} ${z};
2153#else
2154uniform ${A} ${P} u_${z};
2155#endif
2156`:M==="initialize"?k==="vec4"?`
2157#ifndef HAS_UNIFORM_u_${z}
2158    ${z} = a_${z};
2159#else
2160    ${A} ${P} ${z} = u_${z};
2161#endif
2162`:`
2163#ifndef HAS_UNIFORM_u_${z}
2164    ${z} = unpack_mix_${k}(a_${z}, u_${z}_t);
2165#else
2166    ${A} ${P} ${z} = u_${z};
2167#endif
2168`:M==="define-attribute"?`
2169#ifdef HAS_ATTRIBUTE_a_${z}
2170    in ${A} ${P} a_${z};
2171    out ${A} ${P} ${z};
2172#endif
2173`:M==="initialize-attribute"?`
2174#ifdef HAS_ATTRIBUTE_a_${z}
2175    ${z} = a_${z};
2176#endif
2177`:void 0:M==="define"?`
2178#ifndef HAS_UNIFORM_u_${z}
2179uniform lowp float u_${z}_t;
2180in ${A} ${R} a_${z};
2181#else
2182uniform ${A} ${P} u_${z};
2183#endif
2184`:M==="define-instanced"?k==="mat4"?`
2185#ifdef INSTANCED_ARRAYS
2186in vec4 a_${z}0;
2187in vec4 a_${z}1;
2188in vec4 a_${z}2;
2189in vec4 a_${z}3;
2190#else
2191uniform ${A} ${P} u_${z};
2192#endif
2193`:`
2194#ifdef INSTANCED_ARRAYS
2195in ${A} ${R} a_${z};
2196#else
2197uniform ${A} ${P} u_${z};
2198#endif
2199`:M==="initialize-attribute-custom"?`
2200#ifdef HAS_ATTRIBUTE_a_${z}
2201    ${A} ${P} ${z} = a_${z};
2202#endif
2203`:k==="vec4"?`
2204#ifndef HAS_UNIFORM_u_${z}
2205    ${A} ${P} ${z} = a_${z};
2206#else
2207    ${A} ${P} ${z} = u_${z};
2208#endif
2209`:`
2210#ifndef HAS_UNIFORM_u_${z}
2211    ${A} ${P} ${z} = unpack_mix_${k}(a_${z}, u_${z}_t);
2212#else
2213    ${A} ${P} ${z} = u_${z};
2214#endif
2215`}),staticAttributes:f,usedDefines:w,vertexIncludes:g,fragmentIncludes:x}}class zp{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(r,a,h,f,m,g,x,w){this.context=r;let T=this.boundPaintVertexBuffers.length!==f.length;for(let A=0;!T&&A<f.length;A++)this.boundPaintVertexBuffers[A]!==f[A]&&(T=!0);let M=this.boundDynamicVertexBuffers.length!==x.length;for(let A=0;!M&&A<x.length;A++)this.boundDynamicVertexBuffers[A]!==x[A]&&(M=!0);if(!this.vao||this.boundProgram!==a||this.boundLayoutVertexBuffer!==h||T||M||this.boundIndexBuffer!==m||this.boundVertexOffset!==g)this.freshBind(a,h,f,m,g,x,w);else{r.bindVertexArrayOES.set(this.vao);for(const A of x)A&&(A.bind(),w&&A.instanceCount&&A.setVertexAttribDivisor(r.gl,a,w));m&&m.dynamicDraw&&m.bind()}}freshBind(r,a,h,f,m,g,x){const w=r.numAttributes,T=this.context,M=T.gl;this.vao&&this.destroy(),this.vao=T.gl.createVertexArray(),T.bindVertexArrayOES.set(this.vao),this.boundProgram=r,this.boundLayoutVertexBuffer=a,this.boundPaintVertexBuffers=h,this.boundIndexBuffer=f,this.boundVertexOffset=m,this.boundDynamicVertexBuffers=g,a.enableAttributes(M,r),a.bind(),a.setVertexAttribPointers(M,r,m);for(const A of h)A.enableAttributes(M,r),A.bind(),A.setVertexAttribPointers(M,r,m);for(const A of g)A&&(A.enableAttributes(M,r),A.bind(),A.setVertexAttribPointers(M,r,m),x&&A.instanceCount&&A.setVertexAttribDivisor(M,r,x));f&&f.bind(),T.currentNumAttributes=w}destroy(){this.vao&&(this.context.gl.deleteVertexArray(this.vao),this.vao=null)}}function Dp(u,r){const a=Math.pow(2,r.canonical.z),h=r.canonical.y;return[new s.Y(0,h/a).toLngLat().lat,new s.Y(0,(h+1)/a).toLngLat().lat]}function Lp(u,r,a,h,f,m,g){const x=u.context,w=x.gl,T=a.hillshadeFBO;if(!T)return;u.prepareDrawTile();const M=u.isTileAffectedByFog(r),A=u.getOrCreateProgram("hillshade",{overrideFog:M});x.activeTexture.set(w.TEXTURE0),w.bindTexture(w.TEXTURE_2D,T.colorAttachment.get());const P=((O,B,G,q)=>{const Z=G.paint.get("hillshade-shadow-color"),K=G.paint.get("hillshade-highlight-color"),Y=G.paint.get("hillshade-accent-color"),te=G.paint.get("hillshade-emissive-strength");let N=s.ab(G.paint.get("hillshade-illumination-direction"));if(G.paint.get("hillshade-illumination-anchor")==="viewport")N-=O.transform.angle;else if(O.style&&O.style.enable3dLights()&&O.style.directionalLight){const re=O.style.directionalLight.properties.get("direction"),de=s.ac(re.x,re.y,re.z);N=s.ab(de[1])}const $=!O.options.moving;return{u_matrix:q||O.transform.calculateProjMatrix(B.tileID.toUnwrapped(),$),u_image:0,u_latrange:Dp(0,B.tileID),u_light:[G.paint.get("hillshade-exaggeration"),N],u_shadow:Z.toRenderColor(G.lut),u_highlight:K.toRenderColor(G.lut),u_emissive_strength:te,u_accent:Y.toRenderColor(G.lut)}})(u,a,h,u.terrain?r.projMatrix:null);u.uploadCommonUniforms(x,A,r.toUnwrapped());const{tileBoundsBuffer:z,tileBoundsIndexBuffer:R,tileBoundsSegments:k}=u.getTileBoundsBuffers(a);A.draw(u,w.TRIANGLES,f,m,g,s.af.disabled,P,h.id,z,R,k)}function Dc(u,r,a){if(!r.needsDEMTextureUpload)return;
2215const h=u.context,f=h.gl;h.pixelStoreUnpackPremultiplyAlpha.set(!1),r.demTexture=r.demTexture||u.getTileTexture(a.stride);const m=a.getPixels();r.demTexture?r.demTexture.update(m,{premultiply:!1}):r.demTexture=new s.T(h,m,f.R32F,{premultiply:!1}),r.needsDEMTextureUpload=!1}function Wr(u,r,a){const h=u.context,f=h.gl;if(!r.dem)return;const m=r.dem;if(h.activeTexture.set(f.TEXTURE1),Dc(u,r,m),!r.demTexture)return;r.demTexture.bind(f.NEAREST,f.CLAMP_TO_EDGE);const g=m.dim;h.activeTexture.set(f.TEXTURE0);let x=r.hillshadeFBO;if(!x){const P=new s.T(h,{width:g,height:g,data:null},f.RGBA);P.bind(f.LINEAR,f.CLAMP_TO_EDGE),x=r.hillshadeFBO=h.createFramebuffer(g,g,!0,"renderbuffer"),x.colorAttachment.set(P.texture)}h.bindFramebuffer.set(x.framebuffer),h.viewport.set([0,0,g,g]);const{tileBoundsBuffer:w,tileBoundsIndexBuffer:T,tileBoundsSegments:M}=u.getMercatorTileBoundsBuffers(),A=[];u.linearFloatFilteringSupported()&&A.push("TERRAIN_DEM_FLOAT_FORMAT"),u.getOrCreateProgram("hillshadePrepare",{defines:A}).draw(u,f.TRIANGLES,s.ae.disabled,s.ag.disabled,s.a.unblended,s.af.disabled,((P,z)=>{const R=z.stride,k=s.ad.create();return s.ad.ortho(k,0,s.a3,-s.a3,0,0,1),s.ad.translate(k,k,[0,-s.a3,0]),{u_matrix:k,u_image:1,u_dimension:[R,R],u_zoom:P.overscaledZ}})(r.tileID,m),a.id,w,T,M),r.needsHillshadePrepare=!1}function Lc(u,r,a,h,f){const m=function(g,x){if(g)return f(g);if(x){if(u.url&&x.tiles&&u.tiles&&delete u.tiles,x.variants){if(!Array.isArray(x.variants))return f(new Error("variants must be an array"));for(const T of x.variants){if(T==null||typeof T!="object"||T.constructor!==Object)return f(new Error("variant must be an object"));if(!Array.isArray(T.capabilities))return f(new Error("capabilities must be an array"));if(T.capabilities.length===1&&T.capabilities[0]==="meshopt"){x=s.W(x,T);break}}}const w=s.ah(s.W(x,u),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","scheme","tileSize","encoding"]);x.vector_layers&&(w.vectorLayers=x.vector_layers,w.vectorLayerIds=w.vectorLayers.map(T=>T.id)),x.raster_layers&&(w.rasterLayers=x.raster_layers,w.rasterLayerIds=w.rasterLayers.map(T=>T.id)),w.tiles=r.canonicalizeTileset(w,u.url),f(null,w)}};return u.url?s.g(r.transformRequest(r.normalizeSourceURL(u.url,null,a,h),s.R.Source),m):s.e.frame(()=>m(null,u))}class Ys{constructor(r,a,h){this.bounds=s.ai.convert(this.validateBounds(r)),this.minzoom=a||0,this.maxzoom=h||24}validateBounds(r){return Array.isArray(r)&&r.length===4?[Math.max(-180,r[0]),Math.max(-90,r[1]),Math.min(180,r[2]),Math.min(90,r[3])]:[-180,-90,180,90]}contains(r){const a=Math.pow(2,r.z),h=Math.floor(s.aj(this.bounds.getWest())*a),f=Math.floor(s.ak(this.bounds.getNorth())*a),m=Math.ceil(s.aj(this.bounds.getEast())*a),g=Math.ceil(s.ak(this.bounds.getSouth())*a);return r.x>=h&&r.x<m&&r.y>=f&&r.y<g}}class Ks extends s.E{constructor(r,a,h,f){super(),this.id=r,this.dispatcher=h,this.setEventedParent(f),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=s.W({type:"raster"},a),s.W(this,s.ah(a,["url","scheme","tileSize"]))}load(r){this._loaded=!1,this.fire(new s.f("dataloading",{dataType:"source"})),this._tileJSONRequest=Lc(this._options,this.map._requestManager,null,null,(a,h)=>{this._tileJSONRequest=null,this._loaded=!0,a?this.fire(new s.d(a)):h&&(s.W(this,h),h.bounds&&(this.tileBounds=new Ys(h.bounds,this.minzoom,this.maxzoom)),s.an(h.tiles),this.fire(new s.f("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.f("data",{dataType:"source",sourceDataType:"content"}))),r&&r(a)})}loaded(){return this._loaded}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=s.al(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(r){this.cancelTileJSONRequest()}serialize(){return s.W({},this._options)}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}loadTile(r,a){const h=s.e.devicePixelRatio>=2,f=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),h,this.tileSize);r.request=s.h(this.map._requestManager.transformRequest(f,s.R.Tile),(m,g,x,w)=>(delete r.request,r.aborted?(r.state="unloaded",a(null)):m?(r.state="errored",a(m)):g?(this.map._refreshExpiredTiles&&r.setExpiryData({cac
2215heControl:x,expires:w}),r.setTexture(g,this.map.painter),r.state="loaded",s.am(this.dispatcher),void a(null)):a(null)))}abortTile(r,a){r.request&&(r.request.cancel(),delete r.request),a&&a()}unloadTile(r,a){r.texture&&r.texture instanceof s.T?(r.destroy(!0),r.texture&&r.texture instanceof s.T&&this.map.painter.saveTileTexture(r.texture)):r.destroy(),a&&a()}hasTransition(){return!1}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class ll extends s.E{constructor(r,a,h,f){if(super(),this.id=r,this.dispatcher=h,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.W(this,s.ah(a,["url","scheme","tileSize","promoteId"])),this._options=s.W({type:"vector"},a),this._collectResourceTiming=!!a.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(f),this._tileWorkers={},this._deduped=new s.ao}load(r){this._loaded=!1,this.fire(new s.f("dataloading",{dataType:"source"}));const a=Array.isArray(this.map._language)?this.map._language.join():this.map._language,h=this.map._worldview;this._tileJSONRequest=Lc(this._options,this.map._requestManager,a,h,(f,m)=>{this._tileJSONRequest=null,this._loaded=!0,f?(a&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${a}`),h&&h.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${h}`),this.fire(new s.d(f))):m&&(s.W(this,m),m.bounds&&(this.tileBounds=new Ys(m.bounds,this.minzoom,this.maxzoom)),s.an(m.tiles,this.map._requestManager._customAccessToken),this.fire(new s.f("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.f("data",{dataType:"source",sourceDataType:"content"}))),r&&r(f)})}loaded(){return this._loaded}hasTile(r){return!this.tileBounds||this.tileBounds.contains(r.canonical)}onAdd(r){this.map=r,this.load()}reload(){this.cancelTileJSONRequest();const r=s.al(this.id,this.scope);this.load(()=>this.map.style.clearSource(r))}setTiles(r){return this._options.tiles=r,this.reload(),this}setUrl(r){return this.url=r,this._options.url=r,this.reload(),this}onRemove(r){this.cancelTileJSONRequest()}serialize(){return s.W({},this._options)}loadTile(r,a){const h=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme)),f=this.map._requestManager.transformRequest(h,s.R.Tile),m=this.map.style?this.map.style.getLut(this.scope):null,g={request:f,data:void 0,uid:r.uid,tileID:r.tileID,tileZoom:r.tileZoom,zoom:r.tileID.overscaledZ,lut:m?{image:m.image.clone()}:null,tileSize:this.tileSize*r.tileID.overscaleFactor(),type:this.t
2215ype,source:this.id,scope:this.scope,pixelRatio:s.e.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:r.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:r.isExtraShadowCaster,tessellationStep:this.map._tessellationStep};if(g.request.collectResourceTiming=this._collectResourceTiming,r.actor&&r.state!=="expired")r.state==="loading"?r.reloadCallback=a:r.request=r.actor.send("reloadTile",g,x.bind(this));else if(r.actor=this._tileWorkers[h]=this._tileWorkers[h]||this.dispatcher.getActor(),this.dispatcher.ready)r.request=r.actor.send("loadTile",g,x.bind(this),void 0,!0);else{const w=s.ap.call({deduped:this._deduped},g,(T,M)=>{T||!M?x.call(this,T):(g.data={cacheControl:M.cacheControl,expires:M.expires,rawData:M.rawData.slice(0)},r.actor&&r.actor.send("loadTile",g,x.bind(this),void 0,!0))},!0);r.request={cancel:w}}function x(w,T){return delete r.request,r.aborted?a(null):w&&w.status!==404?a(w):(T&&T.resourceTiming&&(r.resourceTiming=T.resourceTiming),this.map._refreshExpiredTiles&&T&&r.setExpiryData(T),r.loadVectorData(T,this.map.painter),s.am(this.dispatcher),a(null),void(r.reloadCallback&&(this.loadTile(r,r.reloadCallback),r.reloadCallback=null)))}}abortTile(r){r.request&&(r.request.cancel(),delete r.request),r.actor&&r.actor.send("abortTile",{uid:r.uid,type:this.t
2215ype,source:this.id,scope:this.scope})}unloadTile(r,a){r.actor&&r.actor.send("removeTile",{uid:r.uid,type:this.type,source:this.id,scope:this.scope}),r.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}const $o=(u,r,a)=>({u_matrix:u,u_image0:0,u_skirt_height:r,u_ground_shadow_factor:a}),Ge=(u,r,a,h,f,m,g,x,w,T,M,A,P,z,R,k)=>({u_proj_matrix:Float32Array.from(u),u_globe_matrix:r,u_normalize_matrix:Float32Array.from(h),u_merc_matrix:a,u_zoom_transition:f,u_merc_center:m,u_image0:0,u_frustum_tl:g,u_frustum_tr:x,u_frustum_br:w,u_frustum_bl:T,u_globe_pos:M,u_globe_radius:A,u_viewport:P,u_grid_matrix:k?Float32Array.from(k):new Float32Array(9),u_skirt_height:z,u_far_z_cutoff:R});class Rc{constructor(r=0,a=0,h=0,f=0){if(isNaN(r)||r<0||isNaN(a)||a<0||isNaN(h)||h<0||isNaN(f)||f<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=r,this.bottom=a,this.left=h,this.right=f}interpolate(r,a,h){return a.top!=null&&r.top!=null&&(this.top=s.a2(r.top,a.top,h)),a.bottom!=null&&r.bottom!=null&&(this.bottom=s.a2(r.bottom,a.bottom,h)),a.left!=null&&r.left!=null&&(this.left=s.a2(r.left,a.left,h)),a.right!=null&&r.right!=null&&(this.right=s.a2(r.right,a.right,h)),this}getCenter(r,a){const h=s.at((this.left+r-this.right)/2,0,r),f=s.at((this.top+a-this.bottom)/2,0,a);return new s.P(h,f)}equals(r){return this.top===r.top&&this.bottom===r.bottom&&this.left===r.left&&this.right===r.right}clone(){return new Rc(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function cl(u,r){const a=s.aw(u,3);s.ad.fromQuat(u,r),s.az(u,3,a)}function Pt(u,r){const a=s.av.identity([]);return s.av.rotateZ(a,a,-r),s.av.rotateX(a,a,-u),a}function Hi(u,r){const a=[u[0],u[1],0],h=[r[0],r[1],0];if(s._.length(a)>=1e-15){const g=s._.normalize([],a);s._.scale(h,g,s._.dot(h,g)),r[0]=h[0],r[1]=h[1]}const f=s._.cross([],r,u);if(s._.len(f)<1e-15)return null;const m=Math.atan2(-f[1],f[0]);return Pt(Math.atan2(Math.sqrt(u[0]*u[0]+u[1]*u[1]),-u[2]),m)}class Ih{constructor(r,a){this.position=r,this.orientation=a}get position(){return this._position}set position(r){if(r){const a=r instanceof s.Y?r:new s.Y(r[0],r[1],r[2]);
2215this._renderWorldCopies&&(a.x=s.au(a.x,0,1)),this._position=a}else this._position=null}lookAtPoint(r,a){if(this.orientation=null,!this.position)return;const h=this.position,f=this._elevation?this._elevation.getAtPointOrZero(s.Y.fromLngLat(r)):0,m=s.Y.fromLngLat(r,f),g=[m.x-h.x,m.y-h.y,m.z-h.z];a||(a=[0,0,1]),a[2]=Math.abs(a[2]),this.orientation=Hi(g,a)}setPitchBearing(r,a){this.orientation=Pt(s.ab(r),s.ab(-a))}}class Js{constructor(r,a){this._transform=s.ad.identity([]),this.orientation=a,this.position=r}get mercatorPosition(){const r=this.position;return new s.Y(r[0],r[1],r[2])}get position(){const r=s.aw(this._transform,3);return[r[0],r[1],r[2]]}set position(r){var a;r&&s.az(this._transform,3,[(a=r)[0],a[1],a[2],1])}get orientation(){return this._orientation}set orientation(r){this._orientation=r||s.av.identity([]),r&&cl(this._transform,this._orientation)}getPitchBearing(){const r=this.forward(),a=this.right();return{bearing:Math.atan2(-a[1],a[0]),pitch:Math.atan2(Math.sqrt(r[0]*r[0]+r[1]*r[1]),-r[2])}}setPitchBearing(r,a){this._orientation=Pt(r,a),cl(this._transform,this._orientation)}forward(){const r=s.aw(this._transform,2);return[-r[0],-r[1],-r[2]]}up(){const r=s.aw(this._transform,1);return[-r[0],-r[1],-r[2]]}right(){const r=s.aw(this._transform,0);return[r[0],r[1],r[2]]}getCameraToWorld(r,a){const h=new Float64Array(16);return s.ad.invert(h,this.getWorldToCamera(r,a)),h}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(r,a,h){const f=this.position;s._.scale(f,f,-r);const m=new Float64Array(16);return s.ad.fromScaling(m,[h,h,h]),s.ad.translate(m,m,f),m[10]*=a,m}getWorldToCamera(r,a){const h=new Float64Array(16),f=new Float64Array(4),m=this.position;return s.av.conjugate(f,this._orientation),s._.scale(m,m,-r),s.ad.fromQuat(h,f),s.ad.translate(h,h,m),h[1]*=-1,h[5]*=-1,h[9]*=-1,h[13]*=-1,h[8]*=a,h[9]*=a,h[10]*=a,h[11]*=a,h}getCameraToClipPerspective(r,a,h,f){const m=new Float64Array(16);return s.ad.perspective(m,r,a,h,f),m}getCameraToClipOrthographic(r,a,h,f,m,g){const x=new Float64Array(16);return s.ad.ortho(x,r,a,h,f,m,g),x}getDistanceToElevation(r,a=!1){const h=r===0?0:s.ax(r,a?s.ay(this.position[1]):this.position[1]),f=this.forward();return(h-this.position[2])/f[2]}clone(){return new Js([...this.position],[...this.orientation])}}const Jn={unknown:0,flipRequired:1,flipNotRequired:2},Rp=Math.tan(85*Math.PI/180);function ft(u,r,a,h,f,m,g){const x=s.ad.create();if(a)if(m.name==="globe"){const w=s.aB(f,r);s.ad.multiply(x,x,w)}else{const w=s.aC.invert([],g);x[0]=w[0],x[1]=w[1],x[4]=w[2],x[5]=w[3],h||s.ad.rotateZ(x,x,f.angle)}else s.ad.multiply(x,f.labelPlaneMatrix,u);return x}function Qs(u,r,a,h,f,m,g){const x=ft(u,r,a,h,f,m,g);return m.name==="globe"&&a||(x[2]=x[6]=x[10]=x[14]=0),x}function Qn(u,r,a,h,f,m,g){if(a){if(m.name==="globe"){const x=ft(u,r,a,h,f,m,g);return s.ad.invert(x,x),s.ad.multiply(x,u,x),x}{const x=s.ad.clone(u),w=s.ad.identity([]);return w[0]=g[0],w[1]=g[1],w[4]=g[2],w[5]=g[3],s.ad.multiply(x,x,w),h||s.ad.rotateZ(x,x,-f.angle),x}}return f.glCoordMatrix}function ir(u,r,a,h){const f=[u,r,a,1];a?s.aA.transformMat4(f,f,h):Fc(f,f,h);const m=f[3];return f[0]/=m,f[1]/=m,f[2]/=m,f}function kc(u,r){return Math.min(.5+u/r*.5,1.5)}function Xi(u,r){const a=u[0]/u[3],h=u[1]/u[3];return a>=-r[0]&&a<=r[0]&&h>=-r[1]&&h<=r[1]}function Ah(u,r,a,h,f,m,g,x,w,T){const M=a.transform,A=h?u.textSizeData:u.iconSizeData,P=s.aD(A,a.transform.zoom),z=M.projection.name==="globe",R=[256/a.width*2+1,256/a.height*2+1],k=h?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;k.clear();let O=null;z&&(O=h?u.text.globeExtVertexArray:u.icon.globeExtVertexArray);const B=u.lineVertexArray,G=h?u.text.placedSymbolArray:u.icon.placedSymbolArray,q=a.transform.width/a.transform.height;let Z,K=!1;for(let Y=0;Y<G.length;Y++){const te=G.get(Y),{numGlyphs:N,writingMode:$}=te;if($!==s.aE.vertical||K||Z===s.aE.horizontal||(K=!0),Z=$,(te.hidden||$===s.aE.vertical)&&!K){Pn(N,k);continue}K=!1;const re=new s.P(te.tileAnchorX,te.tileAnchorY);let{x:de,y:se,z:Q}=M.projection.projectTilePoint(re.x,re.y,T.canonical);if(w){const[qe,je,Be]=w(re);de+=qe,se+=je,Q+=Be}const fe=[de,se,Q,1];if(s.aA.transformMat4(fe,fe,r),!Xi(fe,R)){Pn(N,k);continue}const Me=fe[3],Ie=kc(a.transform.getCameraToCenterDistance(M.projection),Me),Se=s.aF(A,P,te),le=g?Se/Ie:Se*Ie,_e=ir(de,se,Q,f);if(_e[3]<=0){Pn(N,k);continue}let we={};const Ve=g?null:w,Ue=Oc(te,le,!1,x,r,f,m,u.glyphOffsetArray,B,k,O,_e,re,we,q,Ve,M.projection,T,g);K=Ue.useVertical,Ve&&Ue.needsFlipping&&(we={}),(Ue.notEnoughRoom||K||Ue.needsFlipping&&Oc(te,le,!0,x,r,f,m,u.glyphOffsetArray,B,k,O,_e,re,we,q,Ve,M.projection,T,g).notEnoughRoom)&&Pn(N,k)}h?(u.text.dynamicLayoutVertexBuffer.updateData(k),O&&u.text.globeExtVertexBuffer&&u.text.globeExtVertexBuffer.updateData(O)):(u.icon.dynamicLayoutVertexBuffer.updateData(k),O&&u.icon.globeExtVertexBuffer&&u.icon.globeExtVertexBuffer.updateData(O))}function ul(u,r,a,h,f,m,g,x,w,T,M,A,P,z,R,k){const{lineStartIndex:O,glyphStartIndex:B,segment:G}=x,q=B+x.numGlyphs,Z=O+x.lineLength,K=r.getoffsetX(B),Y=r.getoffsetX(q-1),te=eo(u*K,a,h,f,m,g,G,O,Z,w,T,M,A,P,!0,z,R,k);if(!te)return null;const N=eo(u*Y,a,h,f,m,g,G,O,Z,w,T,M,A,P,!0,z,R,k);return N?{first:te,last:N}:null}function hl(u,r,a,h){return u===s.aE.horizontal&&Math.abs(h)>Math.abs(a)?{useVertical:!0}:u===s.aE.vertical?h>0?{needsFlipping:!0}:null:r!==Jn.unknown&&function(f,m){return f===0||Math.abs(m/f)>Rp}(a,h)?r===Jn.flipRequired?{needsFlipping:!0}:null:a<0?{needsFlipping:!0}:null}function Oc(u,r,a,h,f,m,g,x,w,T,M,A,P,z,R,k,O,B,G){const q=r/24,Z=u.lineOffsetX*q,K=u.lineOffsetY*q,{lineStartIndex:Y,glyphStartIndex:te,numGlyphs:N,segment:$,writingMode:re,flipState:de}=u,se=Y+u.lineLength,Q=fe=>
2215{if(M){const[le,_e,we]=fe.up,Ve=T.length;s.aG(M,Ve+0,le,_e,we),s.aG(M,Ve+1,le,_e,we),s.aG(M,Ve+2,le,_e,we),s.aG(M,Ve+3,le,_e,we)}const[Me,Ie,Se]=fe.point;s.aH(T,Me,Ie,Se,fe.angle)};if(N>1){const fe=ul(q,x,Z,K,a,A,P,u,w,m,z,k,!1,O,B,G);if(!fe)return{notEnoughRoom:!0};if(h&&!a){let[Me,Ie,Se]=fe.first.point,[le,_e,we]=fe.last.point;[Me,Ie]=ir(Me,Ie,Se,g),[le,_e]=ir(le,_e,we,g);const Ve=hl(re,de,(le-Me)*R,_e-Ie);if(u.flipState=Ve&&Ve.needsFlipping?Jn.flipRequired:Jn.flipNotRequired,Ve)return Ve}Q(fe.first);for(let Me=te+1;Me<te+N-1;Me++){const Ie=eo(q*x.getoffsetX(Me),Z,K,a,A,P,$,Y,se,w,m,z,k,!1,!1,O,B,G);if(!Ie)return T.length-=4*(Me-te),{notEnoughRoom:!0};Q(Ie)}Q(fe.last)}else{if(h&&!a){const Me=ir(P.x,P.y,0,f),Ie=Y+$+1,Se=new s.P(w.getx(Ie),w.gety(Ie)),le=ir(Se.x,Se.y,0,f),_e=le[3]>0?le:dl(P,Se,Me,1,f,void 0,O,B.canonical),we=hl(re,de,(_e[0]-Me[0])*R,_e[1]-Me[1]);if(u.flipState=we&&we.needsFlipping?Jn.flipRequired:Jn.flipNotRequired,we)return we}const fe=eo(q*x.getoffsetX(te),Z,K,a,A,P,$,Y,se,w,m,z,k,!1,!1,O,B,G);if(!fe)return{notEnoughRoom:!0};Q(fe)}return{}}function Bc(u,r,a,h,f){const{x:m,y:g,z:x}=h.projectTilePoint(u.x,u.y,r);if(!f)return ir(m,g,x,a);const[w,T,M]=f(u);return ir(m+w,g+T,x+M,a)}function dl(u,r,a,h,f,m,g,x){const w=Bc(u.sub(r)._unit()._add(u),x,f,g,m);return s._.sub(w,a,w),s._.normalize(w,w),s._.scaleAndAdd(w,a,w,h)}function eo(u,r,a,h,f,m,g,x,w,T,M,A,P,z,R,k,O,B){const G=h?u-r:u+r;let q=G>0?1:-1,Z=0;h&&(q*=-1,Z=Math.PI),q<0&&(Z+=Math.PI);let K=x+g+(q>0?0:1)|0,Y=f,te=f,N=0,$=0;const re=Math.abs(G),de=[],se=[];let Q=m,fe=Q;const Me=()=>dl(fe,Q,te,re-N+1,M,P,k,O.canonical);for(;N+$<=re;){if(K+=q,K<x||K>=w)return null;if(te=Y,fe=Q,de.push(te),z&&se.push(fe),Q=new s.P(T.getx(K),T.gety(K)),Y=A[K],!Y){const je=Bc(Q,O.canonical,M,k,P);Y=je[3]>0?A[K]=je:Me()}N+=$,$=s._.distance(te,Y)}R&&P&&(A[K]&&(Y=Me(),$=s._.distance(te,Y)),A[K]=Y);const Ie=(re-N)/$,Se=Q.sub(fe)._mult(Ie)._add(fe),le=s._.sub([],Y,te),_e=s._.scaleAndAdd([],te,le,Ie);let we=[0,0,1],Ve=le[0],Ue=le[1];if(B&&(we=k.upVector(O.canonical,Se.x,Se.y),we[0]!==0||we[1]!==0||we[2]!==1)){const je=[we[2],0,-we[0]],Be=s._.cross([],we,je);s._.normalize(je,je),s._.normalize(Be,Be),Ve=s._.dot(le,je),Ue=s._.dot(le,Be)}if(a){const je=s._.cross([],we,le);s._.normalize(je,je),s._.scaleAndAdd(_e,_e,je,a*q)}const qe=Z+Math.atan2(Ue,Ve);return de.push(_e),z&&se.push(Se),{point:_e,angle:qe,path:de,tilePath:se,up:we}}function Pn(u,r){const a=r.length,h=a+4*u;r.resize(h),r.float32.fill(-1/0,4*a,4*h)}function Fc(u,r,a){const h=r[0],f=r[1];return u[0]=a[0]*h+a[4]*f+a[12],u[1]=a[1]*h+a[5]*f+a[13],u[3]=a[3]*h+a[7]*f+a[15],u}const Hr=(u,r,a)=>(1-a)*u+a*r,Nc=u=>u*u*u*u*u;class vi{constructor(r,a,h,f,m,g,x){this.tileSize=512,this._renderWorldCopies=m===void 0||m,this._minZoom=r||0,this._maxZoom=a||22,this._minPitch=h??0,this._maxPitch=f??60,this.setProjection(g),this.setMaxBounds(x),this.width=0,this.height=0,this._center=new s.aI(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 Rc,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Js,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1}clone(){const r=new vi(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection());return r._elevation=this._elevation,r._centerAltitude=this._centerAltitude,r._centerAltitudeValidForE
2215xaggeration=this._centerAltitudeValidForExaggeration,r.tileSize=this.tileSize,r.mercatorFromTransition=this.mercatorFromTransition,r.width=this.width,r.height=this.height,r.cameraElevationReference=this.cameraElevationReference,r._center=this._center,r._setZoom(this.zoom),r._seaLevelZoom=this._seaLevelZoom,r.angle=this.angle,r._fov=this._fov,r._pitch=this._pitch,r._nearZ=this._nearZ,r._farZ=this._farZ,r._averageElevation=this._averageElevation,r._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,r._unmodified=this._unmodified,r._edgeInsets=this._edgeInsets.clone(),r._camera=this._camera.clone(),r._calcMatrices(),r.freezeTileCoverage=this.freezeTileCoverage,r.frustumCorners=this.frustumCorners,r}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch<15}get elevation(){return this._elevation}set elevation(r){this._elevation!==r&&(this._elevation=r,this._updateCameraOnTerrain(),this._calcMatrices())}get depthOcclusionForSymbolsAndCircles(){return this.projection.name!=="globe"&&!this.isOrthographic}updateElevation(r,a=!1){const h=this._elevation&&this._elevation.exaggeration()!==this._centerAltitudeValidForE
2215xaggeration;(this._seaLevelZoom==null||h)&&this._updateCameraOnTerrain(),(r||h)&&this._constrainCamera(a),this._calcMatrices()}getProjection(){return s.ah(this.projection,["name","center","parallels"])}setProjection(r){this.projectionOptions=r||{name:"mercator"};const a=this.projection?this.getProjection():void 0;this.projection=s.aJ(this.projectionOptions);const h=!xt(a,this.getProjection());return h&&this._calcMatrices(),this.mercatorFromTransition=!1,h}setOrthographicProjectionAtLowPitch(r){return this._orthographicProjectionAtLowPitch!==r&&(this._orthographicProjectionAtLowPitch=r,this._calcMatrices(),!0)}setMercatorFromTransition(){const r=this.projection.name;this.mercatorFromTransition=!0,this.projectionOptions={name:"mercator"},this.projection=s.aJ({name:"mercator"});const a=r!==this.projection.name;return a&&this._calcMatrices(),a}get minZoom(){return this._minZoom}set minZoom(r){this._minZoom!==r&&(this._minZoom=r,this.zoom=Math.max(this.zoom,r))}get maxZoom(){return this._maxZoom}set maxZoom(r){this._maxZoom!==r&&(this._maxZoom=r,this.zoom=Math.min(this.zoom,r))}get minPitch(){return this._minPitch}set minPitch(r){this._minPitch!==r&&(this._minPitch=r,this.pitch=Math.max(this.pitch,r))}get maxPitch(){return this._maxPitch}set maxPitch(r){this._maxPitch!==r&&(this._maxPitch=r,this.pitch=Math.min(this.pitch,r))}get renderWorldCopies(){return this._renderWorldCopies&&this.projection.supportsWorldCopies===!0}set renderWorldCopies(r){r===void 0?r=!0:r===null&&(r=!1),this._renderWorldCopies=r}get worldSize(){return this.tileSize*this.scale}get cameraWorldSizeForFog(){const r=Math.max(this._camera.getDistanceToElevation(this._averageElevation),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(r))}get cameraWorldSize(){const r=Math.max(this._camera.getDistanceToElevation(this._averageElevation,!0),Number.EPSILON);return this._worldSizeFromZoom(this._zoomFromMercatorZ(r))}get pixelsPerMeter(){return this.projection.pixelsPerMeter(this.center.lat,this.worldSize)}get cameraPixelsPerMeter(){return s.ax(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.au(this.rotation,-180,180)}set bearing(r){this.rotation=r}get rotation(){return-this.angle/Math.PI*180}set rotation(r){const a=-r*Math.PI/180;this.angle!==a&&(this._unmodified=!1,this.angle=a,this._calcMatrices(),this.rotationMatrix=s.aC.create(),s.aC.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(r){const a=s.at(r,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==a&&(this._unmodified=!1,this._pitch=a,this._calcMatrices())}get aspect(){return this.width/this.height}get fov(){return this._fov/Math.PI*180}get fovX(){return this._fov}get fovY(){const r=1/Math.tan(.5*this.fovX);return 2*Math.atan(1/this.aspect/r)}set fov(r){r=Math.max(.01,Math.min(60,r)),this._fov!==r&&(this._unmodified=!1,this._fov=s.ab(r),this._calcMatrices())}get averageElevation(){return this._averageElevation}set averageElevation(r){this._averageElevation=r,this._calcFogMatrices(),this._distanceTileDataCache={}}get zoom(){return this._zoom}set zoom(r){const a=Math.min(Math.max(r,this.minZoom),this.maxZoom);this._zoom!==a&&(this._unmodified=!1,this._setZoom(a),this._updateSeaLevelZoom(),this._constrain(),this._calcMatrices())}_setZoom(r){this._zoom=r,this.scale=this.zoomScale(r),this.tileZoom=Math.floor(r),this.zoomFraction=r-this.tileZoom}get tileCoverLift(){return this._tileCoverLift}set tileCoverLift(r){this._tileCoverLift!==r&&(this._tileCoverLift=r)}_updateCameraOnTerrain(){const r=this.elevation?this.elevation.getAtPoint(this.locationCoordinate(this.center),Number.NEGATIVE_INFINITY):Number.NEGATIVE_INFINITY,a=this.elevation&&r===Number.NEGATIVE_INFINITY&&this.elevation.visibleDemTiles.length>0&&this.elevation.exaggeration()>
22150&&this._centerAltitudeValidForExaggeration;if(!this._elevation||r===Number.NEGATIVE_INFINITY&&(!a||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const h=this._elevation;a||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&h.exaggeration()&&this._centerAltitudeValidForExaggeration!==h.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*h.exaggeration(),this._centerAltitudeValidForExaggeration=h.exaggeration()):(this._centerAltitude=r||0,this._centerAltitudeValidForExaggeration=h.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){this._centerAltitudeValidForExaggeration!==void 0&&(this._seaLevelZoom=this._zoomFromMercatorZ((this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize))}sampleAverageElevation(){if(!this._elevation)return 0;const r=this._elevation,a=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],h=this.horizonLineFromTop();let f=0,m=0;for(let g=0;g<a.length;g++){const x=new s.P(a[g][0]*this.width,h+a[g][1]*(this.height-h)),w=r.pointCoordinate(x);if(!w)continue;const T=1/Math.hypot(w[0]-this._camera.position[0],w[1]-this._camera.position[1]);f+=w[3]*T,m+=T}return m===0?NaN:f/m}get center(){return this._center}set center(r){r.lat===this._center.lat&&r.lng===this._center.lng||(this._unmodified=!1,this._center=r,this._terrainEnabled()&&(this.cameraElevationReference==="ground"?this._updateCameraOnTerrain():this._updateZoomFromElevation()),this._constrain(),this._calcMatrices())}_updateZoomFromElevation(){if(this._seaLevelZoom==null||!this._elevation)return;const r=this._seaLevelZoom,a=this._elevation.getAtPointOrZero(this.locationCoordinate(this.center)),h=this.pixelsPerMeter/this.worldSize*a,f=this._mercatorZfromZoom(r),m=this._mercatorZfromZoom(this._maxZoom),g=Math.max(f-h,m);this._setZoom(this._zoomFromMercatorZ(g))}get padding(){return this._edgeInsets.toJSON()}set padding(r){this._edgeInsets.equals(r)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,r,1),this._calcMatrices())}computeZoomRelativeTo(r){const a=this.rayIntersectionCoordinate(this.pointRayIntersection(this.centerPoint,r.toAltitude()));let h;h=r.z<this._camera.position[2]?[a.x,a.y,a.z]:[r.x,r.y,r.z];const f=s._.length(s._.sub([],this._camera.position,h));return s.at(this._zoomFromMercatorZ(f),this._minZoom,this._maxZoom)}setFreeCameraOptions(r){if(!this.height||!r.position&&!r.orientation)return;this._updateCameraState();let a=!1;if(r.orientation&&!s.av.exactEquals(r.orientation,this._camera.orientation)&&(a=this._setCameraOrientation(r.orientation)),r.position){const h=[r.position.x,r.position.y,r.position.z];s._.exactEquals(h,this._camera.position)||(this._setCameraPosition(h),a=!0)}a&&(this._updateStateFromCamera(),this.recenterOnTerrain())}getFreeCameraOptions(){this._updateCameraState();const r=this._camera.position,a=new Ih;return a.position=new s.Y(r[0],r[1],r[2]),a.orientation=this._camera.orientation,a._elevation=this.elevation,a._renderWorldCopies=this.renderWorldCopies,a}_setCameraOrientation(r){if(!s.av.length(r))return!1;s.av.normalize(r,r);const a=s._.transformQuat([],[0,0,-1],r),h=s._.transformQuat([],[0,-1,0],r);if(h[2]<0)return!1;const f=Hi(a,h);return!!f&&(this._camera.orientation=f,!0)}_setCameraPosition(r){const a=this.zoomScale(this.minZoom)*this.tileSize,h=this.zoomScale(this.maxZoom)*this.tileSize,f=this.cameraToCenterDistance;r[2]=s.at(r[2],f/h,f/a),this._camera.position=r}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}get fovAboveCenter(){return this._fov*(.5+this.centerOffset.y/this.height)}isPaddingEqual(r){return this._edgeInsets.equals(r)}interpolatePadding(r,a,h){this._unmodified=!1,this._edgeInsets.interpolate(r,a,h),this._constrain(),this._calcMatrices()}coveringZoomLevel(r){const a=(r.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/r.tileSize));return Math.max(0,a)}getVisibleUnwrappedCoordinates(r){const a=[new s.aK(0,r)];if(this.renderWorldCopies){const h=this.pointCoordinate(new s.P(0,0)),f=this.pointCoordinate(new s.P(this.width,0)),m=this.pointCoordinate(new s.P(this.width,this.height)),g=this.pointCoordinate(new s.P(0,this.height)),x=Math.floor(Math.min(h.x,f.x,m.x,g.x)),w=Math.floor(Math.max(h.x,f.x,m.x,g.x)),T=1;for(let M=x-T;M<=w+T;M++)M!==0&&a.push(new s.aK(M,r))}return a}isLODDisabled(r){return(!r||this.pitch<=60)&&this._edgeInsets.top<=this._edgeInsets.bottom&&!this._elevation&&!this.projection.isReprojectedInTileSpace}extendTileCoverForShadows(r,a,h){let f=[];if(a[0]===0&&a[1]===0)return f;for(const g of r){const x=g.canonical,w=g.overscaledZ,T=g.wrap,M=1<<x.z,A=x.x+1<M,P=x.x>0,z=x.y+1<M,R=x.y>0,k=g.wrap-(P?0:1),O=g.wrap+(A?0:1),B=P?x.x-1:M-1,G=A?x.x+1:0;a[0]<0?(f.push(new s.aL(w,O,x.z,G,x.y)),a[1]<0&&z&&(f.push(new s.aL(w,T,x.z,x.x,x.y+1)),f.push(new s.aL(w,O,x.z,G,x.y+1))),a[1]>0&&R&&(f.push(new s.aL(w,T,x.z,x.x,x.y-1)),f.push(new s.aL(w,O,x.z,G,x.y-1)))):a[0]>0?(f.push(new s.aL(w,k,x.z,B,x.y)),a[1]<0&&z&&(f.push(new s.aL(w,T,x.z,x.x,x.y+1)),f.push(new s.aL(w,k,x.z,B,x.y+1))),a[1]>0&&R&&(f.push(new s.aL(w,T,x.z,x.x,x.y-1)),f.push(new s.aL(w,k,x.z,B,x.y-1)))):a[1]<0&&z?f.push(new s.aL(w,T,x.z,x.x,x.y+1)):R&&f.push(new s.aL(w,T,x.z,x.x,x.y-1))}if(f.length>1){f.sort((w,T)=>w.overscaledZ-T.overscaledZ||w.wrap-T.wrap||w.canonical.z-T.canonical.z||w.canonical.x-T.canonical.x||w.canonical.y-T.canonical.y);let g=0,x=0;for(;x<f.length;)f[x].equals(f[g])?++x:f[++g]=f[x++];f.length=g+1}const m=[];for(const g of f)f.some(x=>g.isChildOf(x))||m.push(g);return f=m.filter(g=>!r.some(x=>!!(g.overscaledZ<h&&x.isChildOf(g))||g.equals(x)||g.isChildOf(x))),f}coveringTiles(r){let a=this.coveringZoomLevel(r);const h=a,f=this.elevation&&this.elevation.exaggeration(),m=f&&!r.isTerrainDEM,g=this.projection.name==="mercator";if(r.minzoom!==void 0&&a<r.minzoom)return[];r.maxzoom!==void 0&&a>r.maxzoom&&(a=r.maxzoom);const x=this.locationCoordinate(this.center),w=this.center.lat,T=1<<a,M=[T*x.x,T*x.y,0],A=this.projection.name==="globe",P=!A,z=s.aM.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,a,P),R=A?this._camera.mercatorPosition:this.pointCoordinate(this.getCameraPoint()),k=T*s.ax(1,this.center.lat),O=this._camera.position[2]/s.ax(1,this.center.lat),B=[T*R.x,T*R.y,O*(P?1:k)],G=A||f,q=this.cameraToCenterDistance/r.tileSize*(r.roundZoom?1:.502),Z=this.isLODDisabled(!0)?a:0;let K;if(this._elevation&&r.isTerrainDEM)K=1e4*this._elevation.exaggeration();else if(this._elevation){const le=this._elevation.getMinMaxForVisibleTiles();K=le?le.max:this._centerAltitude}else K=this._centerAltitude;const Y=r.isTerrainDEM?-K:this._elevation?this._elevation.getMinElevationBelowMSL():0,te=this.projection.isReprojectedInTileSpace?s.aN(this):1,N=le=>{const we=new s.Y(le.x+25e-6,le.y,le.z),Ve=new s.Y(le.x,le.y+25e-6,le.z),Ue=le.toLngLat(),qe=we.toLngLat(),je=Ve.toLngLat(),Be=this.locationCoordinate(Ue),ve=this.locationCoordinate(qe),He=this.locationCoordinate(je),yt=Math.hypot(ve.x-Be.x,ve.y-Be.y),it=Math.hypot(He.x-Be.x,He.y-Be.y);return Math.sqrt(yt*it)*te/25e-6},$=le=>{const _e=K,we=Y;return{aabb:s.aQ(this,T,0,0,0,le,we,_e,this.projection),zoom:0,x:0,y:0,minZ:we,maxZ:_e,wrap:le,fullyVisible:!1}},re=[];let de=[];const se=a,Q=r.reparseOverscaled?h:a,fe=(O-this._centerAltitude)*k,Me=le=>{if(!this._elevation||!le.tileID||!g)return;const _e=this._elevation.getMinMaxForTile(le.tileID),we=le.aabb;_e?(we.min[2]=_e.min,we.max[2]=_e.max,we.center[2]=(we.min[2]+we.max[2])/2):(le.shouldSplit=Se(le),le.shouldSplit||(we.min[2]=we.max[2]=we.center[2]=this._centerAltitude))},Ie=(le,_e)=>{if(.707*_e<le)return 1;const we=_e/le;return we/(1.4144271570014144+(Math.pow(1.1,we-1.4144271570014144+1)-1)/(1.1-1)-1)},Se=le=>{if(le.zoom<Z)return!0;
2215if(le.zoom===se)return!1;if(le.shouldSplit!=null)return le.shouldSplit;const _e=le.aabb.distanceX(B),we=le.aabb.distanceY(B);let Ve=fe,Ue=1;if(A){Ve=le.aabb.distanceZ(B);const it=Math.pow(2,le.zoom),ht=s.ay((le.y+1)/it),It=s.ay(le.y/it),oi=Math.min(Math.max(w,ht),It),St=s.b4(oi)/s.b4(w);if(Ue=oi===w?1/Math.max(1,this._mercatorScaleRatio-.3):Math.min(1,St/this._mercatorScaleRatio),this.zoom<=s.b1&&le.zoom===se-1&&St>=.9)return!0}else if(m&&(Ve=le.aabb.distanceZ(B)*k),this.projection.isReprojectedInTileSpace&&h<=5){const it=Math.pow(2,le.zoom),ht=N(new s.Y((le.x+.5)/it,(le.y+.5)/it));Ue=ht>.85?1:ht}if(!g){const it=Math.sqrt(_e*_e+we*we+Ve*Ve);let ht=(1<<se-le.zoom)*q*Ue;return ht*=Ie(Math.max(Ve,fe),it),it<ht}let qe=Number.MAX_VALUE,je=0;const Be=le.aabb.getCorners(),ve=[];for(const it of Be){s._.sub(ve,it,B),A||(m?ve[2]*=k:ve[2]=fe);const ht=s._.dot(ve,this._camera.forward());ht<qe&&(qe=ht,je=Math.abs(ve[2]))}let He=(1<<se-le.zoom)*q*Ue;if(He*=Ie(Math.max(je,fe),qe),qe<He)return!0;const yt=le.aabb.closestPoint(M);return yt[0]===M[0]&&yt[1]===M[1]};if(this.renderWorldCopies)for(let le=1;le<=3;le++)re.push($(-le)),re.push($(le));for(re.push($(0));re.length>0;){const le=re.pop(),_e=le.x,we=le.y;let Ve=le.fullyVisible;const Ue=()=>this.projection.name==="globe"&&(le.y===0||le.y===(1<<le.zoom)-1);if(!Ve){let qe=G?le.aabb.intersects(z):le.aabb.intersectsFlat(z);if(qe===0&&Ue()){const je=new s.aO(le.zoom,_e,we);qe=s.aP(this,T,je,!0).intersects(z)}if(qe===0)continue;Ve=qe===2}if(le.zoom!==se&&Se(le))for(let qe=0;qe<4;qe++){const je=(_e<<1)+qe%2,Be=(we<<1)+(qe>>1),ve={aabb:g?le.aabb.quadrant(qe):s.aQ(this,T,le.zoom+1,je,Be,le.wrap,le.minZ,le.maxZ,this.projection),zoom:le.zoom+1,x:je,y:Be,wrap:le.wrap,fullyVisible:Ve,tileID:void 0,shouldSplit:void 0,minZ:le.minZ,maxZ:le.maxZ};m&&!A&&(ve.tileID=new s.aL(le.zoom+1===se?Q:le.zoom+1,le.wrap,le.zoom+1,je,Be),Me(ve)),re.push(ve)}else{const qe=le.zoom===se?Q:le.zoom;if(r.minzoom&&r.minzoom>qe)continue;if(!Ve){let He=G?le.aabb.intersectsPrecise(z):le.aabb.intersectsPreciseFlat(z);if(He===0&&Ue()){const yt=new s.aO(le.zoom,_e,we);He=s.aP(this,T,yt,!0).intersectsPrecise(z)}if(He===0)continue}const je=M[0]-(.5+_e+(le.wrap<<le.zoom))*(1<<a-le.zoom),Be=M[1]-.5-we,ve=le.tileID?le.tileID:new s.aL(qe,le.wrap,le.zoom,_e,we);de.push({tileID:ve,distanceSq:je*je+Be*Be})}}if(this.fogCullDistSq){const le=this.fogCullDistSq,_e=this.horizonLineFromTop();de=de.filter(we=>{const Ve=[0,0,0,1],Ue=[s.a3,s.a3,0,1],qe=this.calculateFogTileMatrix(we.tileID.toUnwrapped());s.aA.transformMat4(Ve,Ve,qe),s.aA.transformMat4(Ue,Ue,qe);const je=s.aA.min([],Ve,Ue),Be=s.aA.max([],Ve,Ue),ve=s.aR(je,Be);if(ve===0)return!0;let He=!1;const yt=this._elevation;if(yt&&ve>le&&_e!==0){const it=this.calculateProjMatrix(we.tileID.toUnwrapped());let ht;r.isTerrainDEM||(ht=yt.getMinMaxForTile(we.tileID)),ht||(ht={min:Y,max:K});const It=s.b2(this.rotation),oi=[It[0]*s.a3,It[1]*s.a3,ht.max];s._.transformMat4(oi,oi,it),He=(1-oi[1])*this.height*.5<_e}return ve<le||He})}return de.sort((le,_e)=>le.distanceSq-_e.distanceSq).map(le=>le.tileID)}resize(r,a){this.width=r,this.height=a,this.pixelsToGLUnits=[2/r,-2/a],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(r){return Math.pow(2,r)}scaleZoom(r){return Math.log(r)/Math.LN2}project(r){const a=s.at(r.lat,-s.aS,s.aS),h=this.projection.project(r.lng,a);return new s.P(h.x*this.worldSize,h.y*this.worldSize)}unproject(r){return this.projection.unproject(r.x/this.worldSize,r.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/s.ax(1,this.center.lat)/this.worldSize}setLocationAtPoint(r,a){let h,f;const m=this.centerPoint;if(this.projection.name==="globe"){const x=this.worldSize;h=(a.x-m.x)/x,f=(a.y-m.y)/x}else{const x=this.pointCoordinate(a),w=this.pointCoordinate(m);h=x.x-w.x,f=x.y-w.y}const g=this.locationCoordinate(r);this.setLocation(new s.Y(g.x-h,g.y-f))}setLocation(r){this.center=this.coordinateLocation(r),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(r){return this.projection.locationPoint(this,r)}locationPoint3D(r){return this.projection.locationPoint(this,r,!0)}pointLocation(r){return this.coordinateLocation(this.pointCoordinate(r))}pointLocation3D(r){return this.coordinateLocation(this.pointCoordinate3D(r))}locationCoordinate(r,a){const h=a?s.ax(a,r.lat):void 0,f=this.projection.project(r.lng,r.lat);return new s.Y(f.x,f.y,h)}coordinateLocation(r){return this.projection.unproject(r.x,r.y)}pointRayIntersection(r,a){const h=a??this._centerAltitude,f=[r.x,r.y,0,1],m=[r.x,r.y,1,1];s.aA.transformMat4(f,f,this.pixelMatrixInverse),s.aA.transformMat4(m,m,this.pixelMatrixInverse);const g=m[3];s.aA.scale(f,f,1/f[3]),s.aA.scale(m,m,1/g);const x=f[2],w=m[2];return{p0:f,p1:m,t:x===w?0:(h-x)/(w-x)}}screenPointToMercatorRay(r){const a=[r.x,r.y,0,1],h=[r.x,r.y,1,1];return s.aA.transformMat4(a,a,this.pixelMatrixInverse),s.aA.transformMat4(h,h,this.pixelMatrixInverse),s.aA.scale(a,a,1/a[3]),s.aA.scale(h,h,1/h[3]),a[2]=s.ax(a[2],this._center.lat)*this.worldSize,h[2]=s.ax(h[2],this._center.lat)*this.worldSize,s.aA.scale(a,a,1/this.worldSize),s.aA.scale(h,h,1/this.worldSize),new s.aT([a[0],a[1],a[2]],s._.normalize([],s._.sub([],h,a)))}rayIntersectionCoordinate(r){const{p0:a,p1:h,t:f}=r,m=s.ax(a[2],this._center.lat),g=s.ax(h[2],this._center.lat);return new s.Y(s.a2(a[0],h[0],f)/this.worldSize,s.a2(a[1],h[1],f)/this.worldSize,s.a2(m,g,f))}pointCoordinate(r,a=this._centerAltitude){return this.projection.pointCoordinate(this,r.x,r.y,a)}pointCoordinate3D(r){if(!this.elevation)return this.pointCoordinate(r);let a=this.projection.pointCoordinate3D(this,r.x,r.y);if(a)return new s.Y(a[0],a[1],a[2]);let h=0,f=this.horizonLineFromTop();if(r.y>f)return this.pointCoordinate(r);const m=.02*f,g=r.clone();for(let x=0;x<10&&f-h>m;x++){g.y=s.a2(h,f,.66);const w=this.projection.pointCoordinate3D(this,g.x,g.y);w?(f=g.y,a=w):h=g.y}return a?new s.Y(a[0],a[1],a[2]):this.pointCoordinate(r)}isPointAboveHorizon(r){return this.projection.isPointAboveHorizon(this,r)}isPointOnSurface(r){if(r.y<0||r.y>this.height||r.x<0||r.x>this.width)return!1;if(this.elevation||this.zoom>=s.aU)return!this.isPointAboveHorizon(r);const a=this.pointCoordinate(r);return a.y>=0&&a.y<=1}_coordinatePoint(r,a){const h=a&&this.elevation?this.elevation.getAtPointOrZero(r,this._centerAltitude):this._centerAltitude,f=[r.x*this.worldSize,r.y*this.worldSize,h+r.toAltitude(),1];return s.aA.transformMat4(f,f,this.pixelMatrix),f[3]>0?new s.P(f[0]/f[3],f[1]/f[3]):new s.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:r,left:a}=this._edgeInsets,h=this.height-this._edgeInsets.bottom,f=this.width-this._edgeInsets.right,m=this.pointLocation3D(new s.P(a,r)),g=this.pointLocation3D(new s.P(f,r)),x=this.pointLocation3D(new s.P(f,h)),w=this.pointLocation3D(new s.P(a,h));let T=Math.min(m.lng,g.lng,x.lng,w.lng),M=Math.max(m.lng,g.lng,x.lng,w.lng),A=Math.min(m.lat,g.lat,x.lat,w.lat),P=Math.max(m.lat,g.lat,x.lat,w.lat);const z=Math.pow(2,-this.zoom)/16*270,R=this.projection.name==="globe"?1:4,k=(O,B,G,q,Z)=>
2215{const K=(O+G)/2,Y=(B+q)/2,te=new s.P(K,Y),{lng:N,lat:$}=this.pointLocation3D(te),re=Math.max(0,T-N,A-$,N-M,$-P);T=Math.min(T,N),M=Math.max(M,N),A=Math.min(A,$),P=Math.max(P,$),(Z<R||re>z)&&(k(O,B,K,Y,Z+1),k(K,Y,G,q,Z+1))};if(k(a,r,f,r,1),k(f,r,f,h,1),k(f,h,a,h,1),k(a,h,a,r,1),this.projection.name==="globe"){const[O,B]=s.aV(this);O?(P=90,M=180,T=-180):B&&(A=-90,M=180,T=-180)}return new s.ai(new s.aI(T,A),new s.aI(M,P))}_getBoundsRectangular(r,a){const{top:h,left:f}=this._edgeInsets,m=this.height-this._edgeInsets.bottom,g=this.width-this._edgeInsets.right,x=new s.P(f,h),w=new s.P(g,h),T=new s.P(g,m),M=new s.P(f,m);let A=this.pointCoordinate(x,r),P=this.pointCoordinate(w,r);const z=this.pointCoordinate(T,a),R=this.pointCoordinate(M,a),k=(O,B)=>(B.y-O.y)/(B.x-O.x);return A.y>1&&P.y>=0?A=new s.Y((1-R.y)/k(R,A)+R.x,1):A.y<0&&P.y<=1&&(A=new s.Y(-R.y/k(R,A)+R.x,0)),P.y>1&&A.y>=0?P=new s.Y((1-z.y)/k(z,P)+z.x,1):P.y<0&&A.y<=1&&(P=new s.Y(-z.y/k(z,P)+z.x,0)),new s.ai().extend(this.coordinateLocation(A)).extend(this.coordinateLocation(P)).extend(this.coordinateLocation(R)).extend(this.coordinateLocation(z))}_getBoundsRectangularTerrain(){const r=this.elevation;if(!r.visibleDemTiles.length||r.isUsingMockSource())return this._getBoundsRectangular(0,0);const a=r.visibleDemTiles.reduce((h,f)=>{if(f.dem){const m=f.dem.tree;h.min=Math.min(h.min,m.minimums[0]),h.max=Math.max(h.max,m.maximums[0])}return h},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(a.min*r.exaggeration(),a.max*r.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(r=!0){const a=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,h=this.height/2-a*(1-this._horizonShift);return r?Math.max(0,h):h}getMaxBounds(){return this.maxBounds}setMaxBounds(r){this.maxBounds=r,this.minLat=-s.aS,this.maxLat=s.aS,this.minLng=-180,this.maxLng=180,r&&(this.minLat=r.getSouth(),this.maxLat=r.getNorth(),this.minLng=r.getWest(),this.maxLng=r.getEast(),this.maxLng<this.minLng&&(this.maxLng+=360)),this.worldMinX=s.aj(this.minLng)*this.tileSize,this.worldMaxX=s.aj(this.maxLng)*this.tileSize,this.worldMinY=s.ak(this.maxLat)*this.tileSize,this.worldMaxY=s.ak(this.minLat)*this.tileSize,this._constrain()}calculatePosMatrix(r,a){return this.projection.createTileMatrix(this,a,r)}calculateDistanceTileData(r){const a=r.key,h=this._distanceTileDataCache;if(h[a])return h[a];const f=r.canonical,m=1/this.height,g=this.cameraWorldSize,x=g/this.zoomScale(f.z),w=(f.x+Math.pow(2,f.z)*r.wrap)*x,T=f.y*x,M=this.point;M.x*=g/this.worldSize,M.y*=g/this.worldSize;const A=this.angle,P=Math.sin(-A),z=-Math.cos(-A);return h[a]={bearing:[P,z],center:[(M.x-w)*m,(M.y-T)*m],scale:x/s.a3*m},h[a]}calculateFogTileMatrix(r){const a=r.key,h=this._fogTileMatrixCache;if(h[a])return h[a];const f=this.projection.createTileMatrix(this,this.cameraWorldSizeForFog,r);return s.ad.multiply(f,this.worldToFogMatrix,f),h[a]=new Float32Array(f),h[a]}calculateProjMatrix(r,a=!1,h=!1){const f=r.key;let m;if(m=h?this._expandedProjMatrixCache:a?this._alignedProjMatrixCache:this._projMatrixCache,m[f])return m[f];const g=this.calculatePosMatrix(r,this.worldSize);let x;return x=this.projection.isReprojectedInTileSpace?this.mercatorMatrix:h?this.expandedFarZProjMatrix:a?this.alignedProjMatrix:this.projMatrix,s.ad.multiply(g,x,g),m[f]=new Float32Array(g),m[f]}calculatePixelsToTileUnitsMatrix(r){const a=r.tileID.key,h=this._pixelsToTileUnitsCache;if(h[a])return h[a];const f=s.aW(r,this);return h[a]=f,h[a]}customLayerMatrix(){return this.mercatorMatrix.slice()}globeToMercatorMatrix(){if(this.projection.name==="globe"){const r=1/this.worldSize,a=s.ad.fromScaling([],[r,r,r]);return s.ad.multiply(a,a,this.globeMatrix),a}}recenterOnTerrain(){if(!this._elevation||this.projection.name==="globe")return;const r=this._elevation;this._updateCameraState();const a=s.ax(1,this._center.lat)*this.worldSize,h=this._computeCameraPosition(a),f=this._camera.forward(),m=s.ax(1,this._center.lat);h[2]/=m,f[2]/=m,s._.normalize(f,f);const g=r.raycast(h,f,r.exaggeration());if(g){const x=s._.scaleAndAdd([],h,f,g),w=new s.Y(x[0],x[1],s.ax(x[2],s.ay(x[1]))),T=(w.z+s._.length([w.x-h[0],w.y-h[1],w.z-h[2]*m]))*this._pixelsPerMercatorPixel;this._seaLevelZoom=this._zoomFromMercatorZ(T),this._centerAltitude=w.toAltitude(),this._center=this.coordinateLocation(w),this._updateZoomFromElevation(),this._constrain(),this._calcMatrices()}}_constrainCamera(r=!1){if(!this._elevation)return;const a=this._elevation,h=s.ax(1,this._center.lat)*this.worldSize,f=this._computeCameraPosition(h),m=a.getAtPointOrZero(new s.Y(...f)),g=this.pixelsPerMeter/this.worldSize*m,x=this._minimumHeightOverTerrain(),w=f[2]-g;if(w<=x)if(w<0||r){const T=this.locationCoordinate(this._center,this._centerAltitude),M=[f[0],f[1],T.z-f[2]],A=s._.length(M);M[2]-=(x-w)/this._pixelsPerMercatorPixel;const P=s._.length(M);if(P===0)return;s._.scale(M,M,A/P*this._pixelsPerMercatorPixel),this._camera.position=[f[0],f[1],T.z*this._pixelsPerMercatorPixel-M[2]],this._updateStateFromCamera()}else this._isCameraConstrained=!0}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;const r=this.projection.name==="globe"||this.mercatorFromTransition;if(this.projection.isReprojectedInTileSpace||r){const P=this.center;return P.lat=s.at(P.lat,this.minLat,this.maxLat),(this.maxBounds||!this.renderWorldCopies&&!r)&&(P.lng=s.at(P.lng,this.minLng,this.maxLng)),this.center=P,void(this._constraining=!1)}const a=this._unmodified,{x:h,y:f}=this.point;let m=0,g=h,x=f;const w=this.width/2,T=this.height/2,M=this.worldMinY*this.scale,A=this.worldMaxY*this.scale;if(f-T<M&&(x=M+T),f+T>A&&(x=A-T),A-M<this.height&&(m=Math.max(m,this.height/(A-M)),x=(A+M)/2),this.maxBounds||!this._renderWorldCopies||!this.projection.wrap){const P=this.worldMinX*this.scale,z=this.worldMaxX*this.scale,R=this.worldSize/2-(P+z)/2;g=(h+R+this.worldSize)%this.worldSize-R,g-w<P&&(g=P+w),g+w>z&&(g=z-w),z-P<this.width&&(m=Math.max(m,this.width/(z-P)),g=(z+P)/2)}g===h&&x===f||(this.center=this.unproject(new s.P(g,x))),m&&(this.zoom+=this.scaleZoom(m)),this._constrainCamera(),this._unmodified=a,this._constraining=!1}_minZoomForBounds(){let r=Math.max(0,this.scaleZoom(this.height/(this.worldMaxY-this.worldMinY)));return this.maxBounds&&(r=Math.max(r,this.scaleZoom(this.width/(this.worldMaxX-this.worldMinX)))),r}_maxCameraBoundsDistance(){return this._mercatorZfromZoom(this._minZoomForBounds())}
2215_calcMatrices(){if(!this.height)return;const r=this.centerOffset,a=this.projection.name==="globe",h=this.pixelsPerMeter;this.projection.name==="globe"&&(this._mercatorScaleRatio=s.ax(1,this.center.lat)/s.ax(1,s.b3));const f=s.aX(this.projection,this.zoom,this.width,this.height,1024);this._pixelsPerMercatorPixel=this.projection.pixelSpaceConversion(this.center.lat,this.worldSize,f),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 m=this.projection.zAxisUnit==="meters"?h:1,g=this._camera.getWorldToCamera(this.worldSize,m);let x;const w=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,this._farZ);if(w[8]=2*-r.x/this.width,w[9]=2*r.y/this.height,this.isOrthographic){let $=.5*this.height/Math.tan(this._fov/2)*1*Math.tan(.5*this._fov),re=$*this.aspect,de=-re,se=-$;re-=r.x,de-=r.x,$+=r.y,se+=r.y,x=this._camera.getCameraToClipOrthographic(de,re,se,$,this._nearZ,this._farZ),((Q,fe,Me,Ie)=>{for(let Se=0;Se<16;Se++)Q[Se]=Hr(fe[Se],Me[Se],Ie)})(x,x,w,Nc(this.pitch>=15?1:this.pitch/15))}else x=w;const T=s.ad.mul([],w,g);let M=s.ad.mul([],x,g);if(this.projection.isReprojectedInTileSpace){const $=this.locationCoordinate(this.center),re=s.ad.identity([]);s.ad.translate(re,re,[$.x*this.worldSize,$.y*this.worldSize,0]),s.ad.multiply(re,re,s.aY(this)),s.ad.translate(re,re,[-$.x*this.worldSize,-$.y*this.worldSize,0]),s.ad.multiply(M,M,re),s.ad.multiply(T,T,re),this.inverseAdjustmentMatrix=s.aZ(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=s.ad.scale([],M,[this.worldSize,this.worldSize,this.worldSize/m,1]),this.projMatrix=M,this.invProjMatrix=s.ad.invert(new Float64Array(16),this.projMatrix),a){const $=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);$[8]=2*-r.x/this.width,$[9]=2*r.y/this.height,this.expandedFarZProjMatrix=s.ad.mul([],$,g)}else this.expandedFarZProjMatrix=this.projMatrix;const A=s.ad.invert([],x);this.frustumCorners=s.a_.fromInvProjectionMatrix(A,this.horizonLineFromTop(),this.height),this.cameraFrustum=s.aM.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!a);const P=new Float32Array(16);s.ad.identity(P),s.ad.scale(P,P,[1,-1,1]),s.ad.rotateX(P,P,this._pitch),s.ad.rotateZ(P,P,this.angle);const z=s.ad.perspective(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=s.ad.clone(z);const R=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;z[8]=2*-r.x/this.width,z[9]=2*(r.y+R)/this.height,this.skyboxMatrix=s.ad.multiply(P,z,P);const k=this.point,O=k.x,B=k.y,G=this.width%2/2,q=this.height%2/2,Z=Math.cos(this.angle),K=Math.sin(this.angle),Y=O-Math.round(O)+Z*G+K*q,te=B-Math.round(B)+Z*q+K*G,N=new Float64Array(M);if(s.ad.translate(N,N,[Y>.5?Y-1:Y,te>.5?te-1:te,0]),this.alignedProjMatrix=N,M=s.ad.create(),s.ad.scale(M,M,[this.width/2,-this.height/2,1]),s.ad.translate(M,M,[1,-1,0]),this.labelPlaneMatrix=M,M=s.ad.create(),s.ad.scale(M,M,[1,-1,1]),s.ad.translate(M,M,[-1,-1,0]),s.ad.scale(M,M,[2/this.width,2/this.height,1]),this.glCoordMatrix=M,this.pixelMatrix=s.ad.multiply(new Float64Array(16),this.labelPlaneMatrix,T),this._calcFogMatrices(),this._distanceTileDataCache={},M=s.ad.invert(new Float64Array(16),this.pixelMatrix),!M)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=M,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=s.a$(this);const $=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=s._.transformMat4($,$,g),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=M;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const r=this.cameraWorldSizeForFog,a=this.cameraPixelsPerMeter,h=this._camera.position,f=1/this.height/this._pixelsPerMercatorPixel,m=[r,r,a];s._.scale(m,m,f),s._.scale(h,h,-1),s._.multiply(h,h,m);const g=s.ad.create();s.ad.translate(g,g,h),s.ad.scale(g,g,m),this.mercatorFogMatrix=g,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(r,a,f)}_computeCameraPosition(r){const a=(r=r||this.pixelsPerMeter)/this.pixelsPerMeter,h=this._camera.forward(),f=this.point,m=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*a-r/this.worldSize*this._centerAltitude;return[f.x/this.worldSize-h[0]*m,f.y/this.worldSize-h[1]*m,r/this.worldSize*this._centerAltitude-h[2]*m]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(r){const a=this._maxCameraBoundsDistance()*Math.cos(this._pitch),h=this._camera.position[2],f=r[2];let m=1;this.projection.wrap&&(this.center=this.center.wrap()),f>0&&(m=Math.min((a-h)/f,1)),this._camera.position=s._.scaleAndAdd([],this._camera.position,r,m),this._updateStateFromCamera()}_updateStateFromCamera(){const r=this._camera.position,a=this._camera.forward(),{pitch:h,bearing:f}=this._camera.getPitchBearing(),m=s.ax(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,g=this._mercatorZfromZoom(this._maxZoom)*Math.cos(s.ab(this._maxPitch)),x=Math.max((r[2]-m)/Math.cos(h),g),w=this._zoomFromMercatorZ(x);s._.scaleAndAdd(r,r,a,x),this._pitch=s.at(h,s.ab(this.minPitch),s.ab(this.maxPitch)),this.angle=s.au(f,-Math.PI,Math.PI),this._setZoom(s.at(w,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new s.Y(r[0],r[1],r[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(r){return Math.pow(2,r)*this.tileSize}_mercatorZfromZoom(r){return this.cameraToCenterDistance/this._worldSizeFromZoom(r)}_minimumHeightOverTerrain(){const r=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(r)}_zoomFromMercatorZ(r){return this.scaleZoom(this.cameraToCenterDistance/(r*this.tileSize))}zoomFromMercatorZAdjusted(r){let a=0,h=s.aU,f=0,m=1/0;for(;h-a>1e-6&&h>a;){const g=a+.5*(h-a),x=this.tileSize*Math.pow(2,g),w=this.getCameraToCenterDistance(this.projection,g,x),T=this.scaleZoom(w/(r*this.tileSize)),M=Math.abs(g-T);M<m&&(m=M,f=g),g<T?a=g:h=g}return f}_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(r,a){const h=Math.min(r.x,a.x),f=Math.max(r.x,a.x),m=Math.min(r.y,a.y),g=Math.max(r.y,a.y);if(m<this.horizonLineFromTop(!1))return!0;
2215if(this.projection.name!=="mercator")return!1;const x=[new s.P(h,m),new s.P(f,g),new s.P(h,g),new s.P(f,m)],w=this.renderWorldCopies?-3:0,T=this.renderWorldCopies?4:1;for(const M of x){const A=this.pointRayIntersection(M);if(A.t<0)return!0;const P=this.rayIntersectionCoordinate(A);if(P.x<w||P.y<0||P.x>T||P.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+s.b0(this.fovAboveCenter)>88||this.anyCornerOffEdge(new s.P(0,0),new s.P(this.width,this.height))}zoomDeltaToMovement(r,a){const h=s._.length(s._.sub([],this._camera.position,r)),f=this._zoomFromMercatorZ(h)+a;return h-this._mercatorZfromZoom(f)}getCameraPoint(){if(this.projection.name==="globe"){const r=function([a,h,f],m){const g=[a,h,f,1];s.aA.transformMat4(g,g,m);const x=g[3]=Math.max(g[3],1e-6);return g[0]/=x,g[1]/=x,g[2]/=x,g}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new s.P(r[0],r[1])}{const r=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new s.P(0,r))}}getCameraToCenterDistance(r,a=this.zoom,h=this.worldSize){const f=s.aX(r,a,this.width,this.height,1024),m=r.pixelSpaceConversion(this.center.lat,h,f);let g=.5/Math.tan(.5*this._fov)*this.height*m;return this.isOrthographic&&(g=Hr(1,g,Nc(this.pitch>=15?1:this.pitch/15))),g}getWorldToCameraMatrix(){const r=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&s.ad.multiply(r,r,this.globeMatrix),r}getFrustum(r){return s.aM.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,r,this.projection.zAxisUnit==="meters")}}const Ei={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11},to=(u,r)=>{if(r>0&&u.terrain&&s.w("Cutoff is currently disabled on terrain"),r<=0||u.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const a=u.transform,h=Math.max(Math.abs(a._zoom-(u.minCutoffZoom-1)),1),f=a.isLODDisabled(!1)?s.$(60,45,a.pitch):s.$(30,15,a.pitch),m=a._farZ-a._nearZ,g=r*a.height,x=((1-(w=f))*a.cameraToCenterDistance+w*(a._farZ+g))*h;var w;return{shouldRenderCutoff:f<1,uniformValues:{u_cutoff_params:[a._nearZ,a._farZ,(x-a._nearZ)/m,(x-g-a._nearZ)/m]}}},Yi={cascadeCount:2,shadowMapResolution:2048};class ea{constructor(r,a){this.aabb=r,this.lastCascade=a}}class Vc{add(r,a){const h=this.receivers[r.key];h!==void 0?(h.aabb.min[0]=Math.min(h.aabb.min[0],a.min[0]),h.aabb.min[1]=Math.min(h.aabb.min[1],a.min[1]),h.aabb.min[2]=Math.min(h.aabb.min[2],a.min[2]),h.aabb.max[0]=Math.max(h.aabb.max[0],a.max[0]),h.aabb.max[1]=Math.max(h.aabb.max[1],a.max[1]),h.aabb.max[2]=Math.max(h.aabb.max[2],a.max[2])):this.receivers[r.key]=new ea(a,null)}clear(){this.receivers={}}get(r){return this.receivers[r.key]}computeRequiredCascades(r,a,h){const f=s.b6.fromPoints(r.points);let m=0;for(const g in this.receivers){const x=this.receivers[g];if(!x||!f.intersectsAabb(x.aabb))continue;x.aabb.min=f.closestPoint(x.aabb.min),x.aabb.max=f.closestPoint(x.aabb.max);const w=x.aabb.getCorners();for(let T=0;T<h.length;T++){let M=!0;for(const A of w){const P=[A[0]*a,A[1]*a,A[2]];if(s._.transformMat4(P,P,h[T].matrix),P[0]<-1||P[0]>1||P[1]<-1||P[1]>1){M=!1;break}}if(x.lastCascade=T,m=Math.max(m,T),M)break}}return m+1}}class Uc{constructor(r){this.painter=r,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Vc,this._depthMode=new s.ae(r.context.gl.LEQUAL,s.ae.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,r.tp.registerParameter(this,["Shadows"],"_forceDisable",{label:"forceDisable"},()=>{this.painter.style.map.triggerRepaint()}),r.tp.registerParameter(Yi,["Shadows"],"cascadeCount",{min:1,max:2,step:1}),r.tp.registerParameter(Yi,["Shadows"],"shadowMapResolution",{min:32,max:2048,step:32}),r.tp.registerBinding(this,["Shadows"],"_numCascadesToRender",{readonly:!0,label:"numCascadesToRender"})}destroy(){for(const r of this._cascades)r.texture.destroy(),r.framebuffer.destroy();this._cascades=[]}updateShadowParameters(r,a){const h=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!a||!a.properties)return;const f=a.properties.get("shadow-intensity");if(!a.shadowsEnabled()||f<=0||(this._shadowLayerCount=h.style.order.reduce((R,
2215k)=>{const O=h.style._mergedLayers[k];return R+(O.hasShadowPass()&&!O.isHidden(r.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const m=h.context,g=Yi.shadowMapResolution,x=Yi.shadowMapResolution;if(this._cascades.length===0||Yi.shadowMapResolution!==this._cascades[0].texture.size[0]){this._cascades=[];for(let R=0;R<Yi.cascadeCount;++R){const k=h._shadowMapDebug,O=m.gl,B=m.createFramebuffer(g,x,k,"texture"),G=new s.T(m,{width:g,height:x,data:null},O.DEPTH_COMPONENT);if(B.depthAttachment.set(G.texture),k){const q=new s.T(m,{width:g,height:x,data:null},O.RGBA);B.colorAttachment.set(q.texture)}this._cascades.push({framebuffer:B,texture:G,matrix:[],far:0,boundingSphereRadius:0,frustum:new s.aM,scale:0})}}this.shadowDirection=pl(a);let w=0;if(r.elevation){const R=r.elevation,k=[1e4,-1e4];R.visibleDemTiles.filter(O=>O.dem).forEach(O=>{const B=O.dem.tree;k[0]=Math.min(k[0],B.minimums[0]),k[1]=Math.max(k[1],B.maximums[0])}),k[0]!==1e4&&(w=(k[1]-k[0])*R.exaggeration())}const T=1.5*r.cameraToCenterDistance,M=3*T,A=new Float64Array(16);for(let R=0;R<this._cascades.length;++R){const k=this._cascades[R];let O=r.height/50,B=1;Yi.cascadeCount===1?B=M:R===0?B=T:(O=T,B=M);const[G,q]=ro(r,this.shadowDirection,O,B,Yi.shadowMapResolution,w);k.scale=r.scale,k.matrix=G,k.boundingSphereRadius=q,s.ad.invert(A,k.matrix),k.frustum=s.aM.fromInvProjectionMatrix(A,1,0,!0),k.far=B}const P=this._cascades.length-1;this._uniformValues.u_fade_range=[.75*this._cascades[P].far,this._cascades[P].far],this._uniformValues.u_shadow_intensity=f,this._uniformValues.u_shadow_direction=[this.shadowDirection[0],this.shadowDirection[1],this.shadowDirection[2]],this._uniformValues.u_shadow_texel_size=1/Yi.shadowMapResolution,this._uniformValues.u_shadow_map_resolution=Yi.shadowMapResolution,this._uniformValues.u_shadowmap_0=Ei.ShadowMap0,this._uniformValues.u_shadowmap_1=Ei.ShadowMap0+1,this._groundShadowTiles=h.transform.coveringTiles({tileSize:512,renderWorldCopies:!0});const z=h.transform.elevation;for(const R of this._groundShadowTiles){let k={min:0,max:0};if(z){const O=z.getMinMaxForTile(R);O&&(k=O)}this.addShadowReceiver(R.toUnwrapped(),k.min,k.max)}}get enabled(){return this._enabled&&!this._forceDisable}set enabled(r){this._enabled=r}drawShadowPass(r,a){if(!this.enabled)return;const h=this.painter,f=h.context;this._numCascadesToRender=this._receivers.computeRequiredCascades(h.transform.getFrustum(0),h.transform.worldSize,this._cascades),f.viewport.set([0,0,Yi.shadowMapResolution,Yi.shadowMapResolution]);for(let m=0;m<this._numCascadesToRender;++m){h.currentShadowCascade=m,f.bindFramebuffer.set(this._cascades[m].framebuffer.framebuffer),f.clear({color:s.C.white,depth:1});for(const g of r.order){const x=r._mergedLayers[g];if(!x.hasShadowPass()||x.isHidden(h.transform.zoom))continue;const w=r.getLayerSourceCache(x),T=w?a[w.id]:void 0;(x.type==="model"||T&&T.length)&&h.renderLayer(h,w,x,T)}}h.currentShadowCascade=0}drawGroundShadows(){if(!this.enabled)return;const r=this.painter,a=r.style,h=r.context,f=a.directionalLight,m=a.ambientLight;if(!f||!m)return;const g=[],x=to(r,r.longestCutoffRange);x.shouldRenderCutoff&&g.push("RENDER_CUTOFF");const w=Wo(a,f,m),T=new s.ae(h.gl.LEQUAL,s.ae.ReadOnly,r.depthRangeFor3D);for(const M of this._groundShadowTiles){const A=M.toUnwrapped(),P=r.isTileAffectedByFog(M),z=r.getOrCreateProgram("groundShadow",{defines:g,overrideFog:P});this.setupShadows(A,z),r.uploadCommonUniforms(h,z,A,null,x);const R={u_matrix:r.transform.calculateProjMatrix(A),u_ground_shadow_factor:w};z.draw(r,h.gl.TRIANGLES,T,s.ag.disabled,s.a.multiply,s.af.disabled,R,"ground_shadow",r.tileExtentBuffer,r.quadTriangleIndexBuffer,r.tileExtentSegments,{},r.transform.zoom,null,null)}}getShadowPassColorMode(){return this.painter._shadowMapDebug?s.a.unblended:s.a.disabled}getShadowPassDepthMode(){return this._depthMode}getShadowCastingLayerCount(){return this._shadowLayerCount}calculateShadowPassMatrixFromTile(r){const a=this.painter.transform,h=a.calculatePosMatrix(r,a.worldSize);return s.ad.multiply(h,this._cascades[this.painter.currentShadowCascade].matrix,h),Float32Array.from(h)}
2215calculateShadowPassMatrixFromMatrix(r){return s.ad.multiply(r,this._cascades[this.painter.currentShadowCascade].matrix,r),Float32Array.from(r)}setupShadows(r,a,h,f=0){if(!this.enabled)return;const m=this.painter.transform,g=this.painter.context,x=g.gl,w=this._uniformValues,T=new Float64Array(16),M=m.calculatePosMatrix(r,m.worldSize);for(let A=0;A<this._cascades.length;A++)s.ad.multiply(T,this._cascades[A].matrix,M),w[A===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(T),g.activeTexture.set(x.TEXTURE0+Ei.ShadowMap0+A),this._cascades[A].texture.bind(x.NEAREST,x.CLAMP_TO_EDGE);if(this.useNormalOffset=!!h,this.useNormalOffset){const A=s.b5(r.canonical),P=2/m.tileSize*s.a3/Yi.shadowMapResolution,z=P*this._cascades[0].boundingSphereRadius,R=P*this._cascades[this._cascades.length-1].boundingSphereRadius,k=(h==="vector-tile"?1:3)/Math.pow(2,f-r.canonical.z-(1-m.zoom+Math.floor(m.zoom)));w.u_shadow_normal_offset=[A,z*k,R*k],w.u_shadow_bias=[6e-5,.0012,.012]}else w.u_shadow_bias=[36e-5,.0012,.012];a.setShadowUniformValues(g,w)}setupShadowsFromMatrix(r,a,h=!1){if(!this.enabled)return;const f=this.painter.context,m=f.gl,g=this._uniformValues,x=new Float64Array(16);for(let w=0;w<Yi.cascadeCount;w++)s.ad.multiply(x,this._cascades[w].matrix,r),g[w===0?"u_light_matrix_0":"u_light_matrix_1"]=Float32Array.from(x),f.activeTexture.set(m.TEXTURE0+Ei.ShadowMap0+w),this._cascades[w].texture.bind(m.NEAREST,m.CLAMP_TO_EDGE);this.useNormalOffset=h,h?(g.u_shadow_normal_offset=[1,5,5],g.u_shadow_bias=[6e-5,.0012,.012]):g.u_shadow_bias=[36e-5,.0012,.012],a.setShadowUniformValues(f,g)}getShadowUniformValues(){return this._uniformValues}getCurrentCascadeFrustum(){return this._cascades[this.painter.currentShadowCascade].frustum}computeSimplifiedTileShadowVolume(r,a,h,f){if(f[2]>=0)return{};const m=function(w,T,M){const A=M/(1<<w.canonical.z);return new s.b6([w.canonical.x*A+w.wrap*M,w.canonical.y*A+w.wrap*M,0],[(w.canonical.x+1)*A+w.wrap*M,(w.canonical.y+1)*A+w.wrap*M,T])}(r,a,h).getCorners(),g=a/-f[2];f[0]<0?(s._.add(m[0],m[0],[f[0]*g,0,0]),s._.add(m[3],m[3],[f[0]*g,0,0])):f[0]>0&&(s._.add(m[1],m[1],[f[0]*g,0,0]),s._.add(m[2],m[2],[f[0]*g,0,0])),f[1]<0?(s._.add(m[0],m[0],[0,f[1]*g,0]),s._.add(m[1],m[1],[0,f[1]*g,0])):f[1]>0&&(s._.add(m[2],m[2],[0,f[1]*g,0]),s._.add(m[3],m[3],[0,f[1]*g,0]));const x={};return x.vertices=m,x.planes=[io(m[1],m[0],m[4]),io(m[2],m[1],m[5]),io(m[3],m[2],m[6]),io(m[0],m[3],m[7])],x}addShadowReceiver(r,a,h){this._receivers.add(r,s.b6.fromTileIdAndHeight(r,a,h))}getMaxCascadeForTile(r){const a=this._receivers.get(r);return a&&a.lastCascade?a.lastCascade:0}}function io(u,r,a){const h=s._.sub([],a,r),f=s._.sub([],u,r),m=s._.cross([],h,f),g=s._.length(m);return g===0?[0,0,1,0]:(s._.scale(m,m,1/g),[m[0],m[1],m[2],-s._.dot(m,r)])}function pl(u){const r=u.properties.get("direction"),a=s.ac(r.x,r.y,r.z);a[2]=s.at(a[2],0,75);const h=s.b7([a[0],a[1],a[2]]);return s._.fromValues(h.x,h.y,h.z)}function Wo(u,r,a){const h=r.properties.get("color"),f=r.properties.get("intensity"),m=r.properties.get("direction"),g=[m.x,m.y,m.z],x=a.properties.get("color"),w=a.properties.get("intensity"),T=Math.max(s._.dot([0,0,1],g),0),M=[0,0,0];s._.scale(M,x.toRenderColor(u.getLut(r.scope)).toArray01Linear().slice(0,3),w);const A=[0,0,0];return s._.scale(A,h.toRenderColor(u.getLut(a.scope)).toArray01Linear().slice(0,3),T*f),s.b8([M[0]>0?M[0]/(M[0]+A[0]):0,M[1]>0?M[1]/(M[1]+A[1]):0,M[2]>0?M[2]/(M[2]+A[2]):0])}function ro(u,r,a,h,f,m){const g=u.zoom,x=u.scale,w=u.worldSize,T=1/w,M=u.aspect,A=Math.sqrt(1+M*M)*Math.tan(.5*u.fovX),P=A*A,z=h-a,R=h+a;let k,O;P>z/R?(k=h,O=h*A):(k=.5*R*(1+P),O=.5*Math.sqrt(z*z+2*(h*h+a*a)*P+R*R*P*P));const B=u.projection.pixelsPerMeter(u.center.lat,w),G=u._camera.getCameraToWorldMercator(),q=[0,0,-k*T];s._.transformMat4(q,q,G);let Z=O*T;const K=u._edgeInsets;if(!(K.left===0&&K.top===0&&K.right===0&&K.bottom===0||K.left===K.right&&K.top===K.bottom)){const Ve=u._camera.getWorldToCamera(u.worldSize,u.projection.zAxisUnit==="meters"?B:1),Ue=u._camera.getCameraToClipPerspective(u._fov,u.width/u.height,a,h);Ue[8]=2*-u.centerOffset.x/u.width,Ue[9]=2*u.centerOffset.y/u.height;const qe=new Float64Array(16);s.ad.mul(qe,Ue,Ve);const je=new Float64Array(16);s.ad.invert(je,qe);const Be=s.aM.fromInvProjectionMatrix(je,w,g,!0);for(const ve of Be.points){const He=((Y=ve)[0]/=x,Y[1]/=x,Y[2]=s.ax(Y[2],u._center.lat),Y);Z=Math.max(Z,s._.len(s._.subtract([],q,He)))}}var Y;Z*=f/(f-1);const te=Math.acos(r[2]),N=Math.atan2(-r[0],-r[1]),$=new Js;$.position=q,$.setPitchBearing(te,N);const re=$.getWorldToCamera(w,B),de=Z*w,se=Math.min(u._mercatorZfromZoom(17)*w*-2,-2*de),Q=$.getCameraToClipOrthographic(-de,de,-de,de,se,(de+m*B)/r[2]),fe=new Float64Array(16);s.ad.multiply(fe,Q,re);const Me=s._.fromValues(Math.floor(1e6*q[0])/1e6*w,Math.floor(1e6*q[1])/1e6*w,0),Ie=.5*f,Se=[0,0,0];s._.transformMat4(Se,Me,fe),s._.scale(Se,Se,Ie);const le=[Math.floor(Se[0]),Math.floor(Se[1]),Math.floor(Se[2])],_e=[0,0,0];s._.sub(_e,Se,le),s._.scale(_e,_e,-1/Ie);const we=new Float64Array(16);return s.ad.identity(we),s.ad.translate(we,we,_e),s.ad.multiply(fe,we,fe),[fe,de]}function Ho(u,r){return u!=null&&r!=null&&!(!u.hasData()||!r.hasData())&&u.demTexture!=null&&r.demTexture!=null&&u.tileID.key!==r.tileID.key}const zn=new class{constructor(){this.operations={}}newMorphing(u,r,a,h,f){if(u in this.operations){const m=this.operations[u];m.to.tileID.key!==a.tileID.key&&(m.queued=a)}else this.operations[u]={startTime:h,phase:0,duration:f,from:r,to:a,queued:null}}getMorphValuesForProxy(u){if(!(u in this.operations))return null;const r=this.operations[u];return{from:r.from,to:r.to,phase:r.phase}}update(u){for(const r in this.operations){const a=this.operations[r];for(a.phase=(u-a.startTime)/a.duration;a.phase>
2215=1||!this._validOp(a);)if(!this._nextOp(a,u)){delete this.operations[r];break}}}_nextOp(u,r){return!!u.queued&&(u.from=u.to,u.to=u.queued,u.queued=null,u.phase=0,u.startTime=r,!0)}_validOp(u){return u.from.hasData()&&u.to.hasData()}},jc={0:null,1:"TERRAIN_VERTEX_MORPHING"};function ta(u,r,a){if(r===0)return 0;const h=r<1&&a===514?.25/r:1;return 6*Math.pow(1.5,22-u)*Math.max(r,1)*h}function Ch(u,r){const a=1<<u.z;return!r&&(u.x===0||u.x===a-1)||u.y===0||u.y===a-1}const fl=u=>({u_matrix:u});function ml(u,r,a,h,f){if(f>0){const m=s.e.now(),g=(m-u.timeAdded)/f,x=r?(m-r.timeAdded)/f:-1,w=a.getSource(),T=h.coveringZoomLevel({tileSize:w.tileSize,roundZoom:w.roundZoom}),M=!r||Math.abs(r.tileID.overscaledZ-T)>Math.abs(u.tileID.overscaledZ-T),A=M&&u.refreshedUponExpiration?1:s.at(M?g:1-x,0,1);return u.refreshedUponExpiration&&g>=1&&(u.refreshedUponExpiration=!1),r?{opacity:1,mix:1-A}:{opacity:A,mix:0}}return{opacity:1,mix:0}}class Xo extends Ks{constructor(r,a,h,f){super(r,a,h,f),this.type="raster-array",this.maxzoom=22,this._options=s.W({type:"raster-array"},a)}triggerRepaint(r){const a=this.map.painter._terrain,h=this.map.style.getSourceCache(this.id);a&&a.enabled&&h&&a._clearRenderCacheForTile(h.id,r.tileID),this.map.triggerRepaint()}loadTile(r,a){const h=this.map._requestManager.normalizeTileURL(r.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),f=this.map._requestManager.transformRequest(h,s.R.Tile);r.requestParams=f,r.actor||(r.actor=this.dispatcher.getActor()),r.request=r.fetchHeader(void 0,(m,g,x,w)=>{if(delete r.request,r.aborted)return r.state="unloaded",a(null);if(m)return m.code===20?void 0:(r.state="errored",a(m));this.map._refreshExpiredTiles&&r.setExpiryData({cacheControl:x,expires:w}),r.state="empty",a(null)})}unloadTile(r,a){const h=r.texture;h&&h instanceof s.T?(r.destroy(!0),this.map.painter.saveTileTexture(h)):(r.destroy(),r.flushQueues(),r._isHeaderLoaded=!1,delete r._mrt,delete r.textureDescriptor),r.fbo&&(r.fbo.destroy(),delete r.fbo),delete r.request,delete r.requestParams,delete r.neighboringTiles,r.state="unloaded"}prepareTile(r,a,h){r._isHeaderLoaded&&(r.state!=="empty"&&(r.state="reloading"),r.fetchBand(a,h,(f,m)=>{if(f)return r.state="errored",this.fire(new s.d(f)),void this.triggerRepaint(r);m&&(r.setTexture(m,this.map.painter),r.state="loaded",this.triggerRepaint(r))}))}getInitialBand(r){if(!this.rasterLayers)return 0;const a=this.rasterLayers.find(({id:m})=>m===r),h=a&&a.fields,f=h&&h.bands&&h.bands;return f?f[0]:0}getTextureDescriptor(r,a,h){if(!r)return;const f=a.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!f)return;let m=null;a instanceof s.bk?m=a.paint.get("raster-array-band"):a instanceof s.bl&&(m=a.paint.get("raster-particle-array-band"));const g=m||this.getInitialBand(f);if(g!=null)if(r.textureDescriptor){if(!r.updateNeeded(f,g)||h)return Object.assign({},r.textureDescriptor,{texture:r.texture})}else this.prepareTile(r,f,g)}}const _l={vector:ll,raster:Ks,"raster-dem":class extends Ks{constructor(u,r,a,h){super(u,r,a,h),this.type="raster-dem",this.maxzoom=22,this._options=s.W({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}loadTile(u,r){const a=this.map._requestManager.normalizeTileURL(u.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize);function h(f,m){f&&(u.state="errored",r(f)),m&&(u.dem=m,u.dem.onDeserialize(),u.needsHillshadePrepare=!0,u.needsDEMTextureUpload=!0,u.state="loaded",r(null))}u.request=s.h(this.map._requestManager.transformRequest(a,s.R.Tile),(function(f,m,g,x){if(delete u.request,u.aborted)u.state="unloaded",r(null);else if(f)u.state="errored",r(f);else if(m){this.map._refreshExpiredTiles&&u.setExpiryData({cacheControl:g,expires:x});const w=ImageBitmap&&m instanceof ImageBitmap&&s.bi(),T=1-(m.width-s.bj(m.width))/2;T<1||u.neighboringTiles||(u.neighboringTiles=this._getNeighboringTiles(u.tileID));const M=w?m:s.e.getImageData(m,T),A={uid:u.uid,coord:u.tileID,source:this.id,scope:this.scope,rawImageData:M,encoding:this.encoding,padding:T};u.actor&&u.state!=="expired"||(u.actor=this.dispatcher.getActor(),u.actor.send("loadDEMTile",A,h.bind(this),void 0,!0))}}).bind(this))}_getNeighboringTiles(u){const r=u.canonical,a=Math.pow(2,r.z),h=(r.x-1+a)%a,f=r.x===0?u.wrap-1:u.wrap,m=(r.x+1+a)%a,g=r.x+1===a?u.wrap+1:u.wrap,x={};return x[new s.aL(u.overscaledZ,f,r.z,h,r.y).key]={backfilled:!1},x[new s.aL(u.overscaledZ,g,r.z,m,r.y).key]={backfilled:!1},r.y>0&&(x[new s.aL(u.overscaledZ,f,r.z,h,r.y-1).key]={backfilled:!1},x[new s.aL(u.overscaledZ,u.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},x[new s.aL(u.overscaledZ,g,r.z,m,r.y-1).key]={backfilled:!1}),r.y+1<a&&(x[new s.aL(u.overscaledZ,f,r.z,h,r.y+1).key]={backfilled:!1},x[new s.aL(u.overscaledZ,u.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},x[new s.aL(u.overscaledZ,g,r.z,m,r.y+1).key]={backfilled:!1}),x}},"raster-array":Xo,geojson:class extends s.E{constructor(u,r,a,h){super(),this.id=u,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._loaded=!1,this.actor=a.getActor(),this.setEventedParent(h),this._data=r.data,this._options=s.W({},r),this._collectResourceTiming=r.collectResourceTiming,r.maxzoom!==void 0&&(this.maxzoom=r.maxzoom),r.minzoom!==void 0&&(this.minzoom=r.minzoom),r.type&&(this.t
2215ype=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;const f=s.a3/this.tileSize;this.workerOptions=s.W({source:this.id,scope:this.scope,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(r.buffer!==void 0?r.buffer:128)*f,tolerance:(r.tolerance!==void 0?r.tolerance:.375)*f,extent:s.a3,maxZoom:this.maxzoom,lineMetrics:r.lineMetrics||!1,generateId:r.generateId||!1},superclusterOptions:{maxZoom:r.clusterMaxZoom!==void 0?r.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,r.clusterMinPoints||2),extent:s.a3,radius:(r.clusterRadius!==void 0?r.clusterRadius:50)*f,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter,dynamic:r.dynamic},r.workerOptions)}onAdd(u){this.map=u,this.setData(this._data)}setData(u){return this._data=u,this._updateWorkerData(),this}updateData(u){return this._options.dynamic?typeof u!="string"&&(u.type==="Feature"&&(u={type:"FeatureCollection",features:[u]}),u.type!=="FeatureCollection")?this.fire(new s.d(new Error("Data to update should be a feature or a feature collection."))):(this._coalesce&&typeof u!="string"&&typeof this._data!="string"&&this._data.type==="FeatureCollection"?this._data.features.push(...u.features):this._data=u,this._updateWorkerData(!0),this):this.fire(new s.d(new Error("Can't call updateData on a GeoJSON source with dynamic set to false.")))}getClusterExpansionZoom(u,r){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:u,source:this.id,scope:this.scope},r),this}getClusterChildren(u,r){return this.actor.send("geojson.getClusterChildren",{clusterId:u,source:this.id,scope:this.scope},r),this}getClusterLeaves(u,r,a,h){return this.actor.send("geojson.getClusterLeaves",{source:this.id,scope:this.scope,clusterId:u,limit:r,offset:a},h),this}_updateWorkerData(u=!1){if(this._pendingLoad)return void(this._coalesce=!0);this.fire(new s.f("dataloading",{dataType:"source"})),this._loaded=!1;const r=s.W({append:u},this.workerOptions);r.scope=this.scope;const a=this._data;typeof a=="string"?(r.request=this.map._requestManager.transformRequest(s.e.resolveURL(a),s.R.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(a),this._pendingLoad=this.actor.send(`${this.type}.loadData`,r,(h,f)=>{if(this._loaded=!0,this._pendingLoad=null,h)this.fire(new s.d(h));else{const m={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&f&&f.resourceTiming&&f.resourceTiming[this.id]&&(m.resourceTiming=f.resourceTiming[this.id]),u&&(this._partialReload=!0),this.fire(new s.f("data",m)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(u),this._coalesce=!1)})}loaded(){return this._loaded}loadTile(u,r){const a=u.actor?"reloadTile":"loadTile";u.actor=this.actor;const h=this.map.style?this.map.style.getLut(this.scope):null,f=this._partialReload,m={type:this.type,uid:u.uid,tileID:u.tileID,tileZoom:u.tileZoom,zoom:u.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:h?{image:h.image.clone()}:null,scope:this.scope,pixelRatio:s.e.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,partial:f};u.request=this.actor.send(a,m,(g,x)=>f&&!x?(u.state="loaded",r(null)):(delete u.request,u.destroy(),u.aborted?r(null):g?r(g):(u.loadVectorData(x,this.map.painter,a==="reloadTile"),r(null))),void 0,a==="loadTile")}abortTile(u){u.request&&(u.request.cancel(),delete u.request),u.aborted=!0}unloadTile(u,r){this.actor.send("removeTile",{uid:u.uid,type:this.t
2215ype,source:this.id,scope:this.scope}),u.destroy()}onRemove(u){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return s.W({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends s.bm{constructor(u,r,a,h){super(u,r,a,h),this.roundZoom=!0,this.type="video",this.options=r}load(){this._loaded=!1;const u=this.options;this.urls=[];for(const r of u.urls)this.urls.push(this.map._requestManager.transformRequest(r,s.R.Source).url);s.bn(this.urls,(r,a)=>{this._loaded=!0,r?this.fire(new s.d(r)):a&&(this.video=a,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(u){if(this.video){const r=this.video.seekable;u<r.start(0)||u>r.end(0)?this.fire(new s.d(new s.V(`sources.${this.id}`,null,`Playback for this video can be set only between the ${r.start(0)} and ${r.end(0)}-second mark.`))):this.video.currentTime=u}}getVideo(){return this.video}onAdd(u){this.map||(this.map=u,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 u=this.map.painter.context,r=u.gl;this.texture?this.video.paused||(this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),r.texSubImage2D(r.TEXTURE_2D,0,0,0,r.RGBA,r.UNSIGNED_BYTE,this.video)):(this.texture=new s.T(u,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(u)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:s.bm,model:class extends s.E{constructor(u,r,a,h){super(),this.id=u,this.type="model",this.models=[],this._loaded=!1,this._options=r}load(){const u=[];for(const r in this._options.models){const a=this._options.models[r],h=s.l(this.map._requestManager.transformRequest(a.uri,s.R.Model).url).then(f=>{if(!f)return;const m=s.c(f),g=new s.M(r,a.position,a.orientation,m);g.computeBoundsAndApplyParent(),this.models.push(g)}).catch(f=>{this.fire(new s.d(new Error(`Could not load model ${r} from ${a.uri}: ${f.message}`)))});u.push(h)}return Promise.allSettled(u).then(()=>{this._loaded=!0,this.fire(new s.f("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(r=>{this.fire(new s.d(new Error(`Could not load models: ${r.message}`)))})}onAdd(u){this.map=u,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(u,r){}serialize(){return{type:"model"}}},"batched-model":class extends s.E{constructor(u,r,a,h){super(),this.type="batched-model",this.id=u,this.tileSize=512,this._options=r,this.tiles=this._options.tiles,this.maxzoom=r.maxzoom||19,this.minzoom=r.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=a,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(h)}onAdd(u){this.map=u,this.load()}load(u){this._loaded=!1,this.fire(new s.f("dataloading",{dataType:"source"}));const r=Array.isArray(this.map._language)?this.map._language.join():this.map._language,a=this.map._worldview;this._tileJSONRequest=Lc(this._options,this.map._requestManager,r,a,(h,f)=>{this._tileJSONRequest=null,this._loaded=!0,h?(r&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${r}`),a&&a.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${a}`),this.fire(new s.d(h))):f&&(s.W(this,f),f.bounds&&(this.tileBounds=new Ys(f.bounds,this.minzoom,this.maxzoom)),s.an(f.tiles,this.map._requestManager._customAccessToken),this.fire(new s.f("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.f("data",{dataType:"source",sourceDataType:"content"}))),u&&u(h)})}hasTransition(){return!1}hasTile(u){return!this.tileBounds||this.tileBounds.contains(u.canonical)}loaded(){return this._loaded}loadTile(u,r){const a=this.map._requestManager.normalizeTileURL(u.tileID.canonical.url(this.tiles,this.scheme)),h={request:this.map._requestManager.transformRequest(a,s.R.Tile),data:void 0,uid:u.uid,tileID:u.tileID,tileZoom:u.tileZoom,zoom:u.tileID.overscaledZ,tileSize:this.tileSize*u.tileID.overscaleFactor(),type:this.t
2215ype,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:u.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0};if(u.actor&&u.state!=="expired")if(u.state==="loading")u.reloadCallback=r;else{if(u.buckets){const m=Object.values(u.buckets);for(const g of m)g.dirty=!0;return void(u.state="loaded")}u.request=u.actor.send("reloadTile",h,f.bind(this))}else u.actor=this.dispatcher.getActor(),u.request=u.actor.send("loadTile",h,f.bind(this),void 0,!0);function f(m,g){return u.aborted?r(null):m&&m.status!==404?r(m):(g&&(g.resourceTiming&&(u.resourceTiming=g.resourceTiming),this.map._refreshExpiredTiles&&u.setExpiryData(g),u.buckets={...u.buckets,...g.buckets},g.featureIndex&&(u.latestFeatureIndex=g.featureIndex)),u.state="loaded",void r(null))}}serialize(){return s.W({},this._options)}},canvas:class extends s.bm{constructor(u,r,a,h){super(u,r,a,h),r.coordinates?Array.isArray(r.coordinates)&&r.coordinates.length===4&&!r.coordinates.some(f=>!Array.isArray(f)||f.length!==2||f.some(m=>typeof m!="number"))||this.fire(new s.d(new s.V(`sources.${u}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new s.d(new s.V(`sources.${u}`,null,'missing required property "coordinates"'))),r.animate&&typeof r.animate!="boolean"&&this.fire(new s.d(new s.V(`sources.${u}`,null,'optional "animate" property must be a boolean value'))),r.canvas?typeof r.canvas=="string"||r.canvas instanceof HTMLCanvasElement||this.fire(new s.d(new s.V(`sources.${u}`,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.d(new s.V(`sources.${u}`,null,'missing required property "canvas"'))),this.options=r,this.animate=r.animate===void 0||r.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new s.d(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(u){this.map=u,this.load(),this.canvas&&this.animate&&this.play()}onRemove(u){this.pause()}prepare(){let u=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,u=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,u=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const r=this.map.painter.context;this.texture?!u&&!this._playing||this.texture instanceof s.bo||this.texture.update(this.canvas,{premultiply:!0}):this.texture=new s.T(r,this.canvas,r.gl.RGBA,{premultiply:!0}),this._prepareData(r)}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const u of[this.canvas.width,this.canvas.height])if(isNaN(u)||u<=0)return!0;return!1}},custom:class extends s.E{constructor(u,r,a,h){super(),this.id=u,this.type="custom",this._dataType="raster",this._dispatcher=a,this._implementation=r,this.setEventedParent(h),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new s.d(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new s.d(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Ys(this._implementation.bounds,this.minzoom,this.maxzoom)),r.update=this._update.bind(this),r.clearTiles=this._clearTiles.bind(this),r.coveringTiles=this._coveringTiles.bind(this),s.W(this,s.ah(r,["dataType","scheme","minzoom","maxzoom","tileSize","attribution","minTileCacheSize","maxTileCacheSize"]))}serialize(){return s.ah(this,["type","scheme","minzoom","maxzoom","tileSize","attribution"])}load(){this._loaded=!0,this.fire(new s.f("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new s.f("data",{dataType:"source",sourceDataType:"content"}))}loaded(){return this._loaded}onAdd(u){this.map=u,this._loaded=!1,this.fire(new s.f("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(u),this.load()}onRemove(u){this._implementation.onRemove&&this._implementation.onRemove(u)}hasTile(u){if(this._implementation.hasTile){const{x:r,y:a,z:h}=u.canonical;return this._implementation.hasTile({x:r,y:a,z:h})}return!this.tileBounds||this.tileBounds.contains(u.canonical)}loadTile(u,r){const{x:a,y:h,z:f}
2215=u.tileID.canonical,m=new AbortController;u.request=Promise.resolve(this._implementation.loadTile({x:a,y:h,z:f},{signal:m.signal})).then((function(g){return delete u.request,u.aborted?(u.state="unloaded",r(null)):g===void 0?(u.state="errored",r(null)):g===null?(this.loadTileData(u,{width:this.tileSize,height:this.tileSize,data:null}),u.state="loaded",r(null)):function(x){return x instanceof ImageData||x instanceof HTMLCanvasElement||x instanceof ImageBitmap||x instanceof HTMLImageElement}(g)?(this.loadTileData(u,g),u.state="loaded",void r(null)):(u.state="errored",r(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(g=>{g.code!==20&&(u.state="errored",r(g))}),u.request.cancel=()=>m.abort()}loadTileData(u,r){u.setTexture(r,this.map.painter)}unloadTile(u,r){if(u.texture&&u.texture instanceof s.T?(u.destroy(!0),u.texture&&u.texture instanceof s.T&&this.map.painter.saveTileTexture(u.texture)):u.destroy(),this._implementation.unloadTile){const{x:a,y:h,z:f}=u.tileID.canonical;this._implementation.unloadTile({x:a,y:h,z:f})}r&&r()}abortTile(u,r){u.request&&u.request.cancel&&(u.request.cancel(),delete u.request),r&&r()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(u=>({x:u.canonical.x,y:u.canonical.y,z:u.canonical.z}))}_clearTiles(){const u=s.al(this.id,this.scope);this.map.style.clearSource(u)}_update(){this.fire(new s.f("data",{dataType:"source",sourceDataType:"content"}))}}},Oi=function(u,r,a,h){const f=new _l[r.type](u,r,a,h);if(f.id!==u)throw new Error(`Expected Source id to be ${u} instead of ${f.id}`);return s.bp(["load","abort","unload","serialize","prepare"],f),f};class Ph extends s.bv{constructor(r){const a={type:"raster-dem",maxzoom:r.transform.maxZoom},h=new s.bw(s.bx(),null),f=Oi("mock-dem",a,h,r.style);super("mock-dem",f,!1),f.setEventedParent(this),this._sourceLoaded=!0}_loadTile(r,a){r.state="loaded",a(null)}}class Gc extends s.bv{constructor(r){const a=Oi("proxy",{type:"geojson",maxzoom:r.transform.maxZoom},new s.bw(s.bx(),null),r.style);super("proxy",a,!1),a.setEventedParent(this),this.map=this.getSource().map=r,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(r,a,h){if(r.freezeTileCoverage)return;this.transform=r;const f=r.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((m,g)=>{if(m[g.key]="",!this._tiles[g.key]){const x=new s.by(g,this._source.tileSize*g.overscaleFactor(),r.tileZoom);x.state="loaded",this._tiles[g.key]=x}return m},{});for(const m in this._tiles)m in f||(this.freeFBO(m),this._tiles[m].unloadVectorData(),delete this._tiles[m])}freeFBO(r){const a=this.proxyCachedFBO[r];if(a!==void 0){const h=Object.values(a);this.renderCachePool.push(...h),delete this.proxyCachedFBO[r]}}deallocRenderCache(){this.renderCache.forEach(r=>r.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class qc extends s.aL{constructor(r,a,h){super(r.overscaledZ,r.wrap,r.canonical.z,r.canonical.x,r.canonical.y),this.proxyTileKey=a,this.projMatrix=h}}class Zc extends s.bq{constructor(r,a){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},r.tp.registerParameter(this._debugParams,["Terrain"],"sortTilesHiZFirst",{},()=>{this._style.map.triggerRepaint()}),r.tp.registerParameter(this._debugParams,["Terrain"],"disableRenderCache",{},()=>{this._style.map.triggerRepaint()}),r.tp.registerButton(["Terrain"],"Invalidate Render Cache",()=>{this.invalidateRenderCache=!0,this._style.map.triggerRepaint()}),this.painter=r,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[h,f,m]=function(w){const T=new s.bt,M=new s.bu,A=131;T.reserve(17161),M.reserve(33800);const P=s.a3/128,z=s.a3+P/2,R=z+P;for(let O=-P;O<R;O+=P)for(let B=-P;B<R;B+=P){const G=B<0||B>z||O<0||O>
vendor: 5,525 bytes, lines 2215-2216
2215z?24575:0,q=s.at(Math.round(B),0,s.a3),Z=s.at(Math.round(O),0,s.a3);T.emplaceBack(q+G,Z)}const k=(O,B)=>{const G=B*A+O;M.emplaceBack(G+1,G,G+A),M.emplaceBack(G+A,G+A+1,G+1)};for(let O=1;O<129;O++)for(let B=1;B<129;B++)k(B,O);return[0,129].forEach(O=>{for(let B=0;B<130;B++)k(B,O),k(O,B)}),[T,M,32768]}(),g=r.context;this.gridBuffer=g.createVertexBuffer(h,s.br.members),this.gridIndexBuffer=g.createIndexBuffer(f),this.gridSegments=s.b.simpleSegment(0,0,h.length,f.length),this.gridNoSkirtSegments=s.b.simpleSegment(0,0,h.length,m),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new Gc(a.map),this.orthoMatrix=s.ad.create(),s.ad.ortho(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,s.a3,0,s.a3,0,1);const x=g.gl;this._overlapStencilMode=new s.ag({func:x.GEQUAL,mask:255},0,255,x.KEEP,x.KEEP,x.REPLACE),this._previousZoom=r.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=a,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Ph(a.map),this._pendingGroundEffectLayers=[]}set style(r){r.on("data",this._onStyleDataEvent.bind(this)),this._style=r,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(r,a,h){if(r&&r.terrain){this._style!==r&&(this.style=r,this._evaluationZoom=void 0);const f=r.terrain.properties,m=r.terrain.drapeRenderMode===0,g=r.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=s.e.now();const x=r.terrain&&r.terrain.scope,w=f.get("source"),T=m?this._mockSourceCache:r.getSourceCache(w,x);if(!T)return void s.w(`Couldn't find terrain source "${w}".`);if(this.sourceCache=T,this._exaggeration=g?this.calculateExaggeration(a):f.get("exaggeration"),!a.projection.requiresDraping&&g&&this._exaggeration===0)return void this._disable();this.enabled=!0;const M=()=>{this.sourceCache.used&&s.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source.
2216This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const A=this.getScaledDemTileSize();this.sourceCache.update(a,A,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,M(),this._initializing=!0),M(),a.updateElevation(!0,h),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(a),this._emptyDEMTextureDirty=!0,this._previousZoom=a.zoom}else this._disable()}calculateExaggeration(r){const a=this._previousCameraAltitude,h=r.getFreeCameraOptions().position.z/r.pixelsPerMeter*r.worldSize;this._previousCameraAltitude=h;const f=a!=null?h-a:Number.MAX_VALUE;if(Math.abs(f)<2)return this._exaggeration;const m=r.zoom,g=this._style.terrain;if(!this._previousUpdateTimestamp)return g.getExaggeration(m);let x=m-this._previousZoom;const w=this._previousUpdateTimestamp;let T=m;this._evaluationZoom!=null&&(T=this._evaluationZoom,Math.abs(m-T)>.5&&(x=.5*(m-T+x)),x*f<0&&(T+=x)),this._evaluationZoom=T;const M=g.getExaggeration(T),A=M===g.getExaggeration(Math.max(0,T-.1));if(A&&Math.abs(M-this._exaggeration)<.01)return M;let P=Math.min(.1,.00375*(this._updateTimestamp-w));return(A||M<.1||Math.abs(x)<1e-4)&&(P=Math.min(.2,4*P)),s.a2(this._exaggeration,M,P)}resetTileLookupCache(r){this._findCoveringTileCache[r]={}}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(r){r.coord&&r.dataType==="source"?this._clearRenderCacheForTile(r.sourceCacheId,r.coord):r.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 r in this._style._mergedSourceCaches)this._style._mergedSourceCaches[r].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this._emptyDepthBufferTexture&&this._emptyDepthBufferTexture.destroy(),this.pool.forEach(r=>r.fb.destroy()),this.pool=[],this._depthFBO&&(this._depthFBO.destroy(),this._depthFBO=void 0,this._depthTexture=void 0),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 r=2*this.proxySourceCache.getSource().tileSize;return[r,r]}set useVertexMorphing(r){this._useVertexMorphing=r}updateTileBinding(r){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const a=this.proxySourceCache,h=this.painter.transform;this._initializing&&(this._initializing=h._centerAltitude===0&&this.getAtPointOrZero(s.Y.fromLngLat(h.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const f=this.proxyCoords=a.getIds().map(w=>{const T=a.getTileByID(w).tileID;return T.projMatrix=h.calculateProjMatrix(T.toUnwrapped()),T});(function(w,T){const M=T.transform.pointCoordinate(T.transform.getCameraPoint()),A=new s.P(M.x,M.y);w.sort((P,z)=>
2216{if(z.overscaledZ-P.overscaledZ)return z.overscaledZ-P.overscaledZ;const R=new s.P(P.canonical.x+(1<<P.canonical.z)*P.wrap,P.canonical.y),k=new s.P(z.canonical.x+(1<<z.canonical.z)*z.wrap,z.canonical.y),O=A.mult(1<<P.canonical.z);return O.x-=.5,O.y-=.5,O.distSqr(R)-O.distSqr(k)})})(f,this.painter);const m=this.proxyToSource||{};this.proxyToSource={},f.forEach(w=>{this.proxyToSource[w.key]={}}),this.terrainTileForTile={};const g=this._style._mergedSourceCaches;for(const w in g){const T=g[w];if(!T.used||(T!==this.sourceCache&&this.resetTileLookupCache(T.id),this._setupProxiedCoordsForOrtho(T,r[w],m),T.usedForTerrain))continue;const M=r[w];T.getSource().reparseOverscaled&&this._assignTerrainTiles(M)}this.proxiedCoords[a.id]=f.map(w=>new qc(w,w.key,this.orthoMatrix)),this._assignTerrainTiles(f),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(m),this.renderingToTexture=!1;const x={};this._visibleDemTiles=[];for(const w of this.proxyCoords){const T=this.terrainTileForTile[w.key];if(!T)continue;const M=T.tileID.key;M in x||(this._visibleDemTiles.push(T),x[M]=M)}}_assignTerrainTiles(r){this._initializing||r.forEach(a=>{if(this.terrainTileForTile[a.key])return;const h=this._findTileCoveringTileID(a,this.sourceCache);h&&(this.terrainTileForTile[a.key]=h)})}_prepareDEMTextures(){const r=this.painter.context,a=r.gl;for(const h in this.terrainTileForTile){const f=this.terrainTileForTile[h],m=f.dem;!m||f.demTexture&&!f.needsDEMTextureUpload||(r.activeTexture.set(a.TEXTURE1),Dc(this.painter,f,m))}}_prepareDemTileUniforms(r,a,h,f){if(!a||a.demTexture==null)return!1;const m=r.tileID.canonical,g=Math.pow(2,a.tileID.canonical.z-m.z),x=f||"";return h[`u_dem_tl${x}`]=[m.x*g%1,m.y*g%1],h[`u_dem_scale${x}`]=g,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}get emptyDepthBufferTexture(){const r=this.painter.context,a=r.gl;if(!this._emptyDepthBufferTexture){const h=new s.i({width:1,height:1},Uint8Array.of(255,255,255,255));this._emptyDepthBufferTexture=new s.T(r,h,a.RGBA,{premultiply:!1})}return this._emptyDepthBufferTexture}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let r=0;const a=this._visibleDemTiles.reduce((h,f)=>{if(!f.dem)return h;const m=f.dem.tree.minimums[0];return m>0&&r++,h+m},0);return r?a/r:0}_updateEmptyDEMTexture(){const r=this.painter.context,a=r.gl;r.activeTexture.set(a.TEXTURE2);const h=this._getLoadedAreaMinimum(),[f,m]=(()=>{const x=new s.bz({width:1,height:1},new Float32Array([h]));return[a.R32F,x]})();this._emptyDEMTextureDirty=!1;let g=this._emptyDEMTexture;return g?g.update(m,{premultiply:!1}):g=this._emptyDEMTexture=new s.T(r,m,f,{premultiply:!1}),g}setupElevationDraw(r,a,h){const f=this.painter.context,m=f.gl,g={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:[2,0],u_exaggeration:0};g.u_exaggeration=this.exaggeration();let x=null,w=null,T=1;if(h&&h.morphing&&this._useVertexMorphing){const R=h.morphing.srcDemTile,k=h.morphing.dstDemTile;T=h.morphing.phase,R&&k&&(this._prepareDemTileUniforms(r,R,g,"_prev")&&(w=R),this._prepareDemTileUniforms(r,k,g)&&(x=k))}const M=R=>R&&R.demTexture&&this.painter.linearFloatFilteringSupported()?m.LINEAR:m.NEAREST;let A=null;var P,z;if(this.enabled?w&&x?(A=x.demTexture,f.activeTexture.set(m.TEXTURE4),w.demTexture.bind(M(w),m.CLAMP_TO_EDGE),g.u_dem_lerp=T):(x=this.terrainTileForTile[r.tileID.key],A=this._prepareDemTileUniforms(r,x,g)?x.demTexture:this.emptyDEMTexture):A=this.emptyDEMTexture,f.activeTexture.set(m.TEXTURE2),A&&(g.u_dem_size=(P=A).size[0]===1?1:P.size[0]-2,A.bind(M(x),m.CLAMP_TO_EDGE)),f.activeTexture.set(m.TEXTURE3),h&&h.useDepthForOcclusion&&this.painter.terrainDepthTexture&&this.painter.terrainDepthFBO?(this.painter.terrainDepthTexture.bind(m.NEAREST,m.CLAMP_TO_EDGE),g.u_depth_size_inv=[1/this.painter.terrainDepthFBO.width,1/this.painter.terrainDepthFBO.height],g.u_depth_range_unpack=[2/((z=this.painter.depthRangeFor3D)[1]-z[0]),-1-2*z[0]/(z[1]-z[0])]):(this.empty
vendor: 16,191 bytes, line 2216
2216DepthBufferTexture.bind(m.NEAREST,m.CLAMP_TO_EDGE),g.u_depth_range_unpack=[2,0]),f.activeTexture.set(m.TEXTURE0),h&&h.useMeterToDem&&x){const R=(1<<x.tileID.canonical.z)*s.ax(1,this.painter.transform.center.lat)*this.sourceCache.getSource().tileSize;g.u_meter_to_dem=R}if(h&&h.labelPlaneMatrixInv&&(g.u_label_plane_matrix_inv=h.labelPlaneMatrixInv),a.setTerrainUniformValues(f,g),this.painter.transform.projection.name==="globe"){const R=this.globeUniformValues(this.painter.transform,r.tileID.canonical,h&&h.useDenormalizedUpVectorScale);a.setGlobeUniformValues(f,R)}}globeUniformValues(r,a,h){const f=r.projection;return{u_tile_tl_up:f.upVector(a,0,0),u_tile_tr_up:f.upVector(a,s.a3,0),u_tile_br_up:f.upVector(a,s.a3,s.a3),u_tile_bl_up:f.upVector(a,0,s.a3),u_tile_up_scale:h?s.bs(1):f.upVectorScale(a,r.center.lat,r.worldSize).metersToTile}}renderToBackBuffer(r){const a=this.painter,h=this.painter.context;r.length!==0&&(h.bindFramebuffer.set(null),h.viewport.set([0,0,a.width,a.height]),a.gpuTimingDeferredRenderStart(),this.renderingToTexture=!1,function(f,m,g,x,w){if(f.transform.projection.name==="globe")(function(T,M,A,P,z){const R=T.context,k=R.gl;let O,B;const G=T.transform,q=s.ba(T,R,G),Z=(Q,fe)=>{if(B===fe)return;const Me=[jc[fe],"PROJECTION_GLOBE_VIEW"];q&&Me.push("CUSTOM_ANTIALIASING");const Ie=T.isTileAffectedByFog(Q);O=T.getOrCreateProgram("globeRaster",{defines:Me,overrideFog:Ie}),B=fe},K=T.colorModeForRenderPass(),Y=new s.ae(k.LEQUAL,s.ae.ReadWrite,T.depthRangeFor3D);zn.update(z);const te=s.bb(G),N=[s.aj(G.center.lng),s.ak(G.center.lat)],$=T.globeSharedBuffers,re=[G.width*s.e.devicePixelRatio,G.height*s.e.devicePixelRatio],de=Float32Array.from(G.globeMatrix),se={useDenormalizedUpVectorScale:!0};{const Q=T.transform,fe=ta(Q.zoom,M.exaggeration(),M.sourceCache._source.tileSize);B=-1;const Me=k.TRIANGLES;for(const Ie of P){const Se=A.getTile(Ie),le=s.ag.disabled,_e=M.prevTerrainTileForTile[Ie.key],we=M.terrainTileForTile[Ie.key];Ho(_e,we)&&zn.newMorphing(Ie.key,_e,we,z,250),R.activeTexture.set(k.TEXTURE0),Se.texture&&Se.texture.bind(k.LINEAR,k.CLAMP_TO_EDGE);const Ve=zn.getMorphValuesForProxy(Ie.key),Ue=Ve?1:0;Ve&&s.o(se,{morphing:{srcDemTile:Ve.from,dstDemTile:Ve.to,phase:s.b9(Ve.phase)}});const qe=s.bc(Ie.canonical),je=s.bd(qe.getCenter().lat),Be=s.be(Ie.canonical,qe,je,Q.worldSize/Q._pixelsPerMercatorPixel),ve=s.bf(s.bg(Ie.canonical)),He=Ge(Q.expandedFarZProjMatrix,de,te,ve,s.a1(Q.zoom),N,Q.frustumCorners.TL,Q.frustumCorners.TR,Q.frustumCorners.BR,Q.frustumCorners.BL,Q.globeCenterInViewSpace,Q.globeRadius,re,fe,Q._farZ,Be);if(Z(Ie,Ue),O&&(M.setupElevationDraw(Se,O,se),T.uploadCommonUniforms(R,O,Ie.toUnwrapped()),$)){const[yt,it,ht]=$.getGridBuffers(je,fe!==0);O.draw(T,Me,Y,le,K,s.af.backCCW,He,"globe_raster",yt,it,ht)}}}if($&&(T.renderDefaultNorthPole||T.renderDefaultSouthPole)){const Q=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];q&&Q.push("CUSTOM_ANTIALIASING"),O=T.getOrCreateProgram("globeRaster",{defines:Q});for(const fe of P){const{x:Me,y:Ie,z:Se}=fe.canonical,le=Ie===0,_e=Ie===(1<<Se)-1,[we,Ve,Ue,qe]=$.getPoleBuffers(Se,!1);if(qe&&(le||_e)){const je=A.getTile(fe);R.activeTexture.set(k.TEXTURE0),je.texture&&je.texture.bind(k.LINEAR,k.CLAMP_TO_EDGE);let Be=s.bh(Se,Me,G);const ve=s.bf(s.bg(fe.canonical)),He=(yt,it)=>yt.draw(T,k.TRIANGLES,Y,s.ag.disabled,K,s.af.disabled,Ge(G.expandedFarZProjMatrix,Be,Be,ve,0,N,G.frustumCorners.TL,G.frustumCorners.TR,G.frustumCorners.BR,G.frustumCorners.BL,G.globeCenterInViewSpace,G.globeRadius,re,0,G._farZ),"globe_pole_raster",it,Ue,qe);M.setupElevationDraw(je,O,se),T.uploadCommonUniforms(R,O,fe.toUnwrapped()),le&&T.renderDefaultNorthPole&&He(O,we),_e&&T.renderDefaultSouthPole&&(Be=s.ad.scale(s.ad.create(),Be,[1,-1,1]),He(O,Ve))}}}})(f,m,g,x,w);else{const T=f.context,M=T.gl;let A,P;const z=f.shadowRenderer,R=to(f,f.longestCutoffRange),k=K=>{if(P===K)return;const Y=[];Y.push(jc[K]),R.shouldRenderCutoff&&Y.push("RENDER_CUTOFF"),A=f.getOrCreateProgram("terrainRaster",{defines:Y}),P=K},O=f.colorModeForRenderPass(),B=new s.ae(M.LEQUAL,s.ae.ReadWrite,f.depthRangeFor3D);zn.update(w);const G=f.transform,q=ta(G.zoom,m.exaggeration(),m.sourceCache._source.tileSize);let Z=[0,0,0];if(z){const K=f.style.directionalLight,Y=f.style.ambientLight;K&&Y&&(Z=Wo(f.style,K,Y))}{P=-1;const K=M.TRIANGLES,[Y,te]=[m.gridIndexBuffer,m.gridSegments];for(const N of x){const $=g.getTile(N),re=s.ag.disabled,de=m.prevTerrainTileForTile[N.key],se=m.terrainTileForTile[N.key];Ho(de,se)&&zn.newMorphing(N.key,de,se,w,250),T.activeTexture.set(M.TEXTURE0),$.texture&&$.texture.bind(M.LINEAR,M.CLAMP_TO_EDGE);const Q=zn.getMorphValuesForProxy(N.key),fe=Q?1:0;let Me;Q&&(Me={morphing:{srcDemTile:Q.from,dstDemTile:Q.to,phase:s.b9(Q.phase)}});const Ie=$o(N.projMatrix,Ch(N.canonical,G.renderWorldCopies)?q/10:q,Z);if(k(fe),!A)continue;m.setupElevationDraw($,A,Me);const Se=N.toUnwrapped();z&&z.setupShadows(Se,A),f.uploadCommonUniforms(T,A,Se,null,R),A.draw(f,K,B,re,O,s.af.backCCW,Ie,"terrain_raster",m.gridBuffer,Y,te)}}}}(a,this,this.proxySourceCache,r,this._updateTimestamp),this.renderingToTexture=!0,a.gpuTimingDeferredRenderEnd(),r.splice(0,r.length))}renderBatch(r){if(this._drapedRenderBatches.length===0)return r+1;this.renderingToTexture=!0;const a=this.painter,h=this.painter.context,f=this.proxySourceCache,m=this.proxiedCoords[f.id],g=this._drapedRenderBatches.shift(),x=a.style.order,w=[];let T=0;for(const M of m){const A=f.getTileByID(M.proxyTileKey),P=f.proxyCachedFBO[M.key]?f.proxyCachedFBO[M.key][r]:void 0,z=P!==void 0?f.renderCache[P]:this.pool[T++],R=P!==void 0;if(A.texture=z.tex,R&&!z.dirty){w.push(A.tileID);continue}let k;h.bindFramebuffer.set(z.fb.framebuffer),this.renderedToTile=!1,z.dirty&&(h.clear({color:s.C.transparent,stencil:0}),z.dirty=!1);for(let O=g.start;O<=g.end;++O){const B=a.style._mergedLayers[x[O]];if(B.isHidden(a.transform.zoom))continue;const G=a.style.getLayerSourceCache(B),q=G?this.proxyToSource[M.key][G.id]:[M];if(!q)continue;const Z=q;h.viewport.set([0,0,z.fb.width,z.fb.height]),k!==(G?G.id:null)&&(this._setupStencil(z,q,B,G),k=G?G.id:null),a.renderLayer(a,G,B,Z)}if(this._drapedRenderBatches.length===0)for(const O of this._pendingGroundEffectLayers){const B=a.style._mergedLayers[x[O]];if(B.isHidden(a.transform.zoom))continue;const G=a.style.getLayerSourceCache(B),q=G?this.proxyToSource[M.key][G.id]:[M];if(!q)continue;const Z=q;h.viewport.set([0,0,z.fb.width,z.fb.height]),k!==(G?G.id:null)&&(this._setupStencil(z,q,B,G),k=G?G.id:null),a.renderLayer(a,G,B,Z)}this.renderedToTile?(z.dirty=!0,w.push(A.tileID)):R||--T,T===5&&(T=0,this.renderToBackBuffer(w))}return this.renderToBackBuffer(w),this.renderingToTexture=!1,h.bindFramebuffer.set(null),h.viewport.set([0,0,a.width,a.height]),g.end+1}postRender(){}isLayerOrderingCorrect(r){const a=r.order.length;let h=-1,f=a;for(let m=0;m<a;++m)this._style.isLayerDraped(r._mergedLayers[r.order[m]])?h=Math.max(h,m):f=Math.min(f,m);return f>h}getMinElevationBelowMSL(){let r=0;return this._visibleDemTiles.filter(a=>a.dem).forEach(a=>{r=Math.min(r,a.dem.tree.minimums[0])}),r===0?r:(r-30)*this._exaggeration}raycast(r,a,h){if(!this._visibleDemTiles)return null;const f=this._visibleDemTiles.filter(m=>m.dem).map(m=>{const g=m.tileID,x=1<<g.overscaledZ,{x:w,y:T}=g.canonical,M=w/x,A=(w+1)/x,P=T/x,z=(T+1)/x;return{minx:M,miny:P,maxx:A,maxy:z,t:m.dem.tree.raycastRoot(M,P,A,z,r,a,h),tile:m}});f.sort((m,g)=>(m.t!==null?m.t:Number.MAX_VALUE)-(g.t!==null?g.t:Number.MAX_VALUE));for(const m of f){if(m.t==null)return null;const g=m.tile.dem.tree.raycast(m.minx,m.miny,m.maxx,m.maxy,r,a,h);if(g!=null)return g}return null}_createFBO(){const r=this.painter.context,a=r.gl,h=this.drapeBufferSize;r.activeTexture.set(a.TEXTURE0);const f=new s.T(r,{width:h[0],height:h[1],data:null},a.RGBA);f.bind(a.LINEAR,a.CLAMP_TO_EDGE);const m=r.createFramebuffer(h[0],h[1],!0,null);return m.colorAttachment.set(f.texture),m.depthAttachment=new Wn(r,m.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=r.createRenderbuffer(r.gl.DEPTH_STENCIL,h[0],h[1]),this._stencilRef=0,m.depthAttachment.set(this._sharedDepthStencil),r.clear({stencil:0})):m.depthAttachment.set(this._sharedDepthStencil),r.extTextureFilterAnisotropic&&a.texParameterf(a.TEXTURE_2D,r.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,r.extTextureFilterAnisotropicMax),{fb:m,tex:f,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 r in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[r].hasTransition())return!0;return this._style.order.some(r=>{const a=this._style._mergedLayers[r],h=a.isHidden(this.painter.transform.zoom);return a.type==="custom"?!h&&a.shouldRedrape():!h&&a.hasTransition()})}_clearLineLayersFromRenderCache(){let r=!1;for(const h of this._style.getSources())if(h instanceof ll){r=!0;break}if(!r)return;const a={};for(let h=0;h<this._style.order.length;++h){const f=this._style._mergedLayers[this._style.order[h]],m=this._style.getLayerSourceCache(f);if(m&&!a[m.id]&&!f.isHidden(this.painter.transform.zoom)&&f.type==="line"&&f.widthExpression()instanceof s.Z){a[m.id]=!0;for(const g of this.proxyCoords){const x=this.proxyToSource[g.key][m.id];if(x)for(const w of x)this._clearRenderCacheForTile(m.id,w)}}}}_clearRasterLayersFromRenderCache(){let r=!1;for(const h in this._style._mergedSourceCaches)if(this._style._mergedSourceCaches[h]._source instanceof Ks){r=!0;break}if(!r)return;const a={};for(let h=0;h<this._style.order.length;++h){const f=this._style._mergedLayers[this._style.order[h]],m=this._style.getLayerSourceCache(f);if(!m||a[m.id]||f.isHidden(this.painter.transform.zoom)||f.type!=="raster")continue;const g=f.paint.get("raster-fade-duration");for(const x of this.proxyCoords){const w=this.proxyToSource[x.key][m.id];if(w)for(const T of w){const M=ml(m.getTile(T),m.findLoadedParent(T,0),m,this.painter.transform,g);(M.opacity!==1||M.mix!==0)&&this._clearRenderCacheForTile(m.id,T)}}}}_setupDrapedRenderBatches(){const r=this._style.order,a=r.length;if(a===0)return;const h=[];this._pendingGroundEffectLayers=[];let f,m=0,g=this._style._mergedLayers[r[m]];for(;!this._style.isLayerDraped(g)&&g.isHidden(this.painter.transform.zoom)&&++m<a;)g=this._style._mergedLayers[r[m]];for(;m<a;++m){const x=this._style._mergedLayers[r[m]];x.isHidden(this.painter.transform.zoom)||(this._style.isLayerDraped(x)?f===void 0&&(f=m):(x.type==="fill-extrusion"&&this._pendingGroundEffectLayers.push(m),f!==void 0&&(h.push({start:f,end:m-1}),f=void 0)))}if(f!==void 0&&h.push({start:f,end:m-1}),h.length!==0){const x=h[h.length-1];this._pendingGroundEffectLayers.every(w=>w>x.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=h}_setupRenderCache(r){const a=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,a.renderCache.length>a.renderCachePool.length){const g=Object.values(a.proxyCachedFBO);a.proxyCachedFBO={};for(let x=0;x<g.length;++x){const w=Object.values(g[x]);a.renderCachePool.push(...w)}}return}this._clearRasterLayersFromRenderCache();const h=this.proxyCoords,f=this._tilesDirty;for(let g=h.length-1;g>=0;g--){const x=h[g];if(a.getTileByID(x.key),a.proxyCachedFBO[x.key]!==void 0){const w=r[x.key],T=this.proxyToSource[x.key];let M=0;for(const A in T){const P=T[A],z=w[A];if(!z||z.length!==P.length||P.some((R,k)=>R!==z[k]||f[A]&&f[A].hasOwnProperty(R.key))){M=-1;break}++M}for(const A in a.proxyCachedFBO[x.key])a.renderCache[a.proxyCachedFBO[x.key][A]].dirty=M<0||M!==Object.values(w).length}}const m=[...this._drapedRenderBatches];m.sort((g,x)=>x.end-x.start-(g.end-g.start));for(const g of m)for(const x of h){if(a.proxyCachedFBO[x.key])continue;let w=a.renderCachePool.pop();w===void 0&&a.renderCache.length<50&&(w=a.renderCache.length,a.renderCache.push(this._createFBO())),w!==void 0&&(a.proxyCachedFBO[x.key]={},a.proxyCachedFBO[x.key][g.start]=w,a.renderCache[w].dirty=!0)}this._tilesDirty={}}_setupStencil(r,a,h,f){if(!f||!this._sourceTilesOverlap[f.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const m=this.painter.context,g=m.gl;if(a.length<=1)return void(this._overlapStencilType=!1);let x;if(h.isTileClipped())x=a.length,this._overlapStencilMode.test={func:g.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(a[0].overscaledZ>a[a.length-1].overscaledZ))return void(this._overlapStencilType=!1);x=1,this._overlapStencilMode.test={func:g.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+x>255&&(m.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=x,this._overlapStencilMode.ref=this._stencilRef,h.isTileClipped()&&this._renderTileClippingMasks(a,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(r){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[r.key]),this._overlapStencilMode):s.ag.disabled}_renderTileClippingMasks(r,a){const h=this.painter,f=this.painter.context,m=f.gl;h._tileClippingMaskIDs={},f.setColorMode(s.a.disabled),f.setDepthMode(s.ae.disabled);const g=h.getOrCreateProgram("clippingMask");for(const x of r){const w=h._tileClippingMaskIDs[x.key]=--a;g.draw(h,m.TRIANGLES,s.ae.disabled,new s.ag({func:m.ALWAYS,mask:0},w,255,m.KEEP,m.KEEP,m.REPLACE),s.a.disabled,s.af.disabled,fl(x.projMatrix),"$clipping",h.tileExtentBuffer,h.quadTriangleIndexBuffer,h.tileExtentSegments)}}pointCoordinate(r){const a=this.painter.transform;if(r.x<0||r.x>a.width||r.y<0||r.y>a.height)return null;const h=[r.x,r.y,1,1];s.aA.transformMat4(h,h,a.pixelMatrixInverse),s.aA.scale(h,h,1/h[3]),h[0]/=a.worldSize,h[1]/=a.worldSize;const f=a._camera.position,m=s.ax(1,a.center.lat),g=[f[0],f[1],f[2]/m,0],x=s._.subtract([],h.slice(0,3),g);s._.normalize(x,x);const w=this.raycast(g,x,this._exaggeration);return w!==null&&w?(s._.scaleAndAdd(g,g,x,w),g[3]=g[2],g[2]*=m,g):null}_setupProxiedCoordsForOrtho(r,a,h){if(r.getSource()instanceof s.bm)return this._setupProxiedCoordsForImageSource(r,a,h);this._findCoveringTileCache[r.id]=this._findCoveringTileCache[r.id]||{};const f=this.proxiedCoords[r.id]=[],m=this.proxyCoords;for(let w=0;w<m.length;w++){const T=m[w],M=this._findTileCoveringTileID(T,r);if(M){const A=this._createProxiedId(T,M,h[T.key]&&h[T.key][r.id]);f.push(A),this.proxyToSource[T.key][r.id]=[A]}}let g=!1;const x=new Set;for(let w=0;w<a.length;w++){const T=r.getTile(a[w]);if(!T||!T.hasData())continue;const M=this._findTileCoveringTileID(T.tileID,this.proxySourceCache);if(M&&M.tileID.canonical.z!==T.tileID.canonical.z){const A=this.proxyToSource[M.tileID.key][r.id],P=this._createProxiedId(M.tileID,T,h[M.tileID.key]&&h[M.tileID.key][r.id]);A?A.splice(A.length-1,0,P):this.proxyToSource[M.tileID.key][r.id]=[P];const z=this.proxyToSource[M.tileID.key][r.id];x.has(z)||x.add(z),f.push(P),g=!0}}if(this._sourceTilesOverlap[r.id]=g,g&&this._debugParams.sortTilesHiZFirst)for(const w of x)w.sort((T,M)=>M.overscaledZ-T.overscaledZ)}_setupProxiedCoordsForImageSource(r,a,h){if(!r.getSource().loaded())return;const f=this.proxiedCoords[r.id]=[],m=this.proxyCoords,g=r.getSource(),x=g.tileID;if(!x)return;const w=new s.P(x.x,x.y)._div(1<<x.z),T=g.coordinates.map(s.Y.fromLngLat).reduce((A,P)=>(A.min.x=Math.min(A.min.x,P.x-w.x),A.min.y=Math.min(A.min.y,P.y-w.y),A.max.x=Math.max(A.max.x,P.x-w.x),A.max.y=Math.max(A.max.y,P.y-w.y),A),{min:new s.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new s.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),M=(A,P)=>{const z=A.wrap+A.canonical.x/(1<<A.canonical.z),R=A.canonical.y/(1<<A.canonical.z),k=s.a3/(1<<A.canonical.z),O=P.wrap+P.canonical.x/(1<<P.canonical.z),B=P.canonical.y/(1<<P.canonical.z);return z+k<O+T.min.x||z>O+T.max.x||R+k<B+T.min.y||R>B+T.max.y};for(let A=0;A<m.length;A++){const P=m[A];for(let z=0;z<a.length;z++){const R=r.getTile(a[z]);if(!R||!R.hasData()||M(P,R.tileID))continue;
2216const k=this._createProxiedId(P,R,h[P.key]&&h[P.key][r.id]),O=this.proxyToSource[P.key][r.id];O?O.push(k):this.proxyToSource[P.key][r.id]=[k],f.push(k)}}}_createProxiedId(r,a,h){let f=this.orthoMatrix;if(h){const m=h.find(g=>g.key===a.tileID.key);if(m)return m}if(a.tileID.key!==r.key){const m=r.canonical.z-a.tileID.canonical.z;let g,x,w;f=s.ad.create();const T=a.tileID.wrap-r.wrap<<r.overscaledZ;m>0?(g=s.a3>>m,x=g*((a.tileID.canonical.x<<m)-r.canonical.x+T),w=g*((a.tileID.canonical.y<<m)-r.canonical.y)):(g=s.a3<<-m,x=s.a3*(a.tileID.canonical.x-(r.canonical.x+T<<-m)),w=s.a3*(a.tileID.canonical.y-(r.canonical.y<<-m))),s.ad.ortho(f,0,g,0,g,0,1),s.ad.translate(f,f,[x,w,0])}return new qc(a.tileID,r.key,f)}_findTileCoveringTileID(r,a){let h=a.getTile(r);if(h&&h.hasData())return h;const f=this._findCoveringTileCache[a.id],m=f[r.key];if(h=m?a.getTileByID(m):null,h&&h.hasData()||m===null)return h;let g=h?h.tileID:r,x=g.overscaledZ;const w=a.getSource().minzoom,T=[];if(!m){const A=a.getSource().maxzoom;if(r.canonical.z>=A){const P=r.canonical.z-A;a.getSource().reparseOverscaled?(x=Math.max(r.canonical.z+2,a.transform.tileZoom),g=new s.aL(x,r.wrap,A,r.canonical.x>>P,r.canonical.y>>P)):P!==0&&(x=A,g=new s.aL(x,r.wrap,A,r.canonical.x>>P,r.canonical.y>>P))}g.key!==r.key&&(T.push(g.key),h=a.getTile(g))}const M=A=>{T.forEach(P=>{f[P]=A}),T.length=0};for(x-=1;x>=w&&(!h||!h.hasData());x--){h&&M(h.tileID.key);const A=g.calculateScaledKey(x);if(h=a.getTileByID(A),h&&h.hasData())break;const P=f[A];if(P===null)break;P===void 0?T.push(A):h=a.getTileByID(P)}return M(h?h.tileID.key:null),h&&h.hasData()?h:null}findDEMTileFor(r){return this.enabled?this._findTileCoveringTileID(r,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(r,a){let h=this._tilesDirty[r];h||(h=this._tilesDirty[r]={}),h[a.key]=!0}}function zh(u,r,a){const h=function(x,w,T){const M=s._.dot(w,x),A=s._.dot(T,[.2126,.7152,.0722]),P=(R,k,O)=>(1-O)*R+O*k,z=P(1-.3*Math.min(A,1),1,Math.min(M+1,1));return P(.92,1,Math.asin(s.at(w[2],-1,1))/Math.PI+.5)*z}(u,[0,0,1],r),f=[0,0,0];s._.scale(f,a.slice(0,3),h);const m=[0,0,0];s._.scale(m,r.slice(0,3),u[2]);const g=[0,0,0];return s._.add(g,f,m),s.b8(g)}const an=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],gl=["stars","fillExtrusion","fillExtrusionGroundEffect","model","symbolSDF","symbolIcon","symbolTextAndIcon"];class $c{static cacheKey(r,a,h,f){let m=`${a}${f?f.cacheKey:""}`;for(const g of h)r.usedDefines.includes(g)&&(m+=`/${g}`);return m}constructor(r,a,h,f,m,g){const x=r.gl;this.program=x.createProgram(),this.configuration=f,this.name=a,this.fixedDefines=[...g];const w=f?f.getBinderAttributes():[],T=(h.staticAttributes||[]).concat(w);let M=f?f.defines():[];M=M.concat(g.map(O=>`#define ${O}`));const A=`#version 300 es
2217`;let P=A+M.concat("precision mediump float;",Sh,Eh.fragmentSource).join(`
2218`);for(const O of h.fragmentIncludes)P+=`
2219${sl[O]}`;P+=`
2220${h.fragmentSource}`;let z=A+M.concat("precision highp float;",Sh,Eh.vertexSource).join(`
2221`);for(const O of h.vertexIncludes)z+=`
2222${sl[O]}`;z+=`
2223${h.vertexSource}`;const R=x.createShader(x.FRAGMENT_SHADER);if(x.isContextLost())return void(this.failedToCreate=!0);x.shaderSource(R,P),x.compileShader(R),x.attachShader(this.program,R);const k=x.createShader(x.VERTEX_SHADER);if(x.isContextLost())this.failedToCreate=!0;else{x.shaderSource(k,z),x.compileShader(k),x.attachShader(this.program,k),this.attributes={},this.numAttributes=T.length;for(let O=0;O<this.numAttributes;O++)if(T[O]){const B=T[O].startsWith("a_")?T[O]:`a_${T[O]}`;x.bindAttribLocation(this.program,O,B),this.attributes[B]=O}x.linkProgram(this.program),x.deleteShader(k),x.deleteShader(R),this.fixedUniforms=m(r),this.binderUniforms=f?f.getUniforms(r):[],g.includes("TERRAIN")&&(this.terrainUniforms=(O=>({u_dem:new s.a7(O),u_dem_prev:new s.a7(O),u_dem_tl:new s.a8(O),u_dem_scale:new s.aa(O),u_dem_tl_prev:new s.a8(O),u_dem_scale_prev:new s.aa(O),u_dem_size:new s.aa(O),u_dem_lerp:new s.aa(O),u_exaggeration:new s.aa(O),u_depth:new s.a7(O),u_depth_size_inv:new s.a8(O),u_depth_range_unpack:new s.a8(O),u_meter_to_dem:new s.aa(O),u_label_plane_matrix_inv:new s.a6(O)}))(r)),g.includes("GLOBE")&&(this.globeUniforms=(O=>({u_tile_tl_up:new s.aq(O),u_tile_tr_up:new s.aq(O),u_tile_br_up:new s.aq(O),u_tile_bl_up:new s.aq(O),u_tile_up_scale:new s.aa(O)}))(r)),g.includes("FOG")&&(this.fogUniforms=(O=>({u_fog_matrix:new s.a6(O),u_fog_range:new s.a8(O),u_fog_color:new s.as(O),u_fog_horizon_blend:new s.aa(O),u_fog_vertical_limit:new s.a8(O),u_fog_temporal_offset:new s.aa(O),u_frustum_tl:new s.aq(O),u_frustum_tr:new s.aq(O),u_frustum_br:new s.aq(O),u_frustum_bl:new s.aq(O),u_globe_pos:new s.aq(O),u_globe_radius:new s.aa(O),u_globe_transition:new s.aa(O),u_is_globe:new s.a7(O),u_viewport:new s.a8(O)}))(r)),g.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(O=>({u_cutoff_params:new s.as(O)}))(r)),g.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(O=>({u_lighting_ambient_color:new s.aq(O),u_lighting_directional_dir:new s.aq(O),u_lighting_directional_color:new s.aq(O),u_ground_radiance:new s.aq(O)}))(r)),g.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(O=>({u_light_matrix_0:new s.a6(O),u_light_matrix_1:new s.a6(O),u_fade_range:new s.a8(O),u_shadow_normal_offset:new s.aq(O),u_shadow_intensity:new s.aa(O),u_shadow_texel_size:new s.aa(O),u_shadow_map_resolution:new s.aa(O),u_shadow_direction:new s.aq(O),u_shadow_bias:new s.aq(O),u_shadowmap_0:new s.a7(O),u_shadowmap_1:new s.a7(O)}))(r))}}setTerrainUniformValues(r,a){if(!this.terrainUniforms)return;const h=this.terrainUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const f in a)h[f]&&h[f].set(this.program,f,a[f])}}setGlobeUniformValues(r,a){if(!this.globeUniforms)return;const h=this.globeUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const f in a)h[f]&&h[f].set(this.program,f,a[f])}}setFogUniformValues(r,a){if(!this.fogUniforms)return;const h=this.fogUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const f in a)h[f].set(this.program,f,a[f])}}setCutoffUniformValues(r,a){if(!this.cutoffUniforms)return;const h=this.cutoffUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const f in a)h[f].set(this.program,f,a[f])}}setLightsUniformValues(r,a){if(!this.lightsUniforms)return;const h=this.lightsUniforms;if(!this.failedToCreate){r.program.set(this.program);for(const f in a)h[f].set(this.program,f,a[f])}}setShadowUniformValues(r,a){if(this.failedToCreate||!this.shadowUniforms)return;const h=this.shadowUniforms;r.program.set(this.program);for(const f in a)h[f].set(this.program,f,a[f])}_drawDebugWireframe(r,a,h,f,m,g,x,w,T,M){const A=r.options.wireframe;if(A.terrain===!1&&A.layers2D===!1&&A.layers3D===!1)return;const P=r.context;if(!(!(!A.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!A.layers2D||r._terrain&&r._terrain.renderingToTexture||!an.includes(this.name))||!(!A.layers3D||!gl.includes(this.name))))return;const z=P.gl,R=r.wireframeDebugCache.getLinesFromTrianglesBuffer(r.frameCounter,m,P);if(!R)return;const k=[...this.fixedDefines];
2223k.push("DEBUG_WIREFRAME");const O=r.getOrCreateProgram(this.name,{config:this.configuration,defines:k});P.program.set(O.program);const B=(Z,K,Y)=>{if(K[Z]&&Y[Z])for(const te in K[Z])Y[Z][te]&&Y[Z][te].set(Y.program,te,K[Z][te].current)};T&&T.setUniforms(O.program,P,O.binderUniforms,x,{zoom:w}),B("fixedUniforms",this,O),B("terrainUniforms",this,O),B("globeUniforms",this,O),B("fogUniforms",this,O),B("lightsUniforms",this,O),B("shadowUniforms",this,O),R.bind(),P.setColorMode(new s.a([z.ONE,z.ONE_MINUS_SRC_ALPHA,z.ZERO,z.ONE],s.C.transparent,[!0,!0,!0,!1])),P.setDepthMode(new s.ae(a.func===z.LESS?z.LEQUAL:a.func,s.ae.ReadOnly,a.range)),P.setStencilMode(s.ag.disabled);const G=3*g.primitiveLength*2,q=3*g.primitiveOffset*2*2;M&&M>1?z.drawElementsInstanced(z.LINES,G,z.UNSIGNED_SHORT,q,M):z.drawElements(z.LINES,G,z.UNSIGNED_SHORT,q),m.bind(),P.program.set(this.program),P.setDepthMode(a),P.setStencilMode(h),P.setColorMode(f)}draw(r,a,h,f,m,g,x,w,T,M,A,P,z,R,k,O){const B=r.context,G=B.gl;if(this.failedToCreate)return;B.program.set(this.program),B.setDepthMode(h),B.setStencilMode(f),B.setColorMode(m),B.setCullFace(g);for(const K of Object.keys(this.fixedUniforms))this.fixedUniforms[K].set(this.program,K,x[K]);R&&R.setUniforms(this.program,B,this.binderUniforms,P,{zoom:z});const q={[G.POINTS]:1,[G.LINES]:2,[G.TRIANGLES]:3,[G.LINE_STRIP]:1}[a],Z=O&&O>0?1:void 0;for(const K of A.get()){const Y=K.vaos||(K.vaos={});(Y[w]||(Y[w]=new zp)).bind(B,this,T,R?R.getPaintVertexBuffers():[],M,K.vertexOffset,k||[],Z),O&&O>1?G.drawElementsInstanced(a,K.primitiveLength*q,G.UNSIGNED_SHORT,K.primitiveOffset*q*2,O):M?G.drawElements(a,K.primitiveLength*q,G.UNSIGNED_SHORT,K.primitiveOffset*q*2):G.drawArrays(a,K.vertexOffset,K.vertexLength),a===G.TRIANGLES&&M&&this._drawDebugWireframe(r,h,f,m,M,K,P,z,R,O)}}}function ia(u,r){const a=Math.pow(2,r.tileID.overscaledZ),h=r.tileSize*Math.pow(2,u.transform.tileZoom)/a,f=h*(r.tileID.canonical.x+r.tileID.wrap*a),m=h*r.tileID.canonical.y;return{u_image:0,u_texsize:r.imageAtlasTexture?r.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/s.bB(r,1,u.transform.tileZoom),u_pixel_coord_upper:[f>>16,m>>16],u_pixel_coord_lower:[65535&f,65535&m]}}const Wc=s.ad.create(),ra=(u,r,a,h,f,m,g,x,w,T,M,A,P,z,R,k)=>{const O=r.style.light,B=O.properties.get("position"),G=[B.x,B.y,B.z],q=s.bC.create();O.properties.get("anchor")==="viewport"&&(s.bC.fromRotation(q,-r.transform.angle),s._.transformMat3(G,G,q));const Z=O.properties.get("color"),K=r.transform,Y={u_matrix:u,u_lightpos:G,u_lightintensity:O.properties.get("intensity"),u_lightcolor:[Z.r,Z.g,Z.b],u_vertical_gradient:+a,u_opacity:h,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:Wc,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_ao:f,u_edge_radius:m,u_flood_light_color:A,u_vertical_scale:P,u_flood_light_intensity:z,u_ground_shadow_factor:R,u_emissive_strength:k};return K.projection.name==="globe"&&(Y.u_tile_id=[g.canonical.x,g.canonical.y,1<<g.canonical.z],Y.u_zoom_transition=w,Y.u_inv_rot_matrix=M,Y.u_merc_center=T,Y.u_up_dir=K.projection.upVector(new s.aO(0,0,0),T[0]*s.a3,T[1]*s.a3),Y.u_height_lift=x),Y},na=(u,r,a)=>({u_matrix:u,u_edge_radius:r,u_vertical_scale:a}),Yo=(u,r,a,h,f,m,g,x,w,T,M,A,P,z)=>{const R=ra(u,r,a,h,f,m,g,w,T,M,A,P,z,1,[0,0,0],0),k={u_height_factor:-Math.pow(2,g.overscaledZ)/x.tileSize/8};return s.W(R,ia(r,x),k)},yl=(u,r)=>({u_matrix:u,u_emissive_strength:r}),Hc=(u,r,a,h)=>s.W(yl(u,r),ia(a,h)),Dh=(u,r,a)=>({u_matrix:u,u_world:a,u_emissive_strength:r}),Lh=(u,r,a,h,f)=>s.W(Hc(u,r,a,h),{u_world:f}),xl=(u,r,a,h)=>{const f=s.a3/a.tileSize;return{u_matrix:u,u_camera_to_center_distance:r.getCameraToCenterDistance(h),u_extrude_scale:[r.pixelsToGLUnits[0]/f,r.pixelsToGLUnits[1]/f]}},vl=(u,r,a=1)=>({u_matrix:u,u_color:r.toRenderColor(null),u_overlay:0,u_overlay_scale:a}),Xc=s.ad.create(),oa=(u,r,a,h,f,m,g)=>{const x=u.transform,w=x.projection.name==="globe",T=w?s.bD(x.zoom,r.canonical)*x._pixelsPerMercatorPixel:s.bB(a,1,m),M={u_matrix:r.projMatrix,u_extrude_scale:T,u_intensity:g,u_inv_rot_matrix:Xc,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(w){M.u_inv_rot_matrix=h,M.u_merc_center=f,M.u_tile_id=[r.canonical.x,r.canonical.y,1<<r.canonical.z],M.u_zoom_transition=s.a1(x.zoom);const A=f[0]*s.a3,P=f[1]*s.a3;M.u_up_dir=x.projection.upVector(new s.aO(0,0,0),A,P)}return M};function Dn(u,[r,a,h,f],[m,g]){if(m===g)return[0,0,0,0];const x=255*(u-1)/(u*(g-m));return[r*x,a*x,h*x,f*x]}function Rh(u,r,[a,h]){return a===h?0:.5/u+(r-a)*(u-1)/(u*(h-a))}const Yc=(u,r,a,h,f,m,g,x,w,T,M,A,P,z,R,k,O,B,G,q,Z)=>({u_matrix:u,u_normalize_matrix:r,u_globe_matrix:a,u_merc_matrix:h,u_grid_matrix:f,u_tl_parent:m,u_scale_parent:T,u_fade_t:M.mix,u_opacity:M.opacity*A.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:A.paint.get("raster-brightness-min"),u_brightness_high:A.paint.get("raster-brightness-max"),u_saturation_factor:s.bE(A.paint.get("raster-saturation")),u_contrast_factor:s.bF(A.paint.get("raster-contrast")),u_spin_weights:bl(A.paint.get("raster-hue-rotate")),u_perspective_transform:P,u_raster_elevation:z,u_zoom_transition:g,u_merc_center:x,u_cutoff_params:w,u_colorization_mix:Dn(s.bG,k,B),u_colorization_offset:Rh(s.bG,O,B),u_color_ramp:R,u_texture_offset:[q/(G+2*q),G/(G
2223+2*q)],u_texture_res:[G+2*q,G+2*q],u_emissive_strength:Z});function bl(u){u*=Math.PI/180;const r=Math.sin(u),a=Math.cos(u);return[(2*a+1)/3,(-Math.sqrt(3)*r-a+1)/3,(Math.sqrt(3)*r-a+1)/3]}const Xr=.05,Kc=(u,r,a,h,f,m,g,x,w,T,M,A)=>({u_matrix:u,u_normalize_matrix:r,u_globe_matrix:a,u_merc_matrix:h,u_grid_matrix:f,u_tl_parent:m,u_scale_parent:T,u_fade_t:M.mix,u_opacity:M.opacity,u_image0:0,u_image1:1,u_raster_elevation:A,u_zoom_transition:g,u_merc_center:x,u_cutoff_params:w}),Jc=(u,r,a,h,f,m,g,x,w,T)=>({u_particle_texture:u,u_particle_texture_side_len:r,u_tile_offset:a,u_velocity:h,u_color_ramp:m,u_velocity_res:f,u_max_speed:g,u_uv_offset:x,u_data_scale:[255*w[0],255*w[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Xr,Xr]}),Qc=(u,r,a,h,f,m,g,x,w,T)=>({u_particle_texture:u,u_particle_texture_side_len:r,u_velocity:a,u_velocity_res:h,u_max_speed:f,u_speed_factor:m,u_reset_rate:g,u_rand_seed:Math.random(),u_uv_offset:x,u_data_scale:[255*w[0],255*w[1]],u_data_offset:T,u_particle_pos_scale:1.1,u_particle_pos_offset:[Xr,Xr]}),kh=s.ad.create(),Pr=(u,r,a,h,f,m,g,x,w,T,M,A,P,z,R,k,O,B)=>{const G=f.transform,q={u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:r?r.uSizeT:0,u_size:r?r.uSize:0,u_camera_to_center_distance:G.getCameraToCenterDistance(k),u_rotate_symbol:+a,u_aspect_ratio:G.width/G.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_matrix:m,u_label_plane_matrix:g,u_coord_matrix:x,u_is_text:+w,u_pitch_with_map:+h,u_texsize:T,u_texture:0,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:kh,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:kh,u_up_vector:[0,-1,0],u_color_adj_mat:O,u_icon_transition:B||0};return k.name==="globe"&&(q.u_tile_id=[M.canonical.x,M.canonical.y,1<<M.canonical.z],q.u_zoom_transition=A,q.u_inv_rot_matrix=z,q.u_merc_center=P,q.u_camera_forward=G._camera.forward(),q.u_ecef_origin=s.bH(G.globeMatrix,M.toUnwrapped()),q.u_tile_matrix=Float32Array.from(G.globeMatrix),q.u_up_vector=R),q},no=(u,r,a,h,f,m,g,x,w,T,M,A,P,z,R,k,O)=>s.W(Pr(u,r,a,h,f,m,g,x,w,T,A,P,z,R,k,O),{u_gamma_scale:h?f.transform.getCameraToCenterDistance(O)*Math.cos(f.terrain?0:f.transform._pitch):1,u_device_pixel_ratio:s.e.devicePixelRatio,u_is_halo:1,undefined:void 0}),Oh=(u,r,a,h,f,m,g,x,w,T,M,A,P,z,R,k)=>s.W(no(u,r,a,h,f,m,g,x,!0,w,!0,M,A,P,z,R,k),{u_texsize_icon:T,u_texture_icon:1}),Bh=(u,r,a,h)=>({u_matrix:u,u_emissive_strength:r,u_opacity:a,u_color:h}),sa=(u,r,a,h,f,m,g,x)=>s.W(function(w,T,M,A,P){const{width:z,height:R}=A.imageManager.getPixelSize(T),k=Math.pow(2,P.tileID.overscaledZ),O=P.tileSize*Math.pow(2,A.transform.tileZoom)/k,B=O*(P.tileID.canonical.x+P.tileID.wrap*k),G=O*P.tileID.canonical.y;return{u_image:0,u_pattern_tl:M.tl,u_pattern_br:M.br,u_texsize:[z,R],u_pattern_size:M.displaySize,u_tile_units_to_pixels:1/s.bB(P,1,A.transform.tileZoom),u_pixel_coord_upper:[B>>16,G>>16],u_pixel_coord_lower:[65535&B,65535&G]}}(0,m,g,h,x),{u_matrix:u,u_emissive_strength:r,u_opacity:a}),wl=new Float32Array(s.ad.identity([])),eu=(u,r,a,h,f,m,g,x,w,T,M,A,P,z=[0,0,0],R)=>{const k=f.style.light,O=k.properties.get("position"),B=[-O.x,-O.y,O.z],G=s.bC.create();k.properties.get("anchor")==="viewport"&&(s.bC.fromRotation(G,-f.transform.angle),s._.transformMat3(B,B,G));const q=M.alphaMode==="MASK",Z=k.properties.get("color").toRenderColor(null),K=P.paint.get("model-ambient-occlusion-intensity"),Y=P.paint.get("model-color").constantOr(s.C.white).toRenderColor(null),te=P.paint.get("model-color-mix-intensity").constantOr(0);return{u_matrix:u,u_lighting_matrix:r,u_normal_matrix:a,u_node_matrix:h||wl,u_lightpos:B,u_lightintensity:k.properties.get("intensity"),u_lightcolor:[Z.r,Z.g,Z.b],u_camera_pos:z,u_opacity:m,u_baseTextureIsAlpha:0,u_alphaMask:+q,u_alphaCutoff:M.alphaCutoff,u_baseColorFactor:[g.r,g.g,g.b,g.a],u_emissiveFactor:[x[0],x[1],x[2],1],u_metallicFactor:w,u_roughnessFactor:T,u_baseColorTexture:Ei.BaseColor,u_metallicRoughnessTexture:Ei.MetallicRoughness,u_normalTexture:Ei.Normal,u_occlusionTexture:Ei.Occlusion,u_emissionTexture:Ei.Emission,u_lutTexture:Ei.LUT,u_color_mix:[Y.r,Y.g,Y.b,te],u_aoIntensity:K,u_emissive_strength:A,u_occlusionTextureTransform:R||[0,0,0,0]}},Tl=(u,r=wl,a=wl)=>({u_matrix:u,u_instance:r,u_node_matrix:a}),kp=(u,r,a,h,f)=>({u_matrix:Float32Array.from(u),u_anchorPos:r,u_screenSizePx:a,u_occluderSizePx:h,u_color:f}),Fh={fillExtrusion:u=>({u_matrix:new s.a6(u),u_lightpos:new s.aq(u),u_lightintensity:new s.aa(u),u_lightcolor:new s.aq(u),u_vertical_gradient:new s.aa(u),u_opacity:new s.aa(u),u_edge_radius:new s.aa(u),u_ao:new s.a8(u),u_tile_id:new s.aq(u),u_zoom_transition:new s.aa(u),u_inv_rot_matrix:new s.a6(u),u_merc_center:new s.a8(u),u_up_dir:new s.aq(u),u_height_lift:new s.aa(u),u_flood_light_color:new s.aq(u),u_vertical_scale:new s.aa(u),u_flood_light_intensity:new s.aa(u),u_ground_shadow_factor:new s.aq(u),u_emissive_strength:new s.aa(u)}),fillExtrusionDepth:u=>({u_matrix:new s.a6(u),u_edge_radius:new s.aa(u),u_vertical_scale:new s.aa(u)}),fillExtrusionPattern:u=>({u_matrix:new s.a6(u),u_lightpos:new s.aq(u),u_lightintensity:new s.aa(u),u_lightcolor:new s.aq(u),u_vertical_gradient:new s.aa(u),u_height_factor:new s.aa(u),u_edge_radius:new s.aa(u),u_ao:new s.a8(u),u_tile_id:new s.aq(u),u_zoom_transition:new s.aa(u),u_inv_rot_matrix:new s.a6(u),u_merc_center:new s.a8(u),u_up_dir:new s.aq(u),u_height_lift:new s.aa(u),u_image:new s.a7(u),u_texsize:new s.a8(u),u_pixel_coord_upper:new s.a8(u),u_pixel_coord_lower:new s.a8(u),u_tile_units_to_pixels:new s.aa(u),u_opacity:new s.aa(u)}),fillExtrusionGroundEffect:u=>({u_matrix:new s.a6(u),u_opacity:new s.aa(u),u_ao_pass:new s.aa(u),u_meter_to_tile:new s.aa(u),u_ao:new s.a8(u),u_flood_light_intensity:new s.aa(u),u_flood_light_color:new s.aq(u),u_attenuation:new s.aa(u),u_edge_radius:new s.aa(u),u_fb:new s.a7(u),u_fb_size:new s.aa(u)}),fill:u=>({u_matrix:new s.a6(u),u_emissive_strength:new s.aa(u)}),fillPattern:u=>({u_matrix:new s.a6(u),u_emissive_strength:new s.aa(u),u_image:new s.a7(u),u_texsize:new s.a8(u),u_pixel_coord_upper:new s.a8(u),u_pixel_coord_lower:new s.a8(u),u_tile_units_to_pixels:new s.aa(u)}),fillOutline:u=>({u_matrix:new s.a6(u),u_emissive_strength:new s.aa(u),u_world:new s.a8(u)}),fillOutlinePattern:u=>({u_matrix:new s.a6(u),u_emissive_strength:new s.aa(u),u_world:new s.a8(u),u_image:new s.a7(u),u_texsize:new s.a8(u),u_pixel_coord_upper:new s.a8(u),u_pixel_coord_lower:new s.a8(u),u_tile_units_to_pixels:new s.aa(u)}),circle:s.bI,collisionBox:u=>({u_matrix:new s.a6(u),u_camera_to_center_distance:new s.aa(u),u_extrude_scale:new s.a8(u)}),collisionCircle:u=>({u_matrix:new s.a6(u),u_inv_matrix:new s.a6(u),u_camera_to_center_distance:new s.aa(u),u_viewport_size:new s.a8(u)}),debug:u=>({u_color:new s.a9(u),u_matrix:new s.a6(u),u_overlay:new s.a7(u),u_overlay_scale:new s.aa(u)}),clippingMask:u=>({u_matrix:new s.a6(u)}),heatmap:u=>({u_extrude_scale:new s.aa(u),u_intensity:new s.aa(u),u_matrix:new s.a6(u),u_inv_rot_matrix:new s.a6(u),u_merc_center:new s.a8(u),u_tile_id:new s.aq(u),u_zoom_transition:new s.aa(u),u_up_dir:new s.aq(u)}),heatmapTexture:u=>({u_image:new s.a7(u),u_color_ramp:new s.a7(u),u_opacity:new s.aa(u)}),hillshade:u=>({u_matrix:new s.a6(u),u_image:new s.a7(u),u_latrange:new s.a8(u),u_light:new s.a8(u),u_shadow:new s.a9(u),u_highlight:new s.a9(u),u_emissive_strength:new s.aa(u),u_accent:new s.a9(u)}),hillshadePrepare:u=>({u_matrix:new s.a6(u),u_image:new s.a7(u),u_dimension:new s.a8(u),u_zoom:new s.aa(u)}),line:s.bJ,linePattern:s.bK,raster:u=>({u_matrix:new s.a6(u),u_normalize_matrix:new s.a6(u),u_globe_matrix:new s.a6(u),u_merc_matrix:new s.a6(u),u_grid_matrix:new s.ar(u),u_tl_parent:new s.a8(u),u_scale_parent:new s.aa(u),u_fade_t:new s.aa(u),u_opacity:new s.aa(u),u_image0:new s.a7(u),u_image1:new s.a7(u),u_brightness_low:new s.aa(u),u_brightness_high:new s.aa(u),u_saturation_factor:new s.aa(u),u_contrast_factor:new s.aa(u),u_spin_weights:new s.aq(u),u_perspective_transform:new s.a8(u),u_raster_elevation:new s.aa(u),u_zoom_transition:new s.aa(u),u_merc_center:new s.a8(u),u_cutoff_params:new s.as(u),u_colorization_mix:new s.as(u),u_colorization_offset:new s.aa(u),u_color_ramp:new s.a7(u),u_texture_offset:new s.a8(u),u_texture_res:new s.a8(u),u_emissive_strength:new s.aa(u)}),rasterParticle:u=>({u_matrix:new s.a6(u),u_normalize_matrix:new s.a6(u),u_globe_matrix:new s.a6(u),u_merc_matrix:new s.a6(u),u_grid_matrix:new s.ar(u),u_tl_parent:new s.a8(u),u_scale_parent:new s.aa(u),u_fade_t:new s.aa(u),u_opacity:new s.aa(u),u_image0:new s.a7(u),u_image1:new s.a7(u),u_raster_elevation:new s.aa(u),u_zoom_transition:new s.aa(u),u_merc_center:new s.a8(u),u_cutoff_params:new s.as(u)}),rasterParticleTexture:u=>({u_texture:new s.a7(u),u_opacity:new s.aa(u)}),rasterParticleDraw:u=>({u_particle_texture:new s.a7(u),u_particle_texture_side_len:new s.aa(u),u_tile_offset:new s.a8(u),u_velocity:new s.a7(u),u_color_ramp:new s.a7(u),u_velocity_res:new s.a8(u),u_max_speed:new s.aa(u),u_uv_offset:new s.a8(u),u_data_scale:new s.a8(u),u_data_offset:new s.aa(u),u_particle_pos_scale:new s.aa(u),u_particle_pos_offset:new s.a8(u)}),rasterParticleUpdate:u=>({u_particle_texture:new s.a7(u),u_particle_texture_side_len:new s.aa(u),u_velocity:new s.a7(u),u_velocity_res:new s.a8(u),u_max_speed:new s.aa(u),u_speed_factor:new s.aa(u),u_reset_rate:new s.aa(u),u_rand_seed:new s.aa(u),u_uv_offset:new s.a8(u),u_data_scale:new s.a8(u),u_data_offset:new s.aa(u),u_particle_pos_scale:new s.aa(u),u_particle_pos_offset:new s.a8(u)}),symbolIcon:u=>({u_is_size_zoom_constant:new s.a7(u),u_is_size_feature_constant:new s.a7(u),u_size_t:new s.aa(u),u_size:new s.aa(u),u_camera_to_center_distance:new s.aa(u),u_rotate_symbol:new s.a7(u),u_aspect_ratio:new s.aa(u),u_fade_change:new s.aa(u),u_matrix:new s.a6(u),u_label_plane_matrix:new s.a6(u),u_coord_matrix:new s.a6(u),u_is_text:new s.a7(u),u_pitch_with_map:new s.a7(u),u_texsize:new s.a8(u),u_tile_id:new s.aq(u),u_zoom_transition:new s.aa(u),u_inv_rot_matrix:new s.a6(u),u_merc_center:new s.a8(u),u_camera_forward:new s.aq(u),u_tile_matrix:new s.a6(u),u_up_vector:new s.aq(u),u_ecef_origin:new s.aq(u),u_texture:new s.a7(u),u_icon_transition:new s.aa(u),u_color_adj_mat:new s.a6(u)}),symbolSDF:u=>({u_is_size_zoom_constant:new s.a7(u),u_is_size_feature_constant:new s.a7(u),u_size_t:new s.aa(u),u_size:new s.aa(u),u_camera_to_center_distance:new s.aa(u),u_rotate_symbol:new s.a7(u),u_aspect_ratio:new s.aa(u),u_fade_change:new s.aa(u),u_matrix:new s.a6(u),u_label_plane_matrix:new s.a6(u),u_coord_matrix:new s.a6(u),u_is_text:new s.a7(u),u_pitch_with_map:new s.a7(u),u_texsize:new s.a8(u),u_texture:new s.a7(u),u_gamma_scale:new s.aa(u),u_device_pixel_ratio:new s.aa(u),u_tile_id:new s.aq(u),u_zoom_transition:new s.aa(u),u_inv_rot_matrix:new s.a6(u),u_merc_center:new s.a8(u),u_camera_forward:new s.aq(u),u_tile_matrix:new s.a6(u),u_up_vector:new s.aq(u),u_ecef_origin:new s.aq(u),u_is_halo:new s.a7(u)}),symbolTextAndIcon:u=>({u_is_size_zoom_constant:new s.a7(u),u_is_size_feature_constant:new s.a7(u),u_size_t:new s.aa(u),u_size:new s.aa(u),u_camera_to_center_distance:new s.aa(u),u_rotate_symbol:new s.a7(u),u_aspect_ratio:new s.aa(u),u_fade_change:new s.aa(u),u_matrix:new s.a6(u),u_label_plane_matrix:new s.a6(u),u_coord_matrix:new s.a6(u),u_is_text:new s.a7(u),u_pitch_with_map:new s.a7(u),u_texsize:new s.a8(u),u_texsize_icon:new s.a8(u),u_texture:new s.a7(u),u_texture_icon:new s.a7(u),u_gamma_scale:new s.aa(u),u_device_pixel_ratio:new s.aa(u),u_is_halo:new s.a7(u)}),background:u=>({u_matrix:new s.a6(u),u_emissive_strength:new s.aa(u),u_opacity:new s.aa(u),u_color:new s.a9(u)}),backgroundPattern:u=>({u_matrix:new s.a6(u),u_emissive_strength:new s.aa(u),u_opacity:new s.aa(u),u_image:new s.a7(u),u_pattern_tl:new s.a8(u),u_pattern_br:new s.a8(u),u_texsize:new s.a8(u),u_pattern_size:new s.a8(u),u_pixel_coord_upper:new s.a8(u),u_pixel_coord_lower:new s.a8(u),u_tile_units_to_pixels:new s.aa(u)}),terrainRaster:u=>({u_matrix:new s.a6(u),u_image0:new s.a7(u),u_skirt_height:new s.aa(u),u_ground_shadow_factor:new s.aq(u)}),skybox:u=>({u_matrix:new s.a6(u),u_sun_direction:new s.aq(u),u_cubemap:new s.a7(u),u_opacity:new s.aa(u),u_temporal_offset:new s.aa(u)}),skyboxGradient:u=>({u_matrix:new s.a6(u),u_color_ramp:new s.a7(u),u_center_direction:new s.aq(u),u_radius:new s.aa(u),u_opacity:new s.aa(u),u_temporal_offset:new s.aa(u)}),skyboxCapture:u=>({u_matrix_3f:new s.ar(u),u_sun_direction:new s.aq(u),u_sun_intensity:new s.aa(u),u_color_tint_r:new s.as(u),u_color_tint_m:new s.as(u),u_luminance:new s.aa(u)}),globeRaster:u=>({u_proj_matrix:new s.a6(u),u_globe_matrix:new s.a6(u),u_normalize_matrix:new s.a6(u),u_merc_matrix:new s.a6(u),u_zoom_transition:new s.aa(u),u_merc_center:new s.a8(u),u_image0:new s.a7(u),u_grid_matrix:new s.ar(u),u_skirt_height:new s.aa(u),u_far_z_cutoff:new s.aa(u),u_frustum_tl:new s.aq(u),u_frustum_tr:new s.aq(u),u_frustum_br:new s.aq(u),u_frustum_bl:new s.aq(u),u_globe_pos:new s.aq(u),u_globe_radius:new s.aa(u),u_viewport:new s.a8(u)}),globeAtmosphere:u=>({u_frustum_tl:new s.aq(u),u_frustum_tr:new s.aq(u),u_frustum_br:new s.aq(u),u_frustum_bl:new s.aq(u),u_horizon:new s.aa(u),u_transition:new s.aa(u),u_fadeout_range:new s.aa(u),u_color:new s.as(u),u_high_color:new s.as(u),u_space_color:new s.as(u),u_temporal_offset:new s.aa(u),u_horizon_angle:new s.aa(u)}),model:u=>({u_matrix:new s.a6(u),u_lighting_matrix:new s.a6(u),u_normal_matrix:new s.a6(u),u_node_matrix:new s.a6(u),u_lightpos:new s.aq(u),u_lightintensity:new s.aa(u),u_lightcolor:new s.aq(u),u_camera_pos:new s.aq(u),u_opacity:new s.aa(u),u_baseColorFactor:new s.as(u),u_emissiveFactor:new s.as(u),u_metallicFactor:new s.aa(u),u_roughnessFactor:new s.aa(u),u_baseTextureIsAlpha:new s.a7(u),u_alphaMask:new s.a7(u),u_alphaCutoff:new s.aa(u),u_baseColorTexture:new s.a7(u),u_metallicRoughnessTexture:new s.a7(u),u_normalTexture:new s.a7(u),u_occlusionTexture:new s.a7(u),u_emissionTexture:new s.a7(u),u_lutTexture:new s.a7(u),u_color_mix:new s.as(u),u_aoIntensity:new s.aa(u),u_emissive_strength:new s.aa(u),u_occlusionTextureTransform:new s.as(u)}),modelDepth:u=>({u_matrix:new s.a6(u),u_instance:new s.a6(u),u_node_matrix:new s.a6(u)}),groundShadow:u=>({u_matrix:new s.a6(u),u_ground_shadow_factor:new s.aq(u)}),stars:u=>({u_matrix:new s.a6(u),u_up:new s.aq(u),u_right:new s.aq(u),u_intensity_multiplier:new s.aa(u)}),occlusion:u=>({u_matrix:new s.a6(u),u_anchorPos:new s.aq(u),u_screenSizePx:new s.a8(u),u_occluderSizePx:new s.a8(u),u_color:new s.as(u)})};function tu(u,r,a){const h=r.createTileMatrix(u,u.worldSize,a.toUnwrapped());return s.ad.multiply(new Float32Array(16),u.projMatrix,h)}function Nh(u,r,a){if(r.projection.name===a.projection.name)return u.projMatrix;const h=a.clone();return h.setProjection(r.projection),tu(h,r.getProjection(),u)}function El(u,r,a){return r.name===a.projection.name?u.projMatrix:tu(a,r,u)}let Ko;function Vh(u,r,a,h,f,m,g){const x=u.context,w=x.gl,T=u.transform,M=u.getOrCreateProgram("collisionBox"),A=[];let P=0,z=0;for(let Z=0;Z<h.length;Z++){const K=h[Z],Y=r.getTile(K),te=Y.getBucket(a);if(!te)continue;const N=Nh(K,te,T);let $=N;f[0]===0&&f[1]===0||($=u.translatePosMatrix(N,Y,f,m));const re=g?te.textCollisionBox:te.iconCollisionBox,de=te.collisionCircleArray;
2223if(de.length>0){const se=s.ad.create(),Q=$;s.ad.mul(se,te.placementInvProjMatrix,T.glCoordMatrix),s.ad.mul(se,se,te.placementViewportMatrix),A.push({circleArray:de,circleOffset:z,transform:Q,invTransform:se,projection:te.getProjection()}),P+=de.length/4,z=P}re&&(u.terrain&&u.terrain.setupElevationDraw(Y,M),M.draw(u,w.LINES,s.ae.disabled,s.ag.disabled,u.colorModeForRenderPass(),s.af.disabled,xl($,T,Y,te.getProjection()),a.id,re.layoutVertexBuffer,re.indexBuffer,re.segments,null,T.zoom,null,[re.collisionVertexBuffer,re.collisionVertexBufferExt]))}if(!g||!A.length)return;const R=u.getOrCreateProgram("collisionCircle"),k=new s.bL;k.resize(4*P),k._trim();let O=0;for(const Z of A)for(let K=0;K<Z.circleArray.length/4;K++){const Y=4*K,te=Z.circleArray[Y+0],N=Z.circleArray[Y+1],$=Z.circleArray[Y+2],re=Z.circleArray[Y+3];k.emplace(O++,te,N,$,re,0),k.emplace(O++,te,N,$,re,1),k.emplace(O++,te,N,$,re,2),k.emplace(O++,te,N,$,re,3)}(!Ko||Ko.length<2*P)&&(Ko=function(Z){const K=2*Z,Y=new s.bu;Y.resize(K),Y._trim();for(let te=0;te<K;te++){const N=6*te;Y.uint16[N+0]=4*te+0,Y.uint16[N+1]=4*te+1,Y.uint16[N+2]=4*te+2,Y.uint16[N+3]=4*te+2,Y.uint16[N+4]=4*te+3,Y.uint16[N+5]=4*te+0}return Y}(P));const B=x.createIndexBuffer(Ko,!0),G=x.createVertexBuffer(k,s.bM.members,!0);for(const Z of A){const K={u_matrix:Z.transform,u_inv_matrix:Z.invTransform,u_camera_to_center_distance:(q=T).getCameraToCenterDistance(Z.projection),u_viewport_size:[q.width,q.height]};R.draw(u,w.TRIANGLES,s.ae.disabled,s.ag.disabled,u.colorModeForRenderPass(),s.af.disabled,K,a.id,G,B,s.b.simpleSegment(0,2*Z.circleOffset,Z.circleArray.length,Z.circleArray.length/2),null,T.zoom)}var q;G.destroy(),B.destroy()}const oo=s.ad.create();function aa(u){const r=u._camera.getWorldToCamera(u.worldSize,1),a=s.ad.multiply([],r,u.globeMatrix);s.ad.invert(a,a);const h=[0,0,0],f=[0,1,0,0];return s.aA.transformMat4(f,f,a),h[0]=f[0],h[1]=f[1],h[2]=f[2],s._.normalize(h,h),h}function Op({width:u,height:r,anchor:a,textOffset:h,textScale:f},m){const{horizontalAlign:g,verticalAlign:x}=s.bQ(a),w=-(g-.5)*u,T=-(x-.5)*r,M=s.bP(a,h);return new s.P((w/f+M[0])*m,(T/f+M[1])*m)}function Bp(u,r,a,h,f,m,g,x,w,T,M){const A=u.text.placedSymbolArray,P=u.text.dynamicLayoutVertexArray,z=u.icon.dynamicLayoutVertexArray,R={},k=u.getProjection(),O=El(x,k,m),B=m.elevation,G=k.upVectorScale(x.canonical,m.center.lat,m.worldSize).metersToTile;P.clear();for(let q=0;q<A.length;q++){const Z=A.get(q),{tileAnchorX:K,tileAnchorY:Y,numGlyphs:te}=Z,N=Z.hidden||!Z.crossTileID||u.allowVerticalPlacement&&!Z.placedOrientation?null:h[Z.crossTileID];if(N){let $=0,re=0,de=0;if(B){const we=B?B.getAtTileOffset(x,K,Y):0,[Ve,Ue,qe]=k.upVector(x.canonical,K,Y);$=we*Ve*G,re=we*Ue*G,de=we*qe*G}let[se,Q,fe,Me]=ir(Z.projectedAnchorX+$,Z.projectedAnchorY+re,Z.projectedAnchorZ+de,a?O:g);const Ie=kc(m.getCameraToCenterDistance(k),Me);let Se=f.evaluateSizeForFeature(u.textSizeData,T,Z)*Ie/s.bN;a&&(Se*=u.tilePixelRatio/w);const le=Op(N,Se);a?({x:se,y:Q,z:fe}=k.projectTilePoint(K+le.x,Y+le.y,x.canonical),[se,Q,fe]=ir(se+$,Q+re,fe+de,g)):(r&&le._rotate(-m.angle),se+=le.x,Q+=le.y,fe=0);const _e=u.allowVerticalPlacement&&Z.placedOrientation===s.aE.vertical?Math.PI/2:0;for(let we=0;we<te;we++)s.aH(P,se,Q,fe,_e);M&&Z.associatedIconIndex>=0&&(R[Z.associatedIconIndex]={x:se,y:Q,z:fe,angle:_e})}else Pn(te,P)}if(M){z.clear();const q=u.icon.placedSymbolArray;for(let Z=0;Z<q.length;Z++){const K=q.get(Z),{numGlyphs:Y}=K,te=R[Z];if(K.hidden||!te)Pn(Y,z);else{const{x:N,y:$,z:re,angle:de}=te;for(let se=0;se<Y;se++)s.aH(z,N,$,re,de)}}u.icon.dynamicLayoutVertexBuffer.updateData(z)}u.text.dynamicLayoutVertexBuffer.updateData(P)}function Sl(u,r,a,h,f,m,g={}){const x=a.paint.get("icon-translate"),w=a.paint.get("text-translate"),T=a.paint.get("icon-translate-anchor"),M=a.paint.get("text-translate-anchor"),A=a.layout.get("icon-rotation-alignment"),P=a.layout.get("text-rotation-alignment"),z=a.layout.get("icon-pitch-alignment"),R=a.layout.get("text-pitch-alignment"),k=a.layout.get("icon-keep-upright"),O=a.layout.get("text-keep-upright"),B=a.paint.get("icon-color-saturation"),G=a.paint.get("icon-color-contrast"),q=a.paint.get("icon-color-brightness-min"),Z=a.paint.get("icon-color-brightness-max"),K=a.paint.get("icon-occlusion-opacity").constantOr(0),Y=a.paint.get("text-occlusion-opacity").constantOr(0),te=u.context,N=te.gl,$=u.transform,re=A==="map",de=P==="map",se=z==="map",Q=R==="map",fe=K!==1,Me=Y!==1,Ie=a.layout.get("symbol-sort-key").constantOr(1)!==void 0;let Se=!1;const le=u.depthModeForSublayer(0,s.ae.ReadOnly),_e=[s.aj($.center.lng),s.ak($.center.lat)],we=a.layout.get("text-variable-anchor"),Ve=$.projection.name==="globe",Ue=[],qe=[0,-1,0];for(const je of h){const Be=r.getTile(je),ve=Be.getBucket(a);if(!ve||ve.projection.name==="mercator"&&Ve||ve.fullyClipped)continue;const He=ve.projection.name==="globe",yt=He?s.a1($.zoom):0,it=El(je,ve.getProjection(),$),ht=$.calculatePixelsToTileUnitsMatrix(Be),It=we&&ve.hasTextData(),oi=ve.hasIconTextFit()&&It&&ve.hasIconData(),St=ve.getProjection().createInversionMatrix($,je.canonical),st=()=>{const ii=re&&a.layout.get("symbol-placement")!=="point",Ee=[];a.hasInitialOcclusionOpacityProperties&&fe&&u.symbolParams.useOcclusionQueries&&!He&&!Ve&&Ee.push("OCCLUSION_QUERIES"),a.hasInitialOcclusionOpacityProperties||Ee.push("SYMBOL_OCCLUSION_BY_TERRAIN_DEPTH");const $e=ii||oi,Di=a.paint.get("icon-image-cross-fade").constantOr(0);u.terrainRenderModeElevated()&&se&&Ee.push("PITCH_WITH_MAP_TERRAIN"),He&&(Ee.push("PROJECTION_GLOBE_VIEW"),$e&&Ee.push("PROJECTED_POS_ON_VIEWPORT")),Di>
22230&&Ee.push("ICON_TRANSITION"),ve.icon.zOffsetVertexBuffer&&Ee.push("Z_OFFSET"),Ee.push("TERRAIN_DEPTH_D24"),B===0&&G===0&&q===0&&Z===1||Ee.push("COLOR_ADJUSTMENT");const Gt=ve.icon.programConfigurations.get(a.id),he=u.getOrCreateProgram(ve.sdfIcons?"symbolSDF":"symbolIcon",{config:Gt,defines:Ee});let Ji;const qi=Be.imageAtlasTexture?Be.imageAtlasTexture.size:[0,0],Li=ve.iconSizeData,Zi=s.aD(Li,$.zoom),Br=se||$.pitch!==0,dn=ft(it,Be.tileID.canonical,se,re,$,ve.getProjection(),ht),fr=Qn(it,Be.tileID.canonical,se,re,$,ve.getProjection(),ht),kn=u.translatePosMatrix(fr,Be,x,T,!0),On=u.translatePosMatrix(it,Be,x,T),Bn=$e?oo:dn,en=re&&!se&&!ii;let yo=qe;!Ve&&!$.mercatorFromTransition||re||(yo=aa($));const ps=He?yo:qe;if(ve.sdfIcons&&!ve.iconsInText)Ji=no(Li.kind,Zi,en,se,u,On,Bn,kn,!1,qi,!0,je,yt,_e,St,ps,ve.getProjection());else{const xo=a.getColorAdjustmentMatrix(B,G,q,Z);Ji=Pr(Li.kind,Zi,en,se,u,On,Bn,kn,!1,qi,je,yt,_e,St,ps,ve.getProjection(),xo,Di)}const Ia=Be.imageAtlasTexture?Be.imageAtlasTexture:null,fs=a.layout.get("icon-size").constantOr(0)!==1||ve.iconsNeedLinear,ms=ve.sdfIcons||u.options.rotating||u.options.zooming||fs||Br?N.LINEAR:N.NEAREST,ql=ve.sdfIcons&&a.paint.get("icon-halo-width").constantOr(1)!==0,Zl=u.terrain&&se&&ii?s.ad.invert(s.ad.create(),dn):oo;if(ii&&ve.icon){const xo=$.elevation,$i=xo?xo.getAtTileOffsetFunc(je,$.center.lat,$.worldSize,ve.getProjection()):null,Nu=Qs(it,Be.tileID.canonical,se,re,$,ve.getProjection(),ht);Ah(ve,it,u,!1,Nu,fr,se,k,$i,je)}return{program:he,buffers:ve.icon,uniformValues:Ji,atlasTexture:Ia,atlasTextureIcon:null,atlasInterpolation:ms,atlasInterpolationIcon:null,isSDF:ve.sdfIcons,hasHalo:ql,tile:Be,labelPlaneMatrixInv:Zl}},Jt=()=>{const ii=de&&a.layout.get("symbol-placement")!=="point",Ee=[],$e=ii||we||oi;a.hasInitialOcclusionOpacityProperties&&Me&&u.symbolParams.useOcclusionQueries&&!He&&!Ve&&Ee.push("OCCLUSION_QUERIES"),a.hasInitialOcclusionOpacityProperties||Ee.push("SYMBOL_OCCLUSION_BY_TERRAIN_DEPTH"),u.terrainRenderModeElevated()&&Q&&Ee.push("PITCH_WITH_MAP_TERRAIN"),He&&(Ee.push("PROJECTION_GLOBE_VIEW"),$e&&Ee.push("PROJECTED_POS_ON_VIEWPORT")),ve.text.zOffsetVertexBuffer&&Ee.push("Z_OFFSET"),Ee.push("TERRAIN_DEPTH_D24");const Di=ve.text.programConfigurations.get(a.id),Gt=u.getOrCreateProgram(ve.iconsInText?"symbolTextAndIcon":"symbolSDF",{config:Di,defines:Ee});let he,Ji=[0,0],qi=null;const Li=ve.textSizeData;ve.iconsInText&&(Ji=Be.imageAtlasTexture?Be.imageAtlasTexture.size:[0,0],qi=Be.imageAtlasTexture?Be.imageAtlasTexture:null,he=Q||$.pitch!==0||u.options.rotating||u.options.zooming||Li.kind==="composite"||Li.kind==="camera"?N.LINEAR:N.NEAREST);const Zi=Be.glyphAtlasTexture?Be.glyphAtlasTexture.size:[0,0],Br=s.aD(Li,$.zoom),dn=ft(it,Be.tileID.canonical,Q,de,$,ve.getProjection(),ht),fr=Qn(it,Be.tileID.canonical,Q,de,$,ve.getProjection(),ht),kn=u.translatePosMatrix(fr,Be,w,M,!0),On=u.translatePosMatrix(it,Be,w,M),Bn=$e?oo:dn,en=de&&!Q&&!ii;let yo=qe;!Ve&&!$.mercatorFromTransition||de||(yo=aa($));const ps=He?yo:qe;let Ia;Ia=ve.iconsInText?Oh(Li.kind,Br,en,Q,u,On,Bn,kn,Zi,Ji,je,yt,_e,St,ps,ve.getProjection()):no(Li.kind,Br,en,Q,u,On,Bn,kn,!0,Zi,!0,je,yt,_e,St,ps,ve.getProjection());const fs=Be.glyphAtlasTexture?Be.glyphAtlasTexture:null,ms=N.LINEAR,ql=a.paint.get("text-halo-width").constantOr(1)!==0,Zl=u.terrain&&Q&&ii?s.ad.invert(s.ad.create(),dn):oo;if(ii&&ve.text){const xo=$.elevation,$i=xo?xo.getAtTileOffsetFunc(je,$.center.lat,$.worldSize,ve.getProjection()):null,Nu=Qs(it,Be.tileID.canonical,Q,de,$,ve.getProjection(),ht);Ah(ve,it,u,!0,Nu,fr,Q,O,$i,je)}return{program:Gt,buffers:ve.text,uniformValues:Ia,atlasTexture:fs,atlasTextureIcon:qi,atlasInterpolation:ms,atlasInterpolationIcon:he,isSDF:!0,hasHalo:ql,tile:Be,labelPlaneMatrixInv:Zl}},Zt=ve.icon.segments.get().length,At=ve.text.segments.get().length,dt=Zt&&!g.onlyText?st():null,ti=At&&!g.onlyIcons?Jt():null,yi=a.paint.get("icon-opacity").constantOr(1),Ht=a.paint.get("text-opacity").constantOr(1);if(Ie&&ve.canOverlap){Se=!0;const ii=yi&&!g.onlyText?ve.icon.segments.get():[],Ee=Ht&&!g.onlyIcons?ve.text.segments.get():[];for(const $e of ii)Ue.push({segments:new s.b([$e]),sortKey:$e.sortKey,state:dt});for(const $e of Ee)Ue.push({segments:new s.b([$e]),sortKey:$e.sortKey,state:ti})}
2223else g.onlyText||Ue.push({segments:yi?ve.icon.segments:new s.b([]),sortKey:0,state:dt}),g.onlyIcons||Ue.push({segments:Ht?ve.text.segments:new s.b([]),sortKey:0,state:ti})}Se&&Ue.sort((je,Be)=>je.sortKey-Be.sortKey);for(const je of Ue){const Be=je.state;if(Be)if(u.terrain&&u.terrain.setupElevationDraw(Be.tile,Be.program,{useDepthForOcclusion:!a.hasInitialOcclusionOpacityProperties&&$.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Be.labelPlaneMatrixInv}),te.activeTexture.set(N.TEXTURE0),Be.atlasTexture&&Be.atlasTexture.bind(Be.atlasInterpolation,N.CLAMP_TO_EDGE,!0),Be.atlasTextureIcon&&(te.activeTexture.set(N.TEXTURE1),Be.atlasTextureIcon&&Be.atlasTextureIcon.bind(Be.atlasInterpolationIcon,N.CLAMP_TO_EDGE,!0)),u.uploadCommonLightUniforms(u.context,Be.program),Be.hasHalo){const ve=Be.uniformValues;ve.u_is_halo=1,iu(Be.buffers,je.segments,a,u,Be.program,le,f,m,ve,2),ve.u_is_halo=0}else{if(Be.isSDF){const ve=Be.uniformValues;Be.hasHalo&&(ve.u_is_halo=1,iu(Be.buffers,je.segments,a,u,Be.program,le,f,m,ve,1)),ve.u_is_halo=0}iu(Be.buffers,je.segments,a,u,Be.program,le,f,m,Be.uniformValues,1)}}}function iu(u,r,a,h,f,m,g,x,w,T){const M=h.context.gl,A=[u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer,u.iconTransitioningVertexBuffer,u.globeExtVertexBuffer,u.zOffsetVertexBuffer];u.occlusionQueryOpacityVertexBuffer.length>0&&A.push(u.occlusionQueryOpacityVertexBuffer),f.draw(h,M.TRIANGLES,m,g,x,s.af.disabled,w,a.id,u.layoutVertexBuffer,u.indexBuffer,r,a.paint,h.transform.zoom,u.programConfigurations.get(a.id),A,T)}function la(u,r,a,h,f,m,g){const x=u.context.gl,w=a.paint.get("fill-pattern"),T=w&&w.constantOr(1);let M,A,P,z,R;g?(A=T&&!a.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",M=x.LINES):(A=T?"fillPattern":"fill",M=x.TRIANGLES);for(const k of h){const O=r.getTile(k);if(T&&!O.patternsLoaded())continue;const B=O.getBucket(a);if(!B)continue;u.prepareDrawTile();const G=B.programConfigurations.get(a.id),q=u.isTileAffectedByFog(k),Z=u.getOrCreateProgram(A,{config:G,overrideFog:q});T&&(u.context.activeTexture.set(x.TEXTURE0),O.imageAtlasTexture&&O.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),G.updatePaintBuffers());const K=w.constantOr(null);if(K&&O.imageAtlas){const N=O.imageAtlas.patternPositions[K.toString()];N&&G.setConstantPatternPositions(N)}const Y=u.translatePosMatrix(k.projMatrix,O,a.paint.get("fill-translate"),a.paint.get("fill-translate-anchor")),te=a.paint.get("fill-emissive-strength");if(g){z=B.indexBuffer2,R=B.segments2;const N=u.terrain&&u.terrain.renderingToTexture?u.terrain.drapeBufferSize:[x.drawingBufferWidth,x.drawingBufferHeight];P=A==="fillOutlinePattern"&&T?Lh(Y,te,u,O,N):Dh(Y,te,N)}else z=B.indexBuffer,R=B.segments,P=T?Hc(Y,te,u,O):yl(Y,te);u.uploadCommonUniforms(u.context,Z,k.toUnwrapped()),Z.draw(u,M,f,u.stencilModeForClipping(k),m,s.af.disabled,P,a.id,B.layoutVertexBuffer,z,R,a.paint,u.transform.zoom,G,void 0)}}function hr(u,r,a,h,f,m,g,x){a.resetLayerRenderingStats(u);const w=u.context,T=w.gl,M=u.transform,A=a.paint.get("fill-extrusion-pattern"),P=A.constantOr(1),z=a.paint.get("fill-extrusion-opacity"),R=u.style.enable3dLights(),k=a.paint.get(R&&!P?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),O=[a.paint.get("fill-extrusion-ambient-occlusion-intensity"),k],B=a.layout.get("fill-extrusion-edge-radius"),G=B>0&&!a.paint.get("fill-extrusion-rounded-roof"),q=G?0:B,Z=M.projection.name==="globe"?s.bY():0,K=M.projection.name==="globe",Y=K?s.a1(M.zoom):0,te=[s.aj(M.center.lng),s.ak(M.center.lat)],N=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(a.lut).toArray01().slice(0,3),$=a.paint.get("fill-extrusion-flood-light-intensity"),re=a.paint.get("fill-extrusion-vertical-scale"),de=to(u,a.paint.get("fill-extrusion-cutoff-fade-range")),se=a.paint.get("fill-extrusion-emissive-strength"),Q=[];let fe;K&&Q.push("PROJECTION_GLOBE_VIEW"),O[0]>0&&Q.push("FAUX_AO"),G&&Q.push("ZERO_ROOF_RADIUS"),x&&Q.push("HAS_CENTROID"),$>0&&Q.push("FLOOD_LIGHT"),de.shouldRenderCutoff&&Q.push("RENDER_CUTOFF");const Me=u.renderPass==="shadow",Ie=u.shadowRenderer,Se=Me&&!!Ie;u.shadowRenderer&&(u.shadowRenderer.useNormalOffset=!0);let le=[0,0,0];if(Ie){const Ve=u.style.directionalLight,Ue=u.style.ambientLight;Ve&&Ue&&(le=Wo(u.style,Ve,Ue)),fe=Q.concat(["SHADOWS_SINGLE_CASCADE"])}const _e=Se?"fillExtrusionDepth":P?"fillExtrusionPattern":"fillExtrusion",we=a.getLayerRenderingStats();for(const Ve of h){const Ue=r.getTile(Ve),qe=Ue.getBucket(a);if(!qe||qe.projection.name!==M.projection.name)continue;let je=!1;Ie&&(je=Ie.getMaxCascadeForTile(Ve.toUnwrapped())===0);const Be=u.isTileAffectedByFog(Ve),ve=qe.programConfigurations.get(a.id),He=u.getOrCreateProgram(_e,{config:ve,defines:je?fe:Q,overrideFog:Be});if(u.terrain&&u.terrain.setupElevationDraw(Ue,He,{useMeterToDem:!0}),!qe.centroidVertexBuffer){const St=He.attributes.a_centroid_pos;St!==void 0&&T.vertexAttrib2f(St,0,0)}!Me&&Ie&&Ie.setupShadows(Ue.tileID.toUnwrapped(),He,"vector-tile",Ue.tileID.overscaledZ
2223),P&&(u.context.activeTexture.set(T.TEXTURE0),Ue.imageAtlasTexture&&Ue.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),ve.updatePaintBuffers());const yt=A.constantOr(null);if(yt&&Ue.imageAtlas){const St=Ue.imageAtlas.patternPositions[yt.toString()];St&&ve.setConstantPatternPositions(St)}const it=a.paint.get("fill-extrusion-vertical-gradient");let ht;if(Me&&Ie){if(Ml(Ue.tileID,qe,u))continue;const St=Ie.calculateShadowPassMatrixFromTile(Ue.tileID.toUnwrapped());ht=na(St,q,re)}else{const St=u.translatePosMatrix(Ve.expandedProjMatrix,Ue,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),st=M.projection.createInversionMatrix(M,Ve.canonical);ht=P?Yo(St,u,it,z,O,q,Ve,Ue,Z,Y,te,st,N,re):ra(St,u,it,z,O,q,Ve,Z,Y,te,st,N,re,$,le,se)}u.uploadCommonUniforms(w,He,Ve.toUnwrapped(),null,de);let It=qe.segments;if(M.projection.name==="mercator"&&!Me&&(It=qe.getVisibleSegments(Ue.tileID,u.terrain,u.transform.getFrustum(0)),!It.get().length))continue;if(we)if(Me)for(const St of It.get())we.numRenderedVerticesInShadowPass+=St.primitiveLength;else for(const St of It.get())we.numRenderedVerticesInTransparentPass+=St.primitiveLength;const oi=[];(u.terrain||x)&&oi.push(qe.centroidVertexBuffer),K&&oi.push(qe.layoutVertexExtBuffer),He.draw(u,w.gl.TRIANGLES,f,m,g,s.af.backCCW,ht,a.id,qe.layoutVertexBuffer,qe.indexBuffer,It,a.paint,u.transform.zoom,ve,oi)}u.shadowRenderer&&(u.shadowRenderer.useNormalOffset=!1)}function ln(u,r,a,h,f,m,g,x,w,T,M,A,P,z,R,k,O,B,G){const q=u.context,Z=q.gl,K=u.transform,Y=u.transform.zoom,te=[],N=to(u,a.paint.get("fill-extrusion-cutoff-fade-range"));T==="clear"?(te.push("CLEAR_SUBPASS"),G&&(te.push("CLEAR_FROM_TEXTURE"),q.activeTexture.set(Z.TEXTURE0),G.bind(Z.LINEAR,Z.CLAMP_TO_EDGE))):T==="sdf"&&te.push("SDF_SUBPASS"),O&&te.push("HAS_CENTROID"),N.shouldRenderCutoff&&te.push("RENDER_CUTOFF");const $=a.layout.get("fill-extrusion-edge-radius"),re=(de,se,Q,fe,Me)=>{const Ie=se.programConfigurations.get(a.id),Se=u.isTileAffectedByFog(de),le=u.getOrCreateProgram("fillExtrusionGroundEffect",{config:Ie,defines:te,overrideFog:Se}),_e=((Ve,Ue,qe,je,Be,ve,He,yt,it,ht,It)=>({u_matrix:Ue,u_opacity:qe,u_ao_pass:je?1:0,u_meter_to_tile:Be,u_ao:ve,u_flood_light_intensity:He,u_flood_light_color:yt,u_attenuation:it,u_edge_radius:ht,u_fb:0,u_fb_size:It}))(0,fe,M,w,Me,[A,P*Me],z,R,k,Y>=17?0:$*Me,G?G.size[0]:0),we=[];O&&we.push(se.hiddenByLandmarkVertexBuffer),u.uploadCommonUniforms(q,le,de.toUnwrapped(),null,N),le.draw(u,q.gl.TRIANGLES,f,m,g,x,_e,a.id,se.vertexBuffer,se.indexBuffer,Q,a.paint,Y,Ie,we)};for(const de of h){const se=r.getTile(de),Q=se.getBucket(a);if(!Q||Q.projection.name!==K.projection.name||!Q.groundEffect||Q.groundEffect&&!Q.groundEffect.hasData())continue;const fe=Q.groundEffect,Me=1/Q.tileToMeter;{const Ie=u.translatePosMatrix(de.projMatrix,se,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),Se=fe.getDefaultSegment();re(de,fe,Se,Ie,Me)}if(B)for(let Ie=0;Ie<4;Ie++){const Se=s.bZ[Ie](de),le=r.getTile(Se);if(!le)continue;const _e=le.getBucket(a);if(!_e||_e.projection.name!==K.projection.name||!_e.groundEffect||_e.groundEffect&&!_e.groundEffect.hasData())continue;const we=_e.groundEffect;let Ve,Ue;Ie===0?(Ve=[-s.a3,0,0],Ue=1):Ie===1?(Ve=[s.a3,0,0],Ue=0):Ie===2?(Ve=[0,-s.a3,0],Ue=3):(Ve=[0,s.a3,0],Ue=2);const qe=we.regionSegments[Ue];if(!qe)continue;const je=new Float32Array(16);s.ad.translate(je,de.projMatrix,Ve),re(de,we,qe,u.translatePosMatrix(je,se,a.paint.get("fill-extrusion-translate"),a.paint.get("fill-extrusion-translate-anchor")),Me)}}}function Uh(u,r,a,h,f,m,g){h.centroidVertexArray.length===0&&h.createCentroidsBuffer();const x=m?m.findDEMTileFor(a):null;if(!(x&&x.dem||g))return;const w=B=>new s.P(Math.ceil((B+s.c0)*s.c1),0),T=B=>{const G=r.getSource().minzoom,q=K=>{const Y=r.getTileByID(K);if(Y&&Y.hasData())return Y.getBucket(f)},Z=[0,-1,1];for(const K of Z){if(B.overscaledZ+K<G)continue;const Y=q(B.calculateScaledKey(B.overscaledZ+K));if(Y)return Y}},M=[0,0,0],A=(B,G)=>(M[0]=Math.min(B.min.y,G.min.y),M[1]=Math.max(B.max.y,G.max.y),M[2]=s.a3-G.min.x>B.max.x?G.min.x-s.a3:B.max.x,M),P=(B,G)=>(M[0]=Math.min(B.min.x,G.min.x),M[1]=Math.max(B.max.x,G.max.x),M[2]=s.a3-G.min.y>B.max.y?G.min.y-s.a3:B.max.y,M),z=[(B,G)=>A(B,G),(B,G)=>A(G,B),(B,G)=>P(B,G),(B,G)=>P(G,B)],R=(B,G,q,Z,K,Y,te)=>{if(!m)return 0;const N=[[Y?q:B,Y?B:q,0],[Y?q:G,Y?G:q,0]],$=te<0?s.a3+te:te,re=[Y?$:(B+G)/2,Y?(B+G)/2:$,0];return q===0&&te<0||q!==0&&te>0?m.getForTilePoints(K,[re],!0,Z):N.push(re),m.getForTilePoints(a,N,!0,x),Math.max(N[0][2],N[1][2],re[2])/m.exaggeration()};for(let B=0;B<4;B++){const G=h.borderFeatureIndices[B];if(G.length===0)continue;const q=s.bZ[B](a),Z=T(q);if(!(Z&&Z instanceof s.b_)||h.borderDoneWithNeighborZ[B]===Z.canonical.z)continue;Z.centroidVertexArray.length===0&&Z.createCentroidsBuffer();const K=m?m.findDEMTileFor(q):null;if(!(K&&K.dem||g))continue;const Y=(B<2?1:5)-B,te=Z.borderDoneWithNeighborZ[Y]!==h.canonical.z,N=Z.borderFeatureIndices[Y];let $=0;if(h.canonical.z!==Z.canonical.z){for(const re of G)h.showCentroid(h.featuresOnBorder[re]);if(te)for(const re of N)Z.showCentroid(Z.featuresOnBorder[re]);h.borderDoneWithNeighborZ[B]=Z.canonical.z,Z.borderDoneWithNeighborZ[Y]=h.canonical.z}for(const re of G){const de=h.featuresOnBorder[re],se=h.centroidData[de.centroidDataIndex],Q=de.borders[B];let fe;for(;$<N.length;){fe=Z.featuresOnBorder[N[$]];const Me=fe.borders[Y];if(Me[1]>Q[0]+3||Me[0]>Q[0]-3)break;Z.showCentroid(fe),$++}if(fe&&$<N.length){const Me=$;let Ie=0;for(;!(fe.borders[Y][0]>Q[1]-3)&&(Ie++,++$!==N.length);)fe=Z.featuresOnBorder[N[$]];if(fe=Z.featuresOnBorder[N[Me]],Ie>1){const _e=fe.borders[Y];Math.abs(Q[0]-_e[0])<3&&Math.abs(Q[1]-_e[1])<3&&(Ie=1,$=Me+1)}else if(Ie===0){h.showCentroid(de);continue}const Se=Z.centroidData[fe.centroidDataIndex];g&&Ie===1&&(((k=se).flags|(O=Se).flags)&s.b$?(k.flags|=s.b$,O.flags|=s.b$):(k.flags&=~s.b$,O.flags&=~s.b$));const le=de.intersectsCount()>1||fe.intersectsCount()>1;
2223if(Ie>1)$=Me,se.centroidXY=Se.centroidXY=new s.P(0,0);else if(K&&K.dem&&!le){const _e=z[B](se,Se),we=B%2?s.a3-1:0,Ve=R(_e[0],Math.min(s.a3-1,_e[1]),we,K,q,B<2,_e[2]);se.centroidXY=Se.centroidXY=w(Ve)}else le?se.centroidXY=Se.centroidXY=new s.P(0,0):(se.centroidXY=h.encodeBorderCentroid(de),Se.centroidXY=Z.encodeBorderCentroid(fe));h.writeCentroidToBuffer(se),Z.writeCentroidToBuffer(Se)}else h.showCentroid(de)}h.borderDoneWithNeighborZ[B]=Z.canonical.z,Z.borderDoneWithNeighborZ[Y]=h.canonical.z}var k,O;(h.needsCentroidUpdate||!h.centroidVertexBuffer&&h.centroidVertexArray.length!==0)&&h.uploadCentroid(u)}const ru=[1,0,0],so=[0,1,0],jh=[0,0,1];function Ml(u,r,a){const h=a.transform,f=a.shadowRenderer;if(!f)return!0;const m=u.toUnwrapped(),g=h.tileSize*f._cascades[a.currentShadowCascade].scale;let x=r.maxHeight;if(h.elevation){const k=h.elevation.getMinMaxForTile(u);k&&(x+=k.max)}const w=[...f.shadowDirection];w[2]=-w[2];const T=f.computeSimplifiedTileShadowVolume(m,x,g,w);if(!T)return!1;const M=[ru,so,jh,w,[w[0],0,w[2]],[0,w[1],w[2]]],A=h.projection.name==="globe",P=h.scaleZoom(g),z=s.aM.fromInvProjectionMatrix(h.invProjMatrix,h.worldSize,P,!A),R=f.getCurrentCascadeFrustum();return z.intersectsPrecise(T.vertices,T.planes,M)===0||R.intersectsPrecise(T.vertices,T.planes,M)===0}function Il(u){return[u[0]*s.c2,u[1]*s.c2,u[2]*s.c2,0]}function Jo(u,r,a,h,f,m,g,x,w){const T=h.getSource(),M=a.globeSharedBuffers;if(!M)return;let A,P,z;if(r&&(A=h.getTile(r)),T instanceof s.bm?(P=T.texture,z=s.bh(0,0,a.transform)):A&&r&&(P=A.texture,z=s.bh(r.canonical.z,r.canonical.x,a.transform)),!P||!z)return;u||(z=s.ad.scale(s.ad.create(),z,[1,-1,1]));const R=a.context,k=R.gl,O=f.paint.get("raster-resampling")==="nearest"?k.NEAREST:k.LINEAR,B=a.colorModeForDrapableLayerRenderPass(m),G=g.defines;G.push("GLOBE_POLES");const q=new s.ae(k.LEQUAL,s.ae.ReadWrite,a.depthRangeFor3D),Z=Float32Array.from(a.transform.expandedFarZProjMatrix),K=Float32Array.from(s.bf(s.bg(new s.aO(0,0,0))));a.terrain&&a.terrain.prepareDrawTile(),R.activeTexture.set(k.TEXTURE0),P.bind(O,k.CLAMP_TO_EDGE),R.activeTexture.set(k.TEXTURE1),P.bind(O,k.CLAMP_TO_EDGE),P.useMipmap&&R.extTextureFilterAnisotropic&&a.transform.pitch>20&&k.texParameterf(k.TEXTURE_2D,R.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,R.extTextureFilterAnisotropicMax);const[Y,te,N,$]=r?M.getPoleBuffers(r.canonical.z,!1):M.getPoleBuffers(0,!0),re=f.paint.get("raster-elevation");let de;u?(de=Y,a.renderDefaultNorthPole=re!==0):(de=te,a.renderDefaultSouthPole=re!==0);const se=Il(g.mix),Q=((Me,Ie,Se,le,_e,we,Ve,Ue,qe,je,Be,ve,He)=>Yc(Me,Ie,Se,new Float32Array(16),new Float32Array(9),[0,0],le,[0,0],[0,0,0,0],1,{opacity:1,mix:0},we,[0,0],Ue,2,je,Be,ve,1,0,He))(Z,K,z,s.a1(a.transform.zoom),0,f,0,re,0,se,g.offset,g.range,m),fe=a.getOrCreateProgram("raster",{defines:G});a.uploadCommonUniforms(R,fe,null),fe.draw(a,k.TRIANGLES,q,w,B,x,Q,f.id,de,N,$)}function nu(u){const r=u._nearZ,a=u.projection.farthestPixelDistance(u),h=a-r,f=.2*u.height,m=r+f;return[r,a,(m-f-r)/h,(m-r)/h]}function Nt(u,r,a,h){if(u)return r instanceof Xo&&u instanceof s.c3?r.getTextureDescriptor(u,a,!0):{texture:u.texture,mix:Il(h.mix),offset:h.offset,buffer:0,tileSize:1}}function Fp(u,r,a){if(!u)return null;const h=r.getTextureDescriptor(u,a,!0);if(!h)return null;let{texture:f,mix:m,offset:g,tileSize:x,buffer:w,format:T}=h;if(!f||!T)return null;let M=!1;return T==="uint32"&&(M=!0,m[3]=0,m=Dn(s.c4,m,[0,a.paint.get("raster-particle-max-speed")]),g=Rh(s.c4,g,[0,a.paint.get("raster-particle-max-speed")])),{texture:f,textureOffset:[w/(x+2*w),x/(x+2*w)],tileSize:x,scalarData:M,scale:m,offset:g,defines:["RASTER_ARRAY",{uint8:"DATA_FORMAT_UINT8",uint16:"DATA_FORMAT_UINT16",uint32:"DATA_FORMAT_UINT32"}[T]]}}function tt(u){const r=u._nearZ,a=u.projection.farthestPixelDistance(u),h=a-r,f=.2*u.height,m=r+f;return[r,a,(m-f-r)/h,(m-r)/h]}const Gh=new s.C(1,0,0,1),Al=new s.C(0,1,0,1),ou=new s.C(0,0,1,1),Yr=new s.C(1,0,1,1),su=new s.C(0,1,1,1);function zr(u,r,a,h,f,m,g){const x=u.context,w=u.transform,T=x.gl,M=w.projection.name==="globe",A=M?["PROJECTION_GLOBE_VIEW"]:[];let P=s.ad.clone(a.projMatrix);if(M&&s.a1(w.zoom)>0){const se=s.c5(a.canonical,w),Q=s.c6(se);P=s.ad.multiply(new Float32Array(16),w.globeMatrix,Q),s.ad.multiply(P,w.projMatrix,P)}const z=s.ad.create();z[12]+=2*f/(s.e.devicePixelRatio*w.width),z[13]+=2*m/(s.e.devicePixelRatio*w.height),s.ad.multiply(P,z,P);const R=u.getOrCreateProgram("debug",{defines:A}),k=r.getTileByID(a.key);u.terrain&&u.terrain.setupElevationDraw(k,R);const O=s.ae.disabled,B=s.ag.disabled,G=u.colorModeForRenderPass(),q="$debug";x.activeTexture.set(T.TEXTURE0),u.emptyTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),M?k._makeGlobeTileDebugBuffers(u.context,w):k._makeDebugTileBoundsBuffers(u.context,w.projection);const Z=k._tileDebugBuffer||u.debugBuffer,K=k._tileDebugIndexBuffer||u.debugIndexBuffer,Y=k._tileDebugSegments||u.debugSegments;if(R.draw(u,T.LINE_STRIP,O,B,G,s.af.disabled,vl(P,h),q,Z,K,Y,null,null,null,[k._globeTileDebugBorderBuffer]),g){const se=k.latestRawTileData,Q=Math.floor((se&&se.byteLength||0)/1024);let fe=a.canonical.toString();a.overscaledZ!==a.canonical.z&&(fe+=` => ${a.overscaledZ}`),fe+=` ${k.state}`,fe+=` ${Q}kb`,function(Me,Ie){Me.initDebugOverlayCanvas();const Se=Me.debugOverlayCanvas,le=Me.context.gl,_e=Me.debugOverlayCanvas.getContext("2d");_e.clearRect(0,0,Se.width,Se.height),_e.shadowColor="white",_e.shadowBlur=2,_e.lineWidth=1.5,_e.strokeStyle="white",_e.textBaseline="top",_e.font="bold 36px Open Sans, sans-serif",_e.fillText(Ie,5,5),_e.strokeText(Ie,5,5),Me.debugOverlayTexture.update(Se),Me.debugOverlayTexture.bind(le.LINEAR,le.CLAMP_TO_EDGE)}(u,fe)}const te=r.getTile(a).tileSize,N=512/Math.min(te,512)*(a.overscaledZ/w.zoom)*.5,$=k._tileDebugTextBuffer||u.debugBuffer,re=k._tileDebugTextIndexBuffer||u.quadTriangleIndexBuffer,de=k._tileDebugTextSegments||u.debugSegments;R.draw(u,T.TRIANGLES,O,B,s.a.alphaBlended,s.af.disabled,vl(P,s.C.transparent,N),q,$,re,de,null,null,null,[k._globeTileDebugTextBuffer])}function We(u,r,a,h){Ot(u,0,r+a/2,u.transform.width,a,h)}function Vt(u,r,a,h){Ot(u,r-a/2,0,a,u.transform.height,h)}function Ot(u,r,a,h,f,m){const g=u.context,x=g.gl;x.enable(x.SCISSOR_TEST),x.scissor(r*s.e.devicePixelRatio,a*s.e.devicePixelRatio,h*s.e.devicePixelRatio,f*s.e.devicePixelRatio),g.clear({color:m}),x.disable(x.SCISSOR_TEST)}const br=s.c7([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:Qo}=br;function Et(u,r,a,h){u.emplaceBack(r,a,h)}class ca{constructor(r){this.vertexArray=new s.c8,this.indices=new s.bu,Et(this.vertexArray,-1,-1,1),Et(this.vertexArray,1,-1,1),Et(this.vertexArray,-1,1,1),Et(this.vertexArray,1,1,1),Et(this.vertexArray,-1,-1,-1),Et(this.vertexArray,1,-1,-1),Et(this.vertexArray,-1,1,-1),Et(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=r.createVertexBuffer(this.vertexArray,Qo),this.indexBuffer=r.createIndexBuffer(this.indices),this.segment=s.b.simpleSegment(0,0,36,12)}}function Kr(u,r,a,h,f,m){const g=u.context.gl,x=r.paint.get("sky-atmosphere-color"),w=r.paint.get("sky-atmosphere-halo-color"),T=r.paint.get("sky-atmosphere-sun-intensity"),M=((A,P,z,R,k)=>({u_matrix_3f:A,u_sun_direction:P,u_sun_intensity:z,u_color_tint_r:[R.r,R.g,R.b,R.a],u_color_tint_m:[k.r,k.g,k.b,k.a],u_luminance:5e-5}))(s.bC.fromMat4(s.bC.create(),h),f,T,x,w);g.framebufferTexture2D(g.FRAMEBUFFER,g.COLOR_ATTACHMENT0,g.TEXTURE_CUBE_MAP_POSITIVE_X+m,r.skyboxTexture,0),a.draw(u,g.TRIANGLES,s.ae.disabled,s.ag.disabled,s.a.unblended,s.af.frontCW,M,"skyboxCapture",r.skyboxGeometry.vertexBuffer,r.skyboxGeometry.indexBuffer,r.skyboxGeometry.segment)}const ua=s.c7([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class rr{constructor(r){const a=new s.c9;a.emplaceBack(-1,1,1,0,0),a.emplaceBack(1,1,1,1,0),a.emplaceBack(1,-1,1,1,1),a.emplaceBack(-1,-1,1,0,1);const h=new s.bu;h.emplaceBack(0,1,2),h.emplaceBack(2,3,0),this.vertexBuffer=r.createVertexBuffer(a,ua.members),this.indexBuffer=r.createIndexBuffer(h),this.segments=s.b.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const Ti=s.c7([{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 Np{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class ha{constructor(r){this.colorModeAlphaBlendedWriteRGB=new s.a([s.ca,s.cb,s.ca,s.cb],s.C.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new s.a([s.ca,s.cc,s.ca,s.cc],s.C.transparent,[!1,!1,!1,!0]),this.params=new Np,this.updateNeeded=!0,r.tp.registerParameter(this.params,["Stars"],"starsCount",{min:100,max:16e3,step:1},()=>{this.updateNeeded=!0}),r.tp.registerParameter(this.params,["Stars"],"sizeMultiplier",{min:.01,max:2,step:.01}),r.tp.registerParameter(this.params,["Stars"],"sizeRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0}),r.tp.registerParameter(this.params,["Stars"],"intensityRange",{min:0,max:200,step:1},()=>{this.updateNeeded=!0})}update(r){const a=r.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new rr(a);const h=this.params.sizeRange,f=this.params.intensityRange,m=function(M){const A=s.cf(30),P=[];for(let z=0;z<M;
2223++z){const R=2*Math.PI*A(),k=Math.acos(1-2*A())-.5*Math.PI;P.push(s._.fromValues(Math.cos(k)*Math.cos(R),Math.cos(k)*Math.sin(R),Math.sin(k)))}return P}(this.params.starsCount),g=s.cf(300),x=new s.cd,w=new s.bu;let T=0;for(let M=0;M<m.length;++M){const A=s._.scale([],m[M],200),P=Math.max(0,1+.01*h*(1*g()-.5)),z=Math.max(0,1+.01*f*(1*g()-.5));x.emplaceBack(A[0],A[1],A[2],-1,-1,P,z),x.emplaceBack(A[0],A[1],A[2],1,-1,P,z),x.emplaceBack(A[0],A[1],A[2],1,1,P,z),x.emplaceBack(A[0],A[1],A[2],-1,1,P,z),w.emplaceBack(T+0,T+1,T+2),w.emplaceBack(T+0,T+2,T+3),T+=4}this.starsVx=a.createVertexBuffer(x,Ti.members),this.starsIdx=a.createIndexBuffer(w),this.starsSegments=s.b.simpleSegment(0,0,x.length,w.length)}}destroy(){this.atmosphereBuffer&&this.atmosphereBuffer.destroy(),this.starsVx&&this.starsVx.destroy(),this.starsIdx&&this.starsIdx.destroy()}drawAtmosphereGlow(r,a){const h=r.context,f=h.gl,m=r.transform,g=new s.ae(f.LEQUAL,s.ae.ReadOnly,[0,1]),x=s.a1(m.zoom),w=r.style.getLut(a.scope),T=a.properties.get("color").toRenderColor(w).toArray01(),M=a.properties.get("high-color").toRenderColor(w).toArray01(),A=a.properties.get("space-color").toRenderColor(w).toArray01PremultipliedAlpha(),P=5e-4,z=s.ce(a.properties.get("horizon-blend"),0,1,P,.25),R=s.ba(r,h,m)&&z===P?m.worldSize/(2*Math.PI*1.025)-1:m.globeRadius,k=r.frameCounter/1e3%1,O=s._.length(m.globeCenterInViewSpace),B=Math.sqrt(Math.pow(O,2)-Math.pow(R,2)),G=Math.acos(B/O),q=Z=>{const K=m.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];Z&&K.push("ALPHA_PASS");const Y=r.getOrCreateProgram("globeAtmosphere",{defines:K}),te=(($,re,de,se,Q,fe,Me,Ie,Se,le,_e,we)=>({u_frustum_tl:$,u_frustum_tr:re,u_frustum_br:de,u_frustum_bl:se,u_horizon:Q,u_transition:fe,u_fadeout_range:Me,u_color:Ie,u_high_color:Se,u_space_color:le,u_temporal_offset:_e,u_horizon_angle:we}))(m.frustumCorners.TL,m.frustumCorners.TR,m.frustumCorners.BR,m.frustumCorners.BL,m.frustumCorners.horizon,x,z,T,M,A,k,G);r.uploadCommonUniforms(h,Y);const N=this.atmosphereBuffer;N&&Y.draw(r,f.TRIANGLES,g,s.ag.disabled,Z?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,s.af.backCW,te,Z?"atmosphere_glow_alpha":"atmosphere_glow",N.vertexBuffer,N.indexBuffer,N.segments)};q(!1),q(!0)}drawStars(r,a){const h=s.at(a.properties.get("star-intensity"),0,1);if(h===0)return;const f=r.context,m=f.gl,g=r.transform,x=r.getOrCreateProgram("stars"),w=s.av.identity([]);s.av.rotateX(w,w,-g._pitch),s.av.rotateZ(w,w,-g.angle),s.av.rotateX(w,w,s.ab(g._center.lat)),s.av.rotateY(w,w,-s.ab(g._center.lng));const T=s.ad.fromQuat(new Float32Array(16),w),M=s.ad.multiply([],g.starsProjMatrix,T),A=s.bC.fromMat4([],T),P=s.bC.invert([],A),z=[0,1,0];s._.transformMat3(z,z,P),s._.scale(z,z,this.params.sizeMultiplier);const R=[1,0,0];s._.transformMat3(R,R,P),s._.scale(R,R,this.params.sizeMultiplier);const k=(O=z,B=R,G=h,{u_matrix:Float32Array.from(M),u_up:O,u_right:B,u_intensity_multiplier:G});var O,B,G;r.uploadCommonUniforms(f,x),this.starsVx&&this.starsIdx&&x.draw(r,m.TRIANGLES,s.ae.disabled,s.ag.disabled,this.colorModeAlphaBlendedWriteRGB,s.af.disabled,k,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}function Cl(u,r){const a=[...u],h=r.cameraWorldSizeForFog/r.worldSize,f=s.ad.identity([]);return s.ad.scale(f,f,[h,h,1]),s.ad.multiply(a,f,a),s.ad.multiply(a,r.worldToFogMatrix,a),a}function ao(u,r,a,h,f){const m=a.material,g=h.context,{baseColorTexture:x,metallicRoughnessTexture:w}=m.pbrMetallicRoughness,{normalTexture:T,occlusionTexture:M,emissionTexture:A}=m;function P(z,R,k){if(z&&(u.push(R),g.activeTexture.set(g.gl.TEXTURE0+k),z.gfxTexture)){const{minFilter:O,magFilter:B,wrapS:G,wrapT:q}=z.sampler;z.gfxTexture.bindExtraParam(O,B,G,q)}}P(x,"HAS_TEXTURE_u_baseColorTexture",Ei.BaseColor),P(w,"HAS_TEXTURE_u_metallicRoughnessTexture",Ei.MetallicRoughness),P(T,"HAS_TEXTURE_u_normalTexture",Ei.Normal),P(M,"HAS_TEXTURE_u_occlusionTexture",Ei.Occlusion),P(A,"HAS_TEXTURE_u_emissionTexture",Ei.Emission),f&&(f.texture||(f.texture=new s.ch(h.context,f.image,[f.image.height,f.image.height,f.image.height],g.gl.RGBA)),g.activeTexture.set(g.gl.TEXTURE0+Ei.LUT),f.texture&&f.texture.bind(g.gl.LINEAR,g.gl.CLAMP_TO_EDGE),u.push("APPLY_LUT_ON_GPU")),a.texcoordBuffer&&(u.push("HAS_ATTRIBUTE_a_uv_2f"),r.push(a.texcoordBuffer)),a.colorBuffer&&(u.push(a.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),r.push(a.colorBuffer)),a.normalBuffer&&(u.push("HAS_ATTRIBUTE_a_normal_3f"),r.push(a.normalBuffer)),a.pbrBuffer&&(u.push("HAS_ATTRIBUTE_a_pbr"),u.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),r.push(a.pbrBuffer)),m.alphaMode!=="OPAQUE"&&m.alphaMode!=="MASK"||u.push("UNPREMULT_TEXTURE_IN_SHADER"),m.defined||u.push("DIFFUSE_SHADED"),u.push("USE_STANDARD_DERIVATIVES")}function es(u,r,a,h,f,m){const g=a.paint.get("model-opacity"),x=r.context,w=new s.ae(r.context.gl.LEQUAL,s.ae.ReadWrite,r.depthRangeFor3D),T=r.transform,M=u.mesh,A=M.material,P=A.pbrMetallicRoughness,z=r.style.fog;let R;R=r.transform.projection.zAxisUnit==="pixels"?[...u.nodeModelMatrix]:s.ad.multiply([],h.zScaleMatrix,u.nodeModelMatrix),s.ad.multiply(R,h.negCameraPosMatrix,R);const k=s.ad.invert([],R);s.ad.transpose(k,k);const O=a.paint.get("model-emissive-strength").constantOr(0),B=eu(new Float32Array(u.worldViewProjection),new Float32Array(R),new Float32Array(k),null,r,g,P.baseColorFactor.toRenderColor(null),A.emissiveFactor,P.metallicFactor,P.roughnessFactor,A,O,a),G={defines:[]},q=[];ao(G.defines,q,M,r,a.lut);const Z=r.shadowRenderer;Z&&(Z.useNormalOffset=!1);let K=null;if(z){const N=Cl(u.nodeModelMatrix,r.transform);if(K=new Float32Array(N),T.projection.name!=="globe"){const $=M.aabb.min,re=M.aabb.max,[de,se]=z.getOpacityForBounds(N,$[0],$[1],re[0],re[1]);G.overrideFog=de>=li||se>=li}}const Y=to(r,a.paint.get("model-cutoff-fade-range"));Y.shouldRenderCutoff&&G.defines.push("RENDER_CUTOFF");const te=r.getOrCreateProgram("model",G);r.uploadCommonUniforms(x,te,null,K,Y),r.renderPass!=="shadow"&&Z&&Z.setupShadowsFromMatr
2223ix(u.nodeModelMatrix,te),te.draw(r,x.gl.TRIANGLES,w,f,m,M.material.doubleSided?s.af.disabled:s.af.backCCW,B,a.id,M.vertexBuffer,M.indexBuffer,M.segments,a.paint,r.transform.zoom,void 0,q)}function da(u,r,a,h,f,m,g){let x;x=u.projection.name==="globe"?s.ci(a,u):[...a],s.ad.multiply(x,x,r.matrix);const w=s.ad.multiply([],h,x);if(r.meshes)for(const T of r.meshes){if(T.material.alphaMode!=="BLEND"){g.push({mesh:T,depth:0,modelIndex:f,worldViewProjection:w,nodeModelMatrix:x});continue}const M=s._.transformMat4([],T.centroid,w);M[2]>0&&m.push({mesh:T,depth:M[2],modelIndex:f,worldViewProjection:w,nodeModelMatrix:x})}if(r.children)for(const T of r.children)da(u,T,a,h,f,m,g)}function Bi(u,r,a,h){const f=a.shadowRenderer;if(!f)return;const m=f.getShadowPassDepthMode(),g=f.getShadowPassColorMode(),x=f.calculateShadowPassMatrixFromMatrix(r),w=Tl(x);a.getOrCreateProgram("modelDepth",{defines:a._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(a,a.context.gl.TRIANGLES,m,s.ag.disabled,g,s.af.backCCW,w,h.id,u.vertexBuffer,u.indexBuffer,u.segments,h.paint,a.transform.zoom,void 0,void 0)}function dr(u,r,a){const h=r.updateZoomBasedPaintProperties(),f=function(m,g,x){let w,T,M,A=m.terrain?m.terrain.exaggeration():0;if(m.terrain&&A>0){const P=m.terrain,z=P.findDEMTileFor(x);z&&z.dem?w=s.ck.create(P,x,z):A=0}if(A===0&&(g.terrainElevationMin=0,g.terrainElevationMax=0),A===g.validForExaggeration&&(A===0||w&&w._demTile&&w._demTile.tileID===g.validForDEMTile.id&&w._dem._timestamp===g.validForDEMTile.timestamp))return!1;for(const P in g.instancesPerModel){const z=g.instancesPerModel[P];for(let R=0;R<z.instancedDataArray.length;++R){const k=(w?A*w.getElevationAt(0|z.instancedDataArray.float32[16*R],0|z.instancedDataArray.float32[16*R+1],!0,!0):0)+z.instancesEvaluatedElevation[R];z.instancedDataArray.float32[16*R+6]=k,T=T?Math.min(g.terrainElevationMin,k):k,M=M?Math.max(g.terrainElevationMax,k):k}}return g.terrainElevationMin=T||0,g.terrainElevationMax=M||0,g.validForExaggeration=A,g.validForDEMTile=w&&w._demTile?{id:w._demTile.tileID,timestamp:w._dem._timestamp}:{id:void 0,timestamp:0},!0}(u,r,a);(h||f)&&(r.uploaded=!1,r.upload(u.context))}const Dr={shadowUniformsInitialized:!1,useSingleShadowCascade:!1,tileMatrix:new Float64Array(16),shadowTileMatrix:new Float32Array(16),aabb:new s.b6([0,0,0],[s.a3,s.a3,0])};function ts(u,r){const a=1<<u.canonical.z,h=r.getFreeCameraOptions().position,f=r.elevation,m=u.canonical.x/a,g=(u.canonical.x+1)/a,x=u.canonical.y/a,w=(u.canonical.y+1)/a;let T=r._centerAltitude;if(f){const z=f.getMinMaxForTile(u);z&&z.max>T&&(T=z.max)}const M=s.at(h.x,m,g)-h.x,A=s.at(h.y,x,w)-h.y,P=s.ax(T,r.center.lat)-h.z;return r._zoomFromMercatorZ(Math.sqrt(M*M+A*A+P*P))}function Si(u,r,a,h,f,m,g){const x=u.context,w=u.renderPass==="shadow",T=u.shadowRenderer,M=w&&T?T.getShadowPassDepthMode():new s.ae(x.gl.LEQUAL,s.ae.ReadWrite,u.depthRangeFor3D),A=u.isTileAffectedByFog(m);if(a.meshes)for(const P of a.meshes){const z=["MODEL_POSITION_ON_GPU"],R=[];let k,O,B;h.instancedDataArray.length>20&&z.push("INSTANCED_ARRAYS");const G=to(u,r.paint.get("model-cutoff-fade-range"));if(G.shouldRenderCutoff&&z.push("RENDER_CUTOFF"),w&&T)k=u.getOrCreateProgram("modelDepth",{defines:z}),O=Tl(g.shadowTileMatrix,g.shadowTileMatrix,Float32Array.from(a.matrix)),B=T.getShadowPassColorMode();else{ao(z,R,P,u,r.lut),k=u.getOrCreateProgram("model",{defines:z,overrideFog:A});const Z=P.material,K=Z.pbrMetallicRoughness,Y=r.paint.get("model-opacity"),te=r.paint.get("model-emissive-strength").constantOr(0);O=eu(m.expandedProjMatrix,Float32Array.from(a.matrix),new Float32Array(16),null,u,Y,K.baseColorFactor.toRenderColor(null),Z.emissiveFactor,K.metallicFactor,K.roughnessFactor,Z,te,r,f),T&&(g.shadowUniformsInitialized?k.setShadowUniformValues(x,T.getShadowUniformValues()):(T.setupShadows(m.toUnwrapped(),k,"model-tile",m.overscaledZ),g.shadowUniformsInitialized=!0)),B=G.shouldRenderCutoff||Y<1||Z.alphaMode!=="OPAQUE"?s.a.alphaBlended:s.a.unblended}u.uploadCommonUniforms(x,k,m.toUnwrapped(),null,G);const q=P.material.doubleSided?s.af.disabled:s.af.backCCW;if(h.instancedDataArray.length>20)R.push(h.instancedDataBuffer),k.draw(u,x.gl.TRIANGLES,M,s.ag.disabled,B,q,O,r.id,P.vertexBuffer,P.indexBuffer,P.segments,r.paint,u.transform.zoom,void 0,R,h.instancedDataArray.length);else{const Z=w?"u_instance":"u_normal_matrix";for(let K=0;K<h.instancedDataArray.length;++K)O[Z]=new Float32Array(h.instancedDataArray.arrayBuffer,64*K,16),k.draw(u,x.gl.TRIANGLES,M,s.ag.disabled,B,q,O,r.id,P.vertexBuffer,P.indexBuffer,P.segments,r.paint,u.transform.zoom,void 0,R)}}if(a.children)for(const P of a.children)Si(u,r,P,h,f,m,g)}const Lr=[1,-1,1];function cn(u,r,a,h){if(!a.modelManager)return!0;const f=a.modelManager;if(!a.shadowRenderer)return!0;const m=a.shadowRenderer,g=r.aabb;let x=!0,w=u.maxHeight;if(w===0){let M=0;for(const A in u.instancesPerModel){const P=f.getModel(A,h);P?M=Math.max(M,Math.max(Math.max(P.aabb.max[0],P.aabb.max[1]),P.aabb.max[2])):x=!1}w=u.maxScale*M*1.41+u.maxVerticalOffset,x&&(u.maxHeight=w)}g.max[2]=w,g.min[2]+=u.terrainElevationMin,g.max[2]+=u.terrainElevationMax,s._.transformMat4(g.min,g.min,r.tileMatrix),s._.transformMat4(g.max,g.max,r.tileMatrix);const T=g.intersects(m.getCurrentCascadeFrustum());return a.currentShadowCascade===0&&(u.isInsideFirstShadowMapFrustum=T===2),T===0}function zi(u,r){const a=u.uniformValues.u_cutoff_params[0],h=u.uniformValues.u_cutoff_params[1],f=u.uniformValues.u_cutoff_params[2],m=u.uniformValues.u_cutoff_params[3];return h===a||m===f?1:s.at(((r-a)/(h-a)-f)/(m-f),0,1)}function au(u,r,a,h){if(r.pitch<20)return 1;const f=r.getWorldToCameraMatrix(),m=s.ad.multiply([],f,u),g=[...a.min,1];let x=s.aA.transformMat4([],g,m),w=x,T=x;g[1]=a.max[1],x=s.aA.transformMat4([],g,m),w=x[1]<w[1]?x:w,T=x[1]>T[1]?x:T,g[0]=a.max[0],x=s.aA.transformMat4([],g,m),w=x[1]<w[1]?x:w,T=x[1]>T[1]?x:T,g[1]=a.min[1],x=s.aA.transformMat4([],g,m),w=x[1]<w[1]?x:w,T=x[1]>T[1]?x:T;const M=s.at(h[0],0,1),A=100*r.pixelsPerMeter*s.at(h[1],0,1),P=s.at(h[2],0,1),z=s._.lerp([],w,T,M),R=Math.tan(.5*r.fovX),k=-z[2]*R;if(A===0)return z[1]<-Math.abs(k)?P:1;const O=(-Math.abs(k)-z[1])/A,B=(q,Z,K)=>(1-K)*q+K*Z,G=s.at(B(1,P,O),P,1);
2223return B(1,G,s.at((r.pitch-20)/20,0,1))}class Rr{}class pa{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(r,a,h){{const A=this._storage.get(a.id);if(A)return A.lastUsedFrameIdx=r,A.buf}const f=h.gl,m=f.getBufferParameter(f.ELEMENT_ARRAY_BUFFER,f.BUFFER_SIZE),g=new ArrayBuffer(m),x=new Int16Array(g);f.getBufferSubData(f.ELEMENT_ARRAY_BUFFER,0,new Int16Array(g));const w=new s.cm;for(let A=0;A<m/2;A+=3){const P=x[A],z=x[A+1],R=x[A+2];w.emplaceBack(P,z),w.emplaceBack(z,R),w.emplaceBack(R,P)}const T=h.bindVertexArrayOES.current,M=new Rr;return M.buf=new s.I(h,w),M.lastUsedFrameIdx=r,this._storage.set(a.id,M),h.bindVertexArrayOES.set(T),M.buf}update(r){for(const[a,h]of this._storage)r-h.lastUsedFrameIdx>30&&(h.buf.destroy(),this._storage.delete(a))}destroy(){for(const[r,a]of this._storage)a.buf.destroy(),this._storage.delete(r)}}const fa=s.c7([{type:"Float32",name:"a_offset_xy",components:2}]);class lo{constructor(r){const a=new s.cn,h=new s.bu;a.emplaceBack(-1,-1),a.emplaceBack(1,-1),a.emplaceBack(1,1),a.emplaceBack(-1,1),h.emplaceBack(0,1,2),h.emplaceBack(0,2,3),this.segments=s.b.simpleSegment(0,0,a.length,h.length),this.vx=r.createVertexBuffer(a,fa.members),this.idx=r.createIndexBuffer(h)}destroy(){this.vx.destroy(),this.idx.destroy()}}const lu={symbol:function(u,r,a,h,f){if(u.renderPass!=="translucent")return;const m=s.ag.disabled,g=u.colorModeForRenderPass();a.layout.get("text-variable-anchor")&&function(T,M,A,P,z,R,k){const O=M.transform,B=z==="map",G=R==="map";for(const q of T){const Z=P.getTile(q),K=Z.getBucket(A);if(!K||!K.text||!K.text.segments.get().length)continue;const Y=s.aD(K.textSizeData,O.zoom),te=El(q,K.getProjection(),O),N=O.calculatePixelsToTileUnitsMatrix(Z),$=ft(te,Z.tileID.canonical,G,B,O,K.getProjection(),N),re=K.hasIconTextFit()&&K.hasIconData();if(Y){const de=Math.pow(2,O.zoom-Z.tileID.overscaledZ);Bp(K,B,G,k,s.bO,O,$,q,de,Y,re)}}}(h,u,a,r,a.layout.get("text-rotation-alignment"),a.layout.get("text-pitch-alignment"),f);const x=a.paint.get("icon-opacity").constantOr(1)!==0,w=a.paint.get("text-opacity").constantOr(1)!==0;a.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(x||w)?Sl(u,r,a,h,m,g):(x&&Sl(u,r,a,h,m,g,{onlyIcons:!0}),w&&Sl(u,r,a,h,m,g,{onlyText:!0}),function(T,M,A,P){if(!T.symbolParams.useOcclusionQueries)return;const z=T.context.gl,R=T.transform,k=A.paint,O=k.get("icon-occlusion-opacity").constantOr(0),B=k.get("text-occlusion-opacity").constantOr(0);if(!A.hasInitialOcclusionOpacityProperties||O===1&&B===1)return;const G=R.projection.name==="globe";for(const q of P){const Z=M.getTile(q),K=Z.getBucket(A);if(!K||K.projection.name==="mercator"&&G||K.fullyClipped)continue;if(K.projection.name==="globe"){s.w(`Occlusion not supported for globe mode. Layer: ${A.type}`);continue}const Y=El(q,K.getProjection(),R),te=s.ad.fromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,T.symbolParams.depthOffset,1),N=s.ad.multiply([],te,Y),$=T.symbolParams.visualizeOcclusions!=="none"?1:T.symbolParams.occlusionQueryFrameWindow;for(let re=0;re<K.symbolInstances.length;re++){const de=K.symbolInstances.get(re),se=T.style.placement.opacities[de.crossTileID];if(se&&se.isHidden()||(T.frameCounter+re)%$!=0)continue;const Q=de.tileAnchorX,fe=de.tileAnchorY,Me=de.zOffset;let Ie;if(T.symbolParams.visualizeOcclusions==="none"){const Ve=K.queries.get(re);if(Ve){if(!Ve.isFree()){if(!Ve.isResultAvailable())continue;const Ue=Ve.consumeResult();de.occlusionState=Ue===0?0:1;continue}Ie=Ve}else Ie=new Oo(T.context),K.queries.set(re,Ie)}const Se=T.getOrCreateProgram("occlusion"),le=T.symbolParams.occluderSize,_e=kp(N,[Q,fe,Me],[R.width,R.height],[le,le],T.symbolParams.visualizeOcclusions==="zPass"?[1,0,0,.8]:[1,.4,.2,.9]);T.terrain&&T.terrain.setupElevationDraw(Z,Se,{useDepthForOcclusion:!1,labelPlaneMatrixInv:void 0}),T.symbolParams.visualizeOcclusions==="none"&&Ie&&Ie.begin();const we=new s.ae(T.symbolParams.visualizeOcclusions==="zPass"?T.context.gl.ALWAYS:T.context.gl.LEQUAL,s.ae.ReadOnly,T.depthRangeFor3D);Se.draw(T,z.TRIANGLES,we,s.ag.disabled,T.symbolParams.visualizeOcclusions!=="none"?s.a.alphaBlendedNonPremultiplied:s.a.disabled,s.af.disabled,_e,"occlusion",T.occlusionBuffers.vx,T.occlusionBuffers.idx,T.occlusionBuffers.segments),T.symbolParams.visualizeOcclusions==="none"&&Ie&&Ie.end()}}}(u,r,a,h)),r.map.showCollisionBoxes&&(Vh(u,r,a,h,a.paint.get("text-translate"),a.paint.get("text-translate-anchor"),!0),Vh(u,r,a,h,a.paint.get("icon-translate"),a.paint.get("icon-translate-anchor"),!1))},circle:function(u,r,a,h){if(u.renderPass!=="translucent")return;const f=a.paint.get("circle-opacity"),m=a.paint.get("circle-stroke-width"),g=a.paint.get("circle-stroke-opacity"),x=a.layout.get("
2223circle-sort-key").constantOr(1)!==void 0,w=a.paint.get("circle-emissive-strength");if(f.constantOr(1)===0&&(m.constantOr(1)===0||g.constantOr(1)===0))return;const T=u.context,M=T.gl,A=u.transform,P=u.depthModeForSublayer(0,s.ae.ReadOnly),z=s.ag.disabled,R=u.colorModeForDrapableLayerRenderPass(w),k=A.projection.name==="globe",O=[s.aj(A.center.lng),s.ak(A.center.lat)],B=[];for(let q=0;q<h.length;q++){const Z=h[q],K=r.getTile(Z),Y=K.getBucket(a);if(!Y||Y.projection.name!==A.projection.name)continue;const te=Y.programConfigurations.get(a.id),N=s.bR(a),$=u.isTileAffectedByFog(Z);k&&N.push("PROJECTION_GLOBE_VIEW"),N.push("TERRAIN_DEPTH_D24");const re=u.getOrCreateProgram("circle",{config:te,defines:N,overrideFog:$}),de=Y.layoutVertexBuffer,se=Y.globeExtVertexBuffer,Q=Y.indexBuffer,fe=A.projection.createInversionMatrix(A,Z.canonical),Me={programConfiguration:te,program:re,layoutVertexBuffer:de,globeExtVertexBuffer:se,indexBuffer:Q,uniformValues:s.bS(u,Z,K,fe,O,a),tile:K};if(x){const Ie=Y.segments.get();for(const Se of Ie)B.push({segments:new s.b([Se]),sortKey:Se.sortKey,state:Me})}else B.push({segments:Y.segments,sortKey:0,state:Me})}x&&B.sort((q,Z)=>q.sortKey-Z.sortKey);const G={useDepthForOcclusion:A.depthOcclusionForSymbolsAndCircles};for(const q of B){const{programConfiguration:Z,program:K,layoutVertexBuffer:Y,globeExtVertexBuffer:te,indexBuffer:N,uniformValues:$,tile:re}=q.state,de=q.segments;u.terrain&&u.terrain.setupElevationDraw(re,K,G),u.uploadCommonUniforms(T,K,re.tileID.toUnwrapped()),K.draw(u,M.TRIANGLES,P,z,R,s.af.disabled,$,a.id,Y,N,de,a.paint,A.zoom,Z,[te])}},heatmap:function(u,r,a,h){if(a.paint.get("heatmap-opacity")!==0)if(u.renderPass==="offscreen"){const f=u.context,m=f.gl,g=s.ag.disabled,x=new s.a([m.ONE,m.ONE,m.ONE,m.ONE],s.C.transparent,[!0,!0,!0,!0]);(function(z,R,k,O){const B=z.gl,G=R.width*O,q=R.height*O;z.activeTexture.set(B.TEXTURE1),z.viewport.set([0,0,G,q]);let Z=k.heatmapFbo;if(!Z||Z&&(Z.width!==G||Z.height!==q)){Z&&Z.destroy();const K=B.createTexture();B.bindTexture(B.TEXTURE_2D,K),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_S,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_WRAP_T,B.CLAMP_TO_EDGE),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MIN_FILTER,B.LINEAR),B.texParameteri(B.TEXTURE_2D,B.TEXTURE_MAG_FILTER,B.LINEAR),Z=k.heatmapFbo=z.createFramebuffer(G,q,!0,null),function(Y,te,N,$,re,de){const se=Y.gl;se.texImage2D(se.TEXTURE_2D,0,Y.extRenderToTextureHalfFloat?se.RGBA16F:se.RGBA,re,de,0,se.RGBA,Y.extRenderToTextureHalfFloat?se.HALF_FLOAT:se.UNSIGNED_BYTE,null),$.colorAttachment.set(N)}(z,0,K,Z,G,q)}else B.bindTexture(B.TEXTURE_2D,Z.colorAttachment.get()),z.bindFramebuffer.set(Z.framebuffer)})(f,u,a,u.transform.projection.name==="globe"?.5:.25),f.clear({color:s.C.transparent});const w=u.transform,T=w.projection.name==="globe",M=T?["PROJECTION_GLOBE_VIEW"]:[],A=T?s.af.frontCCW:s.af.disabled,P=[s.aj(w.center.lng),s.ak(w.center.lat)];for(let z=0;z<h.length;z++){const R=h[z];if(r.hasRenderableParent(R))continue;const k=r.getTile(R),O=k.getBucket(a);if(!O||O.projection.name!==w.projection.name)continue;const B=u.isTileAffectedByFog(R),G=O.programConfigurations.get(a.id),q=u.getOrCreateProgram("heatmap",{config:G,defines:M,overrideFog:B}),{zoom:Z}=u.transform;u.terrain&&u.terrain.setupElevationDraw(k,q),u.uploadCommonUniforms(f,q,R.toUnwrapped());const K=w.projection.createInversionMatrix(w,R.canonical);q.draw(u,m.TRIANGLES,s.ae.disabled,g,x,A,oa(u,R,k,K,P,Z,a.paint.get("heatmap-intensity")),a.id,O.layoutVertexBuffer,O.indexBuffer,O.segments,a.paint,u.transform.zoom,G,T?[O.globeExtVertexBuffer]:null)}f.viewport.set([0,0,u.width,u.height])}else u.renderPass==="translucent"&&(u.context.setColorMode(u.colorModeForRenderPass()),function(f,m){const g=f.context,x=g.gl,w=m.heatmapFbo;if(!w)return;g.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,w.colorAttachment.get()),g.activeTexture.set(x.TEXTURE1);let T=m.colorRampTexture;T||(T=m.colorRampTexture=new s.T(g,m.colorRamp,x.RGBA)),T.bind(x.LINEAR,x.CLAMP_TO_EDGE),f.getOrCreateProgram("heatmapTexture").draw(f,x.TRIANGLES,s.ae.disabled,s.ag.disabled,f.colorModeForRenderPass(),s.af.disabled,((M,A,P,z)=>({u_image:0,u_color_ramp:1,u_opacity:A.paint.get("heatmap-opacity")}))(0,m),m.id,f.viewportBuffer,f.quadTriangleIndexBuffer,f.viewportSegments,m.paint,f.transform.zoom)}(u,a))},line:function(u,r,a,h){if(u.renderPass!=="translucent")return;const f=a.paint.get("line-opacity"),m=a.paint.get("line-width");if(f.constantOr(1)===0||m.constantOr(1)===0)return;const g=a.paint.get("line-emissive-strength"),x=a.paint.get("line-occlusion-opacity"),w=u.context,T=w.gl,M=a.layout.get("line-z-offset"),A=!M.isConstant()||!!M.constantOr(0),P=A?new s.ae(u.depthOcclusion?T.GREATER:T.LEQUAL,s.ae.ReadOnly,u.depthRangeFor3D):u.depthModeForSublayer(0,s.ae.ReadOnly),z=u.colorModeForDrapableLayerRenderPass(g),R=u.terrain&&u.terrain.renderingToTexture,k=R?1:s.e.devicePixelRatio,O=a.paint.get("line-dasharray"),B=O.constantOr(1),G=a.layout.get("line-cap"),q=O.constantOr(null),Z=G.constantOr(null),K=a.paint.get("line-pattern"),Y=K.constantOr(1),te=K.constantOr(null),N=a.paint.get("line-opacity").constantOr(1);let $=!Y&&N!==1||u.depthOcclusion&&x>0&&x<1;const re=a.paint.get("line-gradient"),de=Y?"linePattern":"line",se=s.bT(a);let Q;if(R&&u.terrain&&u.terrain.clipOrMaskOverlapStencilType()&&($=!1),x!==0&&u.depthOcclusion){const Me=a.paint._values["line-opacity"];Me&&Me.value&&Me.value.kind==="constant"?Q=Me.value:s.w(`Occlusion opacity for layer ${a.id} is supported only when line-opacity isn't data-driven.`)}if(A&&(u.forceTerrainMode=!0),!A&&x!==0&&u.terrain&&!R)return void s.w(`Occlusion opacity for layer ${a.id} is supported on terrain only if the layer has non-zero line-z-offset.`);const fe=$&&A?u.stencilModeFor3D():s.ag.disabled;for(const Me of h){const Ie=r.getTile(Me);if(Y&&!Ie.patternsLoaded())continue;const Se=Ie.getBucket(a);if(!Se)continue;u.prepareDrawTile();const le=Se.programConfigurations.get(a.id),_e=u.isTileAffectedByFog(Me),we=u.getOrCreateProgram(de,{config:le,defines:A?[...se,"ELEVATED"]:se,overrideFog:_e});if(te&&Ie.imageAtlas){const ve=Ie.imageAtlas.patternPositions[te.toString()];ve&&le.setConstantPatternPositions(ve)}if(!Y&&q&&Z&&Ie.lineAtlas){const ve=Ie.lineAtlas.getDash(q,Z);ve&&le.setConstantPatternPositions(ve)}let[Ve,Ue]=a.paint.get("line-trim-offset");(Z==="round"||Z==="square")&&Ve!==Ue&&(Ve===0&&(Ve-=1),Ue===1&&(Ue+=1));const qe=R?Me.projMatrix:null,je=Y?s.bU(u,Ie,a,qe,k,[Ve,Ue]):s.bV(u,Ie,a,qe,Se.lineClipsArray.length,k,[Ve,Ue]);if(re){const ve=Se.gradients[a.id];let He=ve.texture;if(a.gradientVersion!==ve.version){let yt=256;if(a.stepInterpolant){const it=r.getSource().maxzoom,ht=Me.canonical.z===it?Math.ceil(1<<u.transform.maxZoom-Me.canonical.z):1;yt=s.at(s.bW(Se.maxLineLength/s.a3*1024*ht),256,w.maxTextureSize)}ve.gradient=s.bX({expression:a.gradientExpression(),evaluationKey:"lineProgress",resolution:yt,image:ve.gradient||void 0,clips:Se.lineClipsArray}),ve.texture?ve.texture.update(ve.gradient):ve.texture=new s.T(w,ve.gradient,T.RGBA),ve.version=a.gradientVersion,He=ve.texture}w.activeTexture.set(T.TEXTURE1),He.bind(a.stepInterpolant?T.NEAREST:T.LINEAR,T.CLAMP_TO_EDGE)}B&&(w.activeTexture.set(T.TEXTURE0),Ie.lineAtlasTexture&&Ie.lineAtlasTexture.bind(T.LINEAR,T.REPEAT),le.updatePaintBuffers()),Y&&(w.activeTexture.set(T.TEXTURE0),Ie.imageAtlasTexture&&Ie.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),le.updatePaintBuffers()),A&&u.terrain.setupElevationDraw(Ie,we),u.uploadCommonUniforms(w,we,Me.toUnwrapped());const Be=ve=>{Q!=null&&(Q.value=N*x),we.draw(u,T.TRIANGLES,P,ve,z,s.af.disabled,je,a.id,Se.layoutVertexBuffer,Se.indexBuffer,Se.segments,a.paint,u.transform.zoom,le,[Se.layoutVertexBuffer2,Se.patternVertexBuffer,Se.zOffsetVertexBuffer]),Q!=null&&(Q.value=N)};if($&&!A){const ve=u.stencilModeForClipping(Me).ref;ve===0&&R&&w.clear({stencil:0});const He={func:T.EQUAL,mask:255};je.u_alpha_discard_threshold=.8,Be(new s.ag(He,ve,255,T.KEEP,T.KEEP,T.INVERT)),je.u_alpha_discard_threshold=0,Be(new s.ag(He,ve,255,T.KEEP,T.KEEP,T.KEEP))}else $&&A&&(je.u_alpha_discard_threshold=.001),Be(A?fe:u.stencilModeForClipping(Me))}$&&(u.resetStencilClippingMasks(),R&&w.clear({stencil:0})),x===0||u.depthOcclusion||R||u.layersWithOcclusionOpacity.push(u.currentLayer),A&&(u.forceTerrainMode=!1)},fill:function(u,r,a,h){const f=a.paint.get("fill-color"),m=a.paint.get("fill-opacity");if(m.constantOr(1)===0)return;const g=a.paint.get("fill-emissive-strength"),x=u.colorModeForDrapableLayerRenderPass(g),w=a.paint.get("fill-pattern"),T=u.opaquePassEnabledForLayer()&&!w.constantOr(1)&&f.constantOr(s.C.transparent).a===1&&m.constantOr(0)===1?"opaque":"translucent";if(u.renderPass===T){const M=u.depthModeForSublayer(1,u.renderPass==="opaque"?s.ae.ReadWrite:s.ae.ReadOnly);la(u,r,a,h,M,x,!1)}if(u.renderPass==="translucent"&&a.paint.get("fill-antialias")){const M=u.depthModeForSublayer(a.getPaintProperty("fill-outline-color")?2:0,s.ae.ReadOnly);la(u,r,a,h,M,x,!0)}},"fill-extrusion":function(u,r,a,h){const f=a.paint.get("fill-extrusion-opacity"),m=u.context,g=m.gl,x=u.terrain,w=x&&x.renderingToTexture;if(f===0)return;const T=u.conflationActive&&u.style.isLayerClipped(a,r.getSource()),M=u.style.order.indexOf(a.fqid);if(T&&function(A,P,z,R,k){for(const O of R){const B=P.getTile(O).getBucket(z);B&&(B.updateReplacement(O,A.replacementSource,k),B.uploadCentroid(A.context))}}(u,r,a,h,M),x||T)for(const A of h){const P=r.getTile(A).getBucket(a);P&&Uh(u.context,r,A,P,a,x,T)}if(u.renderPass==="shadow"&&u.shadowRenderer){const A=u.shadowRenderer;if(x&&f<.65&&a._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof s.Z)return;const P=A.getShadowPassDepthMode(),z=A.getShadowPassColorMode();hr(u,r,a,h,P,s.ag.disabled,z,T)}else if(u.renderPass==="translucent"){const A=!a.paint.get("fill-extrusion-pattern").constantOr(1),P=a.paint.get("fill-extrusion-color").constantOr(s.C.white);if(!w&&P.a!==0){const z=new s.ae(u.context.gl.LEQUAL,s.ae.ReadWrite,u.depthRangeFor3D);f===1&&A?hr(u,r,a,h,z,s.ag.disabled,s.a.unblended,T):(hr(u,r,a,h,z,s.ag.disabled,s.a.disabled,T),hr(u,r,a,h,z,u.stencilModeFor3D(),u.colorModeForRenderPass(),T),u.resetStencilClippingMasks())}if(u.style.enable3dLights()&&A&&(!x&&u.transform.projection.name!=="globe"||w)){const z=a.paint.get("fill-extrusion-opacity"),R=a.paint.get("fill-extrusion-ambient-occlusion-intensity"),k=a.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),O=a.paint.get("fill-extrusion-flood-light-intensity"),B=a.paint.get("fill-extrusion-flood-light-color").toRenderColor(a.lut).toArray01().slice(0,3),G=R>0&&k>0,q=O>0,Z=(Y,te,N)=>(1-N)*Y+N*te,K=Y=>{const te=u.depthModeForSublayer(1,s.ae.ReadOnly,g.LEQUAL,!0),N=a.paint.get(Y?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),$=Z(.1,3,N),re=u._showOverdrawInspector;if(!re){const de=new s.ag({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),se=new s.a([g.ONE,g.ONE,g.ONE,g.ONE],s.C.transparent,[!1,!1,!1,!0],g.MIN);ln(u,r,a,h,te,de,se,s.af.disabled,Y,"sdf",z,R,k,O,B,$,T,!1)}{const de=re?s.ag.disabled:new s.ag({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),se=re?u.colorModeForRenderPass():new s.a([g.ONE_MINUS_DST_ALPHA,g.DST_ALPHA,g.ONE,g.ONE],s.C.transparent,[!0,!0,!0,!0]);ln(u,r,a,h,te,de,se,s.af.disabled,Y,"color",z,R,k,O,B,$,T,!1)}};if(w){const Y=(te,N,$)=>{const re=u.depthModeForSublayer(1,s.ae.ReadOnly,g.LEQUAL,!1),de=a.paint.get(te?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),se=Z(.1,3,de);{const Q=new s.a([g.ONE,g.ONE,g.ONE,g.ONE],s.C.transparent,[!1,!1,!1,!0]);ln(u,r,a,h,re,s.ag.disabled,Q,s.af.disabled,te,"clear",z,R,k,O,B,se,T,N)}{const Q=new s.ag({func:g.ALWAYS,mask:255},255,255,g.KEEP,g.KEEP,g.REPLACE),fe=new s.a([g.ONE,g.ONE,g.ONE,g.ONE],s.C.transparent,[!1,!1,!1,!0],g.MIN);ln(u,r,a,h,re,Q,fe,s.af.disabled,te,"sdf",z,R,k,O,B,se,T,N)}{const Q=te?g.ZERO:g.ONE_MINUS_DST_ALPHA,fe=new s.ag({func:g.EQUAL,mask:255},255,255,g.KEEP,g.DECR,g.DECR),Me=new s.a([Q,g.DST_ALPHA,g.ONE_MINUS_DST_ALPHA,g.ZERO],s.C.transparent,[!0,!0,!0,!0]);ln(u,r,a,h,re,fe,Me,s.af.disabled,te,"color",z,R,k,O,B,se,T,N)}{const Q=new s.a([g.ONE,g.ONE,g.ONE,te?g.ZERO:g.ONE],s.C.transparent,[!1,!1,!1,!0],te?g.FUNC_ADD:g.MAX);ln(u,r,a,h,re,s.ag.disabled,Q,s.af.disabled,te,"clear",z,R,k,O,B,se,T,N,$)}};if(G||q){let te;if(u.prepareDrawTile(),x){const N=x.drapeBufferSize[0],$=x.drapeBufferSize[1];te=x.framebufferCopyTexture,te&&(!te||te.size[0]===N&&te.size[1]===$)||(te&&te.destroy(),te=x.framebufferCopyTexture=new s.T(m,new s.i({width:N,height:$}),g.RGBA)),te.bind(g.LINEAR,g.CLAMP_TO_EDGE),g.copyTexImage2D(g.TEXTURE_2D,0,g.RGBA,0,0,N,$,0)}
2223G&&Y(!0,!1,te),q&&Y(!1,!0,te)}}else G&&K(!0),q&&K(!1)}}},hillshade:function(u,r,a,h){if(u.renderPass!=="offscreen"&&u.renderPass!=="translucent"||u.style.disableElevatedTerrain)return;const f=u.context,m=u.terrain&&u.terrain.renderingToTexture,[g,x]=u.renderPass!=="translucent"||m?[{},h]:u.stencilConfigForOverlap(h);for(const w of x){const T=r.getTile(w);if(T.needsHillshadePrepare&&u.renderPass==="offscreen")Wr(u,T,a);else if(u.renderPass==="translucent"){const M=u.depthModeForSublayer(0,s.ae.ReadOnly),A=a.paint.get("hillshade-emissive-strength"),P=u.colorModeForDrapableLayerRenderPass(A),z=m&&u.terrain?u.terrain.stencilModeForRTTOverlap(w):g[w.overscaledZ];Lp(u,w,T,a,M,z,P)}}f.viewport.set([0,0,u.width,u.height]),u.resetStencilClippingMasks()},raster:function(u,r,a,h,f,m){if(u.renderPass!=="translucent"||a.paint.get("raster-opacity")===0)return;const g=u.transform.projection.name==="globe",x=a.paint.get("raster-elevation")!==0,w=x&&g;if(u.renderElevatedRasterBackface&&!w)return;const T=u.context,M=T.gl,A=r.getSource(),P=function(Y,te,N,$){const re=te.paint.get("raster-color"),de=Y.type==="raster-array",se=[],Q=te.paint.get("raster-resampling"),fe=te.paint.get("raster-color-mix");let Me=te.paint.get("raster-color-range");const Ie=[fe[0],fe[1],fe[2],0],Se=fe[3];let le=Q==="nearest"?$.NEAREST:$.LINEAR;if(de&&(se.push("RASTER_ARRAY"),re||se.push("RASTER_COLOR"),Q==="linear"&&se.push("RASTER_ARRAY_LINEAR"),le=$.NEAREST,!Me&&Y.rasterLayers)){const _e=Y.rasterLayers.find(({id:we})=>we===te.sourceLayer);_e&&_e.fields&&_e.fields.range&&(Me=_e.fields.range)}if(Me=Me||[0,1],re){se.push("RASTER_COLOR"),N.activeTexture.set($.TEXTURE2),te.updateColorRamp(Me);let _e=te.colorRampTexture;_e||(_e=te.colorRampTexture=new s.T(N,te.colorRamp,$.RGBA)),_e.bind($.LINEAR,$.CLAMP_TO_EDGE)}return{mix:Ie,range:Me,offset:Se,defines:se,resampling:le}}(A,a,T,M);if(A instanceof s.bm&&!h.length&&!g)return;const z=a.paint.get("raster-emissive-strength"),R=u.colorModeForDrapableLayerRenderPass(z),k=u.terrain&&u.terrain.renderingToTexture,O=!u.options.moving,B=a.paint.get("raster-resampling")==="nearest"?M.NEAREST:M.LINEAR;if(A instanceof s.bm&&!h.length&&(A.onNorthPole||A.onSouthPole)){const Y=x?u.stencilModeFor3D():s.ag.disabled;return void Jo(!!A.onNorthPole,null,u,r,a,z,P,s.af.disabled,Y)}if(!h.length)return;const[G,q]=A instanceof s.bm||k?[{},h]:u.stencilConfigForOverlap(h),Z=q[q.length-1].overscaledZ;w&&P.defines.push("PROJECTION_GLOBE_VIEW"),x&&P.defines.push("RENDER_CUTOFF");const K=(Y,te,N)=>{for(const $ of Y){const re=$.toUnwrapped(),de=r.getTile($);if(k&&(!de||!de.hasData()))continue;T.activeTexture.set(M.TEXTURE0);const se=Nt(de,A,a,P);if(!se||!se.texture)continue;const{texture:Q,mix:fe,offset:Me,tileSize:Ie,buffer:Se}=se;let le,_e;k?(le=s.ae.disabled,_e=$.projMatrix):x?(le=new s.ae(M.LEQUAL,s.ae.ReadWrite,u.depthRangeFor3D),_e=g?Float32Array.from(u.transform.expandedFarZProjMatrix):u.transform.calculateProjMatrix(re,O)):(le=u.depthModeForSublayer($.overscaledZ-Z,a.paint.get("raster-opacity")===1?s.ae.ReadWrite:s.ae.ReadOnly,M.LESS),_e=u.transform.calculateProjMatrix(re,O));const we=u.terrain&&k?u.terrain.stencilModeForRTTOverlap($):G[$.overscaledZ],Ve=m?0:a.paint.get("raster-fade-duration");de.registerFadeDuration(Ve);const Ue=r.findLoadedParent($,0),qe=ml(de,Ue,r,u.transform,Ve);let je,Be;u.terrain&&u.terrain.prepareDrawTile(),T.activeTexture.set(M.TEXTURE0),Q.bind(B,M.CLAMP_TO_EDGE),T.activeTexture.set(M.TEXTURE1),Ue?(Ue.texture&&Ue.texture.bind(B,M.CLAMP_TO_EDGE),je=Math.pow(2,Ue.tileID.overscaledZ-de.tileID.overscaledZ),Be=[de.tileID.canonical.x*je%1,de.tileID.canonical.y*je%1]):Q.bind(B,M.CLAMP_TO_EDGE),Q.useMipmap&&T.extTextureFilterAnisotropic&&u.transform.pitch>20&&M.texParameterf(M.TEXTURE_2D,T.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,T.extTextureFilterAnisotropicMax);const ve=u.transform;let He;const yt=x?nu(ve):[0,0,0,0];let it,ht,It,oi,St,st=0;if(w&&A instanceof s.bm&&A.coordinates.length>3)it=Float32Array.from(s.bf(s.bg(new s.aO(0,0,0)))),ht=Float32Array.from(ve.globeMatrix),It=Float32Array.from(s.bb(ve)),oi=[s.aj(ve.center.lng),s.ak(ve.center.lat)],He=A.elevatedGlobePerspectiveTransform,St=A.elevatedGlobeGridMatrix||new Float32Array(9);else if(w){const dt=s.bc($.canonical);st=s.bd(dt.getCenter().lat),it=Float32Array.from(s.bf(s.bg($.canonical))),ht=Float32Array.from(ve.globeMatrix),It=Float32Array.from(s.bb(ve)),oi=[s.aj(ve.center.lng),s.ak(ve.center.lat)],He=[0,0],St=Float32Array.from(s.be($.canonical,dt,st,ve.worldSize/ve._pixelsPerMercatorPixel))}else He=A instanceof s.bm?A.perspectiveTransform:[0,0],it=new Float32Array(16),ht=new Float32Array(9),It=new Float32Array(16),oi=[0,0],St=new Float32Array(9);const Jt=Yc(_e,it,ht,It,St,Be||[0,0],s.a1(u.transform.zoom),oi,yt,je||1,qe,a,He,x?a.paint.get("raster-elevation"):0,2,fe,Me,P.range,Ie,Se,z),Zt=u.isTileAffectedByFog($),At=u.getOrCreateProgram("raster",{defines:P.defines,overrideFog:Zt});if(u.uploadCommonUniforms(T,At,re),A instanceof s.bm){const dt=A.elevatedGlobeVertexBuffer,ti=A.elevatedGlobeIndexBuffer;if(k||!g)A.boundsBuffer&&A.boundsSegments&&At.draw(u,M.TRIANGLES,le,s.ag.disabled,R,s.af.disabled,Jt,a.id,A.boundsBuffer,u.quadTriangleIndexBuffer,A.boundsSegments);else if(dt&&ti){const yi=ve.zoom<=s.b1?A.elevatedGlobeSegments:A.getSegmentsForLongitude(ve.center.lng);yi&&At.draw(u,M.TRIANGLES,le,s.ag.disabled,R,te,Jt,a.id,dt,ti,yi)}}else if(w){le=new s.ae(M.LEQUAL,s.ae.ReadOnly,u.depthRangeFor3D);const dt=u.globeSharedBuffers;if(dt){const[ti,yi,Ht]=dt.getGridBuffers(st,!1);At.draw(u,M.TRIANGLES,le,N||we,u.colorModeForRenderPass(),te,Jt,a.id,ti,yi,Ht)}}else{const{tileBoundsBuffer:dt,tileBoundsIndexBuffer:ti,tileBoundsSegments:yi}=u.getTileBoundsBuffers(de);At.draw(u,M.TRIANGLES,le,we,R,s.af.disabled,Jt,a.id,dt,ti,yi)}}if(!(A instanceof s.bm)&&w)for(const $ of Y){const re=$.canonical.y===(1<<$.canonical.z)-1;$.canonical.y===0&&Jo(!0,$,u,r,a,z,P,te,N||s.ag.disabled),re&&Jo(!1,$,u,r,a,z,P,te===s.af.frontCW?s.af.backCW:s.af.frontCW,N||s.ag.disabled)}};w?K(q,u.renderElevatedRasterBackface?s.af.backCW:s.af.frontCW,u.stencilModeFor3D()):K(q,s.af.disabled,void 0),u.resetStencilClippingMasks()},"raster-particle":function(u,r,a,h,f,m){u.renderPass==="offscreen"&&function(g,x,w,T){if(!T.length)return;const M=g.context,A=M.gl,P=x.getSource();if(!(P instanceof Xo))return;const z=Math.ceil(Math.sqrt(w.paint.get("raster-particle-count")));let R=w.particlePositionRGBAImage;
2223if(!R||R.width!==z){const q=function(Z){const K=Z*Z,Y=new Uint8Array(4*K),te=function($){return $|=0,$=Math.imul(2747636419^$,2654435769),$=Math.imul($^$>>>16,2654435769),(($=Math.imul($^$>>>16,2654435769))>>>0)/4294967296},N=1/1.1;for(let $=0;$<K;$++){const re=N*(te(2*$+0)+Xr),de=N*(te(2*$+1)+Xr),se=255*re%1,Q=255*de%1,fe=se,Me=de-Q/255,Ie=Q;Y[4*$+0]=255*(re-se/255),Y[4*$+1]=255*fe,Y[4*$+2]=255*Me,Y[4*$+3]=255*Ie}return Y}(z);R=w.particlePositionRGBAImage=new s.i({width:z,height:z},q)}let k=w.particleFramebuffer;k?k.width!==z&&(k.destroy(),k=w.particleFramebuffer=M.createFramebuffer(z,z,!0,null)):k=w.particleFramebuffer=M.createFramebuffer(z,z,!0,null);const O=[];for(const q of T){const Z=x.getTile(q);if(!(Z instanceof s.c3))continue;const K=Fp(Z,P,w);if(!K)continue;const Y=[Z.tileSize,Z.tileSize];let te=w.tileFramebuffer;te||(te=w.tileFramebuffer=M.createFramebuffer(Y[0],Y[1],!0,null));let N=Z.rasterParticleState;N||(N=Z.rasterParticleState=new yr(M,q,Y,R));const $=N.update(w.lastInvalidatedAt);N.particleTextureDimension!==z&&N.updateParticleTexture(q,R);const re=N.targetColorTexture;N.targetColorTexture=N.backgroundColorTexture,N.backgroundColorTexture=re;const de=N.particleTexture0;N.particleTexture0=N.particleTexture1,N.particleTexture1=de,O.push([q,K,N,$])}if(O.length===0)return;const B=s.e.now(),G=w.previousDrawTimestamp?.001*(B-w.previousDrawTimestamp):.0167;if(w.previousDrawTimestamp=B,w.hasColorMap()){M.activeTexture.set(A.TEXTURE0+2);let q=w.colorRampTexture;q||(q=w.colorRampTexture=new s.T(M,w.colorRamp,A.RGBA)),q.bind(A.LINEAR,A.CLAMP_TO_EDGE)}M.bindFramebuffer.set(w.tileFramebuffer.framebuffer),function(q,Z,K){const Y=q.context,te=Y.gl,N=Z.tileFramebuffer;Y.activeTexture.set(te.TEXTURE0);const $={u_texture:0,u_opacity:1.05*(de=Z.paint.get("raster-particle-fade-opacity-factor"))/(de+.05)},re=q.getOrCreateProgram("rasterParticleTexture",{defines:[],overrideFog:!1});var de;for(const se of K){const[,,Q,fe]=se;N.colorAttachment.set(Q.targetColorTexture.texture),Y.viewport.set([0,0,N.width,N.height]),Y.clear({color:s.C.transparent}),fe&&(Q.backgroundColorTexture.bind(te.NEAREST,te.CLAMP_TO_EDGE),re.draw(q,te.TRIANGLES,s.ae.disabled,s.ag.disabled,s.a.alphaBlended,s.af.disabled,$,Z.id,q.viewportBuffer,q.quadTriangleIndexBuffer,q.viewportSegments))}}(g,w,O),function(q,Z,K,Y){const te=q.context,N=te.gl,$=K.tileFramebuffer,re=q.transform.projection.name==="globe",de=K.paint.get("raster-particle-max-speed");for(const se of Y){const[Q,fe,Me]=se;te.activeTexture.set(N.TEXTURE0+0),fe.texture.bind(N.LINEAR,N.CLAMP_TO_EDGE),$.colorAttachment.set(Me.targetColorTexture.texture);const Ie=q.getOrCreateProgram("rasterParticleDraw",{defines:fe.defines,overrideFog:!1});te.activeTexture.set(N.TEXTURE0+1);const Se=fe.scalarData?[]:[0,1,2,3].map(we=>s.bZ[we](Q));Se.push(Q);const le=Q.canonical.x,_e=Q.canonical.y;for(const we of Se){const Ve=Z.getTile(re?we.wrapped():we);if(!Ve)continue;const Ue=Ve.rasterParticleState;if(!Ue)continue;const qe=we.canonical.x+(1<<we.canonical.z)*(we.wrap-Q.wrap),je=we.canonical.y;Ue.particleTexture0.bind(N.NEAREST,N.CLAMP_TO_EDGE);const Be=Jc(1,Ue.particleTexture0.size[0],[qe-le,je-_e],0,fe.texture.size,2,de,fe.textureOffset,fe.scale,fe.offset);Ie.draw(q,N.POINTS,s.ae.disabled,s.ag.disabled,s.a.alphaBlended,s.af.disabled,Be,K.id,Ue.particleIndexBuffer,void 0,Ue.particleSegment)}}}(g,x,w,O),M.bindFramebuffer.set(w.particleFramebuffer.framebuffer),function(q,Z,K,Y){const te=q.context,N=te.gl,$=Z.paint.get("raster-particle-max-speed"),re=Y*Z.paint.get("raster-particle-speed-factor")*.15,de=function(Q){return Math.pow(Q,6)}(.01+1*Z.paint.get("raster-particle-reset-rate-factor")),se=Z.particleFramebuffer;te.viewport.set([0,0,se.width,se.height]);for(const Q of K){const[,fe,Me]=Q;te.activeTexture.set(N.TEXTURE0+0),fe.texture.bind(N.LINEAR,N.CLAMP_TO_EDGE),te.activeTexture.set(N.TEXTURE0+1);const Ie=Me.particleTexture0;Ie.bind(N.NEAREST,N.CLAMP_TO_EDGE);const Se=Qc(1,Ie.size[0],0,fe.texture.size,$,re,de,fe.textureOffset,fe.scale,fe.offset);se.colorAttachment.set(Me.particleTexture1.texture),te.clear({color:s.C.transparent}),q.getOrCreateProgram("rasterParticleUpdate",{defines:fe.defines}).draw(q,N.TRIANGLES,s.ae.disabled,s.ag.disabled,s.a.unblended,s.af.disabled,Se,Z.id,q.viewportBuffer,q.quadTriangleIndexBuffer,q.viewportSegments)}}(g,w,O,G)}(u,r,a,h),u.renderPass==="translucent"&&(function(g,x,w,T,M){const A=g.context,P=A.gl,z=!g.o
vendor: 2,492 bytes, line 2223
2223ptions.moving,R=g.transform.projection.name==="globe";if(!T.length)return;const[k,O]=g.stencilConfigForOverlap(T),B=[];R&&B.push("PROJECTION_GLOBE_VIEW");const G=g.stencilModeFor3D();for(const q of O){const Z=q.toUnwrapped(),K=x.getTile(q);if(!K.rasterParticleState)continue;const Y=K.rasterParticleState,te=100;K.registerFadeDuration(te);const N=x.findLoadedParent(q,0),$=ml(K,N,x,g.transform,te);let re,de;g.terrain&&g.terrain.prepareDrawTile(),A.activeTexture.set(P.TEXTURE0),Y.targetColorTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),A.activeTexture.set(P.TEXTURE1),N&&N.rasterParticleState?(N.rasterParticleState.targetColorTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE),re=Math.pow(2,N.tileID.overscaledZ-K.tileID.overscaledZ),de=[K.tileID.canonical.x*re%1,K.tileID.canonical.y*re%1]):Y.targetColorTexture.bind(P.LINEAR,P.CLAMP_TO_EDGE);const se=R?Float32Array.from(g.transform.expandedFarZProjMatrix):g.transform.calculateProjMatrix(Z,z),Q=g.transform,fe=tt(Q),Me=s.bc(q.canonical),Ie=s.bd(Me.getCenter().lat);let Se,le,_e,we,Ve;R?(Se=Float32Array.from(s.bf(s.bg(q.canonical))),le=Float32Array.from(Q.globeMatrix),_e=Float32Array.from(s.bb(Q)),we=[s.aj(Q.center.lng),s.ak(Q.center.lat)],Ve=Float32Array.from(s.be(q.canonical,Me,Ie,Q.worldSize/Q._pixelsPerMercatorPixel))):(Se=new Float32Array(16),le=new Float32Array(9),_e=new Float32Array(16),we=[0,0],Ve=new Float32Array(9));const Ue=Kc(se,Se,le,_e,Ve,de||[0,0],s.a1(g.transform.zoom),we,fe,re||1,$,250),qe=g.isTileAffectedByFog(q),je=g.getOrCreateProgram("rasterParticle",{defines:B,overrideFog:qe});if(g.uploadCommonUniforms(A,je,Z),R){const Be=new s.ae(P.LEQUAL,s.ae.ReadWrite,g.depthRangeFor3D),ve=0,He=g.globeSharedBuffers;if(He){const[yt,it,ht]=He.getGridBuffers(Ie,ve!==0);je.draw(g,P.TRIANGLES,Be,G,s.a.alphaBlended,s.af.backCCW,Ue,w.id,yt,it,ht)}}else{const Be=g.depthModeForSublayer(0,s.ae.ReadOnly),ve=k[q.overscaledZ],{tileBoundsBuffer:He,tileBoundsIndexBuffer:yt,tileBoundsSegments:it}=g.getTileBoundsBuffers(K);je.draw(g,P.TRIANGLES,Be,ve,s.a.alphaBlended,s.af.disabled,Ue,w.id,He,yt,it)}}g.resetStencilClippingMasks()}(u,r,a,h),u.style.map.triggerRepaint())},background:function(u,r,a,h){const f=a.paint.get("background-color"),m=a.paint.get("background-opacity"),g=a.paint.get("background-emissive-strength");if(m===0)return;const x=u.context,w=x.gl,T=u.transform,M=T.tileSize,A=a.paint.get("background-pattern");let P;if(A!==void 0&&(A===null||(P=u.imageManager.getPattern(A.toString(),a.scope,u.style.getLut(a.scope)),!P)))return;
2223const z=!A&&f.a===1&&m===1&&u.opaquePassEnabledForLayer()?"opaque":"translucent";if(u.renderPass!==z)return;const R=s.ag.disabled,k=u.depthModeForSublayer(0,z==="opaque"?s.ae.ReadWrite:s.ae.ReadOnly),O=u.colorModeForDrapableLayerRenderPass(g),B=A?"backgroundPattern":"background";let G,q=h;q||(G=u.getBackgroundTiles(),q=Object.values(G).map(Z=>Z.tileID)),A&&(x.activeTexture.set(w.TEXTURE0),u.imageManager.bind(u.context,a.scope));for(const Z of q){const K=u.isTileAffectedByFog(Z),Y=u.getOrCreateProgram(B,{overrideFog:K}),te=Z.toUnwrapped(),N=h?Z.projMatrix:u.transform.calculateProjMatrix(te);u.prepareDrawTile();const $=r?r.getTile(Z):G?G[Z.key]:new s.by(Z,M,T.zoom,u),re=A?sa(N,g,m,u,0,a.scope,P,{tileID:Z,tileSize:M}):Bh(N,g,m,f.toRenderColor(a.lut));u.uploadCommonUniforms(x,Y,te);const{tileBoundsBuffer:de,tileBoundsIndexBuffer:se,tileBoundsSegments:Q}=u.getTileBoundsBuffers($);Y.draw(u,w.TRIANGLES,k,R,O,s.af.disabled,re,a.id,de,se,Q)}},sky:function(u,r,a){const h=u._atmosphere?s.a1(u.transform.zoom):1,f=a.paint.get("sky-opacity")*h;if(f===0)return;const m=u.context,g=a.paint.get("sky-type"),x=new s.ae(m.gl.LEQUAL,s.ae.ReadOnly,[0,1]),w=u.frameCounter/1e3%1;g==="atmosphere"?u.renderPass==="offscreen"?a.needsSkyboxCapture(u)&&(function(T,M,A,P){const z=T.context,R=z.gl;let k=M.skyboxFbo;if(!k){k=M.skyboxFbo=z.createFramebuffer(32,32,!0,null),M.skyboxGeometry=new ca(z),M.skyboxTexture=z.gl.createTexture(),R.bindTexture(R.TEXTURE_CUBE_MAP,M.skyboxTexture),R.texParameteri(R.TEXTURE_CUBE_MAP,R.TEXTURE_WRAP_S,R.CLAMP_TO_EDGE),R.texParameteri(R.TEXTURE_CUBE_MAP,R.TEXTURE_WRAP_T,R.CLAMP_TO_EDGE),R.texParameteri(R.TEXTURE_CUBE_MAP,R.TEXTURE_MIN_FILTER,R.LINEAR),R.texParameteri(R.TEXTURE_CUBE_MAP,R.TEXTURE_MAG_FILTER,R.LINEAR);for(let q=0;q<6;++q)R.texImage2D(R.TEXTURE_CUBE_MAP_POSITIVE_X+q,0,R.RGBA,32,32,0,R.RGBA,R.UNSIGNED_BYTE,null)}z.bindFramebuffer.set(k.framebuffer),z.viewport.set([0,0,32,32]);const O=M.getCenter(T,!0),B=T.getOrCreateProgram("skyboxCapture"),G=new Float64Array(16);s.ad.identity(G),s.ad.rotateY(G,G,.5*-Math.PI),Kr(T,M,B,G,O,0),s.ad.identity(G),s.ad.rotateY(G,G,.5*Math.PI),Kr(T,M,B,G,O,1),s.ad.identity(G),s.ad.rotateX(G,G,.5*-Math.PI),Kr(T,M,B,G,O,2),s.ad.identity(G),s.ad.rotateX(G,G,.5*Math.PI),Kr(T,M,B,G,O,3),s.ad.identity(G),Kr(T,M,B,G,O,4),s.ad.identity(G),s.ad.rotateY(G,G,Math.PI),Kr(T,M,B,G,O,5),z.viewport.set([0,0,T.width,T.height])}(u,a),a.markSkyboxValid(u)):u.renderPass==="sky"&&function(T,M,A,P,z){const R=T.context,k=R.gl,O=T.transform,B=T.getOrCreateProgram("skybox");R.activeTexture.set(k.TEXTURE0),k.bindTexture(k.TEXTURE_CUBE_MAP,M.skyboxTexture);const G=((q,Z,K,Y,te)=>({u_matrix:q,u_sun_direction:Z,u_cubemap:0,u_opacity:Y,u_temporal_offset:te}))(O.skyboxMatrix,M.getCenter(T,!1),0,P,z);T.uploadCommonUniforms(R,B),B.draw(T,k.TRIANGLES,A,s.ag.disabled,T.colorModeForRenderPass(),s.af.backCW,G,"skybox",M.skyboxGeometry.vertexBuffer,M.skyboxGeometry.indexBuffer,M.skyboxGeometry.segment)}(u,a,x,f,w):g==="gradient"&&u.renderPass==="sky"&&function(T,M,A,P,z){const R=T.context,k=R.gl,O=T.transform,B=T.getOrCreateProgram("skyboxGradient");M.skyboxGeometry||(M.skyboxGeometry=new ca(R)),R.activeTexture.set(k.TEXTURE0);let G=M.colorRampTexture;G||(G=M.colorRampTexture=new s.T(R,M.colorRamp,k.RGBA)),G.bind(k.LINEAR,k.CLAMP_TO_EDGE);const q=((Z,K,Y,te,N)=>({u_matrix:Z,u_color_ramp:0,u_center_direction:K,u_radius:s.ab(Y),u_opacity:te,u_temporal_offset:N}))(O.skyboxMatrix,M.getCenter(T,!1),M.paint.get("sky-gradient-radius"),P,z);T.uploadCommonUniforms(R,B),B.draw(T,k.TRIANGLES,A,s.ag.disabled,T.colorModeForRenderPass(),s.af.backCW,q,"skyboxGradient",M.skyboxGeometry.vertexBuffer,M.skyboxGeometry.indexBuffer,M.skyboxGeometry.segment)}(u,a,x,f,w)},debug:function(u,r,a,h,f,m){for(let g=0;g<a.length;g++)if(f){const T=new s.C(h.r*.8,h.g*.8,h.b*.8,1);zr(u,r,a[g],h,-1,-1,m),zr(u,r,a[g],h,-1,1,m),zr(u,r,a[g],h,1,1,m),zr(u,r,a[g],h,1,-1,m),zr(u,r,a[g],T,0,0,m)}else zr(u,r,a[g],h,0,0,m)},custom:function(u,r,a,h){const f=u.context,m=a.implementation;if(!u.transform.projection.unsupportedLayers||!u.transform.projection.unsupportedLayers.includes("custom")||u.terrain&&(u.terrain.renderingToTexture||u.renderPass==="offscreen")&&a.isDraped(r)){if(u.renderPass==="offscreen"){const g=m.prerender;if(g){if(u.setCustomLayerDefaults(),f.setColorMode(u.colorModeForRenderPass()),u.transform.projection.name==="globe"){const x=u.transform.pointMerc;g.call(m,f.gl,u.transform.customLayerMatrix(),u.transform.getProjection(),u.transform.globeToMercatorMatrix(),s.a1(u.transform.zoom),[x.x,x.y],u.transform.pixelsPerMeterRatio)}else g.call(m,f.gl,u.transform.customLayerMatrix());f.setDirty(),u.setBaseState()}}else if(u.renderPass==="translucent"){if(u.terrain&&u.terrain.renderingToTexture){const x=m.renderToTile;if(x){const w=h[0].canonical,T=new s.Y(w.x+h[0].wrap*(1<<w.z),w.y,w.z);f.setDepthMode(s.ae.disabled),f.setStencilMode(s.ag.disabled),f.setColorMode(u.colorModeForRenderPass()),u.setCustomLayerDefaults(),x.call(m,f.gl,T),f.setDirty(),u.setBaseState()}return}u.setCustomLayerDefaults(),f.setColorMode(u.colorModeForRenderPass()),f.setStencilMode(s.ag.disabled);const g=m.renderingMode==="3d"?new s.ae(u.context.gl.LEQUAL,s.ae.ReadWrite,u.depthRangeFor3D):u.depthModeForSublayer(0,s.ae.ReadOnly);if(f.setDepthMode(g),u.transform.projection.name==="globe"){const x=u.transform.pointMerc;m.render(f.gl,u.transform.customLayerMatrix(),u.transform.getProjection(),u.transform.globeToMercatorMatrix(),s.a1(u.transform.zoom),[x.x,x.y],u.transform.pixelsPerMeterRatio)}else m.render(f.gl,u.transform.customLayerMatrix());f.setDirty(),u.setBaseState(),f.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(u,r,a,h){if(u.renderPass==="opaque")return;const f=a.paint.get("model-opacity");if(f===0)return;const m=a.paint.get("model-cast-shadows");
2223if(u.renderPass==="shadow"&&(!m||u.terrain&&f<.65&&a._transitionablePaint._values["model-opacity"].value.expression instanceof s.Z))return;const g=u.shadowRenderer,x=a.paint.get("model-receive-shadows");g&&(g.useNormalOffset=!0,x||(g.enabled=!1));const w=()=>{g&&(g.useNormalOffset=!0,x||(g.enabled=!0))},T=r.getSource();if(u.renderPass==="light-beam"&&T.type!=="batched-model")return;if(T.type==="vector"||T.type==="geojson")return function(B,G,q,Z,K){const Y=B.transform;if(Y.projection.name!=="mercator")return void s.w(`Drawing 3D models for ${Y.projection.name} projection is not yet implemented`);const te=Y.getFreeCameraOptions().position;if(!B.modelManager)return;const N=B.modelManager;q.modelManager=N;const $=B.shadowRenderer;if(!q._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const re=q._unevaluatedLayout._values["model-id"],de={...q.layout.get("model-id").parameters},se=B.style.order.indexOf(q.fqid);for(const Q of Z){const fe=G.getTile(Q).getBucket(q);if(!fe||fe.projection.name!==Y.projection.name)continue;const Me=fe.getModelUris();Me&&!fe.modelsRequested&&(N.addModelsFromBucket(Me,K),fe.modelsRequested=!0);const Ie=ts(Q,Y);de.zoom=Ie;const Se=re.possiblyEvaluate(de);if(dr(B,fe,Q),Dr.shadowUniformsInitialized=!1,Dr.useSingleShadowCascade=!!$&&$.getMaxCascadeForTile(Q.toUnwrapped())===0,B.renderPass==="shadow"&&$){if(B.currentShadowCascade===1&&fe.isInsideFirstShadowMapFrustum)continue;const we=Y.calculatePosMatrix(Q.toUnwrapped(),Y.worldSize);if(Dr.tileMatrix.set(we),Dr.shadowTileMatrix=Float32Array.from($.calculateShadowPassMatrixFromMatrix(we)),Dr.aabb.min.fill(0),Dr.aabb.max[0]=Dr.aabb.max[1]=s.a3,Dr.aabb.max[2]=0,cn(fe,Dr,B,q.scope))continue}const le=1<<Q.canonical.z,_e=[((te.x-Q.wrap)*le-Q.canonical.x)*s.a3,(te.y*le-Q.canonical.y)*s.a3,te.z*le*s.a3];B.conflationActive&&Object.keys(fe.instancesPerModel).length>0&&B.style.isLayerClipped(q,G.getSource())&&fe.updateReplacement(Q,B.replacementSource,se)&&(fe.uploaded=!1,fe.upload(B.context));for(let we in fe.instancesPerModel){const Ve=fe.instancesPerModel[we];Ve.features.length>0&&(we=Se.evaluate(Ve.features[0].feature,{}));const Ue=N.getModel(we,K);if(Ue&&Ue.uploaded)for(const qe of Ue.nodes)Si(B,q,qe,Ve,_e,Q,Dr)}}}(u,r,a,h,T.type==="vector"?a.scope:""),void w();if(!T.loaded())return;if(T.type==="batched-model")return function(B,G,q,Z){q.resetLayerRenderingStats(B);const K=B.context,Y=B.transform,te=B.style.fog,N=B.shadowRenderer;if(Y.projection.name!=="mercator")return void s.w(`Drawing 3D landmark models for ${Y.projection.name} projection is not yet implemented`);const $=B.transform.getFreeCameraOptions().position,re=s._.scale([],[$.x,$.y,$.z],B.transform.worldSize);s._.negate(re,re);const de=s.ad.identity([]),se=s.cg(Y.center.lat,Y.zoom),Q=s.ad.fromScaling([],[1,1,1/se]);s.ad.translate(de,de,re);const fe=q.paint.get("model-opacity"),Me=new s.ae(K.gl.LEQUAL,s.ae.ReadWrite,B.depthRangeFor3D),Ie=new s.ae(K.gl.LEQUAL,s.ae.ReadOnly,B.depthRangeFor3D),Se=new s.b6([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),le=B.renderPass==="shadow",_e=le&&N?N.getCurrentCascadeFrustum():Y.getFrustum(Y.scaleZoom(Y.worldSize)),we=q.paint.get("model-front-cutoff"),Ve=we[2]<1,Ue=to(B,q.paint.get("model-cutoff-fade-range")),qe=q.getLayerRenderingStats();(function(je,Be,ve,He){const yt=je.terrain?je.terrain.exaggeration():0,it=je.transform.zoom;for(const ht of He){const It=Be.getTile(ht).getBucket(ve);It&&(je.conflationActive&&It.updateReplacement(ht,je.replacementSource),It.evaluateScale(je,ve),je.terrain&&yt>0&&It.elevationUpdate(je.terrain,yt,ht,ve.source),It.needsReEvaluation(je,it,ve)&&It.evaluate(ve))}})(B,G,q,Z),function(){let je,Be,ve;Ve?(je=Z.length-1,Be=-1,ve=-1):(je=0,Be=Z.length,ve=1);for(let He=je;He!==Be;He+=ve){const yt=Z[He],it=G.getTile(yt).getBucket(q);if(!it||!it.uploaded)continue;let ht=!1;N&&(ht=N.getMaxCascadeForTile(yt.toUnwrapped())===0);const It=Y.calculatePosMatrix(yt.toUnwrapped(),Y.worldSize),oi=it.modelTraits,St=[];for(const st of it.getNodesInfo()){if(st.hiddenByReplacement||!st.node.meshes)continue;const Jt=st.node;let Zt=0;B.terrain&&Jt.elevation&&(Zt=Jt.elevation*B.terrain.exaggeration());const At=st.evaluatedScale;if(At[0]<=1&&At[1]<=1&&At[2]<=1&&(()=>{const Gt=st.aabb;return Se.min=[...Gt.min],Se.max=[...Gt.max],Se.min[2]+=Zt,Se.max[2]+=Zt,s._.transformMat4(Se.min,Se.min,It),s._.transformMat4(Se.max,Se.max,It),Se})().intersects(_e)===0)continue;const dt=[...It],ti=Jt.anchor?Jt.anchor[0]:0,yi=Jt.anchor?Jt.anchor[1]:0;s.ad.translate(dt,dt,[ti*(At[0]-1),yi*(At[1]-1),Zt]),s._.exactEquals(At,s.cj)||s.ad.scale(dt,dt,At);const Ht=s.ad.multiply([],dt,Jt.matrix),ii=s.ad.multiply([],Y.expandedFarZProjMatrix,Ht),Ee=s.ad.multiply([],Y.expandedFarZProjMatrix,dt),$e=s.aA.transformMat4([],[ti,yi,Zt,1],ii)[2];Jt.hidden=!1;let Di=fe;le||(Ve&&(Di*=au(dt,Y,st.aabb,we)),Di*=zi(Ue,$e)),Di!==0?St.push({nodeInfo:st,depth:$e,opacity:Di,wvpForNode:ii,wvpForTile:Ee,nodeModelMatrix:Ht,tileModelMatrix:dt}):Jt.hidden=!0}
2223le||St.sort((st,Jt)=>!Ve||st.opacity===1&&Jt.opacity===1?st.depth<Jt.depth?-1:1:st.opacity===1?-1:Jt.opacity===1?1:st.depth>Jt.depth?-1:1);for(const st of St){const Jt=st.nodeInfo,Zt=Jt.node;let At=s.ad.multiply([],Q,st.tileModelMatrix);s.ad.multiply(At,de,At);const dt=s.ad.invert([],At);s.ad.transpose(dt,dt),s.ad.scale(dt,dt,Lr),At=s.ad.multiply(At,At,Zt.matrix);const ti=B.renderPass==="light-beam",yi=oi&s.cl.HasMapboxMeshFeatures,Ht=yi?0:Jt.evaluatedRMEA[0][2];for(let ii=0;ii<Zt.meshes.length;++ii){const Ee=Zt.meshes[ii],$e=ii===Zt.lightMeshIndex;let Di=st.wvpForNode;if($e){if(!ti&&!B.terrain&&B.shadowRenderer){B.currentLayer<B.firstLightBeamLayer&&(B.firstLightBeamLayer=B.currentLayer);continue}Di=st.wvpForTile}else if(ti)continue;const Gt={defines:[]},he=[];if(ao(Gt.defines,he,Ee,B,q.lut),yi||Gt.defines.push("DIFFUSE_SHADED"),ht&&Gt.defines.push("SHADOWS_SINGLE_CASCADE"),qe&&(le?qe.numRenderedVerticesInShadowPass+=Ee.vertexArray.length:qe.numRenderedVerticesInTransparentPass+=Ee.vertexArray.length),le){Bi(Ee,st.nodeModelMatrix,B,q);continue}let Ji=null;if(te){const fr=Cl(st.nodeModelMatrix,B.transform);if(Ji=new Float32Array(fr),Y.projection.name!=="globe"){const kn=Ee.aabb.min,On=Ee.aabb.max,[Bn,en]=te.getOpacityForBounds(fr,kn[0],kn[1],On[0],On[1]);Gt.overrideFog=Bn>=li||en>=li}}const qi=Ee.material;let Li;qi.occlusionTexture&&qi.occlusionTexture.offsetScale&&(Li=qi.occlusionTexture.offsetScale,Gt.defines.push("OCCLUSION_TEXTURE_TRANSFORM")),!le&&N&&(N.useNormalOffset=!!Ee.normalBuffer);const Zi=B.getOrCreateProgram("model",Gt);!le&&N&&N.setupShadowsFromMatrix(st.tileModelMatrix,Zi,N.useNormalOffset),B.uploadCommonUniforms(K,Zi,null,Ji);const Br=qi.pbrMetallicRoughness;Br.metallicFactor=.9,Br.roughnessFactor=.5;const dn=eu(new Float32Array(Di),new Float32Array(At),new Float32Array(dt),new Float32Array(Zt.matrix),B,st.opacity,Br.baseColorFactor.toRenderColor(null),qi.emissiveFactor,Br.metallicFactor,Br.roughnessFactor,qi,Ht,q,[0,0,0],Li);!$e&&(Jt.hasTranslucentParts||st.opacity<1)&&Zi.draw(B,K.gl.TRIANGLES,Me,s.ag.disabled,s.a.disabled,s.af.backCCW,dn,q.id,Ee.vertexBuffer,Ee.indexBuffer,Ee.segments,q.paint,B.transform.zoom,void 0,he),Zi.draw(B,K.gl.TRIANGLES,$e?Ie:Me,s.ag.disabled,$e||st.opacity<1||Jt.hasTranslucentParts?s.a.alphaBlended:s.a.unblended,s.af.backCCW,dn,q.id,Ee.vertexBuffer,Ee.indexBuffer,Ee.segments,q.paint,B.transform.zoom,void 0,he)}}}}()}(u,r,a,h),void w();if(T.type!=="model")return;const M=T.getModels(),A=[],P=u.transform.getFreeCameraOptions().position,z=s._.scale([],[P.x,P.y,P.z],u.transform.worldSize);s._.negate(z,z);const R=[],k=[];let O=0;for(const B of M){const G=a.paint.get("model-rotation").constantOr(null),q=a.paint.get("model-scale").constantOr(null),Z=a.paint.get("model-translation").constantOr(null);B.computeModelMatrix(u,G,q,Z,!0,!0,!1);const K=s.ad.identity([]),Y=s.cg(B.position.lat,u.transform.zoom),te=s.ad.fromScaling([],[1,1,1/Y]);s.ad.translate(K,K,z),A.push({zScaleMatrix:te,negCameraPosMatrix:K});for(const N of B.nodes)da(u.transform,N,B.matrix,u.transform.expandedFarZProjMatrix,O,R,k);O++}if(R.sort((B,G)=>G.depth-B.depth),u.renderPass!=="shadow"){if(f===1)for(const B of k)es(B,u,a,A[B.modelIndex],s.ag.disabled,u.colorModeForRenderPass());else{for(const B of k)es(B,u,a,A[B.modelIndex],s.ag.disabled,s.a.disabled);for(const B of k)es(B,u,a,A[B.modelIndex],u.stencilModeFor3D(),u.colorModeForRenderPass());u.resetStencilClippingMasks()}for(const B of R)es(B,u,a,A[B.modelIndex],s.ag.disabled,u.colorModeForRenderPass());w()}else{for(const B of k)Bi(B.mesh,B.nodeModelMatrix,u,a);for(const B of R)Bi(B.mesh,B.nodeModelMatrix,u,a);w()}}},Jr={model:function(u,r,a){const h=r.getSource();if(!h.loaded())return;if(h.type==="vector"||h.type==="geojson")return void(a.modelManager&&a.modelManager.upload(a,h.type==="vector"?u.scope:""));if(h.type==="batched-model"||h.type!=="model")return;const f=h.getModels();for(const m of f)m.upload(a.context)},raster:function(u,r,a){const h=r.getSource();if(!(h instanceof Xo&&h.loaded()))return;const f=u.sourceLayer||h.rasterLayerIds&&h.rasterLayerIds[0];if(!f)return;const m=u.paint.get("raster-array-band")||h.getInitialBand(f);if(m==null)return;const g=r.getIds().map(x=>r.getTileByID(x));for(const x of g)x.updateNeeded(f,m)&&h.prepareTile(x,f,m)},"raster-particle":function(u,r,a){const h=r.getSource();if(!(h instanceof Xo&&h.loaded()))return;const f=u.sourceLayer||h.rasterLayerIds&&h.rasterLayerIds[0];if(!f)return;const m=u.paint.get("raster-particle-array-band")||h.getInitialBand(f);if(m==null)return;const g=r.getIds().map(x=>r.getTileByID(x));for(const x of g)x.updateNeeded(f,m)&&h.prepareTile(x,f,m)}};class Vp{constructor(r,a,h,f){this.context=new Zs(r,a),this.occlusionBuffers=new lo(this.context),this.transform=h,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this.tp=f,this._timeStamp=s.e.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const m=["fill","line","symbol","circle","heatmap","fill-extrusion","raster","raster-particle","hillshade","model","background","sky"];for(const g of m)this._debugParams.enabledLayers[g]=!0;f.registerParameter(this._debugParams,["Terrain"],"showTerrainProxyTiles",{},()=>{this.style.map.triggerRepaint()}),f.registerParameter(this._debugParams,["FPS"],"fpsWindow",{min:1,max:100,step:1}),f.registerBinding(this._debugParams,["FPS"],"continousRedraw",{readonly:!0,label:"continuous redraw"}),f.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"value"}),f.registerBinding(this,["FPS"],"_averageFPS",{readonly:!0,label:"graph",view:"graph",min:0,max:200});for(const g of m)f.registerParameter(this._debugParams.enabledLayers,["Debug","Layers"],g);this.symbolParams=new Bo(f),this.setup(),this.numSublayers=s.bv.maxUnderzooming+s.bv.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.co,this.longestCutoffRange=0,this.minCutoffZoom=0,this._fogVisible=!1,this._cachedTileFogOpacities={},this._shadowRenderer=new Uc(this),this._wireframeDebugCache=new pa,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[]}updateTerrain(r,a){const h=!!r&&!!r.terrain&&this.transform.projection.supportsTerrain;if(!(h||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new Zc(this,r));const f=this._terrain;this.transform.elevation=h?f:null,f.update(r,this.transform,a),this.transform.elevation&&!f.enabled&&(this.transform.elevation=null)}_updateFog(r){const a=r.fog;if(!a||this.transform.projection.name==="globe"||a.getOpacity(this.transform.pitch)<1||a.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[h,f]=a.getFovAdjustedRange(this.transform._fov);if(h>f)return void(this.transform.fogCullDistSq=null);const m=h+.78*(f-h);this.transform.fogCullDistSq=m*m}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(r){r&&!this._terrain&&(this._terrain=new Zc(this,this.style)),this._forceTerrainMode=r}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(r,a){if(this.width=r*s.e.devicePixelRatio,this.height=a*s.e.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const h of this.style.order)this.style._mergedLayers[h].resize()}setup(){const r=this.context,a=new s.bt;a.emplaceBack(0,0),a.emplaceBack(s.a3,0),a.emplaceBack(0,s.a3),a.emplaceBack(s.a3,s.a3),this.tileExtentBuffer=r.createVertexBuffer(a,s.br.members),this.tileExtentSegments=s.b.simpleSegment(0,0,4,2);const h=new s.bt;h.emplaceBack(0,0),h.emplaceBack(s.a3,0),h.emplaceBack(0,s.a3),h.emplaceBack(s.a3,s.a3),this.debugBuffer=r.createVertexBuffer(h,s.br.members),this.debugSegments=s.b.simpleSegment(0,0,4,5);const f=new s.bt;f.emplaceBack(-1,-1),f.emplaceBack(1,-1),f.emplaceBack(-1,1),f.emplaceBack(1,1),this.viewportBuffer=r.createVertexBuffer(f,s.br.members),this.viewportSegments=s.b.simpleSegment(0,0,4,2);const m=new s.cp;m.emplaceBack(0,0,0,0),m.emplaceBack(s.a3,0,s.a3,0),m.emplaceBack(0,s.a3,0,s.a3),m.emplaceBack(s.a3,s.a3,s.a3,s.a3),this.mercatorBoundsBuffer=r.createVertexBuffer(m,s.cq.members),this.mercatorBoundsSegments=s.b.simpleSegment(0,0,4,2);const g=new s.bu;g.emplaceBack(0,1,2),g.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=r.createIndexBuffer(g);const x=new s.cr;for(const T of[0,1,3,2,0])x.emplaceBack(T);this.debugIndexBuffer=r.createIndexBuffer(x),this.emptyTexture=new s.T(r,new s.i({width:1,height:1},Uint8Array.of(0,0,0,0)),r.gl.RGBA),this.identityMat=s.ad.create();const w=this.context.gl;this.stencilClearMode=new s.ag({func:w.ALWAYS,mask:0},0,255,w.ZERO,w.ZERO,w.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(r){return r._makeTileBoundsBuffers(this.context,this.transform.projection),r._tileBoundsBuffer?{tileBoundsBuffer:r._tileBoundsBuffer,tileBoundsIndexBuffer:r._tileBoundsIndexBuffer,tileBoundsSegments:r._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const r=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,r.TRIANGLES,s.ae.disabled,this.stencilClearMode,s.a.disabled,s.af.disabled,fl(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(r,a,h){if(!a||this.currentStencilSource===a.id||!r.isTileClipped()||!h||h.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let x=!1;for(const w of h)if(this._tileClippingMaskIDs[w.key]===void 0){x=!0;break}if(!x)return}this.currentStencilSource=a.id;const f=this.context,m=f.gl;this.nextStencilID+h.length>256&&this.clearStencil(),f.setColorMode(s.a.disabled),f.setDepthMode(s.ae.disabled);const g=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const x of h){const w=a.getTile(x),T=this._tileClippingMaskIDs[x.key]=this.nextStencilID++,{tileBoundsBuffer:M,tileBoundsIndexBuffer:A,tileBoundsSegments:P}=this.getTileBoundsBuffers(w);g.draw(this,m.TRIANGLES,s.ae.disabled,new s.ag({func:m.ALWAYS,mask:0},T,255,m.KEEP,m.KEEP,m.REPLACE),s.a.disabled,s.af.disabled,fl(x.projMatrix),"$clipping",M,A,P)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const r=this.nextStencilID++,a=this.context.gl;return new s.ag({func:a.NOTEQUAL,mask:255},r,255,a.KEEP,a.KEEP,a.REPLACE)}stencilModeForClipping(r){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(r);const a=this.context.gl;return new s.ag({func:a.EQUAL,mask:255},this._tileClippingMaskIDs[r.key],0,a.KEEP,a.KEEP,a.REPLACE)}stencilConfigForOverlap(r){const a=this.context.gl,h=r.sort((g,x)=>
2223x.overscaledZ-g.overscaledZ),f=h[h.length-1].overscaledZ,m=h[0].overscaledZ-f+1;if(m>1){this.currentStencilSource=void 0,this.nextStencilID+m>256&&this.clearStencil();const g={};for(let x=0;x<m;x++)g[x+f]=new s.ag({func:a.GEQUAL,mask:255},x+this.nextStencilID,255,a.KEEP,a.KEEP,a.REPLACE);return this.nextStencilID+=m,[g,h]}return[{[f]:s.ag.disabled},h]}colorModeForRenderPass(){const r=this.context.gl;return this._showOverdrawInspector?new s.a([r.CONSTANT_COLOR,r.ONE,r.CONSTANT_COLOR,r.ONE],new s.C(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?s.a.unblended:s.a.alphaBlended}colorModeForDrapableLayerRenderPass(r){const a=this.context.gl;return this.style&&this.style.enable3dLights()&&this.terrain&&this.terrain.renderingToTexture&&this.renderPass==="translucent"?new s.a([a.ONE,a.ONE_MINUS_SRC_ALPHA,a.CONSTANT_ALPHA,a.ONE_MINUS_SRC_ALPHA],new s.C(0,0,0,r===void 0?0:r),[!0,!0,!0,!0]):this.colorModeForRenderPass()}depthModeForSublayer(r,a,h,f=!1){if(this.depthOcclusion)return new s.ae(this.context.gl.GREATER,s.ae.ReadOnly,this.depthRangeFor3D);if(!this.opaquePassEnabledForLayer()&&!f)return s.ae.disabled;const m=1-((1+this.currentLayer)*this.numSublayers+r)*this.depthEpsilon;return new s.ae(h||this.context.gl.LEQUAL,a,[m,m])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}blitDepth(){const r=this.context.gl,a=Math.ceil(this.width),h=Math.ceil(this.height),f=this.context.bindFramebuffer.get(),m=r.getParameter(r.TEXTURE_BINDING_2D);this.terrainDepthFBO&&this.terrainDepthFBO.width===a&&this.terrainDepthFBO.height===h||(this.terrainDepthFBO&&(this.terrainDepthFBO.destroy(),this.terrainDepthFBO=void 0,this.terrainDepthTexture=void 0),a!==0&&h!==0&&(this.terrainDepthFBO=new Hn(this.context,a,h,!1,"texture"),this.terrainDepthTexture=new s.T(this.context,{width:a,height:h,data:null},r.DEPTH_STENCIL),this.terrainDepthFBO.depthAttachment.set(this.terrainDepthTexture.texture))),this.context.bindFramebuffer.set(f),r.bindTexture(r.TEXTURE_2D,m),this.terrainDepthFBO&&(r.bindFramebuffer(r.READ_FRAMEBUFFER,null),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,this.terrainDepthFBO.framebuffer),r.blitFramebuffer(0,0,a,h,0,0,a,h,r.DEPTH_BUFFER_BIT,r.NEAREST),r.bindFramebuffer(r.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((r,a)=>r+a/this._fpsHistory.length,0))}render(r,a){const h=s.e.now();this._dt=h-this._timeStamp,this._timeStamp=h,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=r.map.repaint,this.style=r,this.options=a;const f=this.style._mergedLayers,m=this.style.order.filter(N=>{const $=f[N];return!($.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[$.type]}),g=m.map(N=>f[N]),x=this.style._mergedSourceCaches;this.imageManager=r.imageManager,this.modelManager=r.modelManager,this.symbolFadeChange=r.placement.symbolFadeChange(s.e.now()),this.imageManager.beginFrame();let w=0,T=!1;for(const N in x){const $=x[N];$.used&&($.prepare(this.context),$.getSource().usedInConflation&&++w)}let M=!1;for(const N of g)N.isHidden(this.transform.zoom)||(N.type==="clip"&&(M=!0),this.prepareLayer(N));const A={},P={},z={},R={},k={};for(const N in x){const $=x[N];A[N]=$.getVisibleCoordinates(),P[N]=A[N].slice().reverse(),z[N]=$.getVisibleCoordinates(!0).reverse(),R[N]=$.getShadowCasterCoordinates(),k[N]=$.sortCoordinatesByDistance(A[N])}const O=N=>{const $=this.style.getLayerSourceCache(N);return $&&$.used?$.getSource():null};if(w||M){const N=[],$=[];let re=0;for(const de of g)this.isSourceForClippingOrConflation(de,O(de))&&(N.push(de),$.push(re)),re++;if(N&&(M||N.length>1)){const de=[];for(let se=0;se<N.length;se++){const Q=N[se],fe=$[se],Me=this.style.getLayerSourceCache(Q);if(!Me||!Me.used||!Me.getSource().usedInConflation&&Q.type!=="clip")continue;let Ie=1/0,Se=s.cu.None;if(Q.type==="clip"){Ie=fe;
2223for(const le of Q.layout.get("clip-layer-types"))Se|=le==="model"?s.cu.Model:le==="symbol"?s.cu.Symbol:s.cu.FillExtrusion}de.push({layer:Q.fqid,cache:Me,order:Ie,clipMask:Se})}this.replacementSource.setSources(de),T=!0}}T||this.replacementSource.clear(),this.conflationActive=T,this.minCutoffZoom=0,this.longestCutoffRange=0,this.opaquePassCutoff=1/0,this._lastOcclusionLayer=-1,this.layersWithOcclusionOpacity=[];for(let N=0;N<g.length;N++){const $=g[N],re=$.cutoffRange();if(this.longestCutoffRange=Math.max(re,this.longestCutoffRange),re>0){const de=O($);de&&(this.minCutoffZoom=Math.max(de.minzoom,this.minCutoffZoom)),$.minzoom&&(this.minCutoffZoom=Math.max($.minzoom,this.minCutoffZoom))}$.is3D()&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=N),this._lastOcclusionLayer=N)}const B=this.style&&this.style.fog;B?(this._fogVisible=B.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=B.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(z),this.opaquePassCutoff=0);const G=this._shadowRenderer;if(G){G.updateShadowParameters(this.transform,this.style.directionalLight);for(const N in x)for(const $ of A[N]){let re={min:0,max:0};this.terrain&&(re=this.terrain.getMinMaxForTile($)||re),G.addShadowReceiver($.toUnwrapped(),re.min,re.max)}}if(this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new s.cs(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new ha(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),!s.ct(this.context.gl))return;this.renderPass="offscreen";for(const N of g){const $=r.getLayerSourceCache(N);if(!N.hasOffscreenPass()||N.isHidden(this.transform.zoom))continue;const re=$?P[$.id]:void 0;(N.type==="custom"||N.type==="raster"||N.type==="raster-particle"||N.isSky()||re&&re.length)&&this.renderLayer(this,$,N,re)}this.depthRangeFor3D=[0,1-(g.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,R)),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(),Z=(()=>
2223{if(a.showOverdrawInspector)return s.C.black;const N=this.style.fog;if(N&&this.transform.projection.supportsFog){const $=this.style.getLut(N.scope);if(!q){const re=N.properties.get("color").toRenderColor($).toArray01();return new s.C(...re)}if(q){const re=N.properties.get("space-color").toRenderColor($).toArray01();return new s.C(...re)}}return s.C.transparent})();if(this.context.clear({color:Z,depth:1}),this.clearStencil(),this._showOverdrawInspector=a.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=m.length-1;this.currentLayer>=0;this.currentLayer--){const N=g[this.currentLayer],$=r.getLayerSourceCache(N);if(N.isSky())continue;const re=$?(N.is3D()?k:P)[$.id]:void 0;this._renderTileClippingMasks(N,$,re),this.renderLayer(this,$,N,re)}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.a1(this.transform.zoom)>0)&&(this.transform.projection.name==="globe"||this.transform.isHorizonVisible()))for(this.currentLayer=0;this.currentLayer<m.length;this.currentLayer++){const N=g[this.currentLayer],$=r.getLayerSourceCache(N);N.isSky()&&this.renderLayer(this,$,N,$?P[$.id]:void 0)}function K(N,$){let re;return $&&(re=(N.type==="symbol"?z:N.is3D()?k:P)[$.id]),re}if(this.renderPass="translucent",this.transform.projection.name==="globe"){for(this.renderElevatedRasterBackface=!0,this.currentLayer=0;this.currentLayer<m.length;){const N=g[this.currentLayer];if(N.type==="raster"){const $=r.getLayerSourceCache(N);this.renderLayer(this,$,N,K(N,$))}++this.currentLayer}this.renderElevatedRasterBackface=!1}this.currentLayer=0,this.firstLightBeamLayer=Number.MAX_SAFE_INTEGER;let Y=0;G&&(Y=G.getShadowCastingLayerCount());let te=!1;for(;this.currentLayer<m.length;){const N=g[this.currentLayer],$=r.getLayerSourceCache(N);if(N.isSky())++this.currentLayer;else if(this.terrain&&this.style.isLayerDraped(N)){if(N.isHidden(this.transform.zoom)){++this.currentLayer;continue}this.currentLayer=this.terrain.renderBatch(this.currentLayer),this._lastOcclusionLayer=Math.max(this.currentLayer,this._lastOcclusionLayer)}else{if(te||!this.terrain||!this.style.hasSymbolLayers()&&!this.style.hasCircleLayers()||this.transform.isOrthographic||(te=!0,this.blitDepth()),N.is3D()||this.terrain||this._renderTileClippingMasks(N,$,$?A[$.id]:void 0),this.renderLayer(this,$,N,K(N,$)),!this.terrain&&G&&Y>0&&N.hasShadowPass()&&--Y==0&&(G.drawGroundShadows(),this.firstLightBeamLayer<=this.currentLayer)){const re=this.currentLayer;for(this.renderPass="light-beam",this.currentLayer=this.firstLightBeamLayer;this.currentLayer<=re;this.currentLayer++){const de=g[this.currentLayer];if(!de.hasLightBeamPass())continue;const se=r.getLayerSourceCache(de);this.renderLayer(this,se,de,se?P[se.id]:void 0)}this.currentLayer=re,this.renderPass="translucent"}if(this.currentLayer>=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const re=this.currentLayer;this.depthOcclusion=!0;for(const de of this.layersWithOcclusionOpacity){this.currentLayer=de;const se=g[this.currentLayer],Q=r.getLayerSourceCache(se),fe=Q?P[Q.id]:void 0;se.is3D()||this.terrain||this._renderTileClippingMasks(se,Q,Q?A[Q.id]:void 0),this.renderLayer(this,Q,se,fe)}this.depthOcclusion=!1,this.currentLayer=re,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let N=null;g.forEach($=>{const re=r.getLayerSourceCache($);re&&!$.isHidden(this.transform.zoom)&&re.getVisibleCoordinates().length&&(!N||N.getSource().maxzoom<re.getSource().maxzoom)&&(N=re)}),N&&this.options.showTileBoundaries&&lu.debug(this,N,N.getVisibleCoordinates(),s.C.red,!1,this.options.showParseStatus)}this.terrain&&this._debugParams.showTerrainProxyTiles&&lu.debug(this,this.terrain.proxySourceCache,this.terrain.proxyCoords,new s.C(1,.8,.1,1),!0,this.options.showParseStatus),this.options.showPadding&&function(N){const $=N.transform.padding;
2223We(N,N.transform.height-($.top||0),3,Gh),We(N,$.bottom||0,3,Al),Vt(N,$.left||0,3,ou),Vt(N,N.transform.width-($.right||0),3,Yr);const re=N.transform.centerPoint;(function(de,se,Q,fe){Ot(de,se-1,Q-10,2,20,fe),Ot(de,se-10,Q-1,20,2,fe)})(N,re.x,N.transform.height-re.y,su)}(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()),T||(this.conflationActive=!1)}prepareLayer(r){this.gpuTimingStart(r);const{unsupportedLayers:a}=this.transform.projection,h=!a||!a.includes(r.type);if(Jr[r.type]&&(h||this.terrain&&r.type==="custom")){const f=this.style.getLayerSourceCache(r);Jr[r.type](r,f,this)}this.gpuTimingEnd()}renderLayer(r,a,h,f){h.isHidden(this.transform.zoom)||(h.type==="background"||h.type==="sky"||h.type==="custom"||h.type==="model"||h.type==="raster"||h.type==="raster-particle"||f&&f.length)&&(this.id=h.id,this.gpuTimingStart(h),r.transform.projection.unsupportedLayers&&r.transform.projection.unsupportedLayers.includes(h.type)&&(!r.terrain||h.type!=="custom")||h.type==="clip"||lu[h.type](r,a,h,f,this.style.placement.variableOffsets,this.options.isInitialLoad),this.gpuTimingEnd())}gpuTimingStart(r){if(!this.options.gpuTiming)return;const a=this.context.extTimerQuery,h=this.context.gl;let f=this.gpuTimers[r.id];f||(f=this.gpuTimers[r.id]={calls:0,cpuTime:0,query:h.createQuery()}),f.calls++,h.beginQuery(a.TIME_ELAPSED_EXT,f.query)}gpuTimingDeferredRenderStart(){if(this.options.gpuTimingDeferredRender){const r=this.context.extTimerQuery,a=this.context.gl,h=a.createQuery();this.deferredRenderGpuTimeQueries.push(h),a.beginQuery(r.TIME_ELAPSED_EXT,h)}}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 r=this.gpuTimers;return this.gpuTimers={},r}collectDeferredRenderGpuQueries(){const r=this.deferredRenderGpuTimeQueries;return this.deferredRenderGpuTimeQueries=[],r}queryGpuTimers(r){const a={};for(const h in r){const f=r[h],m=this.context.extTimerQuery,g=m.getQueryParameter(f.query,this.context.gl.QUERY_RESULT)/1e6;m.deleteQueryEXT(f.query),a[h]=g}return a}queryGpuTimeDeferredRender(r){if(!this.options.gpuTimingDeferredRender)return 0;const a=this.context.extTimerQuery,h=this.context.gl;let f=0;for(const m of r)f+=a.getQueryParameter(m,h.QUERY_RESULT)/1e6,a.deleteQueryEXT(m);return f}translatePosMatrix(r,a,h,f,m){if(!h[0]&&!h[1])return r;const g=m?f==="map"?this.transform.angle:0:f==="viewport"?-this.transform.angle:0;if(g){const T=Math.sin(g),M=Math.cos(g);h=[h[0]*M-h[1]*T,h[0]*T+h[1]*M]}const x=[m?h[0]:s.bB(a,h[0],this.transform.zoom),m?h[1]:s.bB(a,h[1],this.transform.zoom),0],w=new Float32Array(16);return s.ad.translate(w,r,x),w}saveTileTexture(r){const a=r.size[0],h=this._tileTextures[a];h?h.push(r):this._tileTextures[a]=[r]}getTileTexture(r){const a=this._tileTextures[r];return a&&a.length>0?a.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(r,a,h){const f=h===void 0?this.terrain&&this.terrain.renderingToTexture:h,m=[];return this.style&&this.style.enable3dLights()&&(r==="globeRaster"||r==="terrainRaster"?(m.push("LIGHTING_3D_MODE"),m.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):f||m.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"?this._shadowMapDebug||m.push("DEPTH_TEXTURE"):this.shadowRenderer&&(this.shadowRenderer.useNormalOffset?m.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"):m.push("RENDER_SHADOWS","DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(m.push("TERRAIN"),this.linearFloatFilteringSupported()&&m.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&m.push("GLOBE"),!this._fogVisible||f||a!==void 0&&!a||m.push("FOG","FOG_DITHERING"),f&&m.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&m.push("OVERDRAW_INSPECTOR"),m}getOrCreateProgram(r,a){this.cache=this.cache||{};const h=a&&a.defines||[],f=a&&a.config,m=this.currentGlobalDefines(r,a&&a.overrideFog,a&&a.overrideRtt).concat(h),g=$c.cacheKey(Mh[r],r,m,f);return this.cache[g]||(this.cache[g]=new $c(this.context,r,Mh[r],f,Fh[r],m)),this.cache[g]}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 r=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(r.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.RGBA))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.de
2223stroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.terrainDepthFBO&&(this.terrainDepthFBO.destroy(),this.terrainDepthFBO=void 0,this.terrainDepthTexture=void 0)}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(r,a){if(this.style.enable3dLights()){const h=this.style.directionalLight,f=this.style.ambientLight;if(h&&f){const m=((g,x,w)=>{const T=g.properties.get("direction"),M=g.properties.get("color").toRenderColor(w.getLut(g.scope)).toArray01(),A=g.properties.get("intensity"),P=x.properties.get("color").toRenderColor(w.getLut(x.scope)).toArray01(),z=x.properties.get("intensity"),R=[T.x,T.y,T.z],k=s.bA(P,z),O=s.bA(M,A);return{u_lighting_ambient_color:k,u_lighting_directional_dir:R,u_lighting_directional_color:O,u_ground_radiance:zh(R,O,k)}})(h,f,this.style);a.setLightsUniformValues(r,m)}}}uploadCommonUniforms(r,a,h,f,m){if(this.uploadCommonLightUniforms(r,a),this.terrain&&this.terrain.renderingToTexture)return;const g=this.style.fog;if(g){const x=g.getOpacity(this.transform.pitch),w=((T,M,A,P,z,R,k,O,B,G,q,Z)=>{const K=T.transform,Y=M.properties.get("color").toRenderColor(T.style.getLut(M.scope)).toArray01();Y[3]=P;const te=T.frameCounter/1e3%1,[N,$]=M.properties.get("vertical-range");return{u_fog_matrix:A?K.calculateFogTileMatrix(A):Z||T.identityMat,u_fog_range:M.getFovAdjustedRange(K._fov),u_fog_color:Y,u_fog_horizon_blend:M.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(N,$),$],u_fog_temporal_offset:te,u_frustum_tl:z,u_frustum_tr:R,u_frustum_br:k,u_frustum_bl:O,u_globe_pos:B,u_globe_radius:G,u_viewport:q,u_globe_transition:s.a1(K.zoom),u_is_globe:+(K.projection.name==="globe")}})(this,g,h,x,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.e.devicePixelRatio,this.transform.height*s.e.devicePixelRatio],f);a.setFogUniformValues(r,w)}m&&a.setCutoffUniformValues(r,m.uniformValues)}setTileLoadedFlag(r){this.tileLoaded=r}saveCanvasCopy(){const r=this.canvasCopy();r&&(this.frameCopies.push(r),this.tileLoaded=!1)}canvasCopy(){const r=this.context.gl,a=r.createTexture();return r.bindTexture(r.TEXTURE_2D,a),r.copyTexImage2D(r.TEXTURE_2D,0,r.RGBA,0,0,r.drawingBufferWidth,r.drawingBufferHeight,0),a}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const r=this.style&&this.style.fog;return!!r&&r.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const r=this._backgroundTiles,a=this._backgroundTiles={},h=this.transform.coveringTiles({tileSize:512});for(const f of h)a[f.key]=r[f.key]||new s.by(f,512,this.transform.tileZoom,this);return a}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(r,a){return!(!r.is3D()||r.minzoom&&r.minzoom>this.transform.zoom||(this.style._clipLayerIndices.length||r.sourceLayer!=="building")&&r.type!=="clip"&&(!a||a.type!=="batched-model"))}isTileAffectedByFog(r){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let a=this._cachedTileFogOpacities[r.key];return a||(this._cachedTileFogOpacities[r.key]=a=this.style.fog.getOpacityForTile(r)),a[0]>=li||a[1]>=li}}class Pl{constructor(r,a,h,f){this.screenBounds=r,this.cameraPoint=a,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=h,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,f)}static createFromScreenPoints(r,a){let h,f;if(r instanceof s.P||typeof r[0]=="number"){const m=s.P.convert(r);h=[m],f=a.isPointAboveHorizon(m)}else{const m=s.P.convert(r[0]),g=s.P.convert(r[1]);h=[m,g],f=s.cv(m,g).every(x=>a.isPointAboveHorizon(x))}return new Pl(h,a.getCameraPoint(),f,a)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(r){return s.cv(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],r)}bufferedCameraGeometry(r){const a=this.screenBounds[0],h=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],f=s.cv(a,h,0,!1);return this.cameraPoint.y>h.y&&(this.cameraPoint.x>a.x&&this.cameraPoint.x<h.x?f.splice(3,0,this.cameraPoint):this.cameraPoint.x>=h.x?f[2]=this.cameraPoint:this.cameraPoint.x<=a.x&&(f[3]=this.cameraPoint)),s.cw(f,r)}bufferedCameraGeometryGlobe(r){const a=this.screenBounds[0],h=this.screenBounds.length===1?this.screenBounds[0].add(new s.P(1,1)):this.screenBounds[1],f=s.cv(a,h,r),m=this.cameraPoint.clone();switch(3*((m.y>a.y)+(m.y>h.y))+((m.x>a.x)+(m.x>h.x))){case 0:f[0]=m,f[4]=m.clone();break;case 1:f.splice(1,0,m);break;case 2:f[1]=m;break;case 3:f.splice(4,0,m);break;case 5:f.splice(2,0,m);break;case 6:f[3]=m;break;case 7:f.splice(3,0,m);break;case 8:f[2]=m}return f}containsTile(r,a,h,f=0){const m=r.queryPadding/a._pixelsPerMercatorPixel+1,g=h?this._bufferedCameraMercator(m,a):this._bufferedScreenMercator(m,a);let x=r.tileID.wrap+(g.unwrapped?f:0);const w=g.polygon.map(O=>s.cx(r.tileTransform,O,x));if(!s.cy(w,0,0,s.a3,s.a3))return;x=r.tileID.wrap+(this.screenGeometryMercator.unwrapped?f:0);const T=this.screenGeometryMercator.polygon.map(O=>s.cz(r.tileTransform,O,x)),M=T.map(O=>new s.P(O[0],O[1])),A=a.getFreeCameraOptions().position||new s.Y(0,0,0),P=s.cz(r.tileTransform,A,x),z=T.map(O=>{const B=s._.sub(O,O,P);return s._.normalize(B,B),new s.aT(P,B)}),R=s.bB(r,1,a.zoom)*a._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:M,tilespaceRays:z,bufferedTilespaceGeometry:w,bufferedTilespaceBounds:(k=s.cA(w),k.min.x=s.at(k.min.x,0,s.a3),k.min.y=s.at(k.min.y,0,s.a3),k.max.x=s.at(k.max.x,
22230,s.a3),k.max.y=s.at(k.max.y,0,s.a3),k),tile:r,tileID:r.tileID,pixelToTileUnitsFactor:R};var k}_bufferedScreenMercator(r,a){const h=_a(r);if(this._screenRaycastCache[h])return this._screenRaycastCache[h];{let f;return f=a.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(r),a):{polygon:this.bufferedScreenGeometry(r).map(m=>a.pointCoordinate3D(m)),unwrapped:!0},this._screenRaycastCache[h]=f,f}}_bufferedCameraMercator(r,a){const h=_a(r);if(this._cameraRaycastCache[h])return this._cameraRaycastCache[h];{let f;return f=a.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(r),a):{polygon:this.bufferedCameraGeometry(r).map(m=>a.pointCoordinate3D(m)),unwrapped:!0},this._cameraRaycastCache[h]=f,f}}_projectAndResample(r,a){const h=function(m,g){const x=s.ad.multiply([],g.pixelMatrix,g.globeMatrix),w=[0,-s.cD,0,1],T=[0,s.cD,0,1],M=[0,0,0,1];s.aA.transformMat4(w,w,x),s.aA.transformMat4(T,T,x),s.aA.transformMat4(M,M,x);const A=new s.P(w[0]/w[3],w[1]/w[3]),P=new s.P(T[0]/T[3],T[1]/T[3]),z=s.cB(m,A)&&w[3]<M[3],R=s.cB(m,P)&&T[3]<M[3];if(!z&&!R)return null;const k=function(te,N,$){for(let re=1;re<te.length;re++){const de=ma(N.pointCoordinate3D(te[re-1]).x),se=ma(N.pointCoordinate3D(te[re]).x);if($<0){if(de<se)return{idx:re,t:-de/(se-1-de)}}else if(se<de)return{idx:re,t:(1-de)/(se+1-de)}}return null}(m,g,z?-1:1);if(!k)return null;const{idx:O,t:B}=k;let G=O>1?Ki(m.slice(0,O),g):[],q=O<m.length?Ki(m.slice(O),g):[];G=G.map(te=>new s.P(ma(te.x),te.y)),q=q.map(te=>new s.P(ma(te.x),te.y));const Z=[...G];Z.length===0&&Z.push(q[q.length-1]);const K=s.a2(Z[Z.length-1].y,(q.length===0?G[0]:q[0]).y,B);let Y;return Y=z?[new s.P(0,K),new s.P(0,0),new s.P(1,0),new s.P(1,K)]:[new s.P(1,K),new s.P(1,1),new s.P(0,1),new s.P(0,K)],Z.push(...Y),q.length===0?Z.push(G[0]):Z.push(...q),{polygon:Z.map(te=>new s.Y(te.x,te.y)),unwrapped:!1}}(r,a);if(h)return h;const f=function(m,g){let x=!1,w=-1/0,T=0;for(let A=0;A<m.length-1;A++)m[A].x>w&&(w=m[A].x,T=A);for(let A=0;A<m.length-1;A++){const P=(T+A)%(m.length-1),z=m[P],R=m[P+1];Math.abs(z.x-R.x)>.5&&(z.x<R.x?(z.x+=1,P===0&&(m[m.length-1].x+=1)):(R.x+=1,P+1===m.length-1&&(m[0].x+=1)),x=!0)}const M=s.aj(g.center.lng);return x&&M<Math.abs(M-1)&&m.forEach(A=>{A.x-=1}),{polygon:m,unwrapped:x}}(Ki(r,a).map(m=>new s.P(ma(m.x),m.y)),a);return{polygon:f.polygon.map(m=>new s.Y(m.x,m.y)),unwrapped:f.unwrapped}}}function Ki(u,r){return s.cC(u,a=>{const h=r.pointCoordinate3D(a);a.x=h.x,a.y=h.y},1/256)}function ma(u){return u<0?1+u%1:u%1}function _a(u){return 100*u|0}function qh(u,r){const a=s.ad.identity([]);return s.ad.scale(a,a,[.5*u.width,.5*-u.height,1]),s.ad.translate(a,a,[1,-1,0]),s.ad.multiply(a,a,u.calculateProjMatrix(r.toUnwrapped())),Float32Array.from(a)}function ga(u,r,a,h,f,m,g,x=!1){const w=u.tilesIn(h,g,x);w.sort(Zh);const T=[];for(const A of w)T.push({wrappedTileID:A.tile.tileID.wrapped().key,queryResults:A.tile.queryRenderedFeatures(r,a,u._state,A,f,m,qh(u.transform,A.tile.tileID),x)});const M=function(A){const P={},z={};for(const R of A){const k=R.queryResults,O=R.wrappedTileID,B=z[O]=z[O]||{};for(const G in k){const q=k[G],Z=B[G]=B[G]||{},K=P[G]=P[G]||[];for(const Y of q)Z[Y.featureIndex]||(Z[Y.featureIndex]=!0,K.push(Y))}}return P}(T);for(const A in M)M[A].forEach(P=>{const z=P.feature,R=z.layer;R&&R.type!=="background"&&R.type!=="sky"&&R.type!=="slot"&&(z.source=R.source,R["source-layer"]&&(z.sourceLayer=R["source-layer"]),z.state=z.id!==void 0?u.getFeatureState(R["source-layer"],z.id):{})});return M}function Up(u,r){const a=u.getRenderableIds().map(m=>u.getTileByID(m)),h=[],f={};for(let m=0;m<a.length;m++){const g=a[m],x=g.tileID.canonical.key;f[x]||(f[x]=!0,g.querySourceFeatures(h,r))}return h}function Zh(u,r){const a=u.tileID,h=r.tileID;return a.overscaledZ-h.overscaledZ||a.canonical.y-h.canonical.y||a.wrap-h.wrap||a.canonical.x-h.canonical.x}class ya{constructor(r){this.style=r,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const r=!1,a=!1;for(const h in this.style._mergedLayers){const f=this.style._mergedLayers[h];if(f.type==="fill-extrusion")this.layers.push({layer:f,visible:r,visibilityChanged:a});else if(f.type==="model"){const m=this.style.getLayerSource(f);m&&m.type==="batched-model"&&this.layers.push({layer:f,visible:r,visibilityChanged:a})}}}onNewFrame(r){this.layersGotHidden=!1;for(const a of this.layers){const h=a.layer;let f=!1;h.type==="fill-extrusion"?f=!h.isHidden(r)&&h.paint.get("fill-extrusion-opacity")>0:h.type==="model"&&(f=!h.isHidden(r)&&h.paint.get("model-opacity")>0),this.layersGotHidden=this.layersGotHidden||!f&&a.visible,a.visible=f}}updateZOffset(r,a){this.currentBuildingBuckets=[];for(const f of this.layers){const m=f.layer,g=this.style.getLayerSourceCache(m);let x=1;m.type==="fill-extrusion"&&(x=f.visible?m.paint.get("fill-extrusion-vertical-scale"):0);let w=g?g.getTile(a):null;if(!w&&g&&a.canonical.z>g.getSource().minzoom){let T=a.scaledTo(Math.min(g.getSource().maxzoom,a.overscaledZ-1));for(;T.overscaledZ>=g.getSource().minzoom&&(w=g.getTile(T),!w&&T.overscaledZ!==0);)T=T.scaledTo(T.overscaledZ-1)}this.currentBuildingBuckets.push({bucket:w?w.getBucket(m):null,tileID:w?w.tileID:a,verticalScale:x})}r.hasAnyZOffset=!1;let h=!1;for(let f=0;f<r.symbolInstances.length;f++){const m=r.symbolInstances.get(f),g=m.zOffset,x=this._getHeightAtTileOffset(a,m.tileAnchorX,m.tileAnchorY);m.zOffset=x!==Number.NEGATIVE_INFINITY?x:g,h||g===m.zOffset||(h=!0),r.hasAnyZOffset||m.zOffset===0||(r.hasAnyZOffset=!0)}h&&(r.zOffsetBuffersNeedUpload=!0,r.zOffsetSortDirty=!0)}_mapCoordToOverlappingTile(r,a,h,f){let m=a,g=h;if(r.canonical.z!==f.canonical.z){const x=f.canonical,w=1/(1<<r.canonical.z-x.z);m=(a+r.canonical.x*s.a3)*w-x.x*s.a3|0,g=(h+r.canonical.y*s.a3)*w-x.y*s.a3|0}return{tileX:m,tileY:g}}_getHeightAtTileOffset(r,a,h){let f,m;for(let g=0;g<this.layers.length;++g){if(this.layers[g].layer.type!=="fill-extrusion")continue;const{bucket:x,tileID:w,verticalScale:T}=this.currentBuildingBuckets[g];if(!x)continue;const{tileX:M,tileY:A}=this._mapCoordToOverlappingTile(r,a,h,w),P=x.getHeightAtTileCoord(M,A);P&&P.height!==void 0&&(P.hidden?f=P.height:m=Math.max(P.height*T,m||0))}if(m!==void 0)return m;for(let g=0;g<this.layers.length;++g){const x=this.layers[g];if(x.layer.type!=="model"||!x.visible)continue;const{bucket:w,tileID:T}=this.currentBuildingBuckets[g];if(!w)continue;const{tileX:M,tileY:A}=this._mapCoordToOverlappingTile(r,a,h,T),P=w.getHeightAtTileCoord(M,A);if(P&&!P.hidden)return P.height===void 0&&f!==void 0?Math.min(P.maxHeight,f)*P.verticalScale:P.height?P.height*P.verticalScale:Number.NEGATIVE_INFINITY}return this.layersGotHidden?0:Number.NEGATIVE_INFINITY}}function xa(u,r){const a={};for(const h in u)h!=="ref"&&(a[h]=u[h]);return s.cE.forEach(h=>{h in r&&(a[h]=r[h])}),a}function $h(u){u=u.slice();const r=Object.create(null);for(let a=0;a<u.length;a++)r[u[a].id]=u[a];for(let a=0;a<u.length;a++)"ref"in u[a]&&(u[a]=xa(u[a],r[u[a].ref]));return u}const zt={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",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport"};function cu(u,r,a){a.push({command:zt.addSource,args:[u,r[u]]})}function va(u,r,a){r.push({command:zt.removeSource,args:[u]}),a[u]=!0}function Ln(u,r,a,h){va(u,a,h),cu(u,r,a)}function jp(u,r,a){let h;for(h in u[a])if(u[a].hasOwnProperty(h)&&h!=="data"&&!xt(u[a][h],r[a][h]))return!1;for(h in r[a])if(r[a].hasOwnProperty(h)&&h!=="data"&&!xt(u[a][h],r[a][h]))return!1;return!0}function zl(u,r,a,h,f,m){let g;for(g in r=r||{},u=u||{})u.hasOwnProperty(g)&&(xt(u[g],r[g])||a.push({command:m,args:[h,g,r[g],f]}));for(g in r)r.hasOwnProperty(g)&&!u.hasOwnProperty(g)&&(xt(u[g],r[g])||a.push({command:m,args:[h,g,r[g],f]}))}function Dl(u){return u.id}function ba(u,r){return u[r.id]=r,u}class Gp{constructor(r,a){this.reset(r,a)}reset(r,a){this.points=r||[],this._distances=[0];for(let h=1;h<this.points.length;h++)this._distances[h]=this._distances[h-1]+this.points[h].dist(this.points[h-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(a||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(r){if(this.points.length===1)return this.points[0];r=s.at(r,0,1);let a=1,h=this._distances[a];const f=r*this.paddedLength+this.padding;
vendor: 4,082 bytes, line 2223
2223for(;h<f&&a<this._distances.length;)h=this._distances[++a];const m=a-1,g=this._distances[m],x=h-g,w=x>0?(f-g)/x:0;return this.points[m].mult(1-w).add(this.points[a].mult(w))}}class Ll{constructor(r,a,h){const f=this.boxCells=[],m=this.circleCells=[];this.xCellCount=Math.ceil(r/h),this.yCellCount=Math.ceil(a/h);for(let g=0;g<this.xCellCount*this.yCellCount;g++)f.push([]),m.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=r,this.height=a,this.xScale=this.xCellCount/r,this.yScale=this.yCellCount/a,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(r,a,h,f,m){this._forEachCell(a,h,f,m,this._insertBoxCell,this.boxUid++),this.boxKeys.push(r),this.bboxes.push(a),this.bboxes.push(h),this.bboxes.push(f),this.bboxes.push(m)}insertCircle(r,a,h,f){this._forEachCell(a-f,h-f,a+f,h+f,this._insertCircleCell,this.circleUid++),this.circleKeys.push(r),this.circles.push(a),this.circles.push(h),this.circles.push(f)}_insertBoxCell(r,a,h,f,m,g){this.boxCells[m].push(g)}_insertCircleCell(r,a,h,f,m,g){this.circleCells[m].push(g)}_query(r,a,h,f,m,g){if(h<0||r>this.width||f<0||a>this.height)return!m&&[];const x=[];if(r<=0&&a<=0&&this.width<=h&&this.height<=f){if(m)return!0;for(let w=0;w<this.boxKeys.length;w++)x.push({key:this.boxKeys[w],x1:this.bboxes[4*w],y1:this.bboxes[4*w+1],x2:this.bboxes[4*w+2],y2:this.bboxes[4*w+3]});for(let w=0;w<this.circleKeys.length;w++){const T=this.circles[3*w],M=this.circles[3*w+1],A=this.circles[3*w+2];x.push({key:this.circleKeys[w],x1:T-A,y1:M-A,x2:T+A,y2:M+A})}return g?x.filter(g):x}return this._forEachCell(r,a,h,f,this._queryCell,x,{hitTest:m,seenUids:{box:{},circle:{}}},g),m?x.length>0:x}_queryCircle(r,a,h,f,m){const g=r-h,x=r+h,w=a-h,T=a+h;if(x<0||g>this.width||T<0||w>this.height)return!f&&[];const M=[];return this._forEachCell(g,w,x,T,this._queryCellCircle,M,{hitTest:f,circle:{x:r,y:a,radius:h},seenUids:{box:{},circle:{}}},m),f?M.length>0:M}query(r,a,h,f,m){return this._query(r,a,h,f,!1,m)}hitTest(r,a,h,f,m){return this._query(r,a,h,f,!0,m)}hitTestCircle(r,a,h,f){return this._queryCircle(r,a,h,!0,f)}_queryCell(r,a,h,f,m,g,x,w){const T=x.seenUids,M=this.boxCells[m];if(M!==null){const P=this.bboxes;for(const z of M)if(!T.box[z]){T.box[z]=!0;const R=4*z;if(r<=P[R+2]&&a<=P[R+3]&&h>=P[R+0]&&f>=P[R+1]&&(!w||w(this.boxKeys[z]))){if(x.hitTest)return g.push(!0),!0;g.push({key:this.boxKeys[z],x1:P[R],y1:P[R+1],x2:P[R+2],y2:P[R+3]})}}}const A=this.circleCells[m];if(A!==null){const P=this.circles;for(const z of A)if(!T.circle[z]){T.circle[z]=!0;const R=3*z;if(this._circleAndRectCollide(P[R],P[R+1],P[R+2],r,a,h,f)&&(!w||w(this.circleKeys[z]))){if(x.hitTest)return g.push(!0),!0;{const k=P[R],O=P[R+1],B=P[R+2];g.push({key:this.circleKeys[z],x1:k-B,y1:O-B,x2:k+B,y2:O+B})}}}}}_queryCellCircle(r,a,h,f,m,g,x,w){const T=x.circle,M=x.seenUids,A=this.boxCells[m];if(A!==null){const z=this.bboxes;for(const R of A)if(!M.box[R]){M.box[R]=!0;const k=4*R;if(this._circleAndRectCollide(T.x,T.y,T.radius,z[k+0],z[k+1],z[k+2],z[k+3])&&(!w||w(this.boxKeys[R])))return g.push(!0),!0}}const P=this.circleCells[m];if(P!==null){const z=this.circles;for(const R of P)if(!M.circle[R]){M.circle[R]=!0;const k=3*R;if(this._circlesCollide(z[k],z[k+1],z[k+2],T.x,T.y,T.radius)&&(!w||w(this.circleKeys[R])))return g.push(!0),!0}}}_forEachCell(r,a,h,f,m,g,x,w){const T=this._convertToXCellCoord(r),M=this._convertToYCellCoord(a),A=this._convertToXCellCoord(h),P=this._convertToYCellCoord(f);for(let z=T;z<=A;z++)for(let R=M;R<=P;R++)if(m.call(this,r,a,h,f,this.xCellCount*R+z,g,x,w))return}_convertToXCellCoord(r){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(r*this.xScale)))}_convertToYCellCoord(r){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(r*this.yScale)))}_circlesCollide(r,a,h,f,m,g){const x=f-r,w=m-a,T=h+g;return T*T>x*x+w*w}_circleAndRectCollide(r,a,h,f,m,g,x){const w=(g-f)/2,T=Math.abs(r-(f+w));if(T>w+h)return!1;const M=(x-m)/2,A=Math.abs(a-(m+M));if(A>M+h)return!1;if(T<=w||A<=M)return!0;const P=T-w,z=A-M;return P*P+z*z<=h*h}}const kr=100;
2223class Wh{constructor(r,a,h=new Ll(r.width+200,r.height+200,25),f=new Ll(r.width+200,r.height+200,25)){this.transform=r,this.grid=h,this.ignoredGrid=f,this.pitchfactor=Math.cos(r._pitch)*r.cameraToCenterDistance,this.screenRightBoundary=r.width+kr,this.screenBottomBoundary=r.height+kr,this.gridRightBoundary=r.width+200,this.gridBottomBoundary=r.height+200,this.fogState=a}placeCollisionBox(r,a,h,f,m,g,x,w){let T=h.projectedAnchorX,M=h.projectedAnchorY,A=h.projectedAnchorZ;const P=h.elevation,z=h.tileID,R=r.getProjection();if(P&&z){const[Y,te,N]=R.upVector(z.canonical,h.tileAnchorX,h.tileAnchorY),$=R.upVectorScale(z.canonical,this.transform.center.lat,this.transform.worldSize).metersToTile;T+=Y*P*$,M+=te*P*$,A+=N*P*$}const k=this.projectAndGetPerspectiveRatio(x,T,M,A,h.tileID,R.name==="globe"||!!P||this.transform.pitch>0,R),O=g*k.perspectiveRatio,B=(h.x1*a+f.x-h.padding)*O+k.point.x,G=(h.y1*a+f.y-h.padding)*O+k.point.y,q=(h.x2*a+f.x+h.padding)*O+k.point.x,Z=(h.y2*a+f.y+h.padding)*O+k.point.y,K=k.perspectiveRatio<=.55||k.occluded;return!this.isInsideGrid(B,G,q,Z)||!m&&this.grid.hitTest(B,G,q,Z,w)||K?{box:[],offscreen:!1,occluded:k.occluded}:{box:[B,G,q,Z],offscreen:this.isOffscreen(B,G,q,Z),occluded:!1}}placeCollisionCircles(r,a,h,f,m,g,x,w,T,M,A,P,z,R,k){const O=[],B=this.transform.elevation,G=r.getProjection(),q=B?B.getAtTileOffsetFunc(k,this.transform.center.lat,this.transform.worldSize,G):null,Z=new s.P(h.tileAnchorX,h.tileAnchorY);let{x:K,y:Y,z:te}=G.projectTilePoint(Z.x,Z.y,k.canonical);if(q){const[Se,le,_e]=q(Z);K+=Se,Y+=le,te+=_e}const N=G.name==="globe",$=this.projectAndGetPerspectiveRatio(x,K,Y,te,k,N||!!B||this.transform.pitch>0,G),{perspectiveRatio:re}=$,de=(A?g/re:g*re)/s.bN,se=ir(K,Y,te,w),Q=$.signedDistanceFromCamera>0?ul(de,m,h.lineOffsetX*de,h.lineOffsetY*de,!1,se,Z,h,f,w,{},B&&!A?q:null,A&&!!B,G,k,A):null;let fe=!1,Me=!1,Ie=!0;if(Q&&!$.occluded){const Se=.5*z*re+R,le=new s.P(-100,-100),_e=new s.P(this.screenRightBoundary,this.screenBottomBoundary),we=new Gp,{first:Ve,last:Ue}=Q,qe=Ve.path.length;let je=[];for(let He=qe-1;He>=1;He--)je.push(Ve.path[He]);for(let He=1;He<Ue.path.length;He++)je.push(Ue.path[He]);const Be=2.5*Se;T&&(je=je.map(([He,yt,it],ht)=>(q&&!N&&(it=q(ht<qe-1?Ve.tilePath[qe-1-ht]:Ue.tilePath[ht-qe+2])[2]),ir(He,yt,it,T))),je.some(He=>He[3]<=0)&&(je=[]));let ve=[];if(je.length>0){let He=1/0,yt=-1/0,it=1/0,ht=-1/0;for(const It of je)He=Math.min(He,It[0]),it=Math.min(it,It[1]),yt=Math.max(yt,It[0]),ht=Math.max(ht,It[1]);yt>=le.x&&He<=_e.x&&ht>=le.y&&it<=_e.y&&(ve=[je.map(It=>new s.P(It[0],It[1]))],(He<le.x||yt>_e.x||it<le.y||ht>_e.y)&&(ve=s.cF(ve,le.x,le.y,_e.x,_e.y)))}for(const He of ve){we.reset(He,.25*Se);let yt=0;yt=we.length<=.5*Se?1:Math.ceil(we.paddedLength/Be)+1;for(let it=0;it<yt;it++){const ht=it/Math.max(yt-1,1),It=we.lerp(ht),oi=It.x+kr,St=It.y+kr;O.push(oi,St,Se,0);const st=oi-Se,Jt=St-Se,Zt=oi+Se,At=St+Se;if(Ie=Ie&&this.isOffscreen(st,Jt,Zt,At),Me=Me||this.isInsideGrid(st,Jt,Zt,At),!a&&this.grid.hitTestCircle(oi,St,Se,P)&&(fe=!0,!M))return{circles:[],offscreen:!1,collisionDetected:fe,occluded:!1}}}}return{circles:!M&&fe||!Me?[]:O,offscreen:Ie,collisionDetected:fe,occluded:$.occluded}}queryRenderedSymbols(r){if(r.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const a=[];let h=1/0,f=1/0,m=-1/0,g=-1/0;for(const M of r){const A=new s.P(M.x+kr,M.y+kr);h=Math.min(h,A.x),f=Math.min(f,A.y),m=Math.max(m,A.x),g=Math.max(g,A.y),a.push(A)}const x=this.grid.query(h,f,m,g).concat(this.ignoredGrid.query(h,f,m,g)),w={},T={};for(const M of x){const A=M.key;if(w[A.bucketInstanceId]===void 0&&(w[A.bucketInstanceId]={}),w[A.bucketInstanceId][A.featureIndex])continue;const P=[new s.P(M.x1,M.y1),new s.P(M.x2,M.y1),new s.P(M.x2,M.y2),new s.P(M.x1,M.y2)];s.cG(a,P)&&(w[A.bucketInstanceId][A.featureIndex]=!0,T[A.bucketInstanceId]===void 0&&(T[A.bucketInstanceId]=[]),T[A.bucketInstanceId].push(A.featureIndex))}return T}insertCollisionBox(r,a,h,f,m){(a?this.ignoredGrid:this.grid).insert({bucketInstanceId:h,featureIndex:f,collisionGroupID:m},r[0],r[1],r[2],r[3])}insertCollisionCircles(r,a,h,f,m){const g=a?this.ignoredGrid:this.grid,x={bucketInstanceId:h,featureIndex:f,collisionGroupID:m};for(let w=0;w<r.length;
2223w+=4)g.insertCircle(x,r[w],r[w+1],r[w+2])}projectAndGetPerspectiveRatio(r,a,h,f,m,g,x){const w=[a,h,f,1];let T=!1;f||this.transform.pitch>0?(s.aA.transformMat4(w,w,r),this.fogState&&m&&x.name!=="globe"&&(T=function(P,z,R,k,O,B){const G=B.calculateFogTileMatrix(O),q=[z,R,k];return s._.transformMat4(q,q,G),Ii(P,s._.length(q),B.pitch,B._fov)}(this.fogState,a,h,f,m.toUnwrapped(),this.transform)>.9)):Fc(w,w,r);const M=w[3];return{point:new s.P((w[0]/M+1)/2*this.transform.width+kr,(-w[1]/M+1)/2*this.transform.height+kr),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(x)/M*.5,1.5),signedDistanceFromCamera:M,occluded:g&&w[2]>M||T}}isOffscreen(r,a,h,f){return h<kr||r>=this.screenRightBoundary||f<kr||a>this.screenBottomBoundary}isInsideGrid(r,a,h,f){return h>=0&&r<this.gridRightBoundary&&f>=0&&a<this.gridBottomBoundary}getViewportMatrix(){const r=s.ad.identity([]);return s.ad.translate(r,r,[-100,-100,0]),r}}class uu{constructor(r,a,h,f){this.opacity=r?Math.max(0,Math.min(1,r.opacity+(r.placed?a:-a))):f&&h?1:0,this.placed=h}isHidden(){return this.opacity===0&&!this.placed}}class is{constructor(r,a,h,f,m,g=!1){this.text=new uu(r?r.text:null,a,h,m),this.icon=new uu(r?r.icon:null,a,f,m),this.clipped=g}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class un{constructor(r,a,h,f=!1){this.text=r,this.icon=a,this.skipFade=h,this.clipped=f}}class Rl{constructor(){this.invProjMatrix=s.ad.create(),this.viewportMatrix=s.ad.create(),this.circles=[]}}class Hh{constructor(r,a,h,f,m){this.bucketInstanceId=r,this.featureIndex=a,this.sourceLayerIndex=h,this.bucketIndex=f,this.tileID=m}}class Xh{constructor(r){this.crossSourceCollisions=r,this.maxGroupID=0,this.collisionGroups={}}get(r){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[r]){const a=++this.maxGroupID;this.collisionGroups[r]={ID:a,predicate:h=>h.collisionGroupID===a}}return this.collisionGroups[r]}}function rs(u,r,a,h,f){const{horizontalAlign:m,verticalAlign:g}=s.bQ(u),x=-(m-.5)*r,w=-(g-.5)*a,T=s.bP(u,h);return new s.P(x+T[0]*f,w+T[1]*f)}function co(u,r,a,h,f){const m=new s.P(u,r);return a&&m._rotate(h?f:-f),m}class Yh{constructor(r,a,h,f,m,g){this.transform=r.clone(),this.projection=r.projection.name,this.collisionIndex=new Wh(this.transform,m),this.buildingIndex=g,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=a,this.retainedQueryData={},this.collisionGroups=new Xh(h),this.collisionCircleArrays={},this.prevPlacement=f,f&&(f.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(r,a,h,f){const m=h.getBucket(a),g=h.latestFeatureIndex;if(!m||!g||a.fqid!==m.layerIds[0])return;const x=m.layers[0].layout,w=h.collisionBoxArray,T=Math.pow(2,this.transform.zoom-h.tileID.overscaledZ),M=h.tileSize/s.a3,A=h.tileID.toUnwrapped();this.transform.setProjection(m.projection);const P=(z=h.tileID,R=m.getProjection(),k=this.transform,R.name===this.projection?k.calculateProjMatrix(z.toUnwrapped()):tu(k,R,z));var z,R,k;const O=x.get("text-pitch-alignment")==="map",B=x.get("text-rotation-alignment")==="map";a.compileFilter();const G=a.dynamicFilter(),q=a.dynamicFilterNeedsFeature(),Z=this.transform.calculatePixelsToTileUnitsMatrix(h),K=Qs(P,h.tileID.canonical,O,B,this.transform,m.getProjection(),Z);let Y=null;if(O){const $=Qn(P,h.tileID.canonical,O,B,this.transform,m.getProjection(),Z);Y=s.ad.multiply([],this.transform.labelPlaneMatrix,$)}let te=null;G&&h.latestFeatureIndex&&(te={unwrappedTileID:A,dynamicFilter:G,dynamicFilterNeedsFeature:q,featureIndex:h.latestFeatureIndex}),this.retainedQueryData[m.bucketInstanceId]=new Hh(m.bucketInstanceId,g,m.sourceLayerIndex,m.index,h.tileID);const N={bucket:m,layout:x,posMatrix:P,textLabelPlaneMatrix:K,labelToScreenMatrix:Y,clippingData:te,scale:T,textPixelRatio:M,holdingForFade:h.holdingForFade(),collisionBoxArray:w,partiallyEvaluatedTextSize:s.aD(m.textSizeData,this.transform.zoom),partiallyEvaluatedIconSize:s.aD(m.iconSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(m.sourceID)};if(f)for(const $ of m.sortKeyRanges){const{sortKey:re,symbolInstanceStart:de,symbolInstanceEnd:se}=$;r.push({sortKey:re,symbolInstanceStart:de,symbolInstanceEnd:se,parameters:N})}else r.push({symbolInstanceStart:0,symbolInstanceEnd:m.symbolInstances.length,parameters:N})}attemptAnchorPlacement(r,a,h,f,m,g,x,w,T,M,A,P,z,R,k,O,B,G){const{textOffset0:q,textOffset1:Z,crossTileID:K}=P,Y=[q,Z],te=rs(r,h,f,Y,m),N=this.collisionIndex.placeCollisionBox(R,m,a,co(te.x,te.y,g,x,this.transform.angle),A,w,T,M.predicate);if(O){const $=R.getSymbolInstanceIconSize(G,this.transform.zoom,P.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(R,$,O,co(te.x,te.y,g,x,this.transform.angle),A,w,T,M.predicate).box.length===0)return}if(N.box.length>0){let $;return this.prevPlacement&&this.prevPlacement.variableOffsets[K]&&this.prevPlacement.placements[K]&&this.prevPlacement.placements[K].text&&($=this.prevPlacement.variableOffsets[K].anchor),this.variableOffsets[K]={textOffset:Y,width:h,height:f,anchor:r,textScale:m,prevAnchor:$},this.markUsedJustification(R,r,P,k),R.allowVerticalPlacement&&(this.markUsedOrientation(R,k,P),this.placedOrientations[K]=k),{shift:te,placedGlyphBoxes:N}}}placeLayerBucketPart(r,a,h,f){const{bucket:m,layout:g,posMatrix:x,textLabelPlaneMatr
vendor: 21,614 bytes, line 2223
2223ix:w,labelToScreenMatrix:T,clippingData:M,textPixelRatio:A,holdingForFade:P,collisionBoxArray:z,partiallyEvaluatedTextSize:R,partiallyEvaluatedIconSize:k,collisionGroup:O}=r.parameters,B=g.get("text-optional"),G=g.get("icon-optional"),q=g.get("text-allow-overlap"),Z=g.get("icon-allow-overlap"),K=g.get("text-rotation-alignment")==="map",Y=g.get("text-pitch-alignment")==="map",te=g.get("symbol-z-order")==="viewport-y",N=g.get("symbol-z-elevate");this.transform.setProjection(m.projection);let $=q&&(Z||!m.hasIconData()||G),re=Z&&(q||!m.hasTextData()||B);!m.collisionArrays&&z&&m.deserializeCollisionBoxes(z),h&&f&&m.updateCollisionDebugBuffers(this.transform.zoom,z);const de=(se,Q,fe)=>{const{crossTileID:Me,numVerticalGlyphVertices:Ie}=se;if(M){const Zt={zoom:this.transform.zoom,pitch:this.transform.pitch};let At=null;if(M.dynamicFilterNeedsFeature){const dt=this.retainedQueryData[m.bucketInstanceId];At=M.featureIndex.loadFeature({featureIndex:se.featureIndex,bucketIndex:dt.bucketIndex,sourceLayerIndex:dt.sourceLayerIndex,layoutVertexArrayOffset:0})}if(!(0,M.dynamicFilter)(Zt,At,this.retainedQueryData[m.bucketInstanceId].tileID.canonical,new s.P(se.tileAnchorX,se.tileAnchorY),this.transform.calculateDistanceTileData(M.unwrappedTileID)))return this.placements[Me]=new un(!1,!1,!1,!0),void a.add(Me)}if(a.has(Me))return;if(P)return void(this.placements[Me]=new un(!1,!1,!1));let Se=!1,le=!1,_e=!0,we=!1,Ve=!1,Ue=null,qe={box:null,offscreen:null,occluded:null},je={box:null},Be=null,ve=null,He=null,yt=0,it=0,ht=0;fe.textFeatureIndex?yt=fe.textFeatureIndex:se.useRuntimeCollisionCircles&&(yt=se.featureIndex),fe.verticalTextFeatureIndex&&(it=fe.verticalTextFeatureIndex);const It=Zt=>{Zt.tileID=this.retainedQueryData[m.bucketInstanceId].tileID;const At=this.transform.elevation;Zt.elevation=se.zOffset+(At?At.getAtTileOffset(Zt.tileID,Zt.tileAnchorX,Zt.tileAnchorY):0)},oi=fe.textBox;if(oi){It(oi);const Zt=dt=>{let ti=s.aE.horizontal;if(m.allowVerticalPlacement&&!dt&&this.prevPlacement){const yi=this.prevPlacement.placedOrientations[Me];yi&&(this.placedOrientations[Me]=yi,ti=yi,this.markUsedOrientation(m,ti,se))}return ti},At=(dt,ti)=>{if(m.allowVerticalPlacement&&Ie>0&&fe.verticalTextBox){for(const yi of m.writingModes)if(yi===s.aE.vertical?(qe=ti(),je=qe):qe=dt(),qe&&qe.box&&qe.box.length)break}else qe=dt()};if(g.get("text-variable-anchor")){let dt=g.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Me]){const Ht=this.prevPlacement.variableOffsets[Me];dt.indexOf(Ht.anchor)>0&&(dt=dt.filter(ii=>ii!==Ht.anchor),dt.unshift(Ht.anchor))}const ti=(Ht,ii,Ee)=>{const $e=m.getSymbolInstanceTextSize(R,se,this.transform.zoom,Q),Di=(Ht.x2-Ht.x1)*$e+2*Ht.padding,Gt=(Ht.y2-Ht.y1)*$e+2*Ht.padding,he=se.hasIconTextFit&&!Z?ii:null;he&&It(he);let Ji={box:[],offscreen:!1,occluded:!1};const qi=q?2*dt.length:dt.length;for(let Li=0;Li<qi;++Li){const Zi=this.attemptAnchorPlacement(dt[Li%dt.length],Ht,Di,Gt,$e,K,Y,A,x,O,Li>=dt.length,se,Q,m,Ee,he,R,k);if(Zi&&(Ji=Zi.placedGlyphBoxes,Ji&&Ji.box&&Ji.box.length)){Se=!0,Ue=Zi.shift;break}}return Ji};At(()=>ti(oi,fe.iconBox,s.aE.horizontal),()=>{const Ht=fe.verticalTextBox;return Ht&&It(Ht),m.allowVerticalPlacement&&!(qe&&qe.box&&qe.box.length)&&Ie>0&&Ht?ti(Ht,fe.verticalIconBox,s.aE.vertical):{box:null,offscreen:null,occluded:null}}),qe&&(Se=qe.box,_e=qe.offscreen,we=qe.occluded);const yi=Zt(!(!qe||!qe.box));if(!Se&&this.prevPlacement){const Ht=this.prevPlacement.variableOffsets[Me];Ht&&(this.variableOffsets[Me]=Ht,this.markUsedJustification(m,Ht.anchor,se,yi))}}else{const dt=(ti,yi)=>{const Ht=m.getSymbolInstanceTextSize(R,se,this.transform.zoom,Q),ii=this.collisionIndex.placeCollisionBox(m,Ht,ti,new s.P(0,0),q,A,x,O.predicate);return ii&&ii.box&&ii.box.length&&(this.markUsedOrientation(m,yi,se),this.placedOrientations[Me]=yi),ii};At(()=>dt(oi,s.aE.horizontal),()=>{const ti=fe.verticalTextBox;return m.allowVerticalPlacement&&Ie>0&&ti?(It(ti),dt(ti,s.aE.vertical)):{box:null,offscreen:null,occluded:null}}),Zt(!!(qe&&qe.box&&qe.box.length))}}if(Be=qe,Se=Be&&Be.box&&Be.box.length>0,_e=Be&&Be.offscreen,we=Be&&Be.occluded,se.useRuntimeCollisionCircles){const Zt=m.text.placedSymbolArray.get(se.centerJustifiedTextSymbolIndex>=0?se.centerJustifiedTextSymbolIndex:se.verticalPlacedTextSymbolIndex),At=s.aF(m.textSizeData,R,Zt),dt=g.get("text-padding");ve=this.collisionIndex.placeCollisionCircles(m,q,Zt,m.lineVertexArray,m.glyphOffsetArray,At,x,w,T,h,Y,O.predicate,se.collisionCircleDiameter*At/s.bN,dt,this.retainedQueryData[m.bucketInstanceId].tileID),Se=q||ve.circles.length>0&&!ve.collisionDetected,_e=_e&&ve.offscreen,we=ve.occluded}if(fe.iconFeatureIndex&&(ht=fe.iconFeatureIndex),fe.iconBox){const Zt=At=>{It(At);const dt=se.hasIconTextFit&&Ue?co(Ue.x,Ue.y,K,Y,this.transform.angle):new s.P(0,0),ti=m.getSymbolInstanceIconSize(k,this.transform.zoom,se.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(m,ti,At,dt,Z,A,x,O.predicate)};je&&je.box&&je.box.length&&fe.verticalIconBox?(He=Zt(fe.verticalIconBox),le=He.box.length>0):(He=Zt(fe.iconBox),le=He.box.length>0),_e=_e&&He.offscreen,Ve=He.occluded}const St=B||se.numHorizontalGlyphVertices===0&&Ie===0,st=G||se.numIconVertices===0;if(St||st?st?St||(le=le&&Se):Se=le&&Se:le=Se=le&&Se,Se&&Be&&Be.box&&this.collisionIndex.insertCollisionBox(Be.box,g.get("text-ignore-placement"),m.bucketInstanceId,je&&je.box&&it?it:yt,O.ID),le&&He&&this.collisionIndex.insertCollisionBox(He.box,g.get("icon-ignore-placement"),m.bucketInstanceId,ht,O.ID),ve&&(Se&&this.collisionIndex.insertCollisionCircles(ve.circles,g.get("text-ignore-placement"),m.bucketInstanceId,yt,O.ID),h)){const Zt=m.bucketInstanceId;let At=this.collisionCircleArrays[Zt];At===void 0&&(At=this.collisionCircleArrays[Zt]=new Rl);for(let dt=0;dt<ve.circles.length;dt+=4)At.circles.push(ve.circles[dt+0]),At.circles.push(ve.circles[dt+1]),At.circles.push(ve.circles[dt+2]),At.circles.push(ve.collisionDetected?1:0)}const Jt=m.projection.name!=="globe";$=$&&(Jt||!we),re=re&&(Jt||!Ve),this.placements[Me]=new un(Se||$,le||re,_e||m.justReloaded),a.add(Me)};if(N&&this.buildingIndex&&(this.buildingIndex.updateZOffset(m,this.retainedQueryData[m.bucketInstanceId].tileID),m.updateZOffset()),te){const se=m.getSortedSymbolIndexes(this.transform.angle);for(let Q=se.length-1;Q>=0;--Q){const fe=se[Q];de(m.symbolInstances.get(fe),fe,m.collisionArrays[fe])}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 se=m.getSortedIndexesByZOffset();for(let Q=0;Q<se.length;++Q){const fe=se[Q];de(m.symbolInstances.get(fe),fe,m.collisionArrays[fe])}}else for(let se=r.symbolInstanceStart;se<r.symbolInstanceEnd;se++)de(m.symbolInstances.get(se),se,m.collisionArrays[se]);if(h&&m.bucketInstanceId in this.collisionCircleArrays){const se=this.collisionCircleArrays[m.bucketInstanceId];s.ad.invert(se.invProjMatrix,x),se.viewportMatrix=this.collisionIndex.getViewportMatrix()}m.justReloaded=!1}markUsedJustification(r,a,h,f){const{leftJustifiedTextSymbolIndex:m,centerJustifiedTextSymbolIndex:g,rightJustifiedTextSymbolIndex:x,verticalPlacedTextSymbolIndex:w,crossTileID:T}=h,M=s.cJ(a),A=f===s.aE.vertical?w:M==="left"?m:M==="center"?g:M==="right"?x:-1;m>=0&&(r.text.placedSymbolArray.get(m).crossTileID=A>=0&&m!==A?0:T),g>=0&&(r.text.placedSymbolArray.get(g).crossTileID=A>=0&&g!==A?0:T),x>=0&&(r.text.placedSymbolArray.get(x).crossTileID=A>=0&&x!==A?0:T),w>=0&&(r.text.placedSymbolArray.get(w).crossTileID=A>=0&&w!==A?0:T)}markUsedOrientation(r,a,h){const f=a===s.aE.horizontal||a===s.aE.horizontalOnly?a:0,m=a===s.aE.vertical?a:0,{leftJustifiedTextSymbolIndex:g,centerJustifiedTextSymbolIndex:x,rightJustifiedTextSymbolIndex:w,verticalPlacedTextSymbolIndex:T}=h,M=r.text.placedSymbolArray;g>=0&&(M.get(g).placedOrientation=f),x>=0&&(M.get(x).placedOrientation=f),w>=0&&(M.get(w).placedOrientation=f),T>=0&&(M.get(T).placedOrientation=m)}commit(r){this.commitTime=r,this.zoomAtLastRecencyCheck=this.transform.zoom;const a=this.prevPlacement;let h=!1;this.prevZoomAdjustment=a?a.zoomAdjustment(this.transform.zoom):0;const f=a?a.symbolFadeChange(r):1,m=a?a.opacities:{},g=a?a.variableOffsets:{},x=a?a.placedOrientations:{};for(const w in this.placements){const T=this.placements[w],M=m[w];M?(this.opacities[w]=new is(M,f,T.text,T.icon,null,T.clipped),h=h||T.text!==M.text.placed||T.icon!==M.icon.placed):(this.opacities[w]=new is(null,f,T.text,T.icon,T.skipFade,T.clipped),h=h||T.text||T.icon)}for(const w in m){const T=m[w];if(!this.opacities[w]){const M=new is(T,f,!1,!1);M.isHidden()||(this.opacities[w]=M,h=h||T.text.placed||T.icon.placed)}}for(const w in g)this.variableOffsets[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.variableOffsets[w]=g[w]);for(const w in x)this.placedOrientations[w]||!this.opacities[w]||this.opacities[w].isHidden()||(this.placedOrientations[w]=x[w]);h?this.lastPlacementChangeTime=r:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=a?a.lastPlacementChangeTime:r)}updateLayerOpacities(r,a,h,f){const m=new Set;for(const g of a){const x=g.getBucket(r);x&&g.latestFeatureIndex&&r.fqid===x.layerIds[0]&&(this.updateBucketOpacities(x,m,g.collisionBoxArray,h,f,g.tileID),x.layers[0].layout.get("symbol-z-elevate")&&this.buildingIndex&&(this.buildingIndex.updateZOffset(x,g.tileID),x.updateZOffset()))}}updateBucketOpacities(r,a,h,f,m,g){r.hasTextData()&&r.text.opacityVertexArray.clear(),r.hasIconData()&&r.icon.opacityVertexArray.clear(),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexArray.clear(),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexArray.clear();const x=r.layers[0].layout,w=!!r.layers[0].dynamicFilter(),T=new is(null,0,!1,!1,!0),M=x.get("text-allow-overlap"),A=x.get("icon-allow-overlap"),P=x.get("text-variable-anchor"),z=x.get("text-rotation-alignment")==="map",R=x.get("text-pitch-alignment")==="map",k=new is(null,0,M&&(A||!r.hasIconData()||x.get("icon-optional")),A&&(M||!r.hasTextData()||x.get("text-optional")),!0);!r.collisionArrays&&h&&(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData())&&r.deserializeCollisionBoxes(h);const O=(G,q,Z)=>{for(let K=0;K<q/4;K++)G.opacityVertexArray.emplaceBack(Z)};let B=0;m&&r.updateReplacement(g,m);for(let G=0;G<r.symbolInstances.length;G++){const q=r.symbolInstances.get(G),{numHorizontalGlyphVertices:Z,numVerticalGlyphVertices:K,crossTileID:Y,numIconVertices:te,tileAnchorX:N,tileAnchorY:$}=q,re=a.has(Y);let de=this.opacities[Y];re?de=T:de||(de=k,this.opacities[Y]=de),a.add(Y);const se=Z>0||K>0,Q=te>0,fe=this.placedOrientations[Y],Me=fe===s.aE.vertical,Ie=fe===s.aE.horizontal||fe===s.aE.horizontalOnly;!se&&!Q||de.isHidden()||B++;let Se=!1;if((se||Q)&&m)for(const le of r.activeReplacements){if(le.order<f||le.order===1/0||!(le.clipMask&s.cu.Symbol)||le.min.x>N||N>le.max.x||le.min.y>$||$>le.max.y)continue;const _e=s.cH(N,$,g.canonical,le.footprintTileId.canonical);if(Se=s.cI(_e,le),Se)break}if(se){const le=Se?nr:wa(de.text);O(r.text,Z,Me?nr:le),O(r.text,K,Ie?nr:le);const _e=de.text.isHidden(),{leftJustifiedTextSymbolIndex:we,centerJustifiedTextSymbolIndex:Ve,rightJustifiedTextSymbolIndex:Ue,verticalPlacedTextSymbolIndex:qe}=q,je=r.text.placedSymbolArray,Be=_e||Me?1:0;we>=0&&(je.get(we).hidden=Be),Ve>=0&&(je.get(Ve).hidden=Be),Ue>=0&&(je.get(Ue).hidden=Be),qe>=0&&(je.get(qe).hidden=_e||Ie?1:0);const ve=this.variableOffsets[Y];ve&&this.markUsedJustification(r,ve.anchor,q,fe);const He=this.placedOrientations[Y];He&&(this.markUsedJustification(r,"left",q,He),this.markUsedOrientation(r,He,q))}if(Q){const le=Se?nr:wa(de.icon),{placedIconSymbolIndex:_e,verticalPlacedIconSymbolIndex:we}=q,Ve=r.icon.placedSymbolArray,Ue=de.icon.isHidden()?1:0;_e>=0&&(O(r.icon,te,Me?nr:le),Ve.get(_e).hidden=Ue),we>=0&&(O(r.icon,q.numVerticalIconVertices,Ie?nr:le),Ve.get(we).hidden=Ue)}if(r.hasIconCollisionBoxData()||r.hasTextCollisionBoxData()){const le=r.collisionArrays[G];if(le){let _e=new s.P(0,0),we=!0;if(le.textBox||le.verticalTextBox){if(P){const Ue=this.variableOffsets[Y];Ue?(_e=rs(Ue.anchor,Ue.width,Ue.height,Ue.textOffset,Ue.textScale),z&&_e._rotate(R?this.transform.angle:-this.transform.angle)):we=!1}w&&(we=!de.clipped),le.textBox&&ns(r.textCollisionBox.collisionVertexArray,de.text.placed,!we||Me,_e.x,_e.y),le.verticalTextBox&&ns(r.textCollisionBox.collisionVertexArray,de.text.placed,!we||Ie,_e.x,_e.y)}const Ve=we&&!!(!Ie&&le.verticalIconBox);le.iconBox&&ns(r.iconCollisionBox.collisionVertexArray,de.icon.placed,Ve,q.hasIconTextFit?_e.x:0,q.hasIconTextFit?_e.y:0),le.verticalIconBox&&ns(r.iconCollisionBox.collisionVertexArray,de.icon.placed,!Ve,q.hasIconTextFit?_e.x:0,q.hasIconTextFit?_e.y:0)}}}if(r.fullyClipped=B===0,r.sortFeatures(this.transform.angle),this.retainedQueryData[r.bucketInstanceId]&&(this.retainedQueryData[r.bucketInstanceId].featureSortOrder=r.featureSortOrder),r.hasTextData()&&r.text.opacityVertexBuffer&&r.text.opacityVertexBuffer.updateData(r.text.opacityVertexArray),r.hasIconData()&&r.icon.opacityVertexBuffer&&r.icon.opacityVertexBuffer.updateData(r.icon.opacityVertexArray),r.hasIconCollisionBoxData()&&r.iconCollisionBox.collisionVertexBuffer&&r.iconCollisionBox.collisionVertexBuffer.updateData(r.iconCollisionBox.collisionVertexArray),r.hasTextCollisionBoxData()&&r.textCollisionBox.collisionVertexBuffer&&r.textCollisionBox.collisionVertexBuffer.updateData(r.textCollisionBox.collisionVertexArray),r.bucketInstanceId in this.collisionCircleArrays){const G=this.collisionCircleArrays[r.bucketInstanceId];r.placementInvProjMatrix=G.invProjMatrix,r.placementViewportMatrix=G.viewportMatrix,r.collisionCircleArray=G.circles,delete this.collisionCircleArrays[r.bucketInstanceId]}}symbolFadeChange(r){return this.fadeDuration===0?1:(r-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(r){return Math.max(0,(this.transform.zoom-r)/1.5)}hasTransitions(r){return this.stale||r-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(r,a){const h=this.zoomAtLastRecencyCheck===a?1-this.zoomAdjustment(a):1;return this.zoomAtLastRecencyCheck=a,this.commitTime+this.fadeDuration*h>r}setStale(){this.stale=!0}}function ns(u,r,a,h,f){u.emplaceBack(r?1:0,a?1:0,h||0,f||0),u.emplaceBack(r?1:0,a?1:0,h||0,f||0),u.emplaceBack(r?1:0,a?1:0,h||0,f||0),u.emplaceBack(r?1:0,a?1:0,h||0,f||0)}const wr=Math.pow(2,25),hu=Math.pow(2,24),Ne=Math.pow(2,17),Kh=Math.pow(2,16),du=Math.pow(2,9),pu=Math.pow(2,8),Jh=Math.pow(2,1);function wa(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const r=u.placed?1:0,a=Math.floor(127*u.opacity);return a*wr+r*hu+a*Ne+r*Kh+a*du+r*pu+a*Jh+r}const nr=0;class fu{constructor(r){this._sortAcrossTiles=r.layout.get("symbol-z-order")!=="viewport-y"&&r.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(r,a,h,f,m){const g=this._bucketParts;for(;this._currentTileIndex<r.length;)if(a.getBucketParts(g,f,r[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,m())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,g.sort((x,w)=>x.sortKey-w.sortKey));this._currentPartIndex<g.length;){const x=g[this._currentPartIndex];if(a.placeLayerBucketPart(x,this._seenCrossTileIDs,h,x.symbolInstanceStart===0),this._currentPartIndex++,m())return!0}return!1}}class uo{constructor(r,a,h,f,m,g,x,w,T){this.placement=new Yh(r,m,g,x,w,T),this._currentPlacementIndex=a.length-1,this._forceFullPlacement=h,this._showCollisionBoxes=f,this._done=!1}isDone(){return this._done}continuePlacement(r,a,h,f){const m=s.e.now(),g=()=>{const x=s.e.now()-m;return!this._forceFullPlacement&&x>2};for(;this._currentPlacementIndex>=0;){const x=a[r[this._currentPlacementIndex]],w=this.placement.collisionIndex.transform.zoom;if(x.type==="symbol"&&(!x.minzoom||x.minzoom<=w)&&(!x.maxzoom||x.maxzoom>w)){const T=x,M=T.layout.get("symbol-z-elevate"),A=this._inProgressLayer=this._inProgressLayer||new fu(T),P=s.al(x.source,x.scope);if(A.continuePlacement(M?f[P]:h[P],this.placement,this._showCollisionBoxes,x,g))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(r){return this.placement.commit(r),this.placement}}const os=512/s.a3/2;class ss{constructor(r,a,h){this.tileID=r,this.bucketInstanceId=h,this.index=new s.cK(a.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const f=r.canonical.x*s.a3,m=r.canonical.y*s.a3;for(let g=0;g<a.length;g++){const{key:x,crossTileID:w,tileAnchorX:T,tileAnchorY:M}=a.get(g),A=Math.floor((f+T)*os),P=Math.floor((m+M)*os);this.index.add(A,P),this.keys.push(x),this.crossTileIDs.push(w)}this.index.finish()}findMatches(r,a,h){const f=this.tileID.canonical.z<a.canonical.z?1:Math.pow(2,this.tileID.canonical.z-a.canonical.z),m=os/Math.pow(2,a.canonical.z-this.tileID.canonical.z),g=a.canonical.x*s.a3,x=a.canonical.y*s.a3;for(let w=0;w<r.length;w++){const T=r.get(w);if(T.crossTileID)continue;const{key:M,tileAnchorX:A,tileAnchorY:P}=T,z=Math.floor((g+A)*m),R=Math.floor((x+P)*m),k=this.index.range(z-f,R-f,z+f,R+f);for(const O of k){const B=this.crossTileIDs[O];if(this.keys[O]===M&&!h.has(B)){h.add(B),T.crossTileID=B;break}}}}}class qp{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Zp{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(r){const a=Math.round((r-this.lng)/360);if(a!==0)for(const h in this.indexes){const f=this.indexes[h],m={};for(const g in f){const x=f[g];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+a),m[x.tileID.key]=x}this.indexes[h]=m}this.lng=r}addBucket(r,a,h){if(this.indexes[r.overscaledZ]&&this.indexes[r.overscaledZ][r.key]){if(this.indexes[r.overscaledZ][r.key].bucketInstanceId===a.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(r.overscaledZ,this.indexes[r.overscaledZ][r.key])}for(let m=0;m<a.symbolInstances.length;m++)a.symbolInstances.get(m).crossTileID=0;this.usedCrossTileIDs[r.overscaledZ]||(this.usedCrossTileIDs[r.overscaledZ]=new Set);const f=this.usedCrossTileIDs[r.overscaledZ];for(const m in this.indexes){const g=this.indexes[m];if(Number(m)>r.overscaledZ)for(const x in g){const w=g[x];w.tileID.isChildOf(r)&&w.findMatches(a.symbolInstances,r,f)}else{const x=g[r.scaledTo(Number(m)).key];x&&x.findMatches(a.symbolInstances,r,f)}}for(let m=0;m<a.symbolInstances.length;m++){const g=a.symbolInstances.get(m);g.crossTileID||(g.crossTileID=h.generate(),f.add(g.crossTileID))}return this.indexes[r.overscaledZ]===void 0&&(this.indexes[r.overscaledZ]={}),this.indexes[r.overscaledZ][r.key]=new ss(r,a.symbolInstances,a.bucketInstanceId),!0}removeBucketCrossTileIDs(r,a){for(const h of a.crossTileIDs)this.usedCrossTileIDs[r].delete(h)}removeStaleBuckets(r){let a=!1;for(const h in this.indexes){const f=this.indexes[h];for(const m in f)r[f[m].bucketInstanceId]||(this.removeBucketCrossTileIDs(h,f[m]),delete f[m],a=!0)}return a}}class mu{constructor(){this.layerIndexes={},this.crossTileIDs=new qp,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(r,a,h,f){let m=this.layerIndexes[r.fqid];m===void 0&&(m=this.layerIndexes[r.fqid]=new Zp);let g=!1;const x={};f.name!=="globe"&&m.handleWrapJump(h);for(const w of a){const T=w.getBucket(r);T&&r.fqid===T.layerIds[0]&&(T.bucketInstanceId||(T.bucketInstanceId=++this.maxBucketInstanceId),m.addBucket(w.tileID,T,this.crossTileIDs)&&(g=!0),x[T.bucketInstanceId]=!0)}return m.removeStaleBuckets(x)&&(g=!0),g}pruneUnusedLayers(r){const a={};r.forEach(h=>{a[h]=!0});for(const h in this.layerIndexes)a[h]||delete this.layerIndexes[h]}}const $p=new s.N({data:new s.O(s.L.colorTheme.data)}),Rn=(u,r)=>pt(u,r&&r.filter(a=>a.identifier!=="source.canvas")),Qh=s.ah(zt,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setProjection","setCamera","addImport","removeImport","updateImport"]),_u=s.ah(zt,["setCenter","setZoom","setBearing","setPitch"]),ed={version:8,layers:[],sources:{}},td={duration:300,delay:0};class Or extends s.E{constructor(r,a={}){super(),this.map=r,this.scope=a.scope||"",this.globalId=null,this.fragments=[],this.importDepth=a.importDepth||0,this.importsCache=a.importsCache||new Map,this.resolvedImports=a.resolvedImports||new Set,this.transition=s.W({},td),this._buildingIndex=new ya(this),this.crossTileSymbolIndex=new mu,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerIndices=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._changes=a.styleChanges||new vc,this.dispatcher=a.dispatcher?a.dispatcher:new s.bw(s.bx(),this),a.imageManager?this.imageManager=a.imageManager:(this.imageManager=new $s,this.imageManager.setEventedParent(this)),this.imageManager.createScope(this.scope),this.glyphManager=a.glyphManager?a.glyphManager:new s.cM(r._requestManager,a.localFontFamily?s.cN.all:a.localIdeographFontFamily?s.cN.ideographs:s.cN.none,a.localFontFamily||a.localIdeographFontFamily),a.modelManager?this.modelManager=a.modelManager:(this.modelManager=new rl(r._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._serializedLayers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._order=[],this._markersNeedU
2223pdate=!1,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null},this._styleColorThemeForScope={},this.options=a.configOptions?a.configOptions:new Map,this._configDependentLayers=a.configDependentLayers?a.configDependentLayers:new Set,this._config=a.config,this._initialConfig=a.initialConfig,this.dispatcher.broadcast("setReferrer",s.cO());const h=this;this._rtlTextPluginCallback=Or.registerForPluginStateChange(f=>{h.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:f.pluginStatus,pluginURL:f.pluginURL},(m,g)=>{if(s.cP(m),g&&g.every(x=>x))for(const x in h._sourceCaches){const w=h._sourceCaches[x],T=w.getSource().type;T!=="vector"&&T!=="geojson"||w.reload()}})}),this.on("data",f=>{if(f.dataType!=="source"||f.sourceDataType!=="metadata")return;const m=this.getOwnSource(f.sourceId);if(m&&m.vectorLayerIds)for(const g in this._layers){const x=this._layers[g];x.source===m.id&&this._validateLayer(x)}})}load(r){return r?(typeof r=="string"?this.loadURL(r):this.loadJSON(r),this):this}_getGlobalId(r){if(!r)return null;if(typeof r=="string"){if(s.cQ(r))return r;const a=s.cR(r);if(!a.startsWith("http"))try{return new URL(a,location.href).toString()}catch{return a}return a}return`json://${s.cS(JSON.stringify(r))}`}_diffStyle(r,a,h){this.globalId=this._getGlobalId(r);const f=(m,g)=>{try{g(null,this.setState(m,h))}catch(x){g(x,!1)}};if(typeof r=="string"){const m=this.map._requestManager.normalizeStyleURL(r),g=this.map._requestManager.transformRequest(m,s.R.Style);s.g(g,(x,w)=>{x?this.fire(new s.d(x)):w&&f(w,a)})}else typeof r=="object"&&f(r,a)}loadURL(r,a={}){this.fire(new s.f("dataloading",{dataType:"style"}));const h=typeof a.validate=="boolean"?a.validate:!s.cQ(r);this.globalId=this._getGlobalId(r),r=this.map._requestManager.normalizeStyleURL(r,a.accessToken),this.resolvedImports.add(r);const f=this.importsCache.get(r);if(f)return this._load(f,h);const m=this.map._requestManager.transformRequest(r,s.R.Style);this._request=s.g(m,(g,x)=>{if(this._request=null,g)this.fire(new s.d(g));else if(x)return this.importsCache.set(r,x),this._load(x,h)})}loadJSON(r,a={}){this.fire(new s.f("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(r),this._request=s.e.frame(()=>{this._request=null,this._load(r,a.validate!==!1)})}loadEmpty(){this.fire(new s.f("dataloading",{dataType:"style"})),this._load(ed,!1)}_loadImports(r,a,h){if(this.importDepth>=4)return s.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const f=[];for(const m of r){const g=this._createFragmentStyle(m),x=new Promise(M=>{g.once("style.import.load",M),g.once("error",M)}).then(()=>this.mergeAll());if(f.push(x),this.resolvedImports.has(m.url)){g.loadEmpty();continue}const w=m.data||this.importsCache.get(m.url);w?(g.loadJSON(w,{validate:a}),this._isInternalStyle(w)&&(g.globalId=null)):m.url?g.loadURL(m.url,{validate:a}):g.loadEmpty();const T={style:g,id:m.id,config:m.config};if(h){const M=this.fragments.findIndex(({id:A})=>A===h);this.fragments=this.fragments.slice(0,M).concat(T).concat(this.fragments.slice(M))}else this.fragments.push(T)}return Promise.allSettled(f)}getImportGlobalIds(r=this,a=new Set){for(const h of r.fragments)h.style.globalId&&a.add(h.style.globalId),this.getImportGlobalIds(h.style,a);return[...a.values()]}_createFragmentStyle(r){const a=this.scope?s.al(r.id,this.scope):r.id;let h;const f=this._initialConfig&&this._initialConfig[a];(r.config||f)&&(h=s.W({},r.config,f));const m=new Or(this.map,{scope:a,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:h,configOptions:this.options,configDependentLayers:this._configDependentLayers});return m.setEventedParent(this.map,{style:m}),m}_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.isRootStyle()}_isInternalStyle(r){return this.isRootStyle()&&(r.fragment||!!r.schema&&r.fragment!==!1)}_load(r,a){const h=r.schema;if(this._isInternalStyle(r)){const g=s.W({},ed,{imports:[{id:"basemap",data:r,url:""}]});return void this._load(g,a)}if(this.updateConfig(this._config,h),a&&Rn(this,J(r)))return;this._loaded=!0,this.stylesheet=s.cT(r);const f=()=>{for(const T in r.sources)this.addSource(T,r.sources[T],{validate:!1,isInitialLoad:!0});r.sprite?this._loadSprite(r.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),this.glyphManager.setURL(r.glyphs,this.scope);
2223const g=$h(this.stylesheet.layers);if(this._order=g.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 Xe(T.properties,T.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new Xe(this.stylesheet.light)),this._layers={},this._serializedLayers={};for(const T of g){const M=s.cY(T,this.scope,this._styleColorTheme.lut,this.options);M.isConfigDependent&&this._configDependentLayers.add(M.fqid),M.setEventedParent(this,{layer:{id:M.id}}),this._layers[M.id]=M,this._serializedLayers[M.id]=M.serialize();const A=this.getOwnLayerSourceCache(M),P=!!this.directionalLight&&this.directionalLight.shadowsEnabled();A&&M.canCastShadows()&&P&&(A.castsShadows=!0)}this.stylesheet.models&&this.modelManager.addModels(this.stylesheet.models,this.scope);const x=this.stylesheet.terrain;x&&(this.checkCanvasFingerprintNoise(),this.terrainSetForDrapingOnly()||this._createTerrain(x,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new s.f("data",{dataType:"style"}));const w=this.isRootStyle();r.imports?this._loadImports(r.imports,a).then(()=>{this._reloadImports(),this.fire(new s.f(w?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new s.f(w?"style.load":"style.import.load")))},m=this.stylesheet["color-theme"];if(this._styleColorTheme.colorTheme=m,m){const g=this._evaluateColorThemeData(m);this._loadColorTheme(g).then(()=>{f()}).catch(x=>{s.w(`Couldn't load color theme from the stylesheet: ${x}`),f()})}else this._styleColorTheme.lut=null,f()}isRootStyle(){return this.importDepth===0}mergeAll(){let r,a,h,f,m,g,x,w;const T={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(M=>{if(M.stylesheet){if(M.light!=null&&(r=M.light),M.stylesheet.lights)for(const A of M.stylesheet.lights)A.type==="ambient"&&M.ambientLight!=null&&(a=M.ambientLight),A.type==="directional"&&M.directionalLight!=null&&(h=M.directionalLight);f=this._prioritizeTerrain(f,M.terrain,M.stylesheet.terrain),M.stylesheet.fog&&M.fog!=null&&(m=M.fog),M.stylesheet.camera!=null&&(w=M.stylesheet.camera),M.stylesheet.projection!=null&&(g=M.stylesheet.projection),M.stylesheet.transition!=null&&(x=M.stylesheet.transition),T[M.scope]=M._styleColorTheme}}),this.light=r,this.ambientLight=a,this.directionalLight=h,this.fog=m,this._styleColorThemeForScope=T,f===null?delete this.terrain:this.terrain=f,this.camera=w||{"camera-projection":"perspective"},this.projection=g||{name:"mercator"},this.transition=s.W({},td,x),this.mergeSources(),this.mergeLayers()}forEachFragmentStyle(r){const a=h=>{for(const f of h.fragments)a(f.style);r(h)};a(this)}_prioritizeTerrain(r,a,h){const f=r&&r.drapeRenderMode===0;return h===null?a&&a.drapeRenderMode===0?a:f?r:null:a!=null&&(!r||f||a&&a.drapeRenderMode===1)?a:r}mergeTerrain(){let r;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(a=>{r=this._prioritizeTerrain(r,a.terrain,a.stylesheet.terrain)}),r===null?delete this.terrain:this.terrain=r}mergeProjection(){let r;this.forEachFragmentStyle(a=>{a.stylesheet.projection!=null&&(r=a.stylesheet.projection)}),this.projection=r||{name:"mercator"}}mergeSources(){const r={},a={},h={};this.forEachFragmentStyle(f=>{for(const m in f._sourceCaches){const g=s.al(m,f.scope);r[g]=f._sourceCaches[m]}for(const m in f._otherSourceCaches){const g=s.al(m,f.scope);a[g]=f._otherSourceCaches[m]}for(const m in f._symbolSourceCaches){const g=s.al(m,f.scope);h[g]=f._symbolSourceCaches[m]}}),this._mergedSourceCaches=r,this._mergedOtherSourceCaches=a,this._mergedSymbolSourceCaches=h}mergeLayers(){const r={},a=[],h={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(g=>{for(const x of g._order){const w=g._layers[x];if(w.type==="slot"){const T=s.cU(x);if(r[T])continue;r[T]=[]}w.slot&&r[w.slot]?r[w.slot].push(w):a.push(w)}}),this._mergedOrder=[],this._clipLayerIndices=[];let f=0;const m=(g=[])=>{for(const x of g)if(x.type==="slot"){const w=s.cU(x.id);r[w]&&m(r[w]),this._mergedSlots.push(w)}else{const w=s.al(x.id,x.scope);this._mergedOrder.push(w),h[w]=x,x.is3D()&&(this._has3DLayers=!0),x.type==="circle"&&(this._hasCircleLayers=!0),x.type==="symbol"&&(this._hasSymbolLayers=!0),x.type==="clip"&&this._clipLayerIndices.push(f),f++}};m(a),this._mergedLayers=h,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(r){return this.stylesheet.camera=s.W({},this.stylesheet.camera,r),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(r){return r.data?function(a,h,f){const m=s.W({},h);
2223for(const x of Object.keys(s.L.colorTheme))m[x]===void 0&&(m[x]=s.L.colorTheme[x].default);const g=new s.U($p,a,new Map(f));return g.setTransitionOrValue(m,f),g.untransitioned().possiblyEvaluate(new s.X(0))}(this.scope,r,this.options).get("data"):null}_loadColorTheme(r){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const a=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((h,f)=>{const m="data:image/png;base64,";if(!r||r.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void h();let g=r;g.startsWith(m)||(g=m+g);const x="mapbox-reserved-lut",w=new Image;w.src=g,w.onerror=()=>{this._styleColorTheme.lutLoading=!1,f(new Error("Failed to load image data"))},w.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==a)return void h();this._styleColorTheme.lutLoading=!1;const{width:T,height:M,data:A}=s.e.getImageData(w);if(M>32)return void f(new Error("The height of the image must be less than or equal to 32 pixels."));if(T!==M*M)return void f(new Error("The width of the image must be equal to the height squared."));this.getImage(x)&&this.removeImage(x),this.addImage(x,{data:new s.i({width:T,height:M},A),pixelRatio:1,sdf:!1,version:0});const P=this.imageManager.getImage(x,this.scope);P?(this._styleColorTheme.lut={image:P.data,data:r},h()):f(new Error("Missing LUT image."))}})}getLut(r){const a=this._styleColorThemeForScope[r];return a?a.lut:null}setProjection(r){r?this.stylesheet.projection=r: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(r){this._spriteRequest=function(a,h,f){let m,g,x;const w=s.e.devicePixelRatio>1?"@2x":"";let T=s.g(h.transformRequest(h.normalizeSpriteURL(a,w,".json"),s.R.SpriteJSON),(P,z)=>{T=null,x||(x=P,m=z,A())}),M=s.h(h.transformRequest(h.normalizeSpriteURL(a,w,".png"),s.R.SpriteImage),(P,z)=>{M=null,x||(x=P,g=z,A())});function A(){if(x)f(x);else if(m&&g){const P=s.e.getImageData(g),z={};for(const R in m){const{width:k,height:O,x:B,y:G,sdf:q,pixelRatio:Z,stretchX:K,stretchY:Y,content:te}=m[R],N=new s.i({width:k,height:O});s.i.copy(P,N,{x:B,y:G},{x:0,y:0},{width:k,height:O},null),z[R]={data:N,pixelRatio:Z,sdf:q,stretchX:K,stretchY:Y,content:te}}f(null,z)}}return{cancel(){T&&(T.cancel(),T=null),M&&(M.cancel(),M=null)}}}(r,this.map._requestManager,(a,h)=>{if(this._spriteRequest=null,a)this.fire(new s.d(a));else if(h)for(const f in h)this.imageManager.addImage(f,this.scope,h[f]);this.imageManager.setLoaded(!0,this.scope),this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new s.f("data",{dataType:"style"}))})}_validateLayer(r){const a=this.getOwnSource(r.source);if(!a)return;const h=r.sourceLayer;h&&(a.type==="geojson"||a.vectorLayerIds&&a.vectorLayerIds.indexOf(h)===-1)&&this.fire(new s.d(new Error(`Source layer "${h}" does not exist on source "${a.id}" as specified by style layer "${r.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const r in this._sourceCaches)if(!this._sourceCaches[r].loaded())return!1;if(!this.imageManager.isLoaded()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:r}of this.fragments)if(!r.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((r,a)=>{const h=this.fragments[a];return h&&h.style&&(r.data=h.style.serialize()),r})}_serializeSources(){const r={};for(const a in this._sourceCaches){const h=this._sourceCaches[a].getSource();r[h.id]||(r[h.id]=h.serialize())}return r}_serializeLayers(r){const a=[];for(const h of r){const f=this._layers[h];f&&f.type!=="custom"&&a.push(f.serialize())}return a}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition())return!0;for(const r in this._sourceCaches)if(this._sourceCaches[r].hasTransition())return!0;for(const r in this._layers)if(this._layers[r].hasTransition())return!0;return!1}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}isLayerDraped(r){return!!this.terrain&&r.isDraped(this.getLayerSourceCache(r))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(r){const a=this.getOwnLayer(r);if(a)return a;this.fire(new s.d(new Error(`The layer '${r}' does not exist in the map's style.`)))}_checkSource(r){const a=this.getOwnSource(r);if(a)return a;this.fire(new s.d(new Error(`The source '${r}' does not exist in the map's style.`)))}update(r){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(r),this.directionalLight&&this.directionalLight.recalculate(r);const a=this.calculateLightsBrightness();r.brightness=a||0,a!==this._brightness&&(this._brightness=a,this.dispatcher.broadcast("setBrightness",a));const h=this._changes.isDirty();let f=!1;if(this._changes.isDirty()){const g=this._changes.getLayerUpdatesByScope();for(const x in g){const{updatedIds:w,removedIds:T}=g[x];(w||T)&&(this._updateWorkerLayers(x,w,T),f=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(r),this.light&&this.light.updateTransitions(r),this.ambientLight&&this.ambientLight.updateTransitions(r),this.directionalLight&&this.directionalLight.updateTransitions(r),this.fog&&this.fog.updateTransitions(r),this._changes.reset()}const m={};for(const g in this._mergedSourceCaches){const x=this._mergedSourceCaches[g];m[g]=x.used,x.used=!1,x.tileCoverLift=0}for(const g of this._mergedOrder){const x=this._mergedLayers[g];if(x.recalculate(r,this._availableImages),!x.isHidden(r.zoom)){const w=this.getLayerSourceCache(x);w&&(w.used=!0,w.tileCoverLift=Math.max(w.tileCoverLift,x.tileCoverLift()))}if(!this._precompileDone&&this._shouldPrecompile)for(let w=x.minzoom||0;w<(x.maxzoom||25.5);w++){const T=this.map.painter;if(T){const M=x.getProgramIds();if(!M)continue;for(const A of M){const P=x.getDefaultProgramParams(A,r.zoom,this._styleColorTheme.lut);P&&(T.style=this,this.fog&&(T._fogVisible=!0,P.overrideFog=!0,T.getOrCreateProgram(A,P)),T._fogVisible=!1,P.overrideFog=!1,T.getOrCreateProgram(A,P),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(P.overrideRtt=!0,T.getOrCreateProgram(A,P)))}}}}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&f&&this.mergeLayers();for(const g in m){const x=this._mergedSourceCaches[g];m[g]!==x.used&&x.getSource().fire(new s.f("data",{sourceDataType:"visibility",dataType:"source",sourceId:x.getSource().id}))}this.light&&this.light.recalculate(r),this.terrain&&this.terrain.recalculate(r),this.fog&&this.fog.recalculate(r),this.z=r.zoom,this._markersNeedU
2223pdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),h&&this.fire(new s.f("data",{dataType:"style"}))}_updateTilesForChangedImages(){const r=this._changes.getUpdatedImages();if(r.length){for(const a in this._sourceCaches)this._sourceCaches[a].reloadTilesForDependencies(["icons","patterns"],r);this._changes.resetUpdatedImages()}}_updateWorkerLayers(r,a,h){const f=this.getFragmentStyle(r);f&&this.dispatcher.broadcast("updateLayers",{layers:a?f._serializeLayers(a):[],scope:r,removedIds:h||[],options:f.options})}setState(r,a){if(this._checkLoaded(),Rn(this,J(r)))return!1;(r=s.cT(r)).layers=$h(r.layers);const h=function(g,x){if(!g)return[{command:zt.setStyle,args:[x]}];let w=[];try{if(!xt(g.version,x.version))return[{command:zt.setStyle,args:[x]}];if(xt(g.center,x.center)||w.push({command:zt.setCenter,args:[x.center]}),xt(g.zoom,x.zoom)||w.push({command:zt.setZoom,args:[x.zoom]}),xt(g.bearing,x.bearing)||w.push({command:zt.setBearing,args:[x.bearing]}),xt(g.pitch,x.pitch)||w.push({command:zt.setPitch,args:[x.pitch]}),xt(g.sprite,x.sprite)||w.push({command:zt.setSprite,args:[x.sprite]}),xt(g.glyphs,x.glyphs)||w.push({command:zt.setGlyphs,args:[x.glyphs]}),xt(g.imports,x.imports)||function(z=[],R=[],k){R=R||[];const O=(z=z||[]).map(Dl),B=R.map(Dl),G=z.reduce(ba,{}),q=R.reduce(ba,{}),Z=O.slice();let K,Y,te,N;for(K=0,Y=0;K<O.length;K++)te=O[K],q.hasOwnProperty(te)?Y++:(k.push({command:zt.removeImport,args:[te]}),Z.splice(Z.indexOf(te,Y),1));for(K=0,Y=0;K<B.length;K++)te=B[B.length-1-K],Z[Z.length-1-K]!==te&&(G.hasOwnProperty(te)?(k.push({command:zt.removeImport,args:[te]}),Z.splice(Z.lastIndexOf(te,Z.length-Y),1)):Y++,N=Z[Z.length-K],k.push({command:zt.addImport,args:[q[te],N]}),Z.splice(Z.length-K,0,te));for(const $ of R){const re=G[$.id];re&&!xt(re,$)&&k.push({command:zt.updateImport,args:[$.id,$]})}}(g.imports,x.imports,w),xt(g.transition,x.transition)||w.push({command:zt.setTransition,args:[x.transition]}),xt(g.light,x.light)||w.push({command:zt.setLight,args:[x.light]}),xt(g.fog,x.fog)||w.push({command:zt.setFog,args:[x.fog]}),xt(g.projection,x.projection)||w.push({command:zt.setProjection,args:[x.projection]}),xt(g.lights,x.lights)||w.push({command:zt.setLights,args:[x.lights]}),xt(g.camera,x.camera)||w.push({command:zt.setCamera,args:[x.camera]}),!xt(g["color-theme"],x["color-theme"]))return[{command:zt.setStyle,args:[x]}];const T={},M=[];(function(z,R,k,O){let B;for(B in R=R||{},z=z||{})z.hasOwnProperty(B)&&(R.hasOwnProperty(B)||va(B,k,O));for(B in R){if(!R.hasOwnProperty(B))continue;const G=R[B];z.hasOwnProperty(B)?xt(z[B],G)||(z[B].type==="geojson"&&G.type==="geojson"&&jp(z,R,B)?k.push({command:zt.setGeoJSONSourceData,args:[B,G.data]}):Ln(B,R,k,O)):cu(B,R,k)}})(g.sources,x.sources,M,T);const A=[];g.layers&&g.layers.forEach(z=>{z.source&&T[z.source]?w.push({command:zt.removeLayer,args:[z.id]}):A.push(z)});let P=g.terrain;P&&T[P.source]&&(w.push({command:zt.setTerrain,args:[void 0]}),P=void 0),w=w.concat(M),xt(P,x.terrain)||w.push({command:zt.setTerrain,args:[x.terrain]}),function(z,R,k){R=R||[];const O=(z=z||[]).map(Dl),B=R.map(Dl),G=z.reduce(ba,{}),q=R.reduce(ba,{}),Z=O.slice(),K=Object.create(null);let Y,te,N,$,re,de,se;for(Y=0,te=0;Y<O.length;Y++)N=O[Y],q.hasOwnProperty(N)?te++:(k.push({command:zt.removeLayer,args:[N]}),Z.splice(Z.indexOf(N,te),1));for(Y=0,te=0;Y<B.length;Y++)N=B[B.length-1-Y],Z[Z.length-1-Y]!==N&&(G.hasOwnProperty(N)?(k.push({command:zt.removeLayer,args:[N]}),Z.splice(Z.lastIndexOf(N,Z.length-te),1)):te++,de=Z[Z.length-Y],k.push({command:zt.addLayer,args:[q[N],de]}),Z.splice(Z.length-Y,0,N),K[N]=!0);for(Y=0;Y<B.length;Y++)if(N=B[Y],$=G[N],re=q[N],!K[N]&&!xt($,re))if(xt($.source,re.source)&&xt($["source-layer"],re["source-layer"])&&xt($.type,re.type)){for(se in zl($.layout,re.layout,k,N,null,zt.setLayoutProperty),zl($.paint,re.paint,k,N,null,zt.setPaintProperty),xt($.slot,re.slot)||k.push({command:zt.setSlot,args:[N,re.slot]}),xt($.filter,re.filter)||k.push({command:zt.setFilter,args:[N,re.filter]}),xt($.minzoom,re.minzoom)&&xt($.maxzoom,re.maxzoom)||k.push({command:zt.setLayerZoomRange,args:[N,re.minzoom,re.maxzoom]}),$)$.hasOwnProperty(se)&&se!=="layout"&&se!=="paint"&&se!=="filter"&&se!=="metadata"&&se!=="minzoom"&&se!=="maxzoom"&&se!=="slot"&&(se.indexOf("paint.")===0?zl
2223($[se],re[se],k,N,se.slice(6),zt.setPaintProperty):xt($[se],re[se])||k.push({command:zt.setLayerProperty,args:[N,se,re[se]]}));for(se in re)re.hasOwnProperty(se)&&!$.hasOwnProperty(se)&&se!=="layout"&&se!=="paint"&&se!=="filter"&&se!=="metadata"&&se!=="minzoom"&&se!=="maxzoom"&&se!=="slot"&&(se.indexOf("paint.")===0?zl($[se],re[se],k,N,se.slice(6),zt.setPaintProperty):xt($[se],re[se])||k.push({command:zt.setLayerProperty,args:[N,se,re[se]]}))}else k.push({command:zt.removeLayer,args:[N]}),de=Z[Z.lastIndexOf(N)+1],k.push({command:zt.addLayer,args:[re,de]})}(A,x.layers,w)}catch(T){console.warn("Unable to compute style diff:",T),w=[{command:zt.setStyle,args:[x]}]}return w}(this.serialize(),r).filter(g=>!(g.command in _u));if(h.length===0)return!1;const f=h.filter(g=>!(g.command in Qh));if(f.length>0)throw new Error(`Unimplemented: ${f.map(g=>g.command).join(", ")}.`);const m=[];return h.forEach(g=>{m.push(this[g.command].apply(this,g.args))}),a&&Promise.all(m).then(a),this.stylesheet=r,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}addImage(r,a){return this.getImage(r)?this.fire(new s.d(new Error("An image with this name already exists."))):(this.imageManager.addImage(r,this.scope,a),this._afterImageUpdated(r),this)}updateImage(r,a){this.imageManager.updateImage(r,this.scope,a)}getImage(r){return this.imageManager.getImage(r,this.scope)}removeImage(r){return this.getImage(r)?(this.imageManager.removeImage(r,this.scope),this._afterImageUpdated(r),this):this.fire(new s.d(new Error("No image with this name exists.")))}_afterImageUpdated(r){this._availableImages=this.imageManager.listImages(this.scope),this._changes.updateImage(r),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages}),this.fire(new s.f("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this._availableImages.slice()}addModel(r,a,h={}){return this._checkLoaded(),this._validate(wt,`models.${r}`,a,null,h)||(this.modelManager.addModel(r,a,this.scope),this._changes.setDirty()),this}hasModel(r){return this.modelManager.hasModel(r,this.scope)}removeModel(r){return this.hasModel(r)?(this.modelManager.removeModel(r,this.scope),this):this.fire(new s.d(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.scope)}addSource(r,a,h={}){if(this._checkLoaded(),this.getOwnSource(r)!==void 0)throw new Error(`There is already a source with ID "${r}".`);if(!a.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(a).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(a.type)>=0&&this._validate(ee,`sources.${r}`,a,null,h))return;this.map&&this.map._collectResourceTiming&&(a.collectResourceTiming=!0);const f=Oi(r,a,this.dispatcher,this);f.scope=this.scope,f.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(f.id),source:f.serialize(),sourceId:f.id}));const m=g=>{const x=(g?"symbol:":"other:")+f.id,w=s.al(x,this.scope),T=this._sourceCaches[x]=new s.bv(w,f,g);(g?this._symbolSourceCaches:this._otherSourceCaches)[f.id]=T,T.onAdd(this.map)};m(!1),a.type!=="vector"&&a.type!=="geojson"||m(!0),f.onAdd&&f.onAdd(this.map),h.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(r){this._checkLoaded();const a=this.getOwnSource(r);if(!a)throw new Error("There is no source with this ID");for(const f in this._layers)if(this._layers[f].source===r)return this.fire(new s.d(new Error(`Source "${r}" cannot be removed while layer "${f}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===r)return this.fire(new s.d(new Error(`Source "${r}" cannot be removed while terrain is using it.`)));const h=this.getOwnSourceCaches(r);for(const f of h){const m=s.cU(f.id);delete this._sourceCaches[m],this._changes.discardSourceCacheUpdate(f.id),f.fire(new s.f("data",{sourceDataType:"metadata",dataType:"source",sourceId:f.getSource().id})),f.setEventedParent(null),f.clearTiles()}return delete this._otherSourceCaches[r],delete this._symbolSourceCaches[r],this.mergeSources(),a.setEventedParent(null),a.onRemove&&a.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(r,a){this._checkLoaded(),this.getOwnSource(r).setData(a),this._changes.setDirty()}getOwnSource(r){const a=this.getOwnSourceCache(r);return a&&a.getSource()}getOwnSources(){const r=[];for(const a in this._otherSourceCaches){const h=this.getOwnSourceCache(a);h&&r.push(h.getSource())}return r}areTilesLoaded(){const r=this._mergedSourceCaches;for(const a in r){const h=r[a]._tiles;for(const f in h){const m=h[f];if(m.state!=="loaded"&&m.state!=="errored")return!1}}return!0}setLights(r){if(this._checkLoaded(),!r)return delete this.ambientLight,void delete this.directionalLight;const a=this._getTransitionParameters();
2223for(const f of r){if(this._validate(me,"lights",f))return;switch(f.type){case"ambient":if(this.ambientLight){const m=this.ambientLight;m.set(f),m.updateTransitions(a)}else this.ambientLight=new Xs(f,vt,this.scope,this.options);break;case"directional":if(this.directionalLight){const m=this.directionalLight;m.set(f),m.updateTransitions(a)}else this.directionalLight=new Xs(f,wc,this.scope,this.options)}}const h=new s.X(this.z||0,a);this.ambientLight&&this.ambientLight.recalculate(h),this.directionalLight&&this.directionalLight.recalculate(h),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const r=this.directionalLight,a=this.ambientLight;if(!r||!a)return;const h=A=>.2126*(A[0]<=.03928?A[0]/12.92:Math.pow((A[0]+.055)/1.055,2.4))+.7152*(A[1]<=.03928?A[1]/12.92:Math.pow((A[1]+.055)/1.055,2.4))+.0722*(A[2]<=.03928?A[2]/12.92:Math.pow((A[2]+.055)/1.055,2.4)),f=r.properties.get("color").toRenderColor(null).toArray01(),m=r.properties.get("intensity"),g=r.properties.get("direction"),x=1-s.ac(g.x,g.y,g.z)[2]/90,w=h(f)*m*x,T=a.properties.get("color").toRenderColor(null).toArray01(),M=a.properties.get("intensity");return(w+h(T)*M)/2}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const r=[];return this.directionalLight&&r.push(this.directionalLight.get()),this.ambientLight&&r.push(this.ambientLight.get()),r}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(r){if(!r)return this;if(s.cV(r)){const a=s.cW(r),h=this.fragments.find(({id:m})=>m===a);if(!h)throw new Error(`Style import not found: ${r}`);const f=s.cU(r);return h.style.getFragmentStyle(f)}{const a=this.fragments.find(({id:h})=>h===r);if(!a)throw new Error(`Style import not found: ${r}`);return a.style}}getConfigProperty(r,a){const h=this.getFragmentStyle(r);if(!h)return null;const f=s.al(a,h.scope),m=h.options.get(f),g=m?m.value||m.default:null;return g?g.serialize():null}setConfigProperty(r,a,h){const f=this.getFragmentStyle(r);if(!f)return;const m=f.stylesheet.schema;if(!m||!m[a])return;const g=s.y(h);if(g.result!=="success")return void Rn(this,g.value);const x=g.value.expression,w=s.al(a,f.scope),T=f.options.get(w);if(!T)return;let M;const{minValue:A,maxValue:P,stepValue:z,type:R,values:k}=m[a],O=s.y(m[a].default);O.result==="success"&&(M=O.value.expression),M?(this.options.set(w,{...T,value:x,default:M,minValue:A,maxValue:P,stepValue:z,type:R,values:k}),this.updateConfigDependencies()):this.fire(new s.d(new Error(`No schema defined for the config option "${a}" in the "${r}" fragment.`)))}getConfig(r){const a=this.getFragmentStyle(r);if(!a)return null;const h=a.stylesheet.schema;if(!h)return null;const f={};for(const m in h){const g=s.al(m,a.scope),x=a.options.get(g),w=x?x.value||x.default:null;f[m]=w?w.serialize():null}return f}setConfig(r,a){const h=this.getFragmentStyle(r);h&&(h.updateConfig(a,h.stylesheet.schema),this.updateConfigDependencies())}getSchema(r){const a=this.getFragmentStyle(r);return a?a.stylesheet.schema:null}setSchema(r,a){const h=this.getFragmentStyle(r);h&&(h.stylesheet.schema=a,h.updateConfig(h._config,a),this.updateConfigDependencies())}updateConfig(r,a){if(this._config=r,r||a)if(a)for(const h in a){let f,m;const g=s.y(a[h].default);if(g.result==="success"&&(f=g.value.expression),r&&r[h]!==void 0){const P=s.y(r[h]);P.result==="success"&&(m=P.value.expression)}const{minValue:x,maxValue:w,stepValue:T,type:M,values:A}=a[h];if(f){const P=s.al(h,this.scope);this.options.set(P,{default:f,value:m,minValue:x,maxValue:w,stepValue:T,type:M,values:A})}else this.fire(new s.d(new Error(`No schema defined for config option "${h}".`)))}else this.fire(new s.d(new Error("Attempting to set config for a style without schema.")))}updateConfigDependencies(){for(const r of this._configDependentLayers){const a=this.getLayer(r);a&&(a.possiblyEvaluateVisibility(),this._updateLayer(a))}this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.forEachFragmentStyle(r=>{if(r._styleColorTheme.colorTheme){const a=r._evaluateColorThemeData(r._styleColorTheme.colorTheme);(!r._styleColorTheme.lut||r._styleColorTheme.lut&&a!==r._styleColorTheme.lut.data)&&r.setColorTheme(r._styleColorTheme.colorTheme)}}),this._changes.setDirty()}addLayer(r,a,h={}){this._checkLoaded();const f=r.id;if(this._layers[f])return void this.fire(new s.d(new Error(`Layer with i
2223d "${f}" already exists on this map`)));let m;if(r.type==="custom"){if(Rn(this,s.cX(r)))return;m=s.cY(r,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof r.source=="object"&&(this.addSource(f,r.source),r=s.cT(r),r=s.W(r,{source:f})),this._validate(Fe,`layers.${f}`,r,{arrayIndex:-1},h))return;m=s.cY(r,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(m),m.setEventedParent(this,{layer:{id:f}}),this._serializedLayers[m.id]=m.serialize()}m.isConfigDependent&&this._configDependentLayers.add(m.fqid);let g=this._order.length;if(a){const M=this._order.indexOf(a);if(M===-1)return void this.fire(new s.d(new Error(`Layer with id "${a}" does not exist on this map.`)));m.slot===this._layers[a].slot?g=M:s.w(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(g,0,f),this._layerOrderChanged=!0,this._layers[f]=m;const x=this.getOwnLayerSourceCache(m),w=!!this.directionalLight&&this.directionalLight.shadowsEnabled();x&&m.canCastShadows()&&w&&(x.castsShadows=!0);const T=this._changes.getRemovedLayer(m);if(T&&m.source&&x&&m.type!=="custom"){this._changes.discardLayerRemoval(m);const M=s.al(m.source,m.scope);T.type!==m.type?this._changes.updateSourceCache(M,"clear"):(this._changes.updateSourceCache(M,"reload"),x.pause())}this._updateLayer(m),m.onAdd&&m.onAdd(this.map),m.scope=this.scope,this.mergeLayers()}moveLayer(r,a){this._checkLoaded();const h=this._checkLayer(r);if(!h||r===a)return;const f=this._order.indexOf(r);this._order.splice(f,1);let m=this._order.length;if(a){const g=this._order.indexOf(a);
2223if(g===-1)return void this.fire(new s.d(new Error(`Layer with id "${a}" does not exist on this map.`)));h.slot===this._layers[a].slot?m=g:s.w(`Layer with id "${a}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(m,0,r),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(r){this._checkLoaded();const a=this._checkLayer(r);if(!a)return;a.setEventedParent(null);const h=this._order.indexOf(r);this._order.splice(h,1),delete this._layers[r],delete this._serializedLayers[r],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(a.fqid),this._changes.removeLayer(a);const f=this.getOwnLayerSourceCache(a);if(f&&f.castsShadows){let m=!1;for(const g in this._layers)if(this._layers[g].source===a.source&&this._layers[g].canCastShadows()){m=!0;break}f.castsShadows=m}a.onRemove&&a.onRemove(this.map),this.mergeLayers()}getOwnLayer(r){return this._layers[r]}hasLayer(r){return r in this._mergedLayers}hasLayerType(r){for(const a in this._layers)if(this._layers[a].type===r)return!0;return!1}setLayerZoomRange(r,a,h){this._checkLoaded();const f=this._checkLayer(r);f&&(f.minzoom===a&&f.maxzoom===h||(a!=null&&(f.minzoom=a),h!=null&&(f.maxzoom=h),this._updateLayer(f)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(r,a){this._checkLoaded();const h=this._checkLayer(r);h&&h.slot!==a&&(h.slot=a,this._updateLayer(h))}setFilter(r,a,h={}){this._checkLoaded();const f=this._checkLayer(r);if(f&&!xt(f.filter,a))return a==null?(f.filter=void 0,void this._updateLayer(f)):void(this._validate(Le,`layers.${f.id}.filter`,a,{layerType:f.type},h)||(f.filter=s.cT(a),this._updateLayer(f)))}getFilter(r){const a=this._checkLayer(r);if(a)return s.cT(a.filter)}setLayoutProperty(r,a,h,f={}){this._checkLoaded();const m=this._checkLayer(r);if(m&&!xt(m.getLayoutProperty(a),h)){if(h!=null&&(!f||f.validate!==!1)&&Rn(m,nt.call(J,{key:`layers.${r}.layout.${a}`,layerType:m.type,objectKey:a,value:h,styleSpec:s.L,style:{glyphs:!0,sprite:!0}})))return;m.setLayoutProperty(a,h),m.isConfigDependent&&this._configDependentLayers.add(m.fqid),this._updateLayer(m)}}getLayoutProperty(r,a){const h=this._checkLayer(r);if(h)return h.getLayoutProperty(a)}setPaintProperty(r,a,h,f={}){this._checkLoaded();const m=this._checkLayer(r);if(!m||xt(m.getPaintProperty(a),h)||h!=null&&(!f||f.validate!==!1)&&Rn(m,Ke.call(J,{key:`layers.${r}.paint.${a}`,layerType:m.type,objectKey:a,value:h,styleSpec:s.L})))return;const g=m.setPaintProperty(a,h);m.isConfigDependent&&this._configDependentLayers.add(m.fqid),g&&this._updateLayer(m),this._changes.updatePaintProperties(m)}getPaintProperty(r,a){const h=this._checkLayer(r);if(h)return h.getPaintProperty(a)}setFeatureState(r,a){this._checkLoaded();const h=r.source,f=r.sourceLayer,m=this._checkSource(h);if(!m)return;const g=m.type;if(g==="geojson"&&f)return void this.fire(new s.d(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(g==="vector"&&!f)return void this.fire(new s.d(new Error("The sourceLayer parameter must be provided for vector source types.")));r.id===void 0&&this.fire(new s.d(new Error("The feature id parameter must be provided.")));const x=this.getOwnSourceCaches(h);for(const w of x)w.setFeatureState(f,r.id,a)}removeFeatureState(r,a){this._checkLoaded();const h=r.source,f=this._checkSource(h);if(!f)return;const m=f.type,g=m==="vector"?r.sourceLayer:void 0;if(m==="vector"&&!g)return void this.fire(new s.d(new Error("The sourceLayer parameter must be provided for vector source types.")));if(a&&typeof r.id!="string"&&typeof r.id!="number")return void this.fire(new s.d(new Error("A feature id is required to remove its specific state property.")));const x=this.getOwnSourceCaches(h);for(const w of x)w.removeFeatureState(g,r.id,a)}getFeatureState(r){this._checkLoaded();const a=r.source,h=r.sourceLayer,f=this._checkSource(a);if(f){if(f.type!=="vector"||h)return r.id===void 0&&this.fire(new s.d(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(a)[0].getFeatureState(h,r.id);this.fire(new s.d(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(r){return this.stylesheet.transition=s.W({},this.stylesheet.transition,r),this.transition=this.stylesheet.transition,this}getTransition(){return s.W({},this.stylesheet.transition)}serialize(){this._checkLoaded();const r=this.getTerrain(),a=r&&this.terrain&&this.terrain.scope===this.scope?r:this.stylesheet.terrain;return s.cZ({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:a,fog:this.stylesheet.fog,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)},h=>h!==void 0)}_updateLayer(r){this._changes.updateLayer(r);const a=this.getLayerSourceCache(r),h=s.al(r.source,r.scope),f=this._changes.getUpd
2223atedSourceCaches();r.source&&!f[h]&&a&&a.getSource().type!=="raster"&&(this._changes.updateSourceCache(h,"reload"),a.pause()),r.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(r){const a=x=>this._mergedLayers[x].type==="fill-extrusion"||this._mergedLayers[x].type==="model",h=this.order,f={},m=[];for(let x=h.length-1;x>=0;x--){const w=h[x];if(a(w)){f[w]=x;for(const T of r){const M=T[w];if(M)for(const A of M)m.push(A)}}}m.sort((x,w)=>w.intersectionZ-x.intersectionZ);const g=[];for(let x=h.length-1;x>=0;x--){const w=h[x];if(a(w))for(let T=m.length-1;T>=0;T--){const M=m[T].feature;if(M.layer&&f[M.layer.id]<x)break;g.push(M),m.pop()}else for(const T of r){const M=T[w];if(M)for(const A of M)g.push(A.feature)}}return g}queryRenderedFeatures(r,a,h){a&&a.filter&&this._validate(Le,"queryRenderedFeatures.filter",a.filter,null,a),a.scope=this.scope,a.availableImages=this._availableImages,a.serializedLayers=this._serializedLayers;const f={};if(a&&a.layers){if(!Array.isArray(a.layers))return this.fire(new s.d(new Error("parameters.layers must be an Array."))),[];for(const T of a.layers){const M=this._mergedLayers[T];if(!M)return this.fire(new s.d(new Error(`The layer '${T}' does not exist in the map's style and cannot be queried for features.`))),[];f[M.source]=!0}}const m=[],g=a.serializedLayers||{},x=a&&a.layers?a.layers.some(T=>{const M=this.getLayer(T);return M&&M.is3D()}):this.has3DLayers(),w=Pl.createFromScreenPoints(r,h);for(const T in this._mergedSourceCaches){const M=this._mergedSourceCaches[T].getSource();if(!M||M.scope!==a.scope)continue;const A=this._mergedSourceCaches[T].getSource().id;a.layers&&!f[A]||m.push(ga(this._mergedSourceCaches[T],this._mergedLayers,g,w,a,h,x,!!this.map._showQueryGeometry))}return this.placement&&m.push(function(T,M,A,P,z,R,k){const O={},B=R.queryRenderedSymbols(P),G=[];for(const q of Object.keys(B).map(Number))G.push(k[q]);G.sort(Zh);for(const q of G){const Z=q.featureIndex.lookupSymbolFeatures(B[q.bucketInstanceId],M,q.bucketIndex,q.sourceLayerIndex,z.filter,z.layers,z.availableImages,T);for(const K in Z){const Y=O[K]=O[K]||[],te=Z[K];te.sort((N,$)=>{const re=q.featureSortOrder;if(re){const de=re.indexOf(N.featureIndex);return re.indexOf($.featureIndex)-de}return $.featureIndex-N.featureIndex});for(const N of te)Y.push(N)}}for(const q in O)O[q].forEach(Z=>{const K=Z.feature,Y=A(T[q]);if(!Y)return;const te=Y.getFeatureState(K.layer["source-layer"],K.id);K.source=K.layer.source,K.layer["source-layer"]&&(K.sourceLayer=K.layer["source-layer"]),K.state=te});return O}(this._mergedLayers,g,this.getLayerSourceCache.bind(this),w.screenGeometry,a,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(m)}querySourceFeatures(r,a){a&&a.filter&&this._validate(Le,"querySourceFeatures.filter",a.filter,null,a);const h=this.getOwnSourceCaches(r);let f=[];for(const m of h)f=f.concat(Up(m,a));return f}addSourceType(r,a,h){return Or.getSourceType(r)?h(new Error(`A source type called "${r}" already exists.`)):(Or.setSourceType(r,a),a.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:r,url:a.workerSourceURL},h):h(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(r,a,h={}){this._checkLoaded();const f=this.light.getLight();let m=!1;for(const x in r)if(!xt(r[x],f[x])){m=!0;break}if(!m)return;const g=this._getTransitionParameters();this.light.setLight(r,a,h),this.light.updateTransitions(g)}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.e.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(r,a=1){if(this._checkLoaded(),!r)return this.terrainSetForDrapingOnly()&&a!==0||delete this.terrain,r===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedU
2223pdate=!0);this.checkCanvasFingerprintNoise();let h=r;const f=r.source==null;if(a===1){if(this.disableElevatedTerrain)return;if(typeof h.source=="object"){const x="terrain-dem-src";this.addSource(x,h.source),h=s.cT(h),h=s.W(h,{source:x})}const m=s.W({},h),g={};if(this.terrain&&f){m.source=this.terrain.get().source;const x=this.terrain?this.getFragmentStyle(this.terrain.scope):null;x&&(g.style=x.serialize())}if(this._validate(ae,"terrain",m,g))return}if(!this.terrain||this.terrain.scope!==this.scope&&!f||this.terrain&&a!==this.terrain.drapeRenderMode){if(!h)return;this._createTerrain(h,a),this.fire(new s.f("data",{dataType:"style"}))}else{const m=this.terrain,g=m.get();for(const x of Object.keys(s.L.terrain))!h.hasOwnProperty(x)&&s.L.terrain[x].default&&(h[x]=s.L.terrain[x].default);for(const x in r)if(!xt(r[x],g[x])){m.set(r,this.options),this.stylesheet.terrain=r;const w=this._getTransitionParameters({duration:0});m.updateTransitions(w),this.fire(new s.f("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(r){const a=this.fog=new wh(r,this.map.transform,this.scope,this.options);this.stylesheet.fog=a.get();const h=this._getTransitionParameters({duration:0});a.updateTransitions(h)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const r of this.map._markers)r._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(r){if(this._checkLoaded(),!r)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const a=this.fog;if(!xt(a.get(),r)){a.set(r,this.options),this.stylesheet.fog=a.get();const h=this._getTransitionParameters({duration:0});a.updateTransitions(h)}}else this._createFog(r);this._markersNeedUpdate=!0}setColorTheme(r){this._checkLoaded();const a=()=>{for(const f in this._layers)this._layers[f].lut=this._styleColorTheme.lut;for(const f in this._sourceCaches)this._sourceCaches[f].clearTiles()};if(this._styleColorTheme.colorTheme=r,!r)return this._styleColorTheme.lut=null,void a();const h=this._evaluateColorThemeData(r);this._loadColorTheme(h).then(()=>{this.fire(new s.f("colorthemeset")),a()}).catch(f=>{s.w(`Couldn't set color theme: ${f}`)})}_getTransitionParameters(r){return{now:s.e.now(),transition:s.W(this.transition,r)}}updateDrapeFirstLayers(){if(!this.terrain)return;const r=[],a=[];for(const h in this._mergedLayers)this.isLayerDraped(this._mergedLayers[h])?r.push(h):a.push(h);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...r),this._drapedFirstOrder.push(...a)}_createTerrain(r,a){const h=this.terrain=new Wt(r,a,this.scope,this.options);a===1&&(this.stylesheet.terrain=r),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const f=this._getTransitionParameters({duration:0});h.updateTransitions(f)}_force3DLayerUpdate(){for(const r in this._layers){const a=this._layers[r];a.type==="fill-extrusion"&&this._updateLayer(a)}}_forceSymbolLayerUpdate(){for(const r in this._layers){const a=this._layers[r];a.type==="symbol"&&this._updateLayer(a)}}_validate(r,a,h,f,m={}){if(m&&m.validate===!1)return!1;const g=s.W({},this.serialize());return Rn(this,r.call(J,s.W({key:a,style:g,value:h,styleSpec:s.L},f)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),s.c_.off("pluginStateChange",this._rtlTextPluginCallback);for(const r in this._mergedLayers)this._mergedLayers[r].setEventedParent(null);for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].clearTiles(),this._mergedSourceCaches[r].setEventedParent(null);this.setEventedParent(null),delete this.fog,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.modelManager.setEventedParent(null),this.dispatcher.remove())}clearSource(r){const a=this.getSourceCaches(r);for(const h of a)h.clearTiles()}clearSources(){for(const r in this._mergedSourceCaches)this._mergedSourceCaches[r].clearTiles()}reloadSource(r){const a=this.getSourceCaches(r);for(const h of a)h.resume(),h.reload()}
2223reloadSources(){for(const r of this.getSources())r.reload&&r.reload()}updateSources(r){let a;this.directionalLight&&(a=pl(this.directionalLight));for(const h in this._mergedSourceCaches)this._mergedSourceCaches[h].update(r,void 0,void 0,a)}_generateCollisionBoxes(){for(const r in this._sourceCaches){const a=this._sourceCaches[r];a.resume(),a.reload()}}_updatePlacement(r,a,h,f,m,g,x=!1){let w=!1,T=!1;const M={},A={};for(const z of this._mergedOrder){const R=this._mergedLayers[z];if(R.type!=="symbol")continue;const k=s.al(R.source,R.scope);let O=M[k];if(!O){const G=this.getLayerSourceCache(R);if(!G)continue;const q=G.getRenderableIds(!0).map(Z=>G.getTileByID(Z));A[k]=q.slice(),O=M[k]=q.sort((Z,K)=>K.tileID.overscaledZ-Z.tileID.overscaledZ||(Z.tileID.isLessThan(K.tileID)?-1:1))}const B=this.crossTileSymbolIndex.addLayer(R,O,a.center.lng,a.projection);w=w||B}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),x=x||this._layerOrderChanged||f===0,this._layerOrderChanged&&this.fire(new s.f("neworder")),(x||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(s.e.now(),a.zoom))&&(this.pauseablePlacement=new uo(a,this._mergedOrder,x,h,f,m,this.placement,this.fog&&a.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,M,A),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(s.e.now()),T=!0),w&&this.pauseablePlacement.placement.setStale()),T||w){this._buildingIndex.onNewFrame(a.zoom);for(let z=0;z<this._mergedOrder.length;z++){const R=this._mergedLayers[this._mergedOrder[z]];if(R.type!=="symbol")continue;const k=this.isLayerClipped(R)&&this._clipLayerIndices.some(O=>z<O);this.placement.updateLayerOpacities(R,M[s.al(R.source,R.scope)],z,k?g:null)}}let P=!1;for(const z of this._mergedOrder){const R=this._mergedLayers[z];if(R.type!=="symbol")continue;const k=M[s.al(R.source,R.scope)];for(const O of k){const B=O.getBucket(R);B&&O.latestFeatureIndex&&R.fqid===B.layerIds[0]&&(P=B.updateOcclusionOpacities(r.context,r.symbolParams,r._dt)||P)}}return{needsRerender:!this.pauseablePlacement.isDone()||this.placement.hasTransitions(s.e.now())||P,occlusionQueryBasedOpacityChanged:P}}_releaseSymbolFadeTiles(){for(const r in this._sourceCaches)this._sourceCaches[r].releaseSymbolFadeTiles()}addImport(r,a){this._checkLoaded();const h=this.stylesheet.imports=this.stylesheet.imports||[];if(h.findIndex(({id:m})=>m===r.id)!==-1)return void this.fire(new s.d(new Error(`Import with id '${r.id}' already exists in the map's style.`)));if(!a)return h.push(r),this._loadImports([r],!0);const f=h.findIndex(({id:m})=>m===a);return f===-1&&this.fire(new s.d(new Error(`Import with id "${a}" does not exist on this map.`))),this.stylesheet.imports=h.slice(0,f).concat(r).concat(h.slice(f)),this._loadImports([r],!0,a)}updateImport(r,a){this._checkLoaded();const h=this.stylesheet.imports||[],f=this.getImportIndex(r);return f===-1?this:typeof a=="string"?(this.setImportUrl(r,a),this):(a.url&&a.url!==h[f].url&&this.setImportUrl(r,a.url),xt(a.config,h[f].config)||this.setImportConfig(r,a.config),xt(a.data,h[f].data)||this.setImportData(r,a.data),this)}moveImport(r,a){this._checkLoaded();let h=this.stylesheet.imports||[];const f=this.getImportIndex(r);if(f===-1)return this;const m=this.getImportIndex(a);if(m===-1)return this;const g=h[f],x=this.fragments[f];return h=h.filter(({id:w})=>w!==r),this.fragments=this.fragments.filter(({id:w})=>w!==r),this.stylesheet.imports=h.slice(0,m).concat(g).concat(h.slice(m)),this.fragments=this.fragments.slice(0,m).concat(x).concat(this.fragments.slice(m)),this.mergeLayers(),this}setImportUrl(r,a){this._checkLoaded();const h=this.stylesheet.imports||[],f=this.getImportIndex(r);if(f===-1)return this;h[f].url=a;const m=this.fragments[f];return m.style=this._createFragmentStyle(h[f]),m.style.on("style.import.load",()=>this.mergeAll()),m.style.loadURL(a),this}setImportData(r,a){this._checkLoaded();const h=this.getImportIndex(r),f=this.stylesheet.imports||[];return h===-1?this:a?(this.fragments[h].style.setState(a),this._reloadImports(),this):(delete f[h].data,this.setImportUrl(r,f[h].url))}setImportConfig(r,a){this._checkLoaded();const h=this.getImportIndex(r),f=this.stylesheet.imports||[];if(h===-1)return this;a?f[h].config=a:delete f[h].config;const m=this.fragments[h],g=m.style.stylesheet&&m.style.stylesheet.schema;return m.config=a,m.style.updateConfig(a,g),this.updateConfigDependencies(),this}removeImport(r){this._checkLoaded();const a=this.stylesheet.imports||[],h=this.getImportIndex(r);h!==-1&&(a.splice(h,1),this.fragments[h].style._remove(),this.fragments.splice(h,1),this._reloadImports())}getImportIndex(r){const a=(this.stylesheet.imports||[]).findIndex(h=>h.id===r);return a===-1&&this.fire(new s.d(new Error(`Import '${r}' does not exist in the map's style and cannot be updated.`))),a}
2223getLayer(r){return this._mergedLayers[r]}getSources(){const r=[];for(const a in this._mergedOtherSourceCaches){const h=this._mergedOtherSourceCaches[a];h&&r.push(h.getSource())}return r}getSource(r,a){const h=this.getSourceCache(r,a);return h&&h.getSource()}getLayerSource(r){const a=this.getLayerSourceCache(r);return a&&a.getSource()}getSourceCache(r,a){const h=s.al(r,a);return this._mergedOtherSourceCaches[h]}getLayerSourceCache(r){const a=s.al(r.source,r.scope);return r.type==="symbol"?this._mergedSymbolSourceCaches[a]:this._mergedOtherSourceCaches[a]}getSourceCaches(r){if(r==null)return Object.values(this._mergedSourceCaches);const a=[];return this._mergedOtherSourceCaches[r]&&a.push(this._mergedOtherSourceCaches[r]),this._mergedSymbolSourceCaches[r]&&a.push(this._mergedSymbolSourceCaches[r]),a}updateSourceCaches(){const r=this._changes.getUpdatedSourceCaches();for(const a in r){const h=r[a];h==="reload"?this.reloadSource(a):h==="clear"&&this.clearSource(a)}}updateLayers(r){const a=this._changes.getUpdatedPaintProperties();for(const h of a){const f=this.getLayer(h);f&&f.updateTransitions(r)}}getImages(r,a,h){this.imageManager.getImages(a.icons,a.scope,h),this._updateTilesForChangedImages();const f=m=>{m&&m.setDependencies(a.tileID.key,a.type,a.icons)};f(this._otherSourceCaches[a.source]),f(this._symbolSourceCaches[a.source])}getGlyphs(r,a,h){this.glyphManager.getGlyphs(a.stacks,a.scope,h)}getResource(r,a,h){return s.c$(a,h)}getOwnSourceCache(r){return this._otherSourceCaches[r]}getOwnLayerSourceCache(r){return r.type==="symbol"?this._symbolSourceCaches[r.source]:this._otherSourceCaches[r.source]}getOwnSourceCaches(r){const a=[];return this._otherSourceCaches[r]&&a.push(this._otherSourceCaches[r]),this._symbolSourceCaches[r]&&a.push(this._symbolSourceCaches[r]),a}_isSourceCacheLoaded(r){const a=this.getOwnSourceCaches(r);return a.length===0?(this.fire(new s.d(new Error(`There is no source with ID '${r}'`))),!1):a.every(h=>h.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(r,a){if(this._clipLayerIndices.length===0&&r.type!=="fill-extrusion")return!1;const h=r.type==="fill-extrusion"&&r.sourceLayer==="building";let f=0;if(r.is3D()){if(h||a&&a.type==="batched-model")return!0;r.type==="model"&&(f=s.cu.Model)}else r.type==="symbol"&&(f=s.cu.Symbol);for(const m of this._clipLayerIndices){const g=this._mergedLayers[this._mergedOrder[m]];if(!g)continue;const x=[];for(const w of g.layout.get("clip-layer-types"))x.push(w==="model"?s.cu.Model:w==="symbol"?s.cu.Symbol:s.cu.FillExtrusion);for(const w of x)if(f&w)return!0}return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(r=>{r.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}function id(u,r){let a=!1,h=null;const f=()=>{h=null,a&&(u(),h=setTimeout(f,r),a=!1)};return()=>(a=!0,h||f(),h)}Or.getSourceType=function(u){return _l[u]},Or.setSourceType=function(u,r){_l[u]=r},Or.registerForPluginStateChange=s.cL;class rd{constructor(r){this._hashName=r&&encodeURIComponent(r),s.bp(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=id(this._updateHashUnthrottled.bind(this),300)}addTo(r){return this._map=r,window.addEventListener("hashchange",this._onHashChange,!1),r.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 r=this._map;if(!r)return"";const a=nd(r);if(this._hashName){const h=this._hashName;let f=!1;const m=location.hash.slice(1).split("&").map(g=>{const x=g.split("=")[0];return x===h?(f=!0,`${x}=${a}`):g}).filter(g=>g);return f||m.push(`${h}=${a}`),`#${m.join("&")}`}return`#${a}`}_getCurrentHash(){const r=location.hash.replace("#","");if(this._hashName){let a;return r.split("&").map(h=>h.split("=")).forEach(h=>{h[0]===this._hashName&&(a=h)}),(a&&a[1]||"").split("/")}return r.split("/")}_onHashChange(){const r=this._map;if(!r)return!1;const a=this._getCurrentHash();if(a.length>=3&&!a.some(h=>isNaN(h))){const h=r.dragRotate.isEnabled()&&r.touchZoomRotate.isEnabled()?+(a[3]||0):r.getBearing();return r.jumpTo({center:[+a[2],+a[1]],zoom:+a[0],bearing:h,pitch:+(a[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}
2223function nd(u,r){const a=u.getCenter(),h=Math.round(100*u.getZoom())/100,f=Math.ceil((h*Math.LN2+Math.log(512/360/.5))/Math.LN10),m=Math.pow(10,f),g=Math.round(a.lng*m)/m,x=Math.round(a.lat*m)/m,w=u.getBearing(),T=u.getPitch();let M=r?`/${g}/${x}/${h}`:`${h}/${x}/${g}`;return(w||T)&&(M+="/"+Math.round(10*w)/10),T&&(M+=`/${Math.round(T)}`),M}const ho={linearity:.3,easing:s.d0(0,0,.3,1)},Wp=s.W({deceleration:2500,maxSpeed:1400},ho),od=s.W({deceleration:20,maxSpeed:1400},ho),gu=s.W({deceleration:1e3,maxSpeed:360},ho),kl=s.W({deceleration:1e3,maxSpeed:90},ho);class yu{constructor(r){this._map=r,this.clear()}clear(){this._inertiaBuffer=[]}record(r){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:s.e.now(),settings:r})}_drainInertiaBuffer(){const r=this._inertiaBuffer,a=s.e.now();for(;r.length>0&&a-r[0].time>160;)r.shift()}_onMoveEnd(r){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const a={zoom:0,bearing:0,pitch:0,pan:new s.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:m}of this._inertiaBuffer)a.zoom+=m.zoomDelta||0,a.bearing+=m.bearingDelta||0,a.pitch+=m.pitchDelta||0,m.panDelta&&a.pan._add(m.panDelta),m.around&&(a.around=m.around),m.pinchAround&&(a.pinchAround=m.pinchAround);const h=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,f={};if(a.pan.mag()){const m=as(a.pan.mag(),h,s.W({},Wp,r||{}));f.offset=a.pan.mult(m.amount/a.pan.mag()),f.center=this._map.transform.center,Qr(f,m)}if(a.zoom){const m=as(a.zoom,h,od);f.zoom=this._map.transform.zoom+m.amount,Qr(f,m)}if(a.bearing){const m=as(a.bearing,h,gu);
vendor: 21,351 bytes, line 2223
2223f.bearing=this._map.transform.bearing+s.at(m.amount,-179,179),Qr(f,m)}if(a.pitch){const m=as(a.pitch,h,kl);f.pitch=this._map.transform.pitch+m.amount,Qr(f,m)}if(f.zoom||f.bearing){const m=a.pinchAround===void 0?a.around:a.pinchAround;f.around=m?this._map.unproject(m):this._map.getCenter()}return this.clear(),f.noMoveStart=!0,f}}function Qr(u,r){(!u.duration||u.duration<r.duration)&&(u.duration=r.duration,u.easing=r.easing)}function as(u,r,a){const{maxSpeed:h,linearity:f,deceleration:m}=a,g=s.at(u*f/(r/1e3),-h,h),x=Math.abs(g)/(m*f);return{easing:a.easing,duration:1e3*x,amount:g*(x/2)}}class or extends s.f{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,a,h,f={}){const m=mi(a.getCanvasContainer(),h),g=a.unproject(m);super(r,s.W({point:m,lngLat:g,originalEvent:h},f)),this._defaultPrevented=!1,this.target=a}}class hn extends s.f{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,a,h){const f=r==="touchend"?h.changedTouches:h.touches,m=qr(a.getCanvasContainer(),f),g=m.map(w=>a.unproject(w)),x=m.reduce((w,T,M,A)=>w.add(T.div(A.length)),new s.P(0,0));super(r,{points:m,point:x,lngLats:g,lngLat:a.unproject(x),originalEvent:h}),this._defaultPrevented=!1}}class Ta extends s.f{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(r,a){super("wheel",{originalEvent:a}),this._defaultPrevented=!1}}class Ol{constructor(r,a){this._map=r,this._clickTolerance=a.clickTolerance}reset(){this._mousedownPos=void 0}wheel(r){return this._firePreventable(new Ta(this._map,r))}mousedown(r,a){return this._mousedownPos=a,this._firePreventable(new or(r.type,this._map,r))}mouseup(r){this._map.fire(new or(r.type,this._map,r))}preclick(r){const a=s.W({},r);a.type="preclick",this._map.fire(new or(a.type,this._map,a))}click(r,a){this._mousedownPos&&this._mousedownPos.dist(a)>=this._clickTolerance||(this.preclick(r),this._map.fire(new or(r.type,this._map,r)))}dblclick(r){return this._firePreventable(new or(r.type,this._map,r))}mouseover(r){this._map.fire(new or(r.type,this._map,r))}mouseout(r){this._map.fire(new or(r.type,this._map,r))}touchstart(r){return this._firePreventable(new hn(r.type,this._map,r))}touchmove(r){this._map.fire(new hn(r.type,this._map,r))}touchend(r){this._map.fire(new hn(r.type,this._map,r))}touchcancel(r){this._map.fire(new hn(r.type,this._map,r))}_firePreventable(r){if(this._map.fire(r),r.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class xu{constructor(r){this._map=r}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(r){this._map.fire(new or(r.type,this._map,r))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new or("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(r){this._delayContextMenu?this._contextMenuEvent=r:this._map.fire(new or(r.type,this._map,r)),this._map.listens("contextmenu")&&r.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ea{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._container=r.getContainer(),this._clickTolerance=a.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(r,a){this.isEnabled()&&r.shiftKey&&r.button===0&&($a(),this._startPos=this._lastPos=a,this._active=!0)}mousemoveWindow(r,a){if(!this._active)return;const h=a,f=this._startPos,m=this._lastPos;if(!f||!m||m.equals(h)||!this._box&&h.dist(f)<this._clickTolerance)return;this._lastPos=h,this._box||(this._box=Dt("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",r));const g=Math.min(f.x,h.x),x=Math.max(f.x,h.x),w=Math.min(f.y,h.y),T=Math.max(f.y,h.y);this._map._requestDomTask(()=>{this._box&&(this._box.style.transform=`translate(${g}px,${w}px)`,this._box.style.width=x-g+"px",this._box.style.height=T-w+"px")})}mouseupWindow(r,a){if(!this._active)return;const h=this._startPos,f=a;if(h&&r.button===0){if(this.reset(),xi(),h.x!==f.x||h.y!==f.y)return this._map.fire(new s.f("boxzoomend",{originalEvent:r})),{cameraAnimation:m=>m.fitScreenCoordinates(h,f,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",r)}}keydown(r){this._active&&r.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",r))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),Wa(),delete this._startPos,delete this._lastPos}_fireEvent(r,a){return this._map.fire(new s.f(r,{originalEvent:a}))}}function ls(u,r){const a={};for(let h=0;h<u.length;h++)a[u[h].identifier]=r[h];return a}class vu{constructor(r){this.reset(),this.numTouches=r.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(r,a,h){(this.centroid||h.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=r.timeStamp),h.length===this.numTouches&&(this.centroid=function(f){const m=new s.P(0,0);for(const g of f)m._add(g);return m.div(f.length)}(a),this.touches=ls(h,a)))}touchmove(r,a,h){if(this.aborted||!this.centroid)return;const f=ls(h,a);for(const m in this.touches){const g=f[m];(!g||g.dist(this.touches[m])>30)&&(this.aborted=!0)}}touchend(r,a,h){if((!this.centroid||r.timeStamp-this.startTime>500)&&(this.aborted=!0),h.length===0){const f=!this.aborted&&this.centroid;if(this.reset(),f)return f}}}class Bl{constructor(r){this.singleTap=new vu(r),this.numTaps=r.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(r,a,h){this.singleTap.touchstart(r,a,h)}touchmove(r,a,h){this.singleTap.touchmove(r,a,h)}touchend(r,a,h){const f=this.singleTap.touchend(r,a,h);if(f){const m=r.timeStamp-this.lastTime<500,g=!this.lastTap||this.lastTap.dist(f)<30;if(m&&g||this.reset(),this.count++,this.lastTime=r.timeStamp,this.lastTap=f,this.count===this.numTaps)return this.reset(),f}}}class bu{constructor(){this._zoomIn=new Bl({numTouches:1,numTaps:2}),this._zoomOut=new Bl({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(r,a,h){this._zoomIn.touchstart(r,a,h),this._zoomOut.touchstart(r,a,h)}touchmove(r,a,h){this._zoomIn.touchmove(r,a,h),this._zoomOut.touchmove(r,a,h)}touchend(r,a,h){const f=this._zoomIn.touchend(r,a,h),m=this._zoomOut.touchend(r,a,h);return f?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()+1,around:g.unproject(f)},{originalEvent:r})}):m?(this._active=!0,r.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:g=>g.easeTo({duration:300,zoom:g.getZoom()-1,around:g.unproject(m)},{originalEvent:r})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const Fl={0:1,2:2};class po{constructor(r){this.reset(),this._clickTolerance=r.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(r,a){return!1}_move(r,a){return{}}mousedown(r,a){if(this._lastPoint)return;const h=Bs(r);this._correctButton(r,h)&&(this._lastPoint=a,this._eventButton=h)}mousemoveWindow(r,a){const h=this._lastPoint;if(h){if(r.preventDefault(),this._eventButton!=null&&function(f,m){const g=Fl[m];return f.buttons===void 0||(f.buttons&g)!==g}(r,this._eventButton))this.reset();else if(this._moved||!(a.dist(h)<this._clickTolerance))return this._moved=!0,this._lastPoint=a,this._move(h,a)}}mouseupWindow(r){this._lastPoint&&Bs(r)===this._eventButton&&(this._moved&&xi(),this.reset())}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class sd extends po{mousedown(r,a){super.mousedown(r,a),this._lastPoint&&(this._active=!0)}_correctButton(r,a){return a===0&&!r.ctrlKey}_move(r,a){return{around:a,panDelta:a.sub(r)}}}class wu extends po{_correctButton(r,a){return a===0&&r.ctrlKey||a===2}_move(r,a){const h=.8*(a.x-r.x);if(h)return this._active=!0,{bearingDelta:h}}contextmenu(r){r.preventDefault()}}class Tu extends po{_correctButton(r,a){return a===0&&r.ctrlKey||a===2}_move(r,a){const h=-.5*(a.y-r.y);if(h)return this._active=!0,{pitchDelta:h}}contextmenu(r){r.preventDefault()}}class cs{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._minTouches=1,this._clickTolerance=a.clickTolerance||1,this.reset(),s.bp(["_addTouchPanBlocker","_showTouchPanBlockerAlert"],this)}reset(){this._active=!1,this._touches={},this._sum=new s.P(0,0)}touchstart(r,a,h){return this._calculateTransform(r,a,h)}touchmove(r,a,h){if(this._active&&!(h.length<this._minTouches)){if(this._map._cooperativeGestures&&!this._map.isMoving()){if(h.length===1&&!s.d1())return void this._showTouchPanBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}return r.cancelable&&r.preventDefault(),this._calculateTransform(r,a,h)}}touchend(r,a,h){this._calculateTransform(r,a,h),this._active&&h.length<this._minTouches&&this.reset()}touchcancel(){this.reset()}_calculateTransform(r,a,h){h.length>0&&(this._active=!0);const f=ls(h,a),m=new s.P(0,0),g=new s.P(0,0);let x=0;for(const T in f){const M=f[T],A=this._touches[T];A&&(m._add(M),g._add(M.sub(A)),x++,f[T]=M)}if(this._touches=f,x<this._minTouches||!g.mag())return;const w=g.div(x);return this._sum._add(w),this._sum.mag()<this._clickTolerance?void 0:{around:m.div(x),panDelta:w}}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=Dt("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=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class Nl{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(r){}_move(r,a,h){return{}}touchstart(r,a,h){this._firstTwoTouches||h.length<2||(this._firstTwoTouches=[h[0].identifier,h[1].identifier],this._start([a[0],a[1]]))}touchmove(r,a,h){const f=this._firstTwoTouches;if(!f)return;r.preventDefault();const[m,g]=f,x=Vl(h,a,m),w=Vl(h,a,g);if(!x||!w)return;const T=this._aroundCenter?null:x.add(w).div(2);return this._move([x,w],T,r)}touchend(r,a,h){if(!this._firstTwoTouches)return;const[f,m]=this._firstTwoTouches,g=Vl(h,a,f),x=Vl(h,a,m);g&&x||(this._active&&xi(),this.reset())}touchcancel(){this.reset()}enable(r){this._enabled=!0,this._aroundCenter=!!r&&r.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function Vl(u,r,a){for(let h=0;h<u.length;h++)if(u[h].identifier===a)return r[h]}function ad(u,r){return Math.log(u/r)/Math.LN2}class Hp extends Nl{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(r){this._startDistance=this._distance=r[0].dist(r[1])}_move(r,a){const h=this._distance;if(this._distance=r[0].dist(r[1]),this._active||!(Math.abs(ad(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ad(this._distance,h),pinchAround:a}}}function Ul(u,r){return 180*u.angleWith(r)/Math.PI}class Eu extends Nl{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(r){this._startVector=this._vector=r[0].sub(r[1]),this._minDiameter=r[0].dist(r[1])}_move(r,a){const h=this._vector;if(this._vector=r[0].sub(r[1]),h&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:Ul(this._vector,h),pinchAround:a}}_isBelowThreshold(r){this._minDiameter=Math.min(this._minDiameter,r.mag());const a=25/(Math.PI*this._minDiameter)*360,h=this._startVector;if(!h)return!1;const f=Ul(r,h);return Math.abs(f)<a}}function Sa(u){return Math.abs(u.y)>Math.abs(u.x)}class Su extends Nl{constructor(r){super(),this._map=r}reset(){super.reset(),this._valid=void 0,this._firstMove=void 0,this._lastPoints=void 0}_start(r){this._lastPoints=r,Sa(r[0].sub(r[1]))&&(this._valid=!1)}_move(r,a,h){const f=this._lastPoints;if(!f)return;const m=r[0].sub(f[0]),g=r[1].sub(f[1]);return this._map._cooperativeGestures&&!s.d1()&&h.touches.length<3||(this._valid=this.gestureBeginsVertically(m,g,h.timeStamp),!this._valid)?void 0:(this._lastPoints=r,this._active=!0,{pitchDelta:(m.y+g.y)/2*-.5})}gestureBeginsVertically(r,a,h){if(this._valid!==void 0)return this._valid;const f=r.mag()>=2,m=a.mag()>=2;if(!f&&!m)return;if(!f||!m)return this._firstMove==null&&(this._firstMove=h),h-this._firstMove<100&&void 0;const g=r.y>0==a.y>0;return Sa(r)&&Sa(a)&&g}}const ld={panStep:100,bearingStep:15,pitchStep:10};class cd{constructor(){const r=ld;this._panStep=r.panStep,this._bearingStep=r.bearingStep,this._pitchStep=r.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(r){if(r.altKey||r.ctrlKey||r.metaKey)return;let a=0,h=0,f=0,m=0,g=0;switch(r.keyCode){case 61:case 107:case 171:case 187:a=1;break;case 189:case 109:case 173:a=-1;break;case 37:r.shiftKey?h=-1:(r.preventDefault(),m=-1);break;case 39:r.shiftKey?h=1:(r.preventDefault(),m=1);break;case 38:r.shiftKey?f=1:(r.preventDefault(),g=-1);break;case 40:r.shiftKey?f=-1:(r.preventDefault(),g=1);break;default:return}return this._rotationDisabled&&(h=0,f=0),{cameraAnimation:x=>{const w=x.getZoom();x.easeTo({duration:300,easeId:"keyboardHandler",easing:Xp,zoom:a?Math.round(w)+a*(r.shiftKey?2:1):w,bearing:x.getBearing()+h*this._bearingStep,pitch:x.getPitch()+f*this._pitchStep,offset:[-m*this._panStep,-g*this._panStep],center:x.getCenter()},{originalEvent:r})}}}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 Xp(u){return u*(2-u)}const us=4.000244140625,Ma=1/450;class ud{constructor(r,a){this._map=r,this._el=r.getCanvasContainer(),this._handler=a,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=Ma,s.bp(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(r){this._defaultZoomRate=r}setWheelZoomRate(r){this._wheelZoomRate=r}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(r){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!r&&r.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(r){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(r.ctrlKey||r.metaKey||this.isZooming()||s.d1()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let a=r.deltaMode===WheelEvent.DOM_DELTA_LINE?40*r.deltaY:r.deltaY;const h=s.e.now(),f=h-(this._lastWheelEventTime||0);this._lastWheelEventTime=h,a!==0&&a%us==0?this._type="wheel":a!==0&&Math.abs(a)<4?this._type="trackpad":f>400?(this._type=null,this._lastValue=a,this._timeout=setTimeout(this._onTimeout,40,r)):this._type||(this._type=Math.abs(f*a)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,a+=this._lastValue)),r.shiftKey&&a&&(a/=4),this._type&&(this._lastWheelEvent=r,this._delta-=a,this._active||this._start(r)),r.preventDefault()}_onTimeout(r){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(r)}_start(r){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 a=mi(this._el,r);this._aroundPoint=this._aroundCenter?this._map.transform.centerPoint:a,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 r=this._map.transform;this._type==="wheel"&&r.projection.wrap&&(r._center.lng>=180||r._center.lng<=-180)&&(this._prevEase=null,this._easing=null,this._lastWheelEvent=null,this._lastWheelEventTime=0);const a=()=>r._terrainEnabled()&&this._aroundCoord?r.computeZoomRelativeTo(this._aroundCoord):r.zoom;if(this._delta!==0){const T=this._type==="wheel"&&Math.abs(this._delta)>us?this._wheelZoomRate:this._defaultZoomRate;let M=2/(1+Math.exp(-Math.abs(this._delta*T)));this._delta<0&&M!==0&&(M=1/M);const A=a(),P=Math.pow(2,A),z=typeof this._targetZoom=="number"?r.zoomScale(this._targetZoom):P;this._targetZoom=Math.min(r.maxZoom,Math.max(r.minZoom,r.scaleZoom(z*M))),this._type==="wheel"&&(this._startZoom=A,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const h=typeof this._targetZoom=="number"?this._targetZoom:a(),f=this._startZoom,m=this._easing;let g,x=!1;if(this._type==="wheel"&&f&&m){const T=Math.min((s.e.now()-this._lastWheelEventTime)/200,1),M=m(T);g=s.a2(f,h,M),T<1?this._frameId||(this._frameId=!0):x=!0}else g=h,x=!0;this._active=!0,x&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let w=g-a();return w*this._lastDelta<0&&(w=0),{noInertia:!0,needsRenderFrame:!x,zoomDelta:w,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(r){let a=s.d2;if(this._prevEase){const h=this._prevEase,f=(s.e.now()-h.start)/h.duration,m=h.easing(f+.01)-h.easing(f),g=.27/Math.sqrt(m*m+1e-4)*.01,x=Math.sqrt(.0729-g*g);a=s.d0(g,x,.25,1)}return this._prevEase={start:s.e.now(),duration:r,easing:a},a}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=Dt("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=setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class pr{constructor(r,a){this._clickZoom=r,this._tapZoom=a}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 Mu{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(r,a){return r.preventDefault(),{cameraAnimation:h=>{h.easeTo({duration:300,zoom:h.getZoom()+(r.shiftKey?-1:1),around:h.unproject(a)},{originalEvent:r})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class jl{constructor(){this._tap=new Bl({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(r,a,h){this._swipePoint||(this._tapTime&&r.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?h.length>0&&(this._swipePoint=a[0],this._swipeTouch=h[0].identifier):this._tap.touchstart(r,a,h))}touchmove(r,a,h){if(this._tapTime){if(this._swipePoint){if(h[0].identifier!==this._swipeTouch)return;const f=a[0],m=f.y-this._swipePoint.y;return this._swipePoint=f,r.preventDefault(),this._active=!0,{zoomDelta:m/128}}}else this._tap.touchmove(r,a,h)}touchend(r,a,h){this._tapTime?this._swipePoint&&h.length===0&&this.reset():this._tap.touchend(r,a,h)&&(this._tapTime=r.t
2223imeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Gl{constructor(r,a,h){this._el=r,this._mousePan=a,this._touchPan=h}enable(r){this._inertiaOptions=r||{},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 Iu{constructor(r,a,h){this._pitchWithRotate=r.pitchWithRotate,this._mouseRotate=a,this._mousePitch=h}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 Au{constructor(r,a,h,f){this._el=r,this._touchZoom=a,this._touchRotate=h,this._tapDragZoom=f,this._rotationDisabled=!1,this._enabled=!0}enable(r){this._touchZoom.enable(r),this._rotationDisabled||this._touchRotate.enable(r),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 fo=u=>u.zoom||u.drag||u.pitch||u.rotate;class Cu extends s.f{}class Pu{constructor(){this.constants=[1,1,.01],this.radius=0}setup(r,a){const h=s._.sub([],a,r);this.radius=s._.length(h[2]<0?s._.div([],h,this.constants):[h[0],h[1],0])}projectRay(r){s._.div(r,r,this.constants),s._.normalize(r,r),s._.mul(r,r,this.constants);const a=s._.scale([],r,this.radius);if(a[2]>0){const h=s._.scale([],[0,0,1],s._.dot(a,[0,0,1])),f=s._.scale([],s._.normalize([],[a[0],a[1],0]),this.radius),m=s._.add([],a,s._.scale([],s._.sub([],s._.add([],f,h),a),2));a[0]=m[0],a[1]=m[1]}return a}}function mo(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta}class hd{constructor(r,a){this._map=r,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new yu(r),this._bearingSnap=a.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new Pu,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(a),s.bp(["handleEvent","handleWindowEvent"],this);const h=this._el;this._listeners=[[h,"touchstart",{passive:!0}],[h,"touchmove",{passive:!1}],[h,"touchend",void 0],[h,"touchcancel",void 0],[h,"mousedown",void 0],[h,"mousemove",void 0],[h,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[h,"mouseover",void 0],[h,"mouseout",void 0],[h,"dblclick",void 0],[h,"click",void 0],[h,"keydown",{capture:!1}],[h,"keyup",void 0],[h,"wheel",{passive:!1}],[h,"contextmenu",void 0],[window,"blur",void 0]];for(const[f,m,g]of this._listeners){const x=f===document?this.handleWindowEvent:this.handleEvent;f.addEventListener(m,x,g)}}destroy(){for(const[r,a,h]of this._listeners){const f=r===document?this.handleWindowEvent:this.handleEvent;r.removeEventListener(a,f,h)}}_addDefaultHandlers(r){const a=this._map,h=a.getCanvasContainer();this._add("mapEvent",new Ol(a,r));const f=a.boxZoom=new Ea(a,r);this._add("boxZoom",f);const m=new bu,g=new Mu;a.doubleClickZoom=new pr(g,m),this._add("tapZoom",m),this._add("clickZoom",g);const x=new jl;this._add("tapDragZoom",x);const w=a.touchPitch=new Su(a);this._add("touchPitch",w);const T=new wu(r),M=new Tu(r);a.dragRotate=new Iu(r,T,M),this._add("mouseRotate",T,["mousePitch"]),this._add("mousePitch",M,["mouseRotate"]);const A=new sd(r),P=new cs(a,r);a.dragPan=new Gl(h,A,P),this._add("mousePan",A),this._add("touchPan",P,["touchZoom","touchRotate"]);const z=new Eu,R=new Hp;a.touchZoomRotate=new Au(h,R,z,x),this._add("touchRotate",z,["touchPan","touchZoom"]),this._add("touchZoom",R,["touchPan","touchRotate"]),this._add("blockableMapEvent",new xu(a));const k=a.scrollZoom=new ud(a,this);this._add("scrollZoom",k,["mousePan"]);const O=a.keyboard=new cd;this._add("keyboard",O);for(const B of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])r.interactive&&r[B]&&a[B].enable(r[B])}_add(r,a,h){this._handlers.push({handlerName:r,handler:a,allowed:h}),this._handlersById[r]=a}stop(r){if(!this._updatingCamera){for(const{handler:a}of this._handlers)a.reset();this._inertia.clear(),this._fireEvents({},{},r),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:r}of this._handlers)if(r.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!fo(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}
vendor: 25,292 bytes, line 2223
2223_blockedByActive(r,a,h){for(const f in r)if(f!==h&&(!a||a.indexOf(f)<0))return!0;return!1}handleWindowEvent(r){this.handleEvent(r,`${r.type}Window`)}_getMapTouches(r){const a=[];for(const h of r)this._el.contains(h.target)&&a.push(h);return a}handleEvent(r,a){this._updatingCamera=!0;const h=r.type==="renderFrame",f=h?void 0:r,m={needsRenderFrame:!1},g={},x={},w=r.touches?this._getMapTouches(r.touches):void 0,T=w?qr(this._el,w):h?void 0:mi(this._el,r);for(const{handlerName:P,handler:z,allowed:R}of this._handlers){if(!z.isEnabled())continue;let k;this._blockedByActive(x,R,P)?z.reset():z[a||r.type]&&(k=z[a||r.type](r,T,w),this.mergeHandlerResult(m,g,k,P,f),k&&k.needsRenderFrame&&this._triggerRenderFrame()),(k||z.isActive())&&(x[P]=z)}const M={};for(const P in this._previousActiveHandlers)x[P]||(M[P]=f);this._previousActiveHandlers=x,(Object.keys(M).length||mo(m))&&(this._changes.push([m,g,M]),this._triggerRenderFrame()),(Object.keys(x).length||mo(m))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=m;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))}mergeHandlerResult(r,a,h,f,m){if(!h)return;s.W(r,h);const g={handlerName:f,originalEvent:h.originalEvent||m};h.zoomDelta!==void 0&&(a.zoom=g),h.panDelta!==void 0&&(a.drag=g),h.pitchDelta!==void 0&&(a.pitch=g),h.bearingDelta!==void 0&&(a.rotate=g)}_applyChanges(){const r={},a={},h={};for(const[f,m,g]of this._changes)f.panDelta&&(r.panDelta=(r.panDelta||new s.P(0,0))._add(f.panDelta)),f.zoomDelta&&(r.zoomDelta=(r.zoomDelta||0)+f.zoomDelta),f.bearingDelta&&(r.bearingDelta=(r.bearingDelta||0)+f.bearingDelta),f.pitchDelta&&(r.pitchDelta=(r.pitchDelta||0)+f.pitchDelta),f.around!==void 0&&(r.around=f.around),f.aroundCoord!==void 0&&(r.aroundCoord=f.aroundCoord),f.pinchAround!==void 0&&(r.pinchAround=f.pinchAround),f.noInertia&&(r.noInertia=f.noInertia),s.W(a,m),s.W(h,g);this._updateMapTransform(r,a,h),this._changes=[]}_updateMapTransform(r,a,h){const f=this._map,m=f.transform,g=G=>[G.x,G.y,G.z];if((G=>{const q=this._eventsInProgress.drag;return q&&!this._handlersById[q.handlerName].isActive()})()&&!mo(r)){const G=m.zoom;m.cameraElevationReference="sea",this._originalZoom!=null&&m._orthographicProjectionAtLowPitch&&m.projection.name!=="globe"&&m.pitch===0?(m.cameraElevationReference="ground",m.zoom=this._originalZoom):(m.recenterOnTerrain(),m.cameraElevationReference="ground"),G!==m.zoom&&this._map._update(!0)}if(m._isCameraConstrained&&f._stop(!0),!mo(r))return void this._fireEvents(a,h,!0);let{panDelta:x,zoomDelta:w,bearingDelta:T,pitchDelta:M,around:A,aroundCoord:P,pinchAround:z}=r;m._isCameraConstrained&&(w>0&&(w=0),m._isCameraConstrained=!1),z!==void 0&&(A=z),(w||(G=>a[G]&&!this._eventsInProgress[G])("drag"))&&A&&(this._dragOrigin=g(m.pointCoordinate3D(A)),this._originalZoom=m.zoom,this._trackingEllipsoid.setup(m._camera.position,this._dragOrigin)),m.cameraElevationReference="sea",f._stop(!0),A=A||f.transform.centerPoint,T&&(m.bearing+=T),M&&(m.pitch+=M),m._updateCameraState();const R=[0,0,0];if(x)if(m.projection.name==="mercator"){const G=this._trackingEllipsoid.projectRay(m.screenPointToMercatorRay(A).dir),q=this._trackingEllipsoid.projectRay(m.screenPointToMercatorRay(A.sub(x)).dir);R[0]=q[0]-G[0],R[1]=q[1]-G[1]}else{const G=m.pointCoordinate(A);if(m.projection.name==="globe"){x=x.rotate(-m.angle);const q=m._pixelsPerMercatorPixel/m.worldSize;R[0]=-x.x*s.d3(s.ay(G.y))*q,R[1]=-x.y*s.d3(m.center.lat)*q}else{const q=m.pointCoordinate(A.sub(x));G&&q&&(R[0]=q.x-G.x,R[1]=q.y-G.y)}}const k=m.zoom,O=[0,0,0];if(w){const G=g(P||m.pointCoordinate3D(A)),q={dir:s._.normalize([],s._.sub([],G,m._camera.position))};if(q.dir[2]<0){const Z=m.zoomDeltaToMovement(G,w);s._.scale(O,q.dir,Z)}}const B=s._.add(R,R,O);m._translateCameraConstrained(B),w&&Math.abs(m.zoom-k)>1e-4&&m.recenterOnTerrain(),m.cameraElevationReference="ground",this._map._update(),r.noInertia||this._inertia.record(r),this._fireEvents(a,h,!0)}_fireEvents(r,a,h){const f=fo(this._eventsInProgress),m=fo(r),g={};for(const M in r){const{originalEvent:A}=r[M];this._eventsInProgress[M]||(g[`${M}start`]=A),this._eventsInProgress[M]=r[M]}!f&&m&&this._fireEvent("movestart",m.originalEvent);for(const M in g)this._fireEvent(M,g[M]);m&&this._fireEvent("move",m.originalEvent);for(const M in r){const{originalEvent:A}=r[M];this._fireEvent(M,A)}const x={};let w;for(const M in this._eventsInProgress){const{handlerName:A,originalEvent:P}=this._eventsInProgress[M];this._handlersById[A].isActive()||(delete this._eventsInProgress[M],w=a[A]||P,x[`${M}end`]=w)}for(const M in x)this._fireEvent(M,x[M]);const T=fo(this._eventsInProgress);if(h&&(f||m)&&!T){this._updatingCamera=!0;const M=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),A=P=>P!==0&&-this._bearingSnap<P&&P<this._bearingSnap;M?(A(M.bearing||this._map.getBearing())&&(M.bearing=0),this._map.easeTo(M,{originalEvent:w})):(this._map.fire(new s.f("moveend",{originalEvent:w})),A(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(r,a){this._map.fire(new s.f(r,a?{originalEvent:a}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(r=>{this._frameId=void 0,this.handleEvent(new Cu("renderFrame",{timeStamp:r})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const zu="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class hs extends s.E{constructor(r,a){super(),this._moving=!1,this._zooming=!1,this.transform=r,this._bearingSnap=a.bearingSnap,this._respectPrefersReducedMotion=a.respectPrefersReducedMotion!==!1,s.bp(["_renderFrameCallback"],this)}getCenter(){return new s.aI(this.transform.center.lng,this.transform.center.lat)}setCenter(r,a){return this.jumpTo({center:r},a)}panBy(r,a,h){return r=s.P.convert(r).mult(-1),this.panTo(this.transform.center,s.W({offset:r},a),h)}panTo(r,a,h){return this.easeTo(s.W({center:r},a),h)}getZoom(){return this.transform.zoom}setZoom(r,a){return this.jumpTo({zoom:r},a),this}zoomTo(r,a,h){return this.easeTo(s.W({zoom:r},a),h)}zoomIn(r,a){return this.zoomTo(this.getZoom()+1,r,a),this}zoomOut(r,a){return this.zoomTo(this.getZoom()-1,r,a),this}getBearing(){return this.transform.bearing}setBearing(r,a){return this.jumpTo({bearing:r},a),this}getPadding(){return this.transform.padding}setPadding(r,a){return this.jumpTo({padding:r},a),this}rotateTo(r,a,h){return this.easeTo(s.W({bearing:r},a),h)}resetNorth(r,a){return this.rotateTo(0,s.W({duration:1e3},r),a),this}resetNorthPitch(r,a){return this.easeTo(s.W({bearing:0,pitch:0,duration:1e3},r),a),this}snapToNorth(r,a){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(r,a):this}getPitch(){return this.transform.pitch}setPitch(r,a){return this.jumpTo({pitch:r},a),this}cameraForBounds(r,a){r=s.ai.convert(r);const h=a&&a.bearing||0,f=a&&a.pitch||0,m=r.getNorthWest(),g=r.getSouthEast();return this._cameraForBounds(this.transform,m,g,h,f,a)}_extendPadding(r){const a={top:0,right:0,bottom:0,left:0};return r==null?s.W({},a,this.transform.padding):typeof r=="number"?{top:r,bottom:r,right:r,left:r}:s.W({},a,r)}_extendCameraOptions(r){return(r=s.W({offset:[0,0],maxZoom:this.transform.maxZoom},r)).padding=this._extendPadding(r.padding),r}_minimumAABBFrustumDistance(r,a){const h=a.max[0]-a.min[0],f=a.max[1]-a.min[1];return h/f>r.aspect?h/(2*Math.tan(.5*r.fovX)*r.aspect):f/(2*Math.tan(.5*r.fovY)*r.aspect)}_cameraForBoundsOnGlobe(r,a,h,f,m,g){const x=r.clone(),w=this._extendCameraOptions(g);x.bearing=f,x.pitch=m;const T=s.aI.convert(a),M=s.aI.convert(h),A=.5*(T.lat+M.lat),P=.5*(T.lng+M.lng),z=s.d4(A,P),R=s._.normalize([],z),k=s._.normalize([],s._.cross([],R,[0,1,0])),O=s._.cross([],k,R),B=[k[0],k[1],k[2],0,O[0],O[1],O[2],0,R[0],R[1],R[2],0,0,0,0,1],G=[z,s.d4(T.lat,T.lng),s.d4(M.lat,T.lng),s.d4(M.lat,M.lng),s.d4(T.lat,M.lng),s.d4(A,T.lng),s.d4(A,M.lng),s.d4(T.lat,P),s.d4(M.lat,P)];let q=s.b6.fromPoints(G.map(we=>[s._.dot(k,we),s._.dot(O,we),s._.dot(R,we)]));const Z=s._.transformMat4([],q.center,B);s._.squaredLength(Z)===0&&s._.set(Z,0,0,1),s._.normalize(Z,Z),s._.scale(Z,Z,s.cD),x.center=s.d5(Z);const K=x.getWorldToCameraMatrix(),Y=s.ad.invert(new Float64Array(16),K);q=s.b6.applyTransform(q,s.ad.multiply([],K,B));const te=this._extendAABB(q,x,w,f);if(!te)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");q=te,s._.transformMat4(Z,Z,K);const N=.5*(q.max[2]-q.min[2]),$=this._minimumAABBFrustumDistance(x,q),re=s._.scale([],[0,0,1],N),de=s._.add(re,Z,re),se=$+(x.pitch===0?0:s._.distance(Z,de)),Q=x.globeCenterInViewSpace,fe=s._.sub([],Z,[Q[0],Q[1],Q[2]]);s._.normalize(fe,fe),s._.scale(fe,fe,se);const Me=s._.add([],Z,fe);s._.transformMat4(Me,Me,Y);const Ie=s.d7/s.cD,Se=s._.length(Me),le=s.ax(Math.max(Se*Ie-s.d7,Number.EPSILON),0),_e=Math.min(x.zoomFromMercatorZAdjusted(le),w.maxZoom);return _e>.5*(s.b1+s.aU)?(x.setProjection({name:"mercator"}),x.zoom=_e,this._cameraForBounds(x,a,h,f,m,g)):{center:x.center,zoom:_e,bearing:f,pitch:m}}_extendAABB(r,a,h,f){const m=.5*((h.padding.left||0)+(h.padding.right||0)),g=.5*((h.padding.top||0)+(h.padding.bottom||0)),x=g,w=m,T=m,M=g,A=a.width-(w+T),P=a.height-(x+M),z=s._.sub([],r.max,r.min),R=Math.min(A/z[0],P/z[1]),k=Math.min(a.scaleZoom(a.scale*R),h.maxZoom);if(isNaN(k))return null;const O=a.scale/a.zoomScale(k),B=new s.b6([r.min[0]-w*O,r.min[1]-M*O,r.min[2]],[r.max[0]+T*O,r.max[1]+x*O,r.max[2]]),G=(typeof h.offset.x=="number"&&typeof h.offset.y=="number"?new s.P(h.offset.x,h.offset.y):s.P.convert(h.offset)).rotate(-s.ab(f));return B.center[0]-=G.x*O,B.center[1]+=G.y*O,B}queryTerrainElevation(r,a){const h=this.transform.elevation;return h?(a=s.W({},{exaggerated:!0},a),h.getAtPoint(s.Y.fromLngLat(r),null,a.exaggerated)):null}_cameraForBounds(r,a,h,f,m,g){if(r.projection.name==="globe")return this._cameraForBoundsOnGlobe(r,a,h,f,m,g);const x=r.clone(),w=this._extendCameraOptions(g);x.bearing=f,x.pitch=m;const T=s.aI.convert(a),M=s.aI.convert(h),A=new s.aI(T.lng,M.lat),P=new s.aI(M.lng,T.lat),z=x.project(T),R=x.project(M),k=this.queryTerrainElevation(T),O=this.queryTerrainElevation(M),B=this.queryTerrainElevation(A),G=this.queryTerrainElevation(P),q=[[z.x,z.y,Math.min(k||0,O||0,B||0,G||0)],[R.x,R.y,Math.max(k||0,O||0,B||0,G||0)]];let Z=s.b6.fromPoints(q);const K=x.getWorldToCameraMatrix(),Y=s.ad.invert(new Float64Array(16),K);Z=s.b6.applyTransform(Z,K);const te=this._extendAABB(Z,x,w,f);if(!te)return void s.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Z=te;const N=.5*s._.sub([],Z.max,Z.min)[2],$=this._minimumAABBFrustumDistance(x,Z),re=[0,0,1,0];s.aA.transformMat4(re,re,K),s.aA.normalize(re,re);const de=s._.scale([],re,$+N),se=s._.add([],Z.center,de);s._.transformMat4(Z.center,Z.center,Y),s._.transformMat4(se,se,Y);const Q=[Z.center[0],Z.center[1],se[2]*x.pixelsPerMeter];s._.scale(Q,Q,1/x.worldSize);const fe=s.d6(Q[0]),Me=s.ay(Q[1]),Ie=Math.min(x._zoomFromMercatorZ(Q[2]),w.maxZoom),Se=new s.aI(fe,Me);return x.mercatorFromTransition&&Ie<.5*(s.b1+s.aU)?(x.setProjection({name:"globe"}),x.zoom=Ie,this._cameraForBounds(x,a,h,f,m,g)):{center:Se,zoom:Ie,bearing:f,pitch:m}}fitBounds(r,a,h){const f=this.cameraForBounds(r,a);return this._fitInternal(f,a,h)}fitScreenCoordinates(r,a,h,f,m){const g=s.P.convert(r),x=s.P.convert(a),w=new s.P(Math.min(g.x,x.x),Math.min(g.y,x.y)),T=new s.P(Math.max(g.x,x.x),Math.max(g.y,x.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(g,x))return this;const M=this.transform.pointLocation3D(w),A=this.transform.pointLocation3D(T),P=this.transform.pointLocation3D(new s.P(w.x,T.y)),z=this.transform.pointLocation3D(new s.P(T.x,w.y)),R=[Math.min(M.lng,A.lng,P.lng,z.lng),Math.min(M.lat,A.lat,P.lat,z.lat)],k=[Math.max(M.lng,A.lng,P.lng,z.lng),Math.max(M.lat,A.lat,P.lat,z.lat)],O=f&&f.pitch?f.pitch:this.getPitch(),B=this._cameraForBounds(this.transform,R,k,h,O,f);return this._fitInternal(B,f,m)}_fitInternal(r,a,h){return r?(a=s.W(r,a)).linear?this.easeTo(a,h):this.flyTo(a,h):this}jumpTo(r,a){this.stop();const h=r.preloadOnly?this.transform.clone():this.transform;let f=!1,m=!1,g=!1;if("zoom"in r&&h.zoom!==+r.zoom&&(f=!0,h.zoom=+r.zoom),r.center!==void 0&&(h.center=s.aI.convert(r.center)),"bearing"in r&&h.bearing!==+r.bearing&&(m=!0,h.bearing=+r.bearing),"pitch"in r&&h.pitch!==+r.pitch&&(g=!0,h.pitch=+r.pitch),r.padding!=null){const x=typeof r.padding=="number"?this._extendPadding(r.padding):r.padding;h.isPaddingEqual(x)||(h.padding=x)}return r.preloadOnly?(this._preloadTiles(h),this):(this.fire(new s.f("movestart",a)).fire(new s.f("move",a)),f&&this.fire(new s.f("zoomstart",a)).fire(new s.f("zoom",a)).fire(new s.f("zoomend",a)),m&&this.fire(new s.f("rotatestart",a)).fire(new s.f("rotate",a)).fire(new s.f("rotateend",a)),g&&this.fire(new s.f("pitchstart",a)).fire(new s.f("pitch",a)).fire(new s.f("pitchend",a)),this.fire(new s.f("moveend",a)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||s.w(zu),this.transform.getFreeCameraOptions()}setFreeCameraOptions(r,a){const h=this.transform;if(!h.projection.supportsFreeCamera)return s.w(zu),this;this.stop();const f=h.zoom,m=h.pitch,g=h.bearing;h.setFreeCameraOptions(r);const x=f!==h.zoom,w=m!==h.pitch,T=g!==h.bearing;return this.fire(new s.f("movestart",a)).fire(new s.f("move",a)),x&&this.fire(new s.f("zoomstart",a)).fire(new s.f("zoom",a)).fire(new s.f("zoomend",a)),T&&this.fire(new s.f("rotatestart",a)).fire(new s.f("rotate",a)).fire(new s.f("rotateend",a)),w&&this.fire(new s.f("pitchstart",a)).fire(new s.f("pitch",a)).fire(new s.f("pitchend",a)),this.fire(new s.f("moveend",a)),this}easeTo(r,a){this._stop(!1,r.easeId),((r=s.W({offset:[0,0],duration:500,easing:s.d2},r)).animate===!1||this._prefersReducedMotion(r))&&(r.duration=0);const h=this.transform,f=this.getZoom(),m=this.getBearing(),g=this.getPitch(),x=this.getPadding(),w="zoom"in r?+r.zoom:f,T="bearing"in r?this._normalizeBearing(r.bearing,m):m,M="pitch"in r?+r.pitch:g,A=this._extendPadding(r.padding),P=s.P.convert(r.offset);let z,R,k;if(h.projection.name==="globe"){const $=s.Y.fromLngLat(h.center),re=P.rotate(-h.angle);$.x+=re.x/h.worldSize,$.y+=re.y/h.worldSize;const de=$.toLngLat(),se=s.aI.convert(r.center||de);this._normalizeCenter(se),z=h.centerPoint.add(re),R=new s.P($.x,$.y).mult(h.worldSize),k=new s.P(s.aj(se.lng),s.ak(se.lat)).mult(h.worldSize).sub(R)}else{z=h.centerPoint.add(P);const $=h.pointLocation(z),re=s.aI.convert(r.center||$);this._normalizeCenter(re),R=h.project($),k=h.project(re).sub(R)}const O=h.zoomScale(w-f);let B,G;r.around&&(B=s.aI.convert(r.around),G=h.locationPoint(B));const q=this._zooming||w!==f,Z=this._rotating||m!==T,K=this._pitching||M!==g,Y=!h.isPaddingEqual(A),te=$=>re=>{if(q&&($.zoom=s.a2(f,w,re)),Z&&($.bearing=s.a2(m,T,re)),K&&($.pitch=s.a2(g,M,re)),Y&&($.interpolatePadding(x,A,re),z=$.centerPoint.add(P)),B)$.setLocationAtPoint(B,G);else{const de=$.zoomScale($.zoom-f),se=w>f?Math.min(2,O):Math.max(.5,O),Q=Math.pow(se,1-re),fe=$.unproject(R.add(k.mult(re*Q)).mult(de));$.setLocationAtPoint($.renderWorldCopies?fe.wrap():fe,z)}return r.preloadOnly||this._fireMoveEvents(a),$};if(r.preloadOnly){const $=this._emulate(te,r.duration,h);return this._preloadTiles($),this}const N={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=q,this._rotating=Z,this._pitching=K,this._padding=Y,this._easeId=r.easeId,this._prepareEase(a,r.noMoveStart,N),this._ease(te(h),$=>{h.cameraElevationReference==="sea"&&h.recenterOnTerrain(),this._afterEase(a,$)},r),this}_prepareEase(r,a,h={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),a||h.moving||this.fire(new s.f("movestart",r)),this._zooming&&!h.zooming&&this.fire(new s.f("zoomstart",r)),this._rotating&&!h.rotating&&this.fire(new s.f("rotatestart",r)),this._pitching&&!h.pitching&&this.fire(new s.f("pitchstart",r))}_fireMoveEvents(r){this.fire(new s.f("move",r)),this._zooming&&this.fire(new s.f("zoom",r)),this._rotating&&this.fire(new s.f("rotate",r)),this._pitching&&this.fire(new s.f("pitch",r))}_afterEase(r,a){if(this._easeId&&a&&this._easeId===a)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const h=this._zooming,f=this._rotating,m=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,h&&this.fire(new s.f("zoomend",r)),f&&this.fire(new s.f("rotateend",r)),m&&this.fire(new s.f("pitchend",r)),this.fire(new s.f("moveend",r))}flyTo(r,a){if(this._prefersReducedMotion(r)){const _e=s.ah(r,["center","zoom","bearing","pitch","around","padding"]);return this.jumpTo(_e,a)}this.stop(),r=s.W({offset:[0,0],speed:1.2,curve:1.42,easing:s.d2},r);const h=this.transform,f=this.getZoom(),m=this.getBearing(),g=this.getPitch(),x=this.getPadding(),w="zoom"in r?s.at(+r.zoom,h.minZoom,h.maxZoom):f,T="bearing"in r?this._normalizeBearing(r.bearing,m):m,M="pitch"in r?+r.pitch:g,A=this._extendPadding(r.padding),P=h.zoomScale(w-f),z=s.P.convert(r.offset);let R=h.centerPoint.add(z);const k=h.pointLocation(R),O=s.aI.convert(r.center||k);this._normalizeCenter(O);const B=h.project(k),G=h.project(O).sub(B);let q=r.curve;const Z=Math.max(h.width,h.height),K=Z/P,Y=G.mag();if("minZoom"in r){const _e=s.at(Math.min(r.minZoom,f,w),h.minZoom,h.maxZoom),we=Z/h.zoomScale(_e-f);q=Math.sqrt(we/Y*2)}const te=q*q;function N(_e){const we=(K*K-Z*Z+(_e?-1:1)*te*te*Y*Y)/(2*(_e?K:Z)*te*Y);return Math.log(Math.sqrt(we*we+1)-we)}function $(_e){return(Math.exp(_e)-Math.exp(-_e))/2}function re(_e){return(Math.exp(_e)+Math.exp(-_e))/2}const de=N(0);let se=function(_e){return re(de)/re(de+q*_e)},Q=function(_e){return Z*((re(de)*($(we=de+q*_e)/re(we))-$(de))/te)/Y;var we},fe=(N(1)-de)/q;if(Math.abs(Y)<1e-6||!isFinite(fe)){if(Math.abs(Z-K)<1e-6)return this.easeTo(r,a);const _e=K<Z?-1:1;fe=Math.abs(Math.log(K/Z))/q,Q=function(){return 0},se=function(we){return Math.exp(_e*q*we)}}r.duration="duration"in r?+r.duration:1e3*fe/("screenSpeed"in r?+r.screenSpeed/q:+r.speed),r.maxDuration&&r.duration>r.maxDuration&&(r.duration=0);const Me=m!==T,Ie=M!==g,Se=!h.isPaddingEqual(A),le=_e=>we=>{const Ve=we*fe,Ue=1/se(Ve);_e.zoom=we===1?w:f+_e.scaleZoom(Ue),Me&&(_e.bearing=s.a2(m,T,we)),Ie&&(_e.pitch=s.a2(g,M,we)),Se&&(_e.interpolatePadding(x,A,we),R=_e.centerPoint.add(z));const qe=we===1?O:_e.unproject(B.add(G.mult(Q(Ve))).mult(Ue));return _e.setLocationAtPoint(_e.renderWorldCopies?qe.wrap():qe,R),_e._updateCameraOnTerrain(),r.preloadOnly||this._fireMoveEvents(a),_e};if(r.preloadOnly){const _e=this._emulate(le,r.duration,h);return this._preloadTiles(_e),this}return this._zooming=!0,this._rotating=Me,this._pitching=Ie,this._padding=Se,this._prepareEase(a,!1),this._ease(le(h),()=>this._afterEase(a),r),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(r){}_cancelRenderFrame(r){}_stop(r,a){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const h=this._onEaseEnd;this._onEaseEnd=void 0,h.call(this,a)}if(!r){const h=this.handlers;h&&h.stop(!1)}return this}_ease(r,a,h){h.animate===!1||h.duration===0?(r(1),a()):(this._easeStart=s.e.now(),this._easeOptions=h,this._onEaseFrame=r,this._onEaseEnd=a,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const r=Math.min((s.e.now()-this._easeStart)/this._easeOptions.duration,1),a=this._onEaseFrame;a&&a(this._easeOptions.easing(r)),r<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(r,a){r=s.au(r,-180,180);const h=Math.abs(r-a);return Math.abs(r-360-a)<h&&(r-=360),Math.abs(r+360-a)<h&&(r+=360),r}_normalizeCenter(r){const a=this.transform;if(a.maxBounds||a.projection.name!=="globe"&&!a.renderWorldCopies)return;const h=r.lng-a.center.lng;r.lng+=h>180?-360:h<-180?360:0}_prefersReducedMotion(r){return this._respectPrefersReducedMotion&&s.e.prefersReducedMotion&&!(r&&r.essential)}_emulate(r,a,h){const f=Math.ceil(15*a/1e3),m=[],g=r(h.clone());for(let x=0;x<=f;x++){const w=g(x/f);m.push(w.clone())}return m}_preloadTiles(r,a){}}class dd{constructor(r={}){this.options=r,s.bp(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(r){const a=this.options&&this.options.compact;return this._map=r,this._container=Dt("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=Dt("button","mapboxgl-ctrl-attrib-button",this._container),Dt("span","mapboxgl-ctrl-icon",this._compactButton).setAttribute("aria-hidden","true"),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=Dt("div","mapboxgl-ctrl-attrib-inner",this._container),a&&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),a===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}_setElementTitle(r,a){const h=this._map._getUIString(`AttributionControl.${a}`);r.removeAttribute("title"),r.firstElementChild&&r.firstElementChild.setAttribute("title",h)}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let r=this._editLink;r||(r=this._editLink=this._container.querySelector(".mapbox-improve-map"));const a=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||s.d8.ACCESS_TOKEN}];if(r){const h=a.reduce((f,m,g)=>(m.value&&(f+=`${m.key}=${m.value}${g<a.length-1?"&":""}`),f),"?");r.href=`${s.d8.FEEDBACK_URL}/${h}#${nd(this._map,!0)}`,r.rel="noopener nofollow",this._setElementTitle(r,"MapFeedback")}}_updateData(r){!r||r.sourceDataType!=="metadata"&&r.sourceDataType!=="visibility"&&r.dataType!=="style"||(this._updateAttributions(),this._updateEditLink())}_updateAttributions(){if(!this._map.style)return;let r=[];if(this._map.style.stylesheet){const f=this._map.style.stylesheet;this.styleOwner=f.owner,this.styleId=f.id}const a=this._map.style._mergedSourceCaches;for(const f in a){const m=a[f];if(m.used){const g=m.getSource();g.attribution&&r.indexOf(g.attribution)<0&&r.push(g.attribution)}}r.sort((f,m)=>f.length-m.length),r=r.filter((f,m)=>{for(let g=m+1;g<r.length;g++)if(r[g].indexOf(f)>=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?r=[...this.options.customAttribution,...r]:r.unshift(this.options.customAttribution));const h=r.join(" | ");h!==this._attribHTML&&(this._attribHTML=h,r.length?(this._innerContainer.innerHTML=h,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 pd{constructor(){s.bp(["_updateLogo","_updateCompact"],this)}onAdd(r){this._map=r,this._container=Dt("div","mapboxgl-ctrl");const a=Dt("a","mapboxgl-ctrl-logo");return a.target="_blank",a.rel="noopener nofollow",a.href="https://www.mapbox.com/",a.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),a.setAttribute("rel","noopener nofollow"),this._container.appendChild(a),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(r){r&&r.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const r=this._map.style._sourceCaches;if(Object.entries(r).length===0)return!0;for(const a in r){const h=r[a].getSource();if(h.hasOwnProperty("mapbox_logo")&&!h.mapbox_logo)return!1}return!0}_updateCompact(){const r=this._container.children;if(r.length){const a=r[0];this._map.getCanvasContainer().offsetWidth<250?a.classList.add("mapboxgl-compact"):a.classList.remove("mapboxgl-compact")}}}class fd{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(r){const a=++this._id;
2223return this._queue.push({callback:r,id:a,cancelled:!1}),a}remove(r){const a=this._currentlyRunning,h=a?this._queue.concat(a):this._queue;for(const f of h)if(f.id===r)return void(f.cancelled=!0)}run(r=0){const a=this._currentlyRunning=this._queue;this._queue=[];for(const h of a)if(!h.cancelled&&(h.callback(r),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}function md(u,r,a){if(u=new s.aI(u.lng,u.lat),r){const h=new s.aI(u.lng-360,u.lat),f=new s.aI(u.lng+360,u.lat),m=360*Math.ceil(Math.abs(u.lng-a.center.lng)/360),g=a.locationPoint(u).distSqr(r),x=r.x<0||r.y<0||r.x>a.width||r.y>a.height;a.locationPoint(h).distSqr(r)<g&&(x||Math.abs(h.lng-a.center.lng)<m)?u=h:a.locationPoint(f).distSqr(r)<g&&(x||Math.abs(f.lng-a.center.lng)<m)&&(u=f)}for(;Math.abs(u.lng-a.center.lng)>180;){const h=a.locationPoint(u);if(h.x>=0&&h.y>=0&&h.x<=a.width&&h.y<=a.height)break;u.lng>a.center.lng?u.lng-=360:u.lng+=360}return u}const Du={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};class Lu extends s.E{constructor(r,a){if(super(),(r instanceof HTMLElement||a)&&(r=s.W({element:r},a)),s.bp(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this),this._anchor=r&&r.anchor||"center",this._color=r&&r.color||"#3FB1CE",this._scale=r&&r.scale||1,this._draggable=r&&r.draggable||!1,this._clickTolerance=r&&r.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=r&&r.rotation||0,this._rotationAlignment=r&&r.rotationAlignment||"auto",this._pitchAlignment=r&&r.pitchAlignment&&r.pitchAlignment||"auto",this._updateMoving=()=>this._update(!0),this._occludedOpacity=r&&r.occludedOpacity||.2,r&&r.element)this._element=r.element,this._offset=s.P.convert(r&&r.offset||[0,0]);else{this._defaultMarker=!0,this._element=Dt("div");const m=41,g=27,x=ur("svg",{display:"block",height:m*this._scale+"px",width:g*this._scale+"px",viewBox:`0 0 ${g} ${m}`},this._element),w=ur("radialGradient",{id:"shadowGradient"},ur("defs",{},x));ur("stop",{offset:"10%","stop-opacity":.4},w),ur("stop",{offset:"100%","stop-opacity":.05},w),ur("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},x),ur("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"},x),ur("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"},x),ur("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},x),this._offset=s.P.convert(r&&r.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",m=>{m.preventDefault()}),this._element.addEventListener("mousedown",m=>{m.preventDefault()});const h=this._element.classList;for(const m in Du)h.remove(`mapboxgl-marker-anchor-${m}`);h.add(`mapboxgl-marker-anchor-${this._anchor}`);const f=r&&r.className?r.className.trim().split(/\s+/):[];h.add(...f),this._popup=null}addTo(r){return r===this._map||(this.remove(),this._map=r,r.getCanvasContainer().appendChild(this._element),r.on("move",this._updateMoving),r.on("moveend",this._update),r.on("remove",this._clearFadeTimer),r._addMarker(this),this.setDraggable(this._draggable),this._update(),r.on("click",this._onMapClick)),this}remove(){const r=this._map;return r&&(r.off("click",this._onMapClick),r.off("move",this._updateMoving),r.off("moveend",this._update),r.off("mousedown",this._addDragHandler),r.off("touchstart",this._addDragHandler),r.off("mouseup",this._onUp),r.off("touchend",this._onUp),r.off("mousemove",this._onMove),r.off("touchmove",this._onMove),r.off("remove",this._clearFadeTimer),r._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(r){return this._lngLat=s.aI.convert(r),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}getElement(){return this._element}setPopup(r){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")),r){if(!("offset"in r.options)){const f=Math.sqrt(Math.pow(13.5,2)/2);r.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[
22230,-38.1],"bottom-left":[f,-1*(38.1-13.5+f)],"bottom-right":[-f,-1*(38.1-13.5+f)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=r,r._marker=this,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(r){const a=r.code,h=r.charCode||r.keyCode;a!=="Space"&&a!=="Enter"&&h!==32&&h!==13||this.togglePopup()}_onMapClick(r){const a=r.originalEvent.target,h=this._element;this._popup&&(a===h||h.contains(a))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const r=this._popup;return r?(r.isOpen()?(r.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(r.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const r=this._map,a=this._pos;if(!r||!a)return!1;const h=r.unproject(a),f=r.getFreeCameraOptions();if(!f.position)return!1;const m=f.position.toLngLat();return m.distanceTo(h)<.9*m.distanceTo(this._lngLat)}_evaluateOpacity(){const r=this._map;if(!r)return;const a=this._pos;if(!a||a.x<0||a.x>r.transform.width||a.y<0||a.y>r.transform.height)return void this._clearFadeTimer();const h=r.unproject(a);let f;r._showingGlobe()&&s.d9(r.transform,this._lngLat)?f=0:(f=1-r._queryFogOpacity(h),r.transform._terrainEnabled()&&r.getTerrain()&&this._behindTerrain()&&(f*=this._occludedOpacity)),this._element.style.opacity=`${f}`,this._element.style.pointerEvents=f>0?"auto":"none",this._popup&&this._popup._setOpacity(f),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const r=this._pos;if(!r||!this._map)return;const a=this._offset.mult(this._scale);this._element.style.transform=`
2224            translate(${r.x}px,${r.y}px)
2225            ${Du[this._anchor]}
2226            ${this._calculateXYTransform()} ${this._calculateZTransform()}
2227            translate(${a.x}px,${a.y}px)
2228        `}_calculateXYTransform(){const r=this._pos,a=this._map,h=this.getPitchAlignment();if(!a||!r||h!=="map")return"";if(!a._showingGlobe()){const w=a.getPitch();return w?`rotateX(${w}deg)`:""}const f=s.b0(s.da(a.transform,this._lngLat)),m=r.sub(s.db(a.transform)),g=Math.abs(m.x)+Math.abs(m.y);if(g===0)return"";const x=f/g;return`rotateX(${-m.y*x}deg) rotateY(${m.x*x}deg)`}_calculateZTransform(){const r=this._pos,a=this._map;if(!a||!r)return"";let h=0;const f=this.getRotationAlignment();if(f==="map")if(a._showingGlobe()){const m=a.project(new s.aI(this._lngLat.lng,this._lngLat.lat+.001)),g=a.project(new s.aI(this._lngLat.lng,this._lngLat.lat-.001)).sub(m);h=s.b0(Math.atan2(g.y,g.x))-90}else h=-a.getBearing();else if(f==="horizon"){const m=s.$(4,6,a.getZoom()),g=s.db(a.transform);g.y+=m*a.transform.height;const x=r.sub(g),w=s.b0(Math.atan2(x.y,x.x));h=(w>90?w-270:w+90)*(1-m)}return h+=this._rotation,h?`rotateZ(${h}deg)`:""}_update(r){cancelAnimationFrame(this._updateFrameId);const a=this._map;
vendor: 5,389 bytes, line 2228
2228a&&(a.transform.renderWorldCopies&&(this._lngLat=md(this._lngLat,this._pos,a.transform)),this._pos=a.project(this._lngLat),r===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),a._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(a._showingGlobe()||a.getTerrain()||a.getFog())&&!this._fadeTimer&&(this._fadeTimer=setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(r){return this._offset=s.P.convert(r),this._update(),this}addClassName(r){return this._element.classList.add(r),this}removeClassName(r){return this._element.classList.remove(r),this}toggleClassName(r){return this._element.classList.toggle(r)}_onMove(r){const a=this._map;if(!a)return;const h=this._pointerdownPos,f=this._positionDelta;if(h&&f){if(!this._isDragging){const m=this._clickTolerance||a._clickTolerance;if(r.point.dist(h)<m)return;this._isDragging=!0}this._pos=r.point.sub(f),this._lngLat=a.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new s.f("dragstart"))),this.fire(new s.f("drag"))}}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1;const r=this._map;r&&(r.off("mousemove",this._onMove),r.off("touchmove",this._onMove)),this._state==="active"&&this.fire(new s.f("dragend")),this._state="inactive"}_addDragHandler(r){const a=this._map,h=this._pos;a&&h&&this._element.contains(r.originalEvent.target)&&(r.preventDefault(),this._positionDelta=r.point.sub(h),this._pointerdownPos=r.point,this._state="pending",a.on("mousemove",this._onMove),a.on("touchmove",this._onMove),a.once("mouseup",this._onUp),a.once("touchend",this._onUp))}setDraggable(r){this._draggable=!!r;const a=this._map;return a&&(r?(a.on("mousedown",this._addDragHandler),a.on("touchstart",this._addDragHandler)):(a.off("mousedown",this._addDragHandler),a.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(r){return this._rotation=r||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(r){return this._rotationAlignment=r||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment==="auto"||this._rotationAlignment==="horizon"&&this._map&&!this._map._showingGlobe()?"viewport":this._rotationAlignment}setPitchAlignment(r){return this._pitchAlignment=r||"auto",this._update(),this}getPitchAlignment(){return this._pitchAlignment==="auto"?this.getRotationAlignment():this._pitchAlignment}setOccludedOpacity(r){return this._occludedOpacity=r||.2,this._update(),this}getOccludedOpacity(){return this._occludedOpacity}}const Ru={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},ku=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Ou(u=new s.P(0,0),r="bottom"){if(typeof u=="number"){const a=Math.round(Math.sqrt(.5*Math.pow(u,2)));switch(r){case"top":return new s.P(0,u);case"top-left":return new s.P(a,a);case"top-right":return new s.P(-a,a);case"bottom":return new s.P(0,-u);case"bottom-left":return new s.P(a,-a);case"bottom-right":return new s.P(-a,-a);case"left":return new s.P(u,0);case"right":return new s.P(-u,0)}return new s.P(0,0)}return u instanceof s.P||Array.isArray(u)?s.P.convert(u):s.P.convert(u[r]||[0,0])}class ds{constructor(r){this.jumpTo(r)}getValue(r){if(r<=this._startTime)return this._start;if(r>=this._endTime)return this._end;const a=s.b9((r-this._startTime)/(this._endTime-this._startTime));return this._start*(1-a)+this._end*a}isEasing(r){return r>=this._startTime&&r<=this._endTime}jumpTo(r){this._startTime=-1/0,this._endTime=-1/0,this._start=r,this._end=r}easeTo(r,a,h){this._start=this.getValue(a),this._end=r,this._startTime=a,this._endTime=a+h}}const _d={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","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 gd{registerParameter(){}registerButton(){}registerBinding(){}refreshUI(){}}const yd={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,maxTileC
2228acheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1},Bu={showCompass:!0,showZoom:!0,visualizePitch:!1};class _o{constructor(r,a,h=!1){this._clickTolerance=10,this.element=a,this.mouseRotate=new wu({clickTolerance:r.dragRotate._mouseRotate._clickTolerance}),this.map=r,h&&(this.mousePitch=new Tu({clickTolerance:r.dragRotate._mousePitch._clickTolerance})),s.bp(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),a.addEventListener("mousedown",this.mousedown),a.addEventListener("touchstart",this.touchstart,{passive:!1}),a.addEventListener("touchmove",this.touchmove),a.addEventListener("touchend",this.touchend),a.addEventListener("touchcancel",this.reset)}down(r,a){this.mouseRotate.mousedown(r,a),this.mousePitch&&this.mousePitch.mousedown(r,a),$a()}move(r,a){const h=this.map,f=this.mouseRotate.mousemoveWindow(r,a),m=f&&f.bearingDelta;if(m&&h.setBearing(h.getBearing()+m),this.mousePitch){const g=this.mousePitch.mousemoveWindow(r,a),x=g&&g.pitchDelta;x&&h.setPitch(h.getPitch()+x)}}off(){const r=this.element;r.removeEventListener("mousedown",this.mousedown),r.removeEventListener("touchstart",this.touchstart,{passive:!1}),r.removeEventListener("touchmove",this.touchmove),r.removeEventListener("touchend",this.touchend),r.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){Wa(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(r){this.down(s.W({},r,{ctrlKey:!0,preventDefault:()=>r.preventDefault()}),mi(this.element,r)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(r){this.move(r,mi(this.element,r))}mouseup(r){this.mouseRotate.mouseupWindow(r),this.mousePitch&&this.mousePitch.mouseupWindow(r),this.offTemp()}touchstart(r){r.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=qr(this.element,r.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>r.preventDefault()},this._startPos))}touchmove(r){r.targetTouches.length!==1?this.reset():(this._lastPos=qr(this.element,r.targetTouches)[0],this.move({preventDefault:()=>r.preventDefault()},this._lastPos))}touchend(r){r.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()}}const xd={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0,showUserHeading:!1},go={maxWidth:100,unit:"metric"},vd={kilometer:"km",meter:"m",mile:"mi",foot:"ft","nautical-mile":"nm"};return{version:s.dt,supported:Ir,setRTLTextPlugin:s.dv,getRTLTextPluginStatus:s.dw,Map:class extends hs{constructor(u){s.dc.mark(s.dd.create);const r=u;if((u=s.W({}
2228,yd,u)).minZoom!=null&&u.maxZoom!=null&&u.minZoom>u.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(u.minPitch!=null&&u.maxPitch!=null&&u.minPitch>u.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(u.minPitch!=null&&u.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(u.maxPitch!=null&&u.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(u.antialias&&s.de(window)&&(u.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 vi(u.minZoom,u.maxZoom,u.minPitch,u.maxPitch,u.renderWorldCopies),u),this._repaint=!!u.repaint,this._interactive=u.interactive,this._minTileCacheSize=u.minTileCacheSize,this._maxTileCacheSize=u.maxTileCacheSize,this._failIfMajorPerformanceCaveat=u.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=u.preserveDrawingBuffer,this._antialias=u.antialias,this._trackResize=u.trackResize,this._bearingSnap=u.bearingSnap,this._refreshExpiredTiles=u.refreshExpiredTiles,this._fadeDuration=u.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=u.crossSourceCollisions,this._collectResourceTiming=u.collectResourceTiming,this._language=this._parseLanguage(u.language),this._worldview=u.worldview,this._renderTaskQueue=new fd,this._domRenderTaskQueue=new fd,this._controls=[],this._markers=[],this._popups=[],this._mapId=s.df(),this._locale=s.W({},_d,u.locale),this._clickTolerance=u.clickTolerance,this._cooperativeGestures=u.cooperativeGestures,this._performanceMetricsCollection=u.performanceMetricsCollection,this._tessellationStep=u.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new ds(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._lastDirtyFrameId=0,this._requestManager=new s.dg(u.transformRequest,u.accessToken,u.testMode),this._silenceAuthErrors=!!u.testMode,this._contextCreateOptions=u.contextCreateOptions?{...u.contextCreateOptions}:{},typeof u.container=="string"){const a=document.getElementById(u.container);if(!a)throw new Error(`Container '${u.container.toString()}' not found.`);this._container=a}else{if(!(u.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=u.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."),u.maxBounds&&this.setMaxBounds(u.maxBounds),s.bp(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._tp||(this._tp=new gd),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._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 hd(this,u),this._localFontFamily=u.localFontFamily,this._localIdeographFontFamily=u.localIdeographFontFamily,(u.style||!u.testMode)&&this.setStyle(u.style||s.d8.DEFAULT_STYLE,{config:u.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),u.projection&&this.setProjection(u.projection),u.hash&&(this._hash=new rd(typeof u.hash=="string"&&u.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){r.center==null&&r.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:u.center,zoom:u.zoom,bearing:u.bearing,pitch:u.pitch});const a=u.bounds;a&&(this.resize(),this.fitBounds(a,s.W({},u.fitBoundsOptions,{duration:0})))}this.resize(),u.attributionControl&&this.addControl(new dd({customAttribution:u.customAttribution}
vendor: 4,497 bytes, line 2228
2228)),this._logoControl=new pd,this.addControl(this._logoControl,u.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent()}),this.on("data",a=>{this._update(a.dataType==="style"),this.fire(new s.f(`${a.dataType}data`,a))}),this.on("dataloading",a=>{this.fire(new s.f(`${a.dataType}dataloading`,a))})}_getMapId(){return this._mapId}addControl(u,r){if(r===void 0&&(r=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new s.d(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const a=u.onAdd(this);this._controls.push(u);const h=this._controlPositions[r];return r.indexOf("bottom")!==-1?h.insertBefore(a,h.firstChild):h.appendChild(a),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new s.d(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const r=this._controls.indexOf(u);return r>-1&&this._controls.splice(r,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(u){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 r=!this._moving;return r&&this.fire(new s.f("movestart",u)).fire(new s.f("move",u)),this.fire(new s.f("resize",u)),r&&this.fire(new s.f("moveend",u)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(u){return this.transform.setMaxBounds(s.ai.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.minZoom=u,this._update(),this.getZoom()<u?this.setZoom(u):this.fire(new s.f("zoomstart")).fire(new s.f("zoom")).fire(new s.f("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.maxZoom=u,this._update(),this.getZoom()>u?this.setZoom(u):this.fire(new s.f("zoomstart")).fire(new s.f("zoom")).fire(new s.f("zoomend")),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.minPitch=u,this._update(),this.getPitch()<u?this.setPitch(u):this.fire(new s.f("pitchstart")).fire(new s.f("pitch")).fire(new s.f("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(u>=this.transform.minPitch)return this.transform.maxPitch=u,this._update(),this.getPitch()>u?this.setPitch(u):this.fire(new s.f("pitchstart")).fire(new s.f("pitch")).fire(new s.f("pitchend")),this;throw new Error("maxPitch must be greater than or equal to minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.renderWorldCopies=u,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(u){return u==="auto"?navigator.language:Array.isArray(u)?u.length===0?void 0:u.map(r=>r==="auto"?navigator.language:r):u}setLanguage(u){const r=this._parseLanguage(u);if(!this.style||r===this._language)return this;this._language=r,this.style.reloadSources();for(const a of this._controls)a._setLanguage&&a._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(u){return this.style&&u!==this._worldview?(this._worldview=u,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(u){return this._lazyInitEmptyStyle(),u?typeof u=="string"&&(u={name:u}
2228):u=null,this._useExplicitProjection=!!u,this._prioritizeAndUpdateProjection(u,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const u=this.transform,r=u.projection.name;let a;r==="globe"&&u.zoom>=s.aU?(u.setMercatorFromTransition(),a=!0):r==="mercator"&&u.zoom<s.aU&&(u.setProjection({name:"globe"}),a=!0),a&&(this.style.applyProjectionUpdate(),this.style._forceSymbolLayerUpdate())}_prioritizeAndUpdateProjection(u,r){return this._updateProjection(u||r||{name:"mercator"})}_updateProjection(u){let r;return r=u.name==="globe"&&this.transform.zoom>=s.aU?this.transform.setMercatorFromTransition():this.transform.setProjection(u),this.style.applyProjectionUpdate(),r&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(u){return this.transform.locationPoint3D(s.aI.convert(u))}unproject(u){return this.transform.pointLocation3D(s.P.convert(u))}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(u,r,a){if(u==="mouseenter"||u==="mouseover"){let h=!1;const f=g=>{const x=r.filter(T=>this.getLayer(T)),w=x.length?this.queryRenderedFeatures(g.point,{layers:x}):[];w.length?h||(h=!0,a.call(this,new or(u,this,g.originalEvent,{features:w}))):h=!1},m=()=>{h=!1};return{layers:new Set(r),listener:a,delegates:{mousemove:f,mouseout:m}}}if(u==="mouseleave"||u==="mouseout"){let h=!1;const f=g=>{const x=r.filter(w=>this.getLayer(w));(x.length?this.queryRenderedFeatures(g.point,{layers:x}):[]).length?h=!0:h&&(h=!1,a.call(this,new or(u,this,g.originalEvent)))},m=g=>{h&&(h=!1,a.call(this,new or(u,this,g.originalEvent)))};return{layers:new Set(r),listener:a,delegates:{mousemove:f,mouseout:m}}}{const h=f=>{const m=r.filter(x=>this.getLayer(x)),g=m.length?this.queryRenderedFeatures(f.point,{layers:m}):[];g.length&&(f.features=g,a.call(this,f),delete f.features)};return{layers:new Set(r),listener:a,delegates:{[u]:h}}}}on(u,r,a){if(typeof r=="function"||a===void 0)return super.on(u,r);if(Array.isArray(r)||(r=[r]),r){for(const f of r)if(!this._isValidId(f))return this}const h=this._createDelegatedListener(u,r,a);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(h);for(const f in h.delegates)this.on(f,h.delegates[f]);return this}once(u,r,a){if(typeof r=="function"||a===void 0)return super.once(u,r);if(Array.isArray(r)||(r=[r]),r){for(const f of r)if(!this._isValidId(f))return this}const h=this._createDelegatedListener(u,r,a);for(const f in h.delegates)this.once(f,h.delegates[f]);return this}off(u,r,a){if(typeof r=="function"||a===void 0)return super.off(u,r);const h=new Set(Array.isArray(r)?r:[r]);for(const g of h)if(!this._isValidId(g))return this;const f=(g,x)=>{if(g.size!==x.size)return!1;for(const w of g)if(!x.has(w))return!1;return!0},m=this._delegatedListeners?this._delegatedListeners[u]:void 0;return m&&(g=>{for(let x=0;x<g.length;x++){const w=g[x];if(w.listener===a&&f(w.layers,h)){for(const T in w.delegates)this.off(T,w.delegates[T]);return g.splice(x,1),this}}})(m),this}queryRenderedFeatures(u,r){if(!this.style)return[];if(r!==void 0||u===void 0||u instanceof s.P||Array.isArray(u)||(r=u,u=void 0),u=u||[[0,0],[this.transform.width,this.transform.height]],(r=r||{}).layers&&Array.isArray(r.layers)){for(const a of r.layers)if(!this._isValidId(a))return[]}return this.style.queryRenderedFeatures(u,r,this.transform)}querySourceFeatures(u,r){return this._isValidId(u)?this.style.querySourceFeatures(u,r):[]}isPointOnSurface(u){const{name:r}=this.transform.projection;return r!=="globe"&&r!=="mercator"&&s.w(`${r} projection does not support isPointOnSurface, this API may behave unexpectedly.`),this.transform.isPointOnSurface(s.P.convert(u))}setStyle(u,r){return r=s.W({},{localIdeographFontFamily:this._localIdeographFontFamily,localFontFamily:this._localFontFamily},r),this.style&&u&&r.diff!==!1&&r.localFontFamily===this._localFontFamily&&r.localIdeographFontFamily===this._localIdeographFontFamily&&!r.config?(this.style._diffStyle(u,(a,h)=>{a?(s.w(`Unable to perform style diff: ${String(a.message||a.error||a)}. Rebuilding the style from scratch.`),this._updateStyle(u,r)):h&&this._update(!0)},()=>{this._postStyleLoadEvent()}),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._localFontFamily=r.localFontFamily,this._updateStyle(u,r))}_getUIString(u){const r=this._locale[u];if(r==null)throw new Error(`Missing UI string '${u}'`);return r}_updateStyle(u,r){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),u){const a=s.W({},r);r&&r.config&&(a.initialConfig=r.config,delete a.config),this.style=new Or(this,a).load(u),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Or(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(u){return u==null?(this.fire(new s.d(new Error("IDs can't be empty."))),!1):!s.cV(u)||(this.fire(new s.d(new Error(`IDs can't 
2228contain special symbols: "${u}".`))),!1)}addSource(u,r){return this._isValidId(u)?(this._lazyInitEmptyStyle(),this.style.addSource(u,r),this._update(!0)):this}isSourceLoaded(u){return!!this._isValidId(u)&&!!this.style&&this.style._isSourceCacheLoaded(u)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(u,r,a){this._lazyInitEmptyStyle(),this.style.addSourceType(u,r,a)}removeSource(u){return this._isValidId(u)?(this.style.removeSource(u),this._updateTerrain(),this._update(!0)):this}getSource(u){return this._isValidId(u)?this.style.getOwnSource(u):null}addImage(u,r,{pixelRatio:a=1,sdf:h=!1,stretchX:f,stretchY:m,content:g}={}){if(this._lazyInitEmptyStyle(),r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap){const{width:x,height:w,data:T}=s.e.getImageData(r);this.style.addImage(u,{data:new s.i({width:x,height:w},T),pixelRatio:a,stretchX:f,stretchY:m,content:g,sdf:h,version:0})}else if(r.width===void 0||r.height===void 0)this.fire(new s.d(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:w}=r,T=r;this.style.addImage(u,{data:new s.i({width:x,height:w},new Uint8Array(T.data)),pixelRatio:a,stretchX:f,stretchY:m,content:g,sdf:h,version:0,userImage:T}),T.onAdd&&T.onAdd(this,u)}}updateImage(u,r){this._lazyInitEmptyStyle();const a=this.style.getImage(u);if(!a)return void this.fire(new s.d(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const h=r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap?s.e.getImageData(r):r,{width:f,height:m,data:g}=h;if(f===void 0||m===void 0)return void this.fire(new s.d(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(f!==a.data.width||m!==a.data.height)return void this.fire(new s.d(new Error(`The width and height of the updated image (${f}, ${m})
2229                must be that same as the previous version of the image
2230                (${a.data.width}, ${a.data.height})`)));const x=!(r instanceof HTMLImageElement||ImageBitmap&&r instanceof ImageBitmap);a.data.replace(g,x),this.style.updateImage(u,a)}hasImage(u){return u?!!this.style&&!!this.style.getImage(u):(this.fire(new s.d(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u,r){s.h(this._requestManager.transformRequest(u,s.R.Image),(a,h)=>{r(a,h instanceof HTMLImageElement?s.e.getImageData(h):h)})}listImages(){return this.style.listImages()}addModel(u,r){this._lazyInitEmptyStyle(),this.style.addModel(u,r)}hasModel(u){return u?this.style.hasModel(u):(this.fire(new s.d(new Error("Missing required model id"))),!1)}removeModel(u){this.style.removeModel(u)}listModels(){return this.style.listModels()}addLayer(u,r){return this._isValidId(u.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(u,r),this._update(!0)):this}getSlot(u){const r=this.getLayer(u);return r&&r.slot||null}setSlot(u,r){return this.style.setSlot(u,r),this.style.mergeLayers(),this._update(!0)}addImport(u,r){return this.style.addImport(u,r),this}updateImport(u,r){return typeof r!="string"&&r.id!==u?(this.removeImport(u),this.addImport(r)):(this.style.updateImport(u,r),this._update(!0))}removeImport(u){return this.style.removeImport(u),this}moveImport(u,r){return this.style.moveImport(u,r),this._update(!0)}moveLayer(u,r){return this._isValidId(u)?(this.style.moveLayer(u,r),this._update(!0)):this}removeLayer(u){return this._isValidId(u)?(this.style.removeLayer(u),this._update(!0)):this}getLayer(u){if(!this._isValidId(u))return null;const r=this.style.getOwnLayer(u);return r?r.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(u,r,a){return this._isValidId(u)?(this.style.setLayerZoomRange(u,r,a),this._update(!0)):this}setFilter(u,r,a={}){return this._isValidId(u)?(this.style.setFilter(u,r,a),this._update(!0)):this}getFilter(u){return this._isValidId(u)?this.style.getFilter(u):null}setPaintProperty(u,r,a,h={}){return this._isValidId(u)?(this.style.setPaintProperty(u,r,a,h),this._update(!0)):this}getPaintProperty(u,r){return this._isValidId(u)?this.style.getPaintProperty(u,r):null}setLayoutProperty(u,r,a,h={}){return this._isValidId(u)?(this.style.setLayoutProperty(u,r,a,h),this._update(!0)):this}getLayoutProperty(u,r){return this._isValidId(u)?this.style.getLayoutProperty(u,r):null}getSchema(u){return this.style.getSchema(u)}setSchema(u,r){return this.style.setSchema(u,r),this._update(!0)}getConfig(u){return this.style.getConfig(u)}setConfig(u,r){return this.style.setConfig(u,r),this._update(!0)}getConfigProperty(u,r){return this.style.getConfigProperty(u,r)}setConfigProperty(u,r,a){return this.style.setConfigProperty(u,r,a),this._update(!0)}setLights(u){if(this._lazyInitEmptyStyle(),u&&u.length===1&&u[0].type==="flat"){const r=u[0];r.properties?this.style.setFlatLight(r.properties,r.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(u),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const u=this.style.getLights()||[];return u.length===0&&u.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),u}setLight(u,r={}
vendor: 5,613 bytes, line 2230
2230){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:u}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(u){return this._lazyInitEmptyStyle(),!u&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(u),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(u){return this._lazyInitEmptyStyle(),this.style.setFog(u),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setColorTheme(u){return this._lazyInitEmptyStyle(),this.style.setColorTheme(u),this._update(!0)}setCamera(u){return this.style.setCamera(u),this._triggerCameraUpdate(u)}_triggerCameraUpdate(u){return this._update(this.transform.setOrthographicProjectionAtLowPitch(u["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(u){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(s.aI.convert(u),this.transform):0}setFeatureState(u,r){return this._isValidId(u.source)?(this.style.setFeatureState(u,r),this._update()):this}removeFeatureState(u,r){return this._isValidId(u.source)?(this.style.removeFeatureState(u,r),this._update()):this}getFeatureState(u){return this._isValidId(u.source)?this.style.getFeatureState(u):null}_updateContainerDimensions(){if(!this._container)return;const u=this._container.getBoundingClientRect().width||400,r=this._container.getBoundingClientRect().height||300;let a,h,f,m=this._container;for(;m&&(!h||!f);){const g=window.getComputedStyle(m).transform;g&&g!=="none"&&(a=g.match(/matrix.*\((.+)\)/)[1].split(", "),a[0]&&a[0]!=="0"&&a[0]!=="1"&&(h=a[0]),a[3]&&a[3]!=="0"&&a[3]!=="1"&&(f=a[3])),m=m.parentElement}this._containerWidth=h?Math.abs(u/h):u,this._containerHeight=f?Math.abs(r/f):r}_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 u=this._container;u.classList.add("mapboxgl-map"),(this._missingCSSCanary=Dt("div","mapboxgl-canary",u)).style.visibility="hidden",this._detectMissingCSS();const r=this._canvasContainer=Dt("div","mapboxgl-canvas-container",u);this._canvas=Dt("canvas","mapboxgl-canvas",r),this._interactive&&(r.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 a=this._controlContainer=Dt("div","mapboxgl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=Dt("div",`mapboxgl-ctrl-${f}`,a)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,r){const a=s.e.devicePixelRatio||1;this._canvas.width=a*Math.ceil(u),this._canvas.height=a*Math.ceil(r),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${r}px`}_addMarker(u){this._markers.push(u)}_removeMarker(u){const r=this._markers.indexOf(u);r!==-1&&this._markers.splice(r,1)}_addPopup(u){this._popups.push(u)}_removePopup(u){const r=this._popups.indexOf(u);r!==-1&&this._popups.splice(r,1)}_setupPainter(){const u=s.W({},Ir.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),r=this._canvas.getContext("webgl2",u);r?(s.dh(r,!0),this.painter=new Vp(r,this._contextCreateOptions,this.transform,this._tp),this.on("data",a=>{a.dataType==="source"&&this.painter.setTileLoadedFlag(!0)}),s.di.testSupport(r)):this.fire(new s.d(new Error("Failed to initialize WebGL")))}_contextLost(u){u.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new s.f("webglcontextlost",{originalEvent:u}))}_contextRestored(u){this._setupPainter(),this.resize(),this._update(),this.fire(new s.f("webglcontextrestored",{originalEvent:u}))}_onMapScroll(u){if(u.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty&&!this._occlusionOpacityChanged&&this._occlusionCriteriaSatisfied()}_update(u){return this.style?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_requestDomTask(u){!this.loaded()||this.loaded()&&!this.isMoving()?u():this._domRenderTaskQueue.add(u)}_render(u){let r;this.fire(new s.f("renderstart")),++this._frameId;const a=this.painter.context.extTimerQuery,h=s.e.now(),f=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(r=f.createQuery(),f.beginQuery(a.TIME_ELAPSED_EXT,r)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&
2230(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(u),this._domRenderTaskQueue.run(u),this._removed)return;this._updateProjectionTransition();const m=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const T=this.transform.zoom,M=this.transform.pitch,A=s.e.now(),P=new s.X(T,{now:A,fadeDuration:m,pitch:M,transition:this.style.transition});this.style.update(P)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let g=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),g=this._updateAverageElevation(h),this.style.updateSources(this.transform),this._forceMarkerAndPopupUpdate()):g=this._updateAverageElevation(h);const x=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,m,this._crossSourceCollisions,this.painter.replacementSource);if(x&&(this._placementDirty=x.needsRerender,this._occlusionOpacityChanged=x.occlusionQueryBasedOpacityChanged),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:m,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.f("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,s.dc.mark(s.dd.load),this.fire(new s.f("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),r){const T=s.e.now()-h;f.endQuery(a.TIME_ELAPSED_EXT),setTimeout(()=>{const M=f.getQueryParameter(r,f.QUERY_RESULT)/1e6;f.deleteQuery(r),this.fire(new s.f("gpu-timing-frame",{cpuTime:T,gpuTime:M}))},50)}if(this.listens("gpu-timing-layer")){const T=this.painter.collectGpuTimers();setTimeout(()=>{const M=this.painter.queryGpuTimers(T);this.fire(new s.f("gpu-timing-layer",{layerTimes:M}))},50)}if(this.listens("gpu-timing-deferred-render")){const T=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const M=this.painter.queryGpuTimeDeferredRender(T);this.fire(new s.f("gpu-timing-deferred-render",{gpuTime:M}))},50)}const w=this._sourcesDirty||this._styleDirty||this._placementDirty||this._occlusionOpacityChanged||g;if((this._sourcesDirty||this._styleDirty||g||this._occlusionOpacityChanged)&&(this._lastDirtyFrameId=this._frameId),w||this._repaint||!this._occlusionCriteriaSatisfied())this.triggerRepaint();else{const T=!this.isMoving()&&this.loaded();if(T&&(g=this._updateAverageElevation(h,!0)),g)this.triggerRepaint();else if(this._triggerFrame(!1),T&&(this.fire(new s.f("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const M=this._calculateSpeedIndex();this.fire(new s.f("speedindexcompleted",{speedIndex:M})),this.speedIndexTiming=!1}}this._loaded&&!this._fullyLoaded&&!w&&this._occlusionCriteriaSatisfied()&&(this._fullyLoaded=!0,s.dc.mark(s.dd.fullLoad),this._performanceMetricsCollection&&s.dj(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(u){for(const r of this._markers)u&&!this.getRenderWorldCopies()&&(r._lngLat=r._lngLat.wrap()),r._update();for(const r of this._popups)!u||this.getRenderWorldCopies()||r._trackPointer||(r._lngLat=r._lngLat.wrap()),r._update()}_updateAverageElevation(u,r=!1){const a=f=>(this.transform.averageElevation=f,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&a(0);const h=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(h||(r||u-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(u)){const f=this.transform.averageElevation;let m=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(m)?m=0:this._averageElevationLastSampledAt=u;const g=Math.abs(f-m);
2230if(g>1){if(this._isInitialLoad||h)return this._averageElevation.jumpTo(m),a(m);this._averageElevation.easeTo(m,u,300)}else if(g>1e-4)return this._averageElevation.jumpTo(m),a(m)}return!!this._averageElevation.isEasing(u)&&a(this._averageElevation.getValue(u))}_authenticate(){s.dk(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,u=>{if(u&&(u.message===s.dl||u.status===401)){const r=this.painter.context.gl;s.dh(r,!1),this._logoControl instanceof pd&&this._logoControl._updateLogo(),r&&r.clear(r.DEPTH_BUFFER_BIT|r.COLOR_BUFFER_BIT|r.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new s.d(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/")))}}),s.dm(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&s.dn(this._requestManager._customAccessToken,{map:this,skuToken:this._requestManager._skuToken,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_updateTerrain(){const u=this._isDragging();this.painter.updateTerrain(this.style,u)}_calculateSpeedIndex(){const u=this.painter.canvasCopy(),r=this.painter.getCanvasCopiesAndTimestamps();r.timeStamps.push(performance.now());const a=this.painter.context.gl,h=a.createFramebuffer();function f(m){a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,m,0);const g=new Uint8Array(a.drawingBufferWidth*a.drawingBufferHeight*4);return a.readPixels(0,0,a.drawingBufferWidth,a.drawingBufferHeight,a.RGBA,a.UNSIGNED_BYTE,g),g}return a.bindFramebuffer(a.FRAMEBUFFER,h),this._canvasPixelComparison(f(u),r.canvasCopies.map(f),r.timeStamps)}_canvasPixelComparison(u,r,a){let h=a[1]-a[0];const f=u.length/4;for(let m=0;m<r.length;m++){const g=r[m];let x=0;for(let w=0;w<g.length;w+=4)g[w]===u[w]&&g[w+1]===u[w+1]&&g[w+2]===u[w+2]&&g[w+3]===u[w+3]&&(x+=1);h+=(a[m+2]-a[m+1])*(1-x/f)}return h}remove(){this._hash&&this._hash.remove();for(const r of this._controls)r.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this._domRenderTaskQueue.clear(),this.style&&this.style.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 u=this.painter.context.gl.getExtension("WEBGL_lose_context");u&&u.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),s.dp(this.painter.context.gl),s.dq.remove(),s.dr.remove(),this._removed=!0,this.fire(new s.f("remove"))}triggerRepaint(){this._triggerFrame(!0)}_triggerFrame(u){this._renderNextFrame=this._renderNextFrame||u,this.style&&!this._frame&&(this._frame=s.e.frame(r=>{const a=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,a&&this._render(r)}))}_preloadTiles(u){const r=this.style?this.style.getSourceCaches():[];return s.ds(r,(a,h)=>a._preloadTiles(u,h),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(u){this._trackResize&&this.resize({originalEvent:u})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._tp.refreshUI(),this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(u){this._showParseStatus!==u&&(this._showParseStatus=u,this._tp.refreshUI(),this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(u){this._showTerrainWireframe!==u&&(this._showTerrainWireframe=u,this._tp.refreshUI(),this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(u){this._showLayers2DWireframe!==u&&(this._showLayers2DWireframe=u,this._tp.refreshUI(),this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(u){this._showLayers3DWireframe!==u&&(this._showLayers3DWireframe=u,this._tp.refreshUI(),this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(u){this._speedIndexTiming!==u&&(this._speedIndexTiming=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._tp.refreshUI(),this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,this._tp.refreshUI(),u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._tp.refreshUI(),this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this._tp.refreshUI(),this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(u){this._showTileAABBs!==u&&(this._showTileAABBs=u,this._tp.refreshUI(),u&&this._update())}_setCacheLimits(u,r){s.du(u,r)}_occlusionCriteriaSatisfied(){const u=this.style&&(this.style.has3DLayers()||this.style.terrain&&!this.style.disableElevatedTerrain);return!(this.style&&this.style.hasSymbolLayers()&&u&&this.painter)||this._frameId-this._lastDirtyFrameId>5+2*this.painter.symbolParams.occlusionQueryFrameWindow}get version(){return s.dt}},NavigationControl:class{constructor(u={}){this.options=s.W({},Bu,u),this._container=Dt("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",r=>r.preventDefault()),this.options.showZoom&&(s.bp(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("mapboxgl-ctrl-zoom-in",r=>{this._map&&this._map.zoomIn({},{originalEvent:r})}),Dt("span","mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("mapboxgl-ctrl-zoom-out",r=>{this._map&&this._map.zoomOut({},{originalEvent:r})}),Dt("span","mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(s.bp(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-compass",r=>{const a=this._map;a&&(this.options.visualizePitch?a.resetNorthPitch({},{originalEvent:r}):a.resetNorth({},{originalEvent:r}))}),this._compassIcon=Dt("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const u=this._map;if(!u)return;
vendor: 4,341 bytes, line 2230
2230const r=u.getZoom(),a=r===u.getMaxZoom(),h=r===u.getMinZoom();this._zoomInButton.disabled=a,this._zoomOutButton.disabled=h,this._zoomInButton.setAttribute("aria-disabled",a.toString()),this._zoomOutButton.setAttribute("aria-disabled",h.toString())}_rotateCompassArrow(){const u=this._map;if(!u)return;const r=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(u.transform.pitch*(Math.PI/180)),.5)}) rotateX(${u.transform.pitch}deg) rotateZ(${u.transform.angle*(180/Math.PI)}deg)`:`rotate(${u.transform.angle*(180/Math.PI)}deg)`;u._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=r)})}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),u.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&u.on("pitch",this._rotateCompassArrow),u.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new _o(u,this._compass,this.options.visualizePitch)),this._container}onRemove(){const u=this._map;u&&(this._container.remove(),this.options.showZoom&&u.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&u.off("pitch",this._rotateCompassArrow),u.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(u,r){const a=Dt("button",u,this._container);return a.type="button",a.addEventListener("click",r),a}_setButtonTitle(u,r){if(!this._map)return;const a=this._map._getUIString(`NavigationControl.${r}`);u.setAttribute("aria-label",a),u.firstElementChild&&u.firstElementChild.setAttribute("title",a)}},GeolocateControl:class extends s.E{constructor(u={}){super();const r=navigator.geolocation;this.options=s.W({geolocation:r},xd,u),s.bp(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=id(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(u){return this._map=u,this._container=Dt("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(u){const r=(a=!!this.options.geolocation)=>{this._supportsGeolocation=a,u(a)};this._supportsGeolocation!==void 0?u(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(a=>r(a.state!=="denied")).catch(()=>r()):r()}_isOutOfMapMaxBounds(u){const r=this._map.getMaxBounds(),a=u.coords;return!!r&&(a.longitude<r.getWest()||a.longitude>r.getEast()||a.latitude<r.getSouth()||a.latitude>r.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(u){if(this._map){if(this._isOutOfMapMaxBounds(u))return this._setErrorState(),this.fire(new s.f("outofmaxbounds",u)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=u,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_E
2230RROR":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(u),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(u),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new s.f("geolocate",u)),this._finish()}}_updateCamera(u){const r=new s.aI(u.coords.longitude,u.coords.latitude),a=u.coords.accuracy,h=this._map.getBearing(),f=s.W({bearing:h},this.options.fitBoundsOptions);this._map.fitBounds(r.toBounds(a),f,{geolocateSource:!0})}_updateMarker(u){if(u){const r=new s.aI(u.coords.longitude,u.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=u.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const u=this._map.transform,r=s.ax(1,u._center.lat)*u.worldSize,a=Math.ceil(2*this._accuracy*r);this._circleElement.style.width=`${a}px`,this._circleElement.style.height=`${a}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_updateMarkerRotation(){this._userLocationDotMarker&&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(u){if(this._map){if(this.options.trackUserLocation)if(u.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 r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(u.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.f("error",u)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(u){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=Dt("button","mapboxgl-ctrl-geolocate",this._container),Dt("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",u===!1){s.w("Geolocation support is not available so the GeolocateControl will be disabled.");const r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}else{const r=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.setAttribute("aria-label",r),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",r)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","fal
2230se"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=Dt("div","mapboxgl-user-location"),this._dotElement.appendChild(Dt("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(Dt("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new Lu({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=Dt("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Lu({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",r=>{r.geolocateSource||this._watchState!=="ACTIVE_LOCK"||r.originalEvent&&r.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.f("trackuserlocationend")))})}}_onDeviceOrientation(u){this._userLocationDotMarker&&(u.webkitCompassHeading?this._heading=u.webkitCompassHeading:u.absolute===!0&&(this._heading=-1*u.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.f("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.f("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.f("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 u;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(u={maximumAge:6e5,timeout:0},this._noTimeout=!0):(u=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,u),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const u=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(r=>{r==="granted"&&u()}).catch(console.error):u()}_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
2230se"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:dd,ScaleControl:class{constructor(u={}){this.options=s.W({},go,u),this._isNumberFormatSupported=function(){try{return new Intl.NumberFormat("en",{style:"unit",unitDisplay:"short",unit:"meter"}),!0}catch{return!1}}(),s.bp(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const u=this.options.maxWidth||100,r=this._map,a=r._containerHeight/2,h=r._containerWidth/2-u/2,f=r.unproject([h,a]),m=r.unproject([h+u,a]),g=f.distanceTo(m);if(this.options.unit==="imperial"){const x=3.2808*g;x>5280?this._setScale(u,x/5280,"mile"):this._setScale(u,x,"foot")}else this.options.unit==="nautical"?this._setScale(u,g/1852,"nautical-mile"):g>=1e3?this._setScale(u,g/1e3,"kilometer"):this._setScale(u,g,"meter")}_setScale(u,r,a){this._map._requestDomTask(()=>{const h=function(m){const g=Math.pow(10,`${Math.floor(m)}`.length-1);let x=m/g;return x=x>=10?10:x>=5?5:x>=3?3:x>=2?2:x>=1?1:function(w){const T=Math.pow(10,Math.ceil(-Math.log(w)/Math.LN10));return Math.round(w*T)/T}(x),g*x}(r),f=h/r;this._container.innerHTML=this._isNumberFormatSupported&&a!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:a}).format(h):`${h}&nbsp;${vd[a]}`,this._container.style.width=u*f+"px"})}onAdd(u){return this._map=u,this._language=u.getLanguage(),this._container=Dt("div","mapboxgl-ctrl mapboxgl-ctrl-scale",u.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(u){this._language=u,this._update()}setUnit(u){this.options.unit=u,this._update()}},FullscreenControl:class{constructor(u={}){this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:s.w("Full screen control 'container' must be a DOM element.")),s.bp(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onwebkitfullscreenchange"in document&&(this._fullscreenchange="webkitfullscreenchange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=Dt("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 u=this._fullscreenButton=Dt("button","mapboxgl-ctrl-fullscreen",this._controlContainer);Dt("span","mapboxgl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",u)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},Popup:class extends s.E{constructor(u){super(),this.options=s.W(Object.create(Ru),u),s.bp(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(u&&u.className?u.className.trim().split(/\s+/):[])}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&u.on("preclick",this._onClose),this.options.closeOnMove&&u.on("move",this._onClose),u.on("remove",this.remove),this._update(),u._addPopup(this),this._focusFirstElement(),this._trackPointer?(u.on("mousemove",this._onMouseEvent),u.on("mouseup",this._onMouseEvent),u._canvasContainer.classList.add("mapboxgl-track-pointer")):u.on("move",this._update),this.fire(new s.f("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const u=this._map;return u&&(u.off("move",this._update),u.off("move",this._onClose),u.off("preclick",this._onClose),u.off("click",this._onClose),u.off("remove",this.remove),u.off("mousemove",this._onMouseEvent),u.off("mouseup",this._onMouseEvent),u.off("drag",this._onMouseEvent),u._canvasContainer&&u._canvasContainer.classList.remove("mapboxgl-track-pointer"),u._removePopup(this),this._map=void 0),this.fire(new s.f("close")),this}getLngLat(){return this._lngLat}setLngLat(u){this._lngLat=s.aI.convert(u),this._pos=null,this._trackPointer=!1,this._update();const r=this._map;return r&&(r.on("move",this._update),r.off("mousemove",this._onMouseEvent),r._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const u=this._map;return u&&(u.off("move",this._update),u.on("mousemove",this._onMouseEvent),u.on("drag",this._onMouseEvent),u._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const r=document.createDocumentFragment(),a=document.createElement("body");let h;for(a.innerHTML=u;h=a.firstChild,h;)r.appendChild(h);return this.setDOMContent(r)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){let r=this._content;if(r)for(;r.hasChildNodes();)r.firstChild&&r.removeChild(r.firstChild);else r=this._content=Dt("div","mapboxgl-popup-content",this._container||void 0);
vendor: 3,620 bytes, line 2230
2230if(r.appendChild(u),this.options.closeButton){const a=this._closeButton=Dt("button","mapboxgl-popup-close-button",r);a.type="button",a.setAttribute("aria-label","Close popup"),a.setAttribute("aria-hidden","true"),a.innerHTML="&#215;",a.addEventListener("click",this._onClose)}return this._update(),this._focusFirstElement(),this}addClassName(u){return this._classList.add(u),this._updateClassList(),this}removeClassName(u){return this._classList.delete(u),this._updateClassList(),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){let r;return this._classList.delete(u)?r=!1:(this._classList.add(u),r=!0),this._updateClassList(),r}_onMouseEvent(u){this._update(u.point)}_getAnchor(u){if(this.options.anchor)return this.options.anchor;const r=this._map,a=this._container,h=this._pos;if(!r||!a||!h)return"bottom";const f=a.offsetWidth,m=a.offsetHeight,g=h.x<f/2,x=h.x>r.transform.width-f/2;if(h.y+u<m)return g?"top-left":x?"top-right":"top";if(h.y>r.transform.height-m){if(g)return"bottom-left";if(x)return"bottom-right"}return g?"left":x?"right":"bottom"}_updateClassList(){const u=this._container;if(!u)return;const r=[...this._classList];r.push("mapboxgl-popup"),this._anchor&&r.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&r.push("mapboxgl-popup-track-pointer"),u.className=r.join(" ")}_update(u){const r=this._map,a=this._content;if(!r||!this._lngLat&&!this._trackPointer||!a)return;let h=this._container;if(h||(h=this._container=Dt("div","mapboxgl-popup",r.getContainer()),this._tip=Dt("div","mapboxgl-popup-tip",h),h.appendChild(a)),this.options.maxWidth&&h.style.maxWidth!==this.options.maxWidth&&(h.style.maxWidth=this.options.maxWidth),r.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=md(this._lngLat,this._pos,r.transform)),!this._trackPointer||u){const f=this._pos=this._trackPointer&&u instanceof s.P?u:r.project(this._lngLat),m=Ou(this.options.offset),g=this._anchor=this._getAnchor(m.y),x=Ou(this.options.offset,g),w=f.add(x).round();r._requestDomTask(()=>{this._container&&g&&(this._container.style.transform=`${Du[g]} translate(${w.x}px,${w.y}px)`)})}if(!this._marker&&r._showingGlobe()){const f=s.d9(r.transform,this._lngLat)?0:1;this._setOpacity(f)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(ku);u&&u.focus()}_onClose(){this.remove()}_setOpacity(u){this._container&&(this._container.style.opacity=`${u}`),this._content&&(this._content.style.pointerEvents=u?"auto":"none")}},Marker:Lu,Style:Or,LngLat:s.aI,LngLatBounds:s.ai,Point:s.P,MercatorCoordinate:s.Y,FreeCameraOptions:Ih,Evented:s.E,config:s.d8,prewarm:s.dx,clearPrewarmedResources:s.dy,get accessToken(){return s.d8.ACCESS_TOKEN},set accessToken(u){s.d8.ACCESS_TOKEN=u},get baseApiUrl(){return s.d8.API_URL},set baseApiUrl(u){s.d8.API_URL=u},get workerCount(){return s.dz.workerCount},set workerCount(u){s.dz.workerCount=u},get maxParallelImageRequests(){return s.d8.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(u){s.d8.MAX_PARALLEL_IMAGE_REQUESTS=u},clearStorage(u){s.dA(u)},get workerUrl(){return s.dB.workerUrl},set workerUrl(u){s.dB.workerUrl=u},get workerClass(){return s.dB.workerClass},set workerClass(u){s.dB.workerClass=u},get workerParams(){return s.dB.workerParams},set workerParams(u){s.dB.workerParams=u},get dracoUrl(){return s.dC()},set dracoUrl(u){s.dD(u)},get meshoptUrl(){return s.dE()},set meshoptUrl(u){s.dF(u)},setNow:s.e.setNow,restoreNow:s.e.restoreNow}});var _0=Cp;return _0})}(Ap)),Ap.exports}var pb=db();const _b=ub(pb);export{_b as m};

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.