@mappedin/mappedin-js 6.0.1-alpha.21 → 6.0.1-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/{GLTFExporter-CJKR5WGG.js → GLTFExporter-NT33W2ET.js} +1 -1
- package/lib/esm/{GLTFLoader-H7ZE3A4X.js → GLTFLoader-RJUUWS5M.js} +1 -1
- package/lib/esm/{PerformanceController-WFRTDYOP.js → PerformanceController-GBUIKYXX.js} +1 -1
- package/lib/esm/{browser-7NYRKP6F.js → browser-T57Q47WH.js} +1 -1
- package/lib/esm/{chunk-ZIBVJYLJ.js → chunk-CW6OSHJQ.js} +1 -1
- package/lib/esm/{chunk-2X6TZZIR.js → chunk-LUEOZOOD.js} +1 -1
- package/lib/esm/{chunk-IKFT423T.js → chunk-PEJPQGCC.js} +1 -1
- package/lib/esm/{chunk-AIIHKMIL.js → chunk-RQ5HBOUE.js} +1 -1
- package/lib/esm/index.d.ts +78 -29
- package/lib/esm/index.js +1 -1
- package/lib/esm/{outdoor-context-OKBFJPVG.js → outdoor-context-UGZG6ZZI.js} +1 -1
- package/lib/esm/{outdoor-context-v4-SVGMPV2P.js → outdoor-context-v4-TLIOCO74.js} +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as Lh,B as kh,C as yi,D as Dh,E as Fh,F as zh,G as $s,H as Js,I as G,J as ut,K as Re,L as kn,M as Bh,N as Rh,O as Dn,P as Oh,Q as Fn,R as Vh,S as Uh,T as Nh,a as be,b as l_,c as T,d as Xs,e as Ks,f as bh,g as Ft,h as vh,i as wh,j as Sh,k as me,l as fi,m as di,n as Ph,o as Th,p as Ih,q as Ah,r as Ae,s as Ch,t as Eh,u as An,v as Cn,w as En,x as Mh,y as Mn,z as Ln}from"./chunk-ZIBVJYLJ.js";import{a as f}from"./chunk-IKFT423T.js";import{a as u,e as te}from"./chunk-J5IUISYU.js";f();var zn={name:"@packages/outdoor-context",private:!0,description:"BSD licensed community fork of mapbox-gl, a WebGL interactive maps library",version:"3.2.0",main:"dist/maplibre-gl.js",style:"dist/maplibre-gl.css",license:"BSD-3-Clause",funding:"https://github.com/maplibre/maplibre-gl-js?sponsor=1",repository:{type:"git",url:"git://github.com/maplibre/maplibre-gl-js.git"},types:"dist/maplibre-gl.d.ts",type:"module",dependencies:{"@mapbox/geojson-rewind":"^0.5.2","@mapbox/jsonlint-lines-primitives":"^2.0.2","@mapbox/point-geometry":"^0.1.0","@mapbox/tiny-sdf":"^2.0.6","@mapbox/unitbezier":"^0.0.1","@mapbox/vector-tile":"^1.3.1","@mapbox/whoots-js":"^3.1.0","@maplibre/maplibre-gl-style-spec":"^19.2.2","@types/geojson":"^7946.0.10","@types/mapbox__point-geometry":"^0.1.2","@types/mapbox__vector-tile":"^1.3.0","@types/pbf":"^3.0.2",earcut:"^2.2.4","geojson-vt":"^3.2.1","gl-matrix":"^3.4.3","global-prefix":"^3.0.0",kdbush:"^4.0.2","murmurhash-js":"^1.0.0",pbf:"^3.2.1",potpack:"^2.0.0",quickselect:"^2.0.0",supercluster:"^8.0.1",tinyqueue:"^2.0.3","vt-pbf":"^3.1.3"},devDependencies:{"@mapbox/mapbox-gl-rtl-text":"^0.2.3","@mapbox/mvt-fixtures":"^3.10.0","@rollup/plugin-commonjs":"^25.0.3","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.1.0","@rollup/plugin-replace":"^5.0.2","@rollup/plugin-strip":"^3.0.2","@rollup/plugin-terser":"^0.4.3","@rollup/plugin-typescript":"^11.1.2","@types/benchmark":"^2.1.2","@types/cssnano":"^5.0.0","@types/d3":"^7.4.0","@types/diff":"^5.0.3","@types/earcut":"^2.1.1","@types/eslint":"^8.44.0","@types/gl":"^6.0.2","@types/glob":"^8.1.0","@types/jest":"^29.5.3","@types/jsdom":"^21.1.1","@types/minimist":"^1.2.2","@types/murmurhash-js":"^1.0.4","@types/nise":"^1.4.1","@types/node":"^20.4.2","@types/offscreencanvas":"^2019.7.0","@types/pixelmatch":"^5.2.4","@types/pngjs":"^6.0.1","@types/react":"^18.2.15","@types/react-dom":"^18.2.6","@types/request":"^2.48.8","@types/shuffle-seed":"^1.1.0","@types/supercluster":"^7.1.0","@types/window-or-global":"^1.0.4","@typescript-eslint/eslint-plugin":"^5.61.0","@typescript-eslint/parser":"^5.62.0",address:"^1.2.2",benchmark:"^2.1.4",canvas:"^2.11.2",cssnano:"^6.0.1",d3:"^7.8.5","d3-queue":"^3.0.7","devtools-protocol":"^0.0.1170846",diff:"^5.1.0","dts-bundle-generator":"^8.0.1",eslint:"^8.45.0","eslint-config-mourner":"^3.0.0","eslint-plugin-html":"^7.1.0","eslint-plugin-import":"^2.27.5","eslint-plugin-jest":"^27.2.3","eslint-plugin-tsdoc":"0.2.17","eslint-plugin-react":"^7.32.2",expect:"^29.5.0",gl:"^6.0.2",glob:"^10.3.3","is-builtin-module":"^3.2.1",jest:"^29.6.1","jest-canvas-mock":"^2.5.2","jest-environment-jsdom":"^29.6.1",jsdom:"^22.1.0","json-stringify-pretty-compact":"^4.0.0",minimist:"^1.2.8","mock-geolocation":"^1.0.11",nise:"^5.1.4","node-plantuml":"^0.9.0","npm-font-open-sans":"^1.1.0","npm-run-all":"^4.1.5","pdf-merger-js":"^4.3.0",pixelmatch:"^5.3.0",pngjs:"^7.0.0",postcss:"^8.4.26","postcss-cli":"^10.1.0","postcss-inline-svg":"^6.0.0","pretty-bytes":"^6.1.1",puppeteer:"^20.8.2",react:"^18.2.0","react-dom":"^18.2.0",rollup:"^3.26.2","rollup-plugin-sourcemaps":"^0.6.3",rw:"^1.3.3",semver:"^7.5.4","shuffle-seed":"^1.1.6","source-map-explorer":"^2.5.3",st:"^3.0.0",stylelint:"^15.10.1","stylelint-config-standard":"^34.0.0","ts-jest":"^29.1.1","ts-node":"^10.9.1",tslib:"^2.6.0",typedoc:"^0.24.8","typedoc-plugin-markdown":"^3.15.3","typedoc-plugin-missing-exports":"^2.0.0",typescript:"^5.1.6"},overrides:{"postcss-inline-svg":{"css-select":"^5.1.0","dom-serializer":"^2.0.0",htmlparser2:"^8.0.1","postcss-value-parser":"^4.2.0"}},scripts:{"generate-dist-package":"npm run tsnode build/generate-dist-package.js","generate-shaders":"npm run tsnode build/generate-shaders.ts","generate-struct-arrays":"npm run tsnode build/generate-struct-arrays.ts","generate-style-code":"npm run tsnode build/generate-style-code.ts","generate-typings":"npm run tsnode build/generate-typings.ts","generate-docs":"typedoc && npm run tsnode build/generate-docs.ts","generate-images":"npm run tsnode build/generate-doc-images.ts","build-dist":"run-p --print-label generate-typings build-dev build-prod build-csp build-csp-dev build-css","build-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev","watch-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev --watch","build-prod":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:production","build-csp":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts","build-csp-dev":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts --environment BUILD:dev","build-css":"postcss -o dist/maplibre-gl.css src/css/maplibre-gl.css","build-diagrams":"cd docs/diagrams; ls *.plantuml | xargs -I {} puml generate --svg {} -o {}.svg","watch-css":"postcss --watch -o dist/maplibre-gl.css src/css/maplibre-gl.css","build-benchmarks":"npm run build-dev && rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts","watch-benchmarks":"rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts --watch","start-server":"st --no-cache -H 0.0.0.0 --port 9966 .",start:"run-p watch-css watch-dev start-server","start-bench":"run-p watch-css watch-benchmarks start-server",lint:"eslint --cache --ext .ts,.tsx,.js,.html --ignore-path .gitignore .","lint-css":"stylelint src/css/maplibre-gl.css",test:"run-p lint lint-css test-render jest",jest:"jest","jest-ci":"jest --reporters=github-actions --reporters=summary","test-build":"jest --selectProjects=build","test-integration":"jest --selectProjects=integration","test-render":"npm run tsnode test/integration/render/run_render_tests.ts","test-unit":"jest --selectProjects=unit","test-watch-roots":"jest --watch",codegen:"run-p generate-dist-package generate-style-code generate-struct-arrays generate-shaders",benchmark:"npm run tsnode test/bench/run-benchmarks.ts","gl-stats":"npm run tsnode test/bench/gl-stats.ts",prepare:"npm run codegen",typecheck:"tsc --noEmit && tsc --project tsconfig.dist.json",tsnode:"node --experimental-loader=ts-node/esm --no-warnings"},files:["build/","dist/*","src/"],engines:{npm:">=8.1.0",node:">=16.14.0"}};f();f();var jh=te(be(),1),Hh=te(l_(),1);function Zh(n){if(n<=0)return 0;if(n>=1)return 1;let t=n*n,e=t*n;return 4*(n<.5?e:3*(n-t)+e-.75)}u(Zh,"easeCubicInOut");function Qs(n,t,e,r){let i=new Hh.default(n,t,e,r);return function(o){return i.solve(o)}}u(Qs,"bezier");var el=Qs(.25,.1,.25,1);function ye(n,t,e){return Math.min(e,Math.max(t,n))}u(ye,"clamp");function St(n,t,e){let r=e-t,i=((n-t)%r+r)%r+t;return i===t?e:i}u(St,"wrap");function Bn(n,t,e){if(!n.length)return e(null,[]);let r=n.length,i=new Array(n.length),o=null;n.forEach((a,s)=>{t(a,(l,c)=>{l&&(o=l),i[s]=c,--r===0&&e(o,i)})})}u(Bn,"asyncAll");function Wh(n,t){let e=[];for(let r in n)r in t||e.push(r);return e}u(Wh,"keysDifference");function k(n,...t){for(let e of t)for(let r in e)n[r]=e[r];return n}u(k,"extend");function ht(n,t){let e={};for(let r=0;r<t.length;r++){let i=t[r];i in n&&(e[i]=n[i])}return e}u(ht,"pick");var c_=1;function Rn(){return c_++}u(Rn,"uniqueId");function Xh(n){return Math.log(n)/Math.LN2%1===0}u(Xh,"isPowerOfTwo");function Kh(n){return n<=1?1:Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}u(Kh,"nextPowerOfTwo");function gi(n,t,e){let r={};for(let i in n)r[i]=t.call(e||this,n[i],i,n);return r}u(gi,"mapObject");function On(n,t,e){let r={};for(let i in n)t.call(e||this,n[i],i,n)&&(r[i]=n[i]);return r}u(On,"filterObject");function wt(n,t){if(Array.isArray(n)){if(!Array.isArray(t)||n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(!wt(n[e],t[e]))return!1;return!0}if(typeof n=="object"&&n!==null&&t!==null){if(typeof t!="object"||Object.keys(n).length!==Object.keys(t).length)return!1;for(let r in n)if(!wt(n[r],t[r]))return!1;return!0}return n===t}u(wt,"deepEqual");function Xe(n){return Array.isArray(n)?n.map(Xe):typeof n=="object"&&n?gi(n,Xe):n}u(Xe,"clone");function $h(n,t){for(let e=0;e<n.length;e++)if(t.indexOf(n[e])>=0)return!0;return!1}u($h,"arraysIntersect");var Gh={};function xe(n){Gh[n]||(typeof console<"u"&&console.warn(n),Gh[n]=!0)}u(xe,"warnOnce");function Pt(n,t,e){return(e.y-n.y)*(t.x-n.x)>(t.y-n.y)*(e.x-n.x)}u(Pt,"isCounterClockwise");function Jh(n,t,e,r){let i=t.y-n.y,o=t.x-n.x,a=r.y-e.y,s=r.x-e.x,l=a*o-s*i;if(l===0)return null;let c=n.y-e.y,p=n.x-e.x,m=(s*c-a*p)/l;return new jh.default(n.x+m*o,n.y+m*i)}u(Jh,"findLineIntersection");function Yh(n){let t=0;for(let e=0,r=n.length,i=r-1,o,a;e<r;i=e++)o=n[e],a=n[i],t+=(a.x-o.x)*(o.y+a.y);return t}u(Yh,"calculateSignedArea");function Qh([n,t,e]){return t+=90,t*=Math.PI/180,e*=Math.PI/180,{x:n*Math.cos(t)*Math.sin(e),y:n*Math.sin(t)*Math.sin(e),z:n*Math.cos(e)}}u(Qh,"sphericalToCartesian");function Ke(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}u(Ke,"isWorker");function ef(n){let t=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,e={};if(n.replace(t,(r,i,o,a)=>{let s=o||a;return e[i]=s?s.toLowerCase():!0,""}),e["max-age"]){let r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}u(ef,"parseCacheControl");var Ys=null;function ar(n){if(Ys==null){let t=n.navigator?n.navigator.userAgent:null;Ys=!!n.safari||!!(t&&(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Ys}u(ar,"isSafari");function ct(n){return typeof ImageBitmap<"u"&&n instanceof ImageBitmap}u(ct,"isImageBitmap");function tf(n,t){let e=new Blob([new Uint8Array(n)],{type:"image/png"});createImageBitmap(e).then(r=>{t(null,r)}).catch(r=>{t(new Error("Could not load image because of ".concat(r.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")))})}u(tf,"arrayBufferToImageBitmap");var qh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function rf(n,t){let e=new Image;e.onload=()=>{t(null,e),URL.revokeObjectURL(e.src),e.onload=null,window.requestAnimationFrame(()=>{e.src=qh})},e.onerror=()=>t(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."));let r=new Blob([new Uint8Array(n)],{type:"image/png"});e.src=n.byteLength?URL.createObjectURL(r):qh}u(rf,"arrayBufferToImage");f();var p_=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),Vn,tl,ee={now:p_,frame(n){let t=requestAnimationFrame(n);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(n,t=0){return this.getImageCanvasContext(n).getImageData(-t,-t,n.width+2*t,n.height+2*t)},getImageCanvasContext(n){let t=window.document.createElement("canvas"),e=t.getContext("2d",{willReadFrequently:!0});if(!e)throw new Error("failed to create canvas 2d context");return t.width=n.width,t.height=n.height,e.drawImage(n,0,0,n.width,n.height),e},resolveURL(n){return Vn||(Vn=document.createElement("a")),Vn.href=n,Vn.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(tl==null&&(tl=matchMedia("(prefers-reduced-motion: reduce)")),tl.matches):!1}};f();var rl=te(be(),1);var Te=class Te{static testProp(t){if(!Te.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in Te.docStyle)return t[e];return t[0]}static create(t,e,r){let i=window.document.createElement(t);return e!==void 0&&(i.className=e),r&&r.appendChild(i),i}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){Te.docStyle&&Te.selectProp&&(Te.userSelect=Te.docStyle[Te.selectProp],Te.docStyle[Te.selectProp]="none")}static enableDrag(){Te.docStyle&&Te.selectProp&&(Te.docStyle[Te.selectProp]=Te.userSelect)}static setTransform(t,e){t.style[Te.transformProp]=e}static addEventListener(t,e,r,i={}){"passive"in i?t.addEventListener(e,r,i):t.addEventListener(e,r,i.capture)}static removeEventListener(t,e,r,i={}){"passive"in i?t.removeEventListener(e,r,i):t.removeEventListener(e,r,i.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",Te.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",Te.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",Te.suppressClickInternal,!0)},0)}static mousePos(t,e){let r=t.getBoundingClientRect();return new rl.default(e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop)}static touchPos(t,e){let r=t.getBoundingClientRect(),i=[];for(let o=0;o<e.length;o++)i.push(new rl.default(e[o].clientX-r.left-t.clientLeft,e[o].clientY-r.top-t.clientTop));return i}static mouseButton(t){return t.button}static remove(t){t&&t.parentNode&&t.parentNode.removeChild(t)}};u(Te,"DOM"),Te.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,Te.selectProp=Te.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),Te.transformProp=Te.testProp(["transform","WebkitTransform"]);var M=Te;f();f();var Ge={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};var ol=class ol extends Error{constructor(e,r,i,o){super("AJAXError: ".concat(r," (").concat(e,"): ").concat(i));this.status=e,this.statusText=r,this.url=i,this.body=o}};u(ol,"AJAXError");var zt=ol,Un=Ke()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,il=u(n=>Ge.REGISTERED_PROTOCOLS[n.substring(0,n.indexOf("://"))],"getProtocolAction"),m_=u(n=>/^file:/.test(n)||/^file:/.test(Un())&&!/^\w+:/.test(n),"isFileURL");function nf(n,t){let e=new AbortController,r=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,referrer:Un(),signal:e.signal}),i=!1,o=!1;n.type==="json"&&r.headers.set("Accept","application/json");let a=u((l,c,p)=>{if(!o){if(l&&l.message!=="SecurityError"&&xe(l),c&&p)return s(c);fetch(r).then(m=>m.ok?s(m):m.blob().then(h=>t(new zt(m.status,m.statusText,n.url,h)))).catch(m=>{m.code!==20&&t(new Error(m.message))})}},"validateOrFetch"),s=u(l=>{(n.type==="arrayBuffer"||n.type==="image"?l.arrayBuffer():n.type==="json"?l.json():l.text()).then(c=>{o||(i=!0,t(null,c,l.headers.get("Cache-Control"),l.headers.get("Expires")))}).catch(c=>{o||t(new Error(c.message))})},"finishRequest");return a(null,null),{cancel:()=>{o=!0,i||e.abort()}}}u(nf,"makeFetchRequest");function h_(n,t){let e=new XMLHttpRequest;e.open(n.method||"GET",n.url,!0),(n.type==="arrayBuffer"||n.type==="image")&&(e.responseType="arraybuffer");for(let r in n.headers)e.setRequestHeader(r,n.headers[r]);return n.type==="json"&&(e.responseType="text",e.setRequestHeader("Accept","application/json")),e.withCredentials=n.credentials==="include",e.onerror=()=>{t(new Error(e.statusText))},e.onload=()=>{if((e.status>=200&&e.status<300||e.status===0)&&e.response!==null){let r=e.response;if(n.type==="json")try{r=JSON.parse(e.response)}catch(i){return t(i)}t(null,r,e.getResponseHeader("Cache-Control"),e.getResponseHeader("Expires"))}else{let r=new Blob([e.response],{type:e.getResponseHeader("Content-Type")});t(new zt(e.status,e.statusText,n.url,r))}},e.send(n.body),{cancel:()=>e.abort()}}u(h_,"makeXMLHttpRequest");var Mr=u(function(n,t){if(/:\/\//.test(n.url)&&!/^https?:|^file:/.test(n.url)){if(Ke()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",n,t);if(!Ke())return(il(n.url)||nf)(n,t)}if(!m_(n.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return nf(n,t);if(Ke()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",n,t,void 0,!0)}return h_(n,t)},"makeRequest"),Bt=u(function(n,t){return Mr(k(n,{type:"json"}),t)},"getJSON"),Nn=u(function(n,t){return Mr(k(n,{type:"arrayBuffer"}),t)},"getArrayBuffer");function nl(n){if(!n||n.indexOf("://")<=0||n.indexOf("data:image/")===0||n.indexOf("blob:")===0)return!0;let t=new URL(n),e=window.location;return t.protocol===e.protocol&&t.host===e.host}u(nl,"sameOrigin");var of=u(function(n,t){let e=window.document.createElement("video");e.muted=!0,e.onloadstart=function(){t(null,e)};for(let r=0;r<n.length;r++){let i=window.document.createElement("source");nl(n[r])||(e.crossOrigin="Anonymous"),i.src=n[r],e.appendChild(i)}return{cancel:()=>{}}},"getVideo");f();f();var _i={supported:!1,testSupport:f_},xi,al=!1,Lr,af=!1;typeof document<"u"&&(Lr=document.createElement("img"),Lr.onload=function(){xi&&sf(xi),xi=null,af=!0},Lr.onerror=function(){al=!0,xi=null},Lr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function f_(n){al||!Lr||(af?sf(n):xi=n)}u(f_,"testSupport");function sf(n){let t=n.createTexture();n.bindTexture(n.TEXTURE_2D,t);try{if(n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,Lr),n.isContextLost())return;_i.supported=!0}catch{}n.deleteTexture(t),al=!0}u(sf,"testWebpTextureUpload");var He;(g=>{let n,t,e,r;g.resetRequestQueue=u(()=>{n=[],t=0,e=0,r={}},"resetRequestQueue"),g.addThrottleControl=u(y=>{let x=e++;return r[x]=y,x},"addThrottleControl"),g.removeThrottleControl=u(y=>{delete r[y],h()},"removeThrottleControl");let s=u(()=>{let y=Object.keys(r),x=!1;if(y.length>0){for(let v of y)if(x=r[v](),x)break}return x},"isThrottled");g.getImage=u((y,x,v=!0)=>{_i.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*");let b={requestParameters:y,supportImageRefresh:v,callback:x,cancelled:!1,completed:!1,cancel:()=>{!b.completed&&!b.cancelled&&(b.cancelled=!0,b.innerRequest&&(b.innerRequest.cancel(),t--),h())}};return n.push(b),h(),b},"getImage");let c=u((y,x)=>{typeof createImageBitmap=="function"?tf(y,x):rf(y,x)},"arrayBufferToCanvasImageSource"),p=u(y=>{let{requestParameters:x,supportImageRefresh:v,callback:b}=y;return k(x,{type:"image"}),(v===!1&&!Ke()&&!il(x.url)&&(!x.headers||Object.keys(x.headers).reduce((P,I)=>P&&I==="accept",!0))?d:Mr)(x,(P,I,C,z)=>{m(y,b,P,I,C,z)})},"doImageRequest"),m=u((y,x,v,b,w,S)=>{v?x(v):b instanceof HTMLImageElement||b instanceof ImageBitmap?x(null,b):b&&c(b,u((I,C)=>{I!=null?x(I):C!=null&&x(null,C,{cacheControl:w,expires:S})},"decoratedCallback")),y.cancelled||(y.completed=!0,t--,h())},"onImageResponse"),h=u(()=>{let y=s()?Ge.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:Ge.MAX_PARALLEL_IMAGE_REQUESTS;for(let x=t;x<y&&n.length>0;x++){let v=n.shift();if(v.cancelled){x--;continue}let b=p(v);t++,v.innerRequest=b}},"processQueue"),d=u((y,x)=>{let v=new Image,b=y.url,w=!1,S=y.credentials;return S&&S==="include"?v.crossOrigin="use-credentials":(S&&S==="same-origin"||!nl(b))&&(v.crossOrigin="anonymous"),v.fetchPriority="high",v.onload=()=>{x(null,v),v.onerror=v.onload=null},v.onerror=()=>{w||x(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.")),v.onerror=v.onload=null},v.src=b,{cancel:()=>{w=!0,v.src=""}}},"getImageUsingHtmlImage")})(He||(He={}));He.resetRequestQueue();f();var sl=class sl{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn?this._transformRequestFn(t,e)||{url:t}:{url:t}}normalizeSpriteURL(t,e,r){let i=y_(t);return i.path+="".concat(e).concat(r),g_(i)}setTransformRequest(t){this._transformRequestFn=t}};u(sl,"RequestManager");var Gn=sl,d_=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function y_(n){let t=n.match(d_);if(!t)throw new Error('Unable to parse URL "'.concat(n,'"'));return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}u(y_,"parseUrl");function g_(n){let t=n.params.length?"?".concat(n.params.join("&")):"";return"".concat(n.protocol,"://").concat(n.authority).concat(n.path).concat(t)}u(g_,"formatUrl");f();f();function lf(n,t,e){e[n]&&e[n].indexOf(t)!==-1||(e[n]=e[n]||[],e[n].push(t))}u(lf,"_addEventListener");function ll(n,t,e){if(e&&e[n]){let r=e[n].indexOf(t);r!==-1&&e[n].splice(r,1)}}u(ll,"_removeEventListener");var ul=class ul{constructor(t,e={}){k(this,e),this.type=t}};u(ul,"Event");var E=ul,cl=class cl extends E{constructor(e,r={}){super("error",k({error:e},r))}};u(cl,"ErrorEvent");var j=cl,pl=class pl{on(t,e){return this._listeners=this._listeners||{},lf(t,e,this._listeners),this}off(t,e){return ll(t,e,this._listeners),ll(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},lf(t,e,this._oneTimeListeners),this):new Promise(r=>this.once(t,r))}fire(t,e){typeof t=="string"&&(t=new E(t,e||{}));let r=t.type;if(this.listens(r)){t.target=this;let i=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(let s of i)s.call(this,t);let o=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(let s of o)ll(r,s,this._oneTimeListeners),s.call(this,t);let a=this._eventedParent;a&&(k(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(t))}else t instanceof j&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}};u(pl,"Evented");var se=pl;f();f();f();f();var Me=Fh,T0=Me.source,uf=Me.light,I0=Me.terrain,A0=Me.filter,cf=Me.paintProperty,pf=Me.layoutProperty;function kr(n,t){let e=!1;if(t&&t.length)for(let r of t)n.fire(new j(new Error(r.message))),e=!0;return e}u(kr,"emitValidationErrors");f();f();f();var qn=class qn{constructor(t,e,r){let i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let a=new Int32Array(this.arrayBuffer);t=a[0],e=a[1],r=a[2],this.d=e+2*r;for(let c=0;c<this.d*this.d;c++){let p=a[3+c],m=a[3+c+1];i.push(p===m?null:a.subarray(p,m))}let s=a[3+i.length],l=a[3+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=e+2*r;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;let o=r/e*t;this.min=-o,this.max=t+o}insert(t,e,r,i,o){this._forEachCell(e,r,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,r,i,o,a){this.cells[o].push(a)}query(t,e,r,i,o){let a=this.min,s=this.max;if(t<=a&&e<=a&&s<=r&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let l=[],c={};return this._forEachCell(t,e,r,i,this._queryCell,l,c,o),l}}_queryCell(t,e,r,i,o,a,s,l){let c=this.cells[o];if(c!==null){let p=this.keys,m=this.bboxes;for(let h=0;h<c.length;h++){let d=c[h];if(s[d]===void 0){let g=d*4;(l?l(m[g+0],m[g+1],m[g+2],m[g+3]):t<=m[g+2]&&e<=m[g+3]&&r>=m[g+0]&&i>=m[g+1])?(s[d]=!0,a.push(p[d])):s[d]=!1}}}}_forEachCell(t,e,r,i,o,a,s,l){let c=this._convertToCellCoord(t),p=this._convertToCellCoord(e),m=this._convertToCellCoord(r),h=this._convertToCellCoord(i);for(let d=c;d<=m;d++)for(let g=p;g<=h;g++){let y=this.d*g+d;if(!(l&&!l(this._convertFromCellCoord(d),this._convertFromCellCoord(g),this._convertFromCellCoord(d+1),this._convertFromCellCoord(g+1)))&&o.call(this,t,e,r,i,y,a,s,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,e=3+this.cells.length+1+1,r=0;for(let a=0;a<this.cells.length;a++)r+=this.cells[a].length;let i=new Int32Array(e+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=e;for(let a=0;a<t.length;a++){let s=t[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+t.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+t.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(t,e){let r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}}static deserialize(t){return new qn(t.buffer)}};u(qn,"TransferableGridIndex");var sr=qn;var Rt={};function O(n,t,e={}){if(Rt[n])throw new Error("".concat(n," is already registered."));Object.defineProperty(t,"_classRegistryKey",{value:n,writeable:!1}),Rt[n]={klass:t,omit:e.omit||[],shallow:e.shallow||[]}}u(O,"register");O("Object",Object);O("TransferableGridIndex",sr);O("Color",me);O("Error",Error);O("AJAXError",zt);O("ResolvedImage",di);O("StylePropertyFunction",Lh);O("StyleExpression",En,{omit:["_evaluator"]});O("ZoomDependentExpression",Ln);O("ZoomConstantExpression",Mn);O("CompoundExpression",Ih,{omit:["_evaluate"]});for(let n in An)An[n]._classRegistryKey||O("Expression_".concat(n),An[n]);function mf(n){return n&&typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||n.constructor&&n.constructor.name==="ArrayBuffer")}u(mf,"isArrayBuffer");function Dr(n,t){if(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp||n instanceof Blob)return n;if(mf(n)||ct(n))return t&&t.push(n),n;if(ArrayBuffer.isView(n)){let e=n;return t&&t.push(e.buffer),e}if(n instanceof ImageData)return t&&t.push(n.data.buffer),n;if(Array.isArray(n)){let e=[];for(let r of n)e.push(Dr(r,t));return e}if(typeof n=="object"){let e=n.constructor,r=e._classRegistryKey;if(!r)throw new Error("can't serialize object of unregistered class");if(!Rt[r])throw new Error("".concat(r," is not registered."));let i=e.serialize?e.serialize(n,t):{};if(e.serialize){if(t&&i===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let o in n){if(!n.hasOwnProperty(o)||Rt[r].omit.indexOf(o)>=0)continue;let a=n[o];i[o]=Rt[r].shallow.indexOf(o)>=0?a:Dr(a,t)}n instanceof Error&&(i.message=n.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(i.$name=r),i}throw new Error("can't serialize object of type ".concat(typeof n))}u(Dr,"serialize");function Fr(n){if(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp||n instanceof Blob||mf(n)||ct(n)||ArrayBuffer.isView(n)||n instanceof ImageData)return n;if(Array.isArray(n))return n.map(Fr);if(typeof n=="object"){let t=n.$name||"Object";if(!Rt[t])throw new Error("can't deserialize unregistered class ".concat(t));let{klass:e}=Rt[t];if(!e)throw new Error("can't deserialize unregistered class ".concat(t));if(e.deserialize)return e.deserialize(n);let r=Object.create(e.prototype);for(let i of Object.keys(n)){if(i==="$name")continue;let o=n[i];r[i]=Rt[t].shallow.indexOf(i)>=0?o:Fr(o)}return r}throw new Error("can't deserialize object of type ".concat(typeof n))}u(Fr,"deserialize");f();f();var ml=class ml{constructor(){this.first=!0}update(t,e){let r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom?(this.lastZoom=t,this.lastFloorZoom=r,!0):!1)}};u(ml,"ZoomHistory");var zr=ml;f();f();var ne={"Latin-1 Supplement":n=>n>=128&&n<=255,Arabic:n=>n>=1536&&n<=1791,"Arabic Supplement":n=>n>=1872&&n<=1919,"Arabic Extended-A":n=>n>=2208&&n<=2303,"Hangul Jamo":n=>n>=4352&&n<=4607,"Unified Canadian Aboriginal Syllabics":n=>n>=5120&&n<=5759,Khmer:n=>n>=6016&&n<=6143,"Unified Canadian Aboriginal Syllabics Extended":n=>n>=6320&&n<=6399,"General Punctuation":n=>n>=8192&&n<=8303,"Letterlike Symbols":n=>n>=8448&&n<=8527,"Number Forms":n=>n>=8528&&n<=8591,"Miscellaneous Technical":n=>n>=8960&&n<=9215,"Control Pictures":n=>n>=9216&&n<=9279,"Optical Character Recognition":n=>n>=9280&&n<=9311,"Enclosed Alphanumerics":n=>n>=9312&&n<=9471,"Geometric Shapes":n=>n>=9632&&n<=9727,"Miscellaneous Symbols":n=>n>=9728&&n<=9983,"Miscellaneous Symbols and Arrows":n=>n>=11008&&n<=11263,"CJK Radicals Supplement":n=>n>=11904&&n<=12031,"Kangxi Radicals":n=>n>=12032&&n<=12255,"Ideographic Description Characters":n=>n>=12272&&n<=12287,"CJK Symbols and Punctuation":n=>n>=12288&&n<=12351,Hiragana:n=>n>=12352&&n<=12447,Katakana:n=>n>=12448&&n<=12543,Bopomofo:n=>n>=12544&&n<=12591,"Hangul Compatibility Jamo":n=>n>=12592&&n<=12687,Kanbun:n=>n>=12688&&n<=12703,"Bopomofo Extended":n=>n>=12704&&n<=12735,"CJK Strokes":n=>n>=12736&&n<=12783,"Katakana Phonetic Extensions":n=>n>=12784&&n<=12799,"Enclosed CJK Letters and Months":n=>n>=12800&&n<=13055,"CJK Compatibility":n=>n>=13056&&n<=13311,"CJK Unified Ideographs Extension A":n=>n>=13312&&n<=19903,"Yijing Hexagram Symbols":n=>n>=19904&&n<=19967,"CJK Unified Ideographs":n=>n>=19968&&n<=40959,"Yi Syllables":n=>n>=40960&&n<=42127,"Yi Radicals":n=>n>=42128&&n<=42191,"Hangul Jamo Extended-A":n=>n>=43360&&n<=43391,"Hangul Syllables":n=>n>=44032&&n<=55215,"Hangul Jamo Extended-B":n=>n>=55216&&n<=55295,"Private Use Area":n=>n>=57344&&n<=63743,"CJK Compatibility Ideographs":n=>n>=63744&&n<=64255,"Arabic Presentation Forms-A":n=>n>=64336&&n<=65023,"Vertical Forms":n=>n>=65040&&n<=65055,"CJK Compatibility Forms":n=>n>=65072&&n<=65103,"Small Form Variants":n=>n>=65104&&n<=65135,"Arabic Presentation Forms-B":n=>n>=65136&&n<=65279,"Halfwidth and Fullwidth Forms":n=>n>=65280&&n<=65519};function hl(n){for(let t of n)if(hf(t.charCodeAt(0)))return!0;return!1}u(hl,"allowsVerticalWritingMode");function hf(n){return n===746||n===747?!0:n<4352?!1:!!(ne["Bopomofo Extended"](n)||ne.Bopomofo(n)||ne["CJK Compatibility Forms"](n)&&!(n>=65097&&n<=65103)||ne["CJK Compatibility Ideographs"](n)||ne["CJK Compatibility"](n)||ne["CJK Radicals Supplement"](n)||ne["CJK Strokes"](n)||ne["CJK Symbols and Punctuation"](n)&&!(n>=12296&&n<=12305)&&!(n>=12308&&n<=12319)&&n!==12336||ne["CJK Unified Ideographs Extension A"](n)||ne["CJK Unified Ideographs"](n)||ne["Enclosed CJK Letters and Months"](n)||ne["Hangul Compatibility Jamo"](n)||ne["Hangul Jamo Extended-A"](n)||ne["Hangul Jamo Extended-B"](n)||ne["Hangul Jamo"](n)||ne["Hangul Syllables"](n)||ne.Hiragana(n)||ne["Ideographic Description Characters"](n)||ne.Kanbun(n)||ne["Kangxi Radicals"](n)||ne["Katakana Phonetic Extensions"](n)||ne.Katakana(n)&&n!==12540||ne["Halfwidth and Fullwidth Forms"](n)&&n!==65288&&n!==65289&&n!==65293&&!(n>=65306&&n<=65310)&&n!==65339&&n!==65341&&n!==65343&&!(n>=65371&&n<=65503)&&n!==65507&&!(n>=65512&&n<=65519)||ne["Small Form Variants"](n)&&!(n>=65112&&n<=65118)&&!(n>=65123&&n<=65126)||ne["Unified Canadian Aboriginal Syllabics"](n)||ne["Unified Canadian Aboriginal Syllabics Extended"](n)||ne["Vertical Forms"](n)||ne["Yijing Hexagram Symbols"](n)||ne["Yi Syllables"](n)||ne["Yi Radicals"](n))}u(hf,"charHasUprightVerticalOrientation");function ff(n){return n>=1424&&n<=2303||ne["Arabic Presentation Forms-A"](n)||ne["Arabic Presentation Forms-B"](n)}u(ff,"charInRTLScript");function x_(n,t){return!(!t&&ff(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||ne.Khmer(n))}u(x_,"charInSupportedScript");function df(n){for(let t of n)if(ff(t.charCodeAt(0)))return!0;return!1}u(df,"stringContainsRTLText");function yf(n,t){for(let e of n)if(!x_(e.charCodeAt(0),t))return!1;return!0}u(yf,"isStringInSupportedScript");f();var ft={unavailable:"unavailable",deferred:"deferred",loading:"loading",loaded:"loaded",error:"error"},fl=null,$e=ft.unavailable,Ot=null,yl=u(function(n){n&&typeof n=="string"&&n.indexOf("NetworkError")>-1&&($e=ft.error),fl&&fl(n)},"triggerPluginCompletionEvent");function dl(){jn.fire(new E("pluginStateChange",{pluginStatus:$e,pluginURL:Ot}))}u(dl,"sendPluginStateToWorker");var jn=new se,bi=u(function(){return $e},"getRTLTextPluginStatus"),gf=u(function(n){return n({pluginStatus:$e,pluginURL:Ot}),jn.on("pluginStateChange",n),n},"registerForPluginStateChange");var xf=u(function(n,t,e=!1){if($e===ft.deferred||$e===ft.loading||$e===ft.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ot=ee.resolveURL(n),$e=ft.deferred,fl=t,dl(),e||_f()},"setRTLTextPlugin"),_f=u(function(){if($e!==ft.deferred||!Ot)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");$e=ft.loading,dl(),Ot&&Nn({url:Ot},n=>{n?yl(n):($e=ft.loaded,dl())})},"downloadRTLTextPlugin"),Je={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded(){return $e===ft.loaded||Je.applyArabicShaping!=null},isLoading(){return $e===ft.loading},setState(n){if(!Ke())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");$e=n.pluginStatus,Ot=n.pluginURL},isParsed(){if(!Ke())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Je.applyArabicShaping!=null&&Je.processBidirectionalText!=null&&Je.processStyledBidirectionalText!=null},getPluginURL(){if(!Ke())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Ot}},bf=u(function(){!Je.isLoading()&&!Je.isLoaded()&&bi()==="deferred"&&_f()},"lazyLoadRTLTextPlugin");var gl=class gl{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new zr,this.transition={})}isSupportedScript(t){return yf(t,Je.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}};u(gl,"EvaluationParameters");var le=gl;var xl=class xl{constructor(t,e){this.property=t,this.value=e,this.expression=kh(e===void 0?t.specification.default:e,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}};u(xl,"PropertyValue");var Br=xl,_l=class _l{constructor(t){this.property=t,this.value=new Br(t,void 0)}transitioned(t,e){return new Hn(this.property,this.value,e,k({},t.transition,this.transition),t.now)}untransitioned(){return new Hn(this.property,this.value,null,{},0)}};u(_l,"TransitionablePropertyValue");var vi=_l,bl=class bl{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Xe(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new vi(this._values[t].property)),this._values[t].value=new Br(this._values[t].property,e===null?void 0:Xe(e))}getTransition(t){return Xe(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new vi(this._values[t].property)),this._values[t].transition=Xe(e)||void 0}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r);let i=this.getTransition(e);i!==void 0&&(t["".concat(e,"-transition")]=i)}return t}transitioned(t,e){let r=new Zn(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(t,e._values[i]);return r}untransitioned(){let t=new Zn(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}};u(bl,"Transitionable");var Rr=bl,vl=class vl{constructor(t,e,r,i,o){this.property=t,this.value=e,this.begin=o+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){let i=t.now||0,o=this.value.possiblyEvaluate(t,e,r),a=this.prior;if(a){if(i>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(i<this.begin)return a.possiblyEvaluate(t,e,r);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(t,e,r),o,Zh(s))}}else return o}};u(vl,"TransitioningPropertyValue");var Hn=vl,wl=class wl{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){let i=new Vt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(t,e,r);return i}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}};u(wl,"Transitioning");var Zn=wl,Sl=class Sl{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return Xe(this._values[t].value)}setValue(t,e){this._values[t]=new Br(this._values[t].property,e===null?void 0:Xe(e))}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){let i=new Vt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(t,e,r);return i}};u(Sl,"Layout");var Wn=Sl,Pl=class Pl{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,e,r,i){return this.property.evaluate(this.value,this.parameters,t,e,r,i)}};u(Pl,"PossiblyEvaluatedPropertyValue");var je=Pl,Tl=class Tl{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}};u(Tl,"PossiblyEvaluated");var Vt=Tl,Il=class Il{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,r){let i=this.specification.type,o=Ae[i];return o?o(t,e,r):t}};u(Il,"DataConstantProperty");var q=Il,Al=class Al{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,i){return t.expression.kind==="constant"||t.expression.kind==="camera"?new je(this,{kind:"constant",value:t.expression.evaluate(e,null,{},r,i)},e):new je(this,t.expression,e)}interpolate(t,e,r){if(t.value.kind!=="constant"||e.value.kind!=="constant")return t;if(t.value.value===void 0||e.value.value===void 0)return new je(this,{kind:"constant",value:void 0},t.parameters);let i=this.specification.type,o=Ae[i];if(o){let a=o(t.value.value,e.value.value,r);return new je(this,{kind:"constant",value:a},t.parameters)}else return t}evaluate(t,e,r,i,o,a){return t.kind==="constant"?t.value:t.evaluate(e,r,i,o,a)}};u(Al,"DataDrivenProperty");var H=Al,Cl=class Cl extends H{possiblyEvaluate(t,e,r,i){if(t.value===void 0)return new je(this,{kind:"constant",value:void 0},e);if(t.expression.kind==="constant"){let o=t.expression.evaluate(e,null,{},r,i),s=t.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,e);return new je(this,{kind:"constant",value:l},e)}else if(t.expression.kind==="camera"){let o=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new je(this,{kind:"constant",value:o},e)}else return new je(this,t.expression,e)}evaluate(t,e,r,i,o,a){if(t.kind==="source"){let s=t.evaluate(e,r,i,o,a);return this._calculate(s,s,s,e)}else return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,i),t.evaluate({zoom:Math.floor(e.zoom)},r,i),t.evaluate({zoom:Math.floor(e.zoom)+1},r,i),e):t.value}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}};u(Cl,"CrossFadedDataDrivenProperty");var Tt=Cl,El=class El{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,i){if(t.value!==void 0)if(t.expression.kind==="constant"){let o=t.expression.evaluate(e,null,{},r,i);return this._calculate(o,o,o,e)}else return this._calculate(t.expression.evaluate(new le(Math.floor(e.zoom-1),e)),t.expression.evaluate(new le(Math.floor(e.zoom),e)),t.expression.evaluate(new le(Math.floor(e.zoom+1),e)),e)}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}};u(El,"CrossFadedProperty");var lr=El,Ml=class Ml{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)}interpolate(){return!1}};u(Ml,"ColorRampProperty");var ur=Ml,Ll=class Ll{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let e in t){let r=t[e];r.specification.overridable&&this.overridableProperties.push(e);let i=this.defaultPropertyValues[e]=new Br(r,void 0),o=this.defaultTransitionablePropertyValues[e]=new vi(r);this.defaultTransitioningPropertyValues[e]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}};u(Ll,"Properties");var Ie=Ll;O("DataDrivenProperty",H);O("DataConstantProperty",q);O("CrossFadedDataDrivenProperty",Tt);O("CrossFadedProperty",lr);O("ColorRampProperty",ur);var Xn="-transition",kl=class kl extends se{constructor(e,r){super();if(this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Wn(r.layout)),r.paint)){this._transitionablePaint=new Rr(r.paint);for(let i in e.paint)this.setPaintProperty(i,e.paint[i],{validate:!1});for(let i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Vt(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,i={}){if(r!=null){let o="layers.".concat(this.id,".layout.").concat(e);if(this._validate(pf,o,e,r,i))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(Xn)?this._transitionablePaint.getTransition(e.slice(0,-Xn.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,i={}){if(r!=null){let o="layers.".concat(this.id,".paint.").concat(e);if(this._validate(cf,o,e,r,i))return!1}if(e.endsWith(Xn))return this._transitionablePaint.setTransition(e.slice(0,-Xn.length),r||void 0),!1;{let o=this._transitionablePaint._values[e],a=o.property.specification["property-type"]==="cross-faded-data-driven",s=o.value.isDataDriven(),l=o.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);let c=this._transitionablePaint._values[e].value;return c.isDataDriven()||s||a||this._handleOverridablePaintPropertyUpdate(e,l,c)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,i){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),On(e,(r,i)=>r!==void 0&&!(i==="layout"&&!Object.keys(r).length)&&!(i==="paint"&&!Object.keys(r).length))}_validate(e,r,i,o,a={}){return a&&a.validate===!1?!1:kr(this,e.call(Me,{key:r,layerType:this.type,objectKey:i,value:o,styleSpec:T,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let r=this.paint.get(e);if(!(!(r instanceof je)||!Cn(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};u(kl,"StyleLayer");var Le=kl;f();f();f();var __={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Dl=class Dl{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}};u(Dl,"Struct");var cr=Dl,b_=128,v_=5,Fl=class Fl{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*v_),b_),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};u(Fl,"StructArray");var Ce=Fl;function fe(n,t=1){let e=0,r=0,i=n.map(a=>{let s=w_(a.type),l=e=vf(e,Math.max(t,s)),c=a.components||1;return r=Math.max(r,s),e+=s*c,{name:a.name,type:a.type,components:c,offset:l}}),o=vf(e,Math.max(r,t));return{members:i,size:o,alignment:t}}u(fe,"createLayout");function w_(n){return __[n].BYTES_PER_ELEMENT}u(w_,"sizeOf");function vf(n,t){return Math.ceil(n/t)*t}u(vf,"align");var wf=te(be(),1);var zl=class zl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,r)}emplace(e,r,i){let o=e*2;return this.int16[o+0]=r,this.int16[o+1]=i,e}};u(zl,"StructArrayLayout2i4");var pr=zl;pr.prototype.bytesPerElement=4;O("StructArrayLayout2i4",pr);var Bl=class Bl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,i)}emplace(e,r,i,o){let a=e*3;return this.int16[a+0]=r,this.int16[a+1]=i,this.int16[a+2]=o,e}};u(Bl,"StructArrayLayout3i6");var Or=Bl;Or.prototype.bytesPerElement=6;O("StructArrayLayout3i6",Or);var Rl=class Rl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,i,o)}emplace(e,r,i,o,a){let s=e*4;return this.int16[s+0]=r,this.int16[s+1]=i,this.int16[s+2]=o,this.int16[s+3]=a,e}};u(Rl,"StructArrayLayout4i8");var wi=Rl;wi.prototype.bytesPerElement=8;O("StructArrayLayout4i8",wi);var Ol=class Ol extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,r,i,o,a,s)}emplace(e,r,i,o,a,s,l){let c=e*6;return this.int16[c+0]=r,this.int16[c+1]=i,this.int16[c+2]=o,this.int16[c+3]=a,this.int16[c+4]=s,this.int16[c+5]=l,e}};u(Ol,"StructArrayLayout2i4i12");var Si=Ol;Si.prototype.bytesPerElement=12;O("StructArrayLayout2i4i12",Si);var Vl=class Vl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,r,i,o,a,s)}emplace(e,r,i,o,a,s,l){let c=e*4,p=e*8;return this.int16[c+0]=r,this.int16[c+1]=i,this.uint8[p+4]=o,this.uint8[p+5]=a,this.uint8[p+6]=s,this.uint8[p+7]=l,e}};u(Vl,"StructArrayLayout2i4ub8");var Pi=Vl;Pi.prototype.bytesPerElement=8;O("StructArrayLayout2i4ub8",Pi);var Ul=class Ul extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,r)}emplace(e,r,i){let o=e*2;return this.float32[o+0]=r,this.float32[o+1]=i,e}};u(Ul,"StructArrayLayout2f8");var Ut=Ul;Ut.prototype.bytesPerElement=8;O("StructArrayLayout2f8",Ut);var Nl=class Nl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s,l,c,p,m){let h=this.length;return this.resize(h+1),this.emplace(h,e,r,i,o,a,s,l,c,p,m)}emplace(e,r,i,o,a,s,l,c,p,m,h){let d=e*10;return this.uint16[d+0]=r,this.uint16[d+1]=i,this.uint16[d+2]=o,this.uint16[d+3]=a,this.uint16[d+4]=s,this.uint16[d+5]=l,this.uint16[d+6]=c,this.uint16[d+7]=p,this.uint16[d+8]=m,this.uint16[d+9]=h,e}};u(Nl,"StructArrayLayout10ui20");var Ti=Nl;Ti.prototype.bytesPerElement=20;O("StructArrayLayout10ui20",Ti);var Gl=class Gl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s,l,c,p,m,h,d){let g=this.length;return this.resize(g+1),this.emplace(g,e,r,i,o,a,s,l,c,p,m,h,d)}emplace(e,r,i,o,a,s,l,c,p,m,h,d,g){let y=e*12;return this.int16[y+0]=r,this.int16[y+1]=i,this.int16[y+2]=o,this.int16[y+3]=a,this.uint16[y+4]=s,this.uint16[y+5]=l,this.uint16[y+6]=c,this.uint16[y+7]=p,this.int16[y+8]=m,this.int16[y+9]=h,this.int16[y+10]=d,this.int16[y+11]=g,e}};u(Gl,"StructArrayLayout4i4ui4i24");var Ii=Gl;Ii.prototype.bytesPerElement=24;O("StructArrayLayout4i4ui4i24",Ii);var ql=class ql extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,i)}emplace(e,r,i,o){let a=e*3;return this.float32[a+0]=r,this.float32[a+1]=i,this.float32[a+2]=o,e}};u(ql,"StructArrayLayout3f12");var Ai=ql;Ai.prototype.bytesPerElement=12;O("StructArrayLayout3f12",Ai);var jl=class jl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let i=e*1;return this.uint32[i+0]=r,e}};u(jl,"StructArrayLayout1ul4");var Ci=jl;Ci.prototype.bytesPerElement=4;O("StructArrayLayout1ul4",Ci);var Hl=class Hl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s,l,c,p){let m=this.length;return this.resize(m+1),this.emplace(m,e,r,i,o,a,s,l,c,p)}emplace(e,r,i,o,a,s,l,c,p,m){let h=e*10,d=e*5;return this.int16[h+0]=r,this.int16[h+1]=i,this.int16[h+2]=o,this.int16[h+3]=a,this.int16[h+4]=s,this.int16[h+5]=l,this.uint32[d+3]=c,this.uint16[h+8]=p,this.uint16[h+9]=m,e}};u(Hl,"StructArrayLayout6i1ul2ui20");var Ei=Hl;Ei.prototype.bytesPerElement=20;O("StructArrayLayout6i1ul2ui20",Ei);var Zl=class Zl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,r,i,o,a,s)}emplace(e,r,i,o,a,s,l){let c=e*6;return this.int16[c+0]=r,this.int16[c+1]=i,this.int16[c+2]=o,this.int16[c+3]=a,this.int16[c+4]=s,this.int16[c+5]=l,e}};u(Zl,"StructArrayLayout2i2i2i12");var Mi=Zl;Mi.prototype.bytesPerElement=12;O("StructArrayLayout2i2i2i12",Mi);var Wl=class Wl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,i,o,a)}emplace(e,r,i,o,a,s){let l=e*4,c=e*8;return this.float32[l+0]=r,this.float32[l+1]=i,this.float32[l+2]=o,this.int16[c+6]=a,this.int16[c+7]=s,e}};u(Wl,"StructArrayLayout2f1f2i16");var Li=Wl;Li.prototype.bytesPerElement=16;O("StructArrayLayout2f1f2i16",Li);var Xl=class Xl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,i,o)}emplace(e,r,i,o,a){let s=e*12,l=e*3;return this.uint8[s+0]=r,this.uint8[s+1]=i,this.float32[l+1]=o,this.float32[l+2]=a,e}};u(Xl,"StructArrayLayout2ub2f12");var ki=Xl;ki.prototype.bytesPerElement=12;O("StructArrayLayout2ub2f12",ki);var Kl=class Kl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,i)}emplace(e,r,i,o){let a=e*3;return this.uint16[a+0]=r,this.uint16[a+1]=i,this.uint16[a+2]=o,e}};u(Kl,"StructArrayLayout3ui6");var Vr=Kl;Vr.prototype.bytesPerElement=6;O("StructArrayLayout3ui6",Vr);var $l=class $l extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b){let w=this.length;return this.resize(w+1),this.emplace(w,e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b)}emplace(e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b,w){let S=e*24,P=e*12,I=e*48;return this.int16[S+0]=r,this.int16[S+1]=i,this.uint16[S+2]=o,this.uint16[S+3]=a,this.uint32[P+2]=s,this.uint32[P+3]=l,this.uint32[P+4]=c,this.uint16[S+10]=p,this.uint16[S+11]=m,this.uint16[S+12]=h,this.float32[P+7]=d,this.float32[P+8]=g,this.uint8[I+36]=y,this.uint8[I+37]=x,this.uint8[I+38]=v,this.uint32[P+10]=b,this.int16[S+22]=w,e}};u($l,"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48");var Di=$l;Di.prototype.bytesPerElement=48;O("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Di);var Jl=class Jl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b,w,S,P,I,C,z,D,A,R,U,L){let N=this.length;return this.resize(N+1),this.emplace(N,e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b,w,S,P,I,C,z,D,A,R,U,L)}emplace(e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b,w,S,P,I,C,z,D,A,R,U,L,N){let V=e*34,W=e*17;return this.int16[V+0]=r,this.int16[V+1]=i,this.int16[V+2]=o,this.int16[V+3]=a,this.int16[V+4]=s,this.int16[V+5]=l,this.int16[V+6]=c,this.int16[V+7]=p,this.uint16[V+8]=m,this.uint16[V+9]=h,this.uint16[V+10]=d,this.uint16[V+11]=g,this.uint16[V+12]=y,this.uint16[V+13]=x,this.uint16[V+14]=v,this.uint16[V+15]=b,this.uint16[V+16]=w,this.uint16[V+17]=S,this.uint16[V+18]=P,this.uint16[V+19]=I,this.uint16[V+20]=C,this.uint16[V+21]=z,this.uint16[V+22]=D,this.uint32[W+12]=A,this.float32[W+13]=R,this.float32[W+14]=U,this.float32[W+15]=L,this.float32[W+16]=N,e}};u(Jl,"StructArrayLayout8i15ui1ul4f68");var Fi=Jl;Fi.prototype.bytesPerElement=68;O("StructArrayLayout8i15ui1ul4f68",Fi);var Yl=class Yl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let i=e*1;return this.float32[i+0]=r,e}};u(Yl,"StructArrayLayout1f4");var mr=Yl;mr.prototype.bytesPerElement=4;O("StructArrayLayout1f4",mr);var Ql=class Ql extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,i)}emplace(e,r,i,o){let a=e*2,s=e*4;return this.uint32[a+0]=r,this.uint16[s+2]=i,this.uint16[s+3]=o,e}};u(Ql,"StructArrayLayout1ul2ui8");var zi=Ql;zi.prototype.bytesPerElement=8;O("StructArrayLayout1ul2ui8",zi);var eu=class eu extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,r)}emplace(e,r,i){let o=e*2;return this.uint16[o+0]=r,this.uint16[o+1]=i,e}};u(eu,"StructArrayLayout2ui4");var Bi=eu;Bi.prototype.bytesPerElement=4;O("StructArrayLayout2ui4",Bi);var tu=class tu extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let i=e*1;return this.uint16[i+0]=r,e}};u(tu,"StructArrayLayout1ui2");var Ri=tu;Ri.prototype.bytesPerElement=2;O("StructArrayLayout1ui2",Ri);var ru=class ru extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,i,o)}emplace(e,r,i,o,a){let s=e*4;return this.float32[s+0]=r,this.float32[s+1]=i,this.float32[s+2]=o,this.float32[s+3]=a,e}};u(ru,"StructArrayLayout4f16");var Ur=ru;Ur.prototype.bytesPerElement=16;O("StructArrayLayout4f16",Ur);var iu=class iu extends cr{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new wf.default(this.anchorPointX,this.anchorPointY)}};u(iu,"CollisionBoxStruct");var Kn=iu;Kn.prototype.size=20;var nu=class nu extends Ei{get(t){return new Kn(this,t)}};u(nu,"CollisionBoxArray");var Oi=nu;O("CollisionBoxArray",Oi);var ou=class ou extends cr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};u(ou,"PlacedSymbolStruct");var $n=ou;$n.prototype.size=48;var au=class au extends Di{get(t){return new $n(this,t)}};u(au,"PlacedSymbolArray");var Vi=au;O("PlacedSymbolArray",Vi);var su=class su extends cr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}};u(su,"SymbolInstanceStruct");var Jn=su;Jn.prototype.size=68;var lu=class lu extends Fi{get(t){return new Jn(this,t)}};u(lu,"SymbolInstanceArray");var Ui=lu;O("SymbolInstanceArray",Ui);var uu=class uu extends mr{getoffsetX(t){return this.float32[t*1+0]}};u(uu,"GlyphOffsetArray");var Ni=uu;O("GlyphOffsetArray",Ni);var cu=class cu extends Or{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};u(cu,"SymbolLineVertexArray");var Gi=cu;O("SymbolLineVertexArray",Gi);var pu=class pu extends cr{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]}};u(pu,"FeatureIndexStruct");var Yn=pu;Yn.prototype.size=8;var mu=class mu extends zi{get(t){return new Yn(this,t)}};u(mu,"FeatureIndexArray");var qi=mu;O("FeatureIndexArray",qi);var hu=class hu extends pr{};u(hu,"PosArray");var Nt=hu,fu=class fu extends Or{};u(fu,"Pos3dArray");var Qn=fu,du=class du extends wi{};u(du,"RasterBoundsArray");var Nr=du,yu=class yu extends pr{};u(yu,"CircleLayoutArray");var eo=yu,gu=class gu extends pr{};u(gu,"FillLayoutArray");var to=gu,xu=class xu extends Si{};u(xu,"FillExtrusionLayoutArray");var ro=xu;var _u=class _u extends Pi{};u(_u,"LineLayoutArray");var io=_u,bu=class bu extends Ut{};u(bu,"LineExtLayoutArray");var no=bu,vu=class vu extends Ti{};u(vu,"PatternLayoutArray");var It=vu,wu=class wu extends Ii{};u(wu,"SymbolLayoutArray");var oo=wu,Su=class Su extends Ai{};u(Su,"SymbolDynamicLayoutArray");var ao=Su,Pu=class Pu extends Ci{};u(Pu,"SymbolOpacityArray");var so=Pu,Tu=class Tu extends Mi{};u(Tu,"CollisionBoxLayoutArray");var ji=Tu,Iu=class Iu extends Li{};u(Iu,"CollisionCircleLayoutArray");var lo=Iu,Au=class Au extends ki{};u(Au,"CollisionVertexArray");var uo=Au,Cu=class Cu extends Vr{};u(Cu,"QuadTriangleArray");var co=Cu,Eu=class Eu extends Vr{};u(Eu,"TriangleIndexArray");var qe=Eu,Mu=class Mu extends Bi{};u(Mu,"LineIndexArray");var Gt=Mu,Lu=class Lu extends Ri{};u(Lu,"LineStripIndexArray");var Hi=Lu;f();var S_=fe([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Sf,size:j1,alignment:H1}=S_;f();var hr=class hr{constructor(t=[]){this.segments=t}prepareSegment(t,e,r,i){let o=this.segments[this.segments.length-1];return t>hr.MAX_VERTEX_ARRAY_LENGTH&&xe("Max vertices per segment is ".concat(hr.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(t)),(!o||o.vertexLength+t>hr.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i)&&(o={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},i!==void 0&&(o.sortKey=i),this.segments.push(o)),o}get(){return this.segments}destroy(){for(let t of this.segments)for(let e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,i){return new hr([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:i,vaos:{},sortKey:0}])}};u(hr,"SegmentVector");var ae=hr;ae.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;O("SegmentVector",ae);f();f();function ku(n,t){return n=ye(Math.floor(n),0,255),t=ye(Math.floor(t),0,255),256*n+t}u(ku,"packUint8ToFloat");f();var Zi=fe([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);f();var Tf=te(zh(),1);var mo=class mo{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,i){this.ids.push(Pf(t)),this.positions.push(e,r,i)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let e=Pf(t),r=0,i=this.ids.length-1;for(;r<i;){let a=r+i>>1;this.ids[a]>=e?i=a:r=a+1}let o=[];for(;this.ids[r]===e;){let a=this.positions[3*r],s=this.positions[3*r+1],l=this.positions[3*r+2];o.push({index:a,start:s,end:l}),r++}return o}static serialize(t,e){let r=new Float64Array(t.ids),i=new Uint32Array(t.positions);return Du(r,i,0,r.length-1),e&&e.push(r.buffer,i.buffer),{ids:r,positions:i}}static deserialize(t){let e=new mo;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}};u(mo,"FeaturePositionMap");var Wi=mo;function Pf(n){let t=+n;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:(0,Tf.default)(String(n))}u(Pf,"getNumericId");function Du(n,t,e,r){for(;e<r;){let i=n[e+r>>1],o=e-1,a=r+1;for(;;){do o++;while(n[o]<i);do a--;while(n[a]>i);if(o>=a)break;po(n,o,a),po(t,3*o,3*a),po(t,3*o+1,3*a+1),po(t,3*o+2,3*a+2)}a-e<r-a?(Du(n,t,e,a),e=a+1):(Du(n,t,a+1,r),r=a)}}u(Du,"sort");function po(n,t,e){let r=n[t];n[t]=n[e],n[e]=r}u(po,"swap");O("FeaturePositionMap",Wi);f();var Fu=class Fu{constructor(t,e){this.gl=t.gl,this.location=e}};u(Fu,"Uniform");var At=Fu,zu=class zu extends At{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}};u(zu,"Uniform1i");var X=zu,Bu=class Bu extends At{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}};u(Bu,"Uniform1f");var B=Bu,Ru=class Ru extends At{constructor(t,e){super(t,e),this.current=[0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1])&&(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}};u(Ru,"Uniform2f");var $=Ru,Ou=class Ou extends At{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2])&&(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}};u(Ou,"Uniform3f");var Ze=Ou,Vu=class Vu extends At{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2]||t[3]!==this.current[3])&&(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}};u(Vu,"Uniform4f");var qt=Vu,Uu=class Uu extends At{constructor(t,e){super(t,e),this.current=me.transparent}set(t){(t.r!==this.current.r||t.g!==this.current.g||t.b!==this.current.b||t.a!==this.current.a)&&(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}};u(Uu,"UniformColor");var pt=Uu,P_=new Float32Array(16),Nu=class Nu extends At{constructor(t,e){super(t,e),this.current=P_}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);return}for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}};u(Nu,"UniformMatrix4f");var J=Nu;function Gu(n){return[ku(255*n.r,255*n.g),ku(255*n.b,255*n.a)]}u(Gu,"packColor");var qu=class qu{constructor(t,e,r){this.value=t,this.uniformNames=e.map(i=>"u_".concat(i)),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return this.type==="color"?new pt(t,e):new B(t,e)}};u(qu,"ConstantBinder");var fr=qu,ju=class ju{constructor(t,e){this.uniformNames=e.map(r=>"u_".concat(r)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,r,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&t.set(o)}getBinding(t,e,r){return r.substr(0,9)==="u_pattern"?new qt(t,e):new B(t,e)}};u(ju,"CrossFadedConstantBinder");var jt=ju,Hu=class Hu{constructor(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map(o=>({name:"a_".concat(o),type:"Float32",components:r==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,e,r,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new le(0),e,{},i,[],o);this.paintVertexArray.resize(t),this._setPaintValue(a,t,s)}updatePaintArray(t,e,r,i){let o=this.expression.evaluate({zoom:0},r,i);this._setPaintValue(t,e,o)}_setPaintValue(t,e,r){if(this.type==="color"){let i=Gu(r);for(let o=t;o<e;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}};u(Hu,"SourceExpressionBinder");var dt=Hu,Zu=class Zu{constructor(t,e,r,i,o,a){this.expression=t,this.uniformNames=e.map(s=>"u_".concat(s,"_t")),this.type=r,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=e.map(s=>({name:"a_".concat(s),type:"Float32",components:r==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,e,r,i,o){let a=this.expression.evaluate(new le(this.zoom),e,{},i,[],o),s=this.expression.evaluate(new le(this.zoom+1),e,{},i,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(l,t,a,s)}updatePaintArray(t,e,r,i){let o=this.expression.evaluate({zoom:this.zoom},r,i),a=this.expression.evaluate({zoom:this.zoom+1},r,i);this._setPaintValue(t,e,o,a)}_setPaintValue(t,e,r,i){if(this.type==="color"){let o=Gu(r),a=Gu(i);for(let s=t;s<e;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=t;o<e;o++)this.paintVertexArray.emplace(o,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){let r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,i=ye(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,e,r){return new B(t,e)}};u(Zu,"CompositeExpressionBinder");var nt=Zu,Wu=class Wu{constructor(t,e,r,i,o,a){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(t,e,r){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(i,t,e.patterns&&e.patterns[this.layerId],r)}updatePaintArray(t,e,r,i,o){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],o)}_setPaintValues(t,e,r,i){if(!i||!r)return;let{min:o,mid:a,max:s}=r,l=i[o],c=i[a],p=i[s];if(!(!l||!c||!p))for(let m=t;m<e;m++)this.zoomInPaintVertexArray.emplace(m,c.tl[0],c.tl[1],c.br[0],c.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],c.pixelRatio,l.pixelRatio),this.zoomOutPaintVertexArray.emplace(m,c.tl[0],c.tl[1],c.br[0],c.br[1],p.tl[0],p.tl[1],p.br[0],p.br[1],c.pixelRatio,p.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Zi.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Zi.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}};u(Wu,"CrossFadedCompositeBinder");var gt=Wu,Xu=class Xu{constructor(t,e,r){this.binders={},this._buffers=[];let i=[];for(let o in t.paint._values){if(!r(o))continue;let a=t.paint.get(o);if(!(a instanceof je)||!Cn(a.property.specification))continue;let s=T_(o,t.type),l=a.value,c=a.property.specification.type,p=a.property.useIntegerZoom,m=a.property.specification["property-type"],h=m==="cross-faded"||m==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=h?new jt(l.value,s):new fr(l.value,s,c),i.push("/u_".concat(o));else if(l.kind==="source"||h){let d=If(o,c,"source");this.binders[o]=h?new gt(l,c,p,e,d,t.id):new dt(l,s,c,d),i.push("/a_".concat(o))}else{let d=If(o,c,"composite");this.binders[o]=new nt(l,s,c,p,e,d),i.push("/z_".concat(o))}}this.cacheKey=i.sort().join("")}getMaxValue(t){let e=this.binders[t];return e instanceof dt||e instanceof nt?e.maxValue:0}populatePaintArrays(t,e,r,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof dt||s instanceof nt||s instanceof gt)&&s.populatePaintArray(t,e,r,i,o)}}setConstantPatternPositions(t,e){for(let r in this.binders){let i=this.binders[r];i instanceof jt&&i.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,r,i,o){let a=!1;for(let s in t){let l=e.getPositions(s);for(let c of l){let p=r.feature(c.index);for(let m in this.binders){let h=this.binders[m];if((h instanceof dt||h instanceof nt||h instanceof gt)&&h.expression.isStateDependent===!0){let d=i.paint.get(m);h.expression=d.value,h.updatePaintArray(c.start,c.end,p,t[s],o),a=!0}}}}return a}defines(){let t=[];for(let e in this.binders){let r=this.binders[e];(r instanceof fr||r instanceof jt)&&t.push(...r.uniformNames.map(i=>"#define HAS_UNIFORM_".concat(i)))}return t}getBinderAttributes(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof dt||r instanceof nt)for(let i=0;i<r.paintVertexAttributes.length;i++)t.push(r.paintVertexAttributes[i].name);else if(r instanceof gt)for(let i=0;i<Zi.members.length;i++)t.push(Zi.members[i].name)}return t}getBinderUniforms(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof fr||r instanceof jt||r instanceof nt)for(let i of r.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){let r=[];for(let i in this.binders){let o=this.binders[i];if(o instanceof fr||o instanceof jt||o instanceof nt){for(let a of o.uniformNames)if(e[a]){let s=o.getBinding(t,e[a],a);r.push({name:a,property:i,binding:s})}}}return r}setUniforms(t,e,r,i){for(let{name:o,property:a,binding:s}of e)this.binders[a].setUniform(s,i,r.get(a),o)}updatePaintBuffers(t){this._buffers=[];for(let e in this.binders){let r=this.binders[e];if(t&&r instanceof gt){let i=t.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof dt||r instanceof nt)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(let e in this.binders){let r=this.binders[e];(r instanceof dt||r instanceof nt||r instanceof gt)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof dt||e instanceof nt||e instanceof gt)&&e.destroy()}}};u(Xu,"ProgramConfiguration");var ho=Xu,Ku=class Ku{constructor(t,e,r=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new ho(i,e,r);this.needsUpload=!1,this._featureMap=new Wi,this._bufferOffset=0}populatePaintArrays(t,e,r,i,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(t,e,i,o,a);e.id!==void 0&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,i){for(let o of r)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(t,this._featureMap,e,o,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};u(Ku,"ProgramConfigurationSet");var Ye=Ku;function T_(n,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[n]||[n.replace("".concat(t,"-"),"").replace(/-/g,"_")]}u(T_,"paintAttributeNames");function I_(n){return{"line-pattern":{source:It,composite:It},"fill-pattern":{source:It,composite:It},"fill-extrusion-pattern":{source:It,composite:It}}[n]}u(I_,"getLayoutException");function If(n,t,e){let r={color:{source:Ut,composite:Ur},number:{source:mr,composite:Ut}},i=I_(n);return i&&i[e]||r[t][e]}u(If,"layoutType");O("ConstantBinder",fr);O("CrossFadedConstantBinder",jt);O("SourceExpressionBinder",dt);O("CrossFadedCompositeBinder",gt);O("CompositeExpressionBinder",nt);O("ProgramConfiguration",ho,{omit:["_buffers"]});O("ProgramConfigurationSet",Ye);f();f();f();var A_=15,$u=Math.pow(2,A_-1)-1,Af=-$u-1;function Qe(n){let t=8192/n.extent,e=n.loadGeometry();for(let r=0;r<e.length;r++){let i=e[r];for(let o=0;o<i.length;o++){let a=i[o],s=Math.round(a.x*t),l=Math.round(a.y*t);a.x=ye(s,Af,$u),a.y=ye(l,Af,$u),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&xe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return e}u(Qe,"loadGeometry");f();function et(n,t){return{type:n.type,id:n.id,properties:n.properties,geometry:t?Qe(n):[]}}u(et,"toEvaluationFeature");function fo(n,t,e,r,i){n.emplaceBack(t*2+(r+1)/2,e*2+(i+1)/2)}u(fo,"addCircleVertex");var Ju=class Ju{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new eo,this.indexArray=new qe,this.segments=new ae,this.programConfigurations=new Ye(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){let i=this.layers[0],o=[],a=null,s=!1;i.type==="circle"&&(a=i.layout.get("circle-sort-key"),s=!a.isConstant());for(let{feature:l,id:c,index:p,sourceLayerIndex:m}of t){let h=this.layers[0]._featureFilter.needGeometry,d=et(l,h);if(!this.layers[0]._featureFilter.filter(new le(this.zoom),d,r))continue;let g=s?a.evaluate(d,{},r):void 0,y={id:c,properties:l.properties,type:l.type,sourceLayerIndex:m,index:p,geometry:h?d.geometry:Qe(l),patterns:{},sortKey:g};o.push(y)}s&&o.sort((l,c)=>l.sortKey-c.sortKey);for(let l of o){let{geometry:c,index:p,sourceLayerIndex:m}=l,h=t[p].feature;this.addFeature(l,c,p,r),e.featureIndex.insert(h,c,p,m,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Sf),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,i){for(let o of e)for(let a of o){let s=a.x,l=a.y;if(s<0||s>=8192||l<0||l>=8192)continue;let c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),p=c.vertexLength;fo(this.layoutVertexArray,s,l,-1,-1),fo(this.layoutVertexArray,s,l,1,-1),fo(this.layoutVertexArray,s,l,1,1),fo(this.layoutVertexArray,s,l,-1,1),this.indexArray.emplaceBack(p,p+1,p+2),this.indexArray.emplaceBack(p,p+3,p+2),c.vertexLength+=4,c.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},i)}};u(Ju,"CircleBucket");var dr=Ju;O("CircleBucket",dr,{omit:["layers"]});f();var Xi=te(be(),1);function yo(n,t){for(let e=0;e<n.length;e++)if(Gr(t,n[e]))return!0;for(let e=0;e<t.length;e++)if(Gr(n,t[e]))return!0;return!!Qu(n,t)}u(yo,"polygonIntersectsPolygon");function Ef(n,t,e){return!!(Gr(n,t)||Yu(t,n,e))}u(Ef,"polygonIntersectsBufferedPoint");function go(n,t){if(n.length===1)return Cf(t,n[0]);for(let e=0;e<t.length;e++){let r=t[e];for(let i=0;i<r.length;i++)if(Gr(n,r[i]))return!0}for(let e=0;e<n.length;e++)if(Cf(t,n[e]))return!0;for(let e=0;e<t.length;e++)if(Qu(n,t[e]))return!0;return!1}u(go,"polygonIntersectsMultiPolygon");function Mf(n,t,e){for(let r=0;r<t.length;r++){let i=t[r];if(n.length>=3){for(let o=0;o<i.length;o++)if(Gr(n,i[o]))return!0}if(C_(n,i,e))return!0}return!1}u(Mf,"polygonIntersectsBufferedMultiLine");function C_(n,t,e){if(n.length>1){if(Qu(n,t))return!0;for(let r=0;r<t.length;r++)if(Yu(t[r],n,e))return!0}for(let r=0;r<n.length;r++)if(Yu(n[r],t,e))return!0;return!1}u(C_,"lineIntersectsBufferedLine");function Qu(n,t){if(n.length===0||t.length===0)return!1;for(let e=0;e<n.length-1;e++){let r=n[e],i=n[e+1];for(let o=0;o<t.length-1;o++){let a=t[o],s=t[o+1];if(E_(r,i,a,s))return!0}}return!1}u(Qu,"lineIntersectsLine");function E_(n,t,e,r){return Pt(n,e,r)!==Pt(t,e,r)&&Pt(n,t,e)!==Pt(n,t,r)}u(E_,"lineSegmentIntersectsLineSegment");function Yu(n,t,e){let r=e*e;if(t.length===1)return n.distSqr(t[0])<r;for(let i=1;i<t.length;i++){let o=t[i-1],a=t[i];if(Lf(n,o,a)<r)return!0}return!1}u(Yu,"pointIntersectsBufferedLine");function Lf(n,t,e){let r=t.distSqr(e);if(r===0)return n.distSqr(t);let i=((n.x-t.x)*(e.x-t.x)+(n.y-t.y)*(e.y-t.y))/r;return i<0?n.distSqr(t):i>1?n.distSqr(e):n.distSqr(e.sub(t)._mult(i)._add(t))}u(Lf,"distToSegmentSquared");function Cf(n,t){let e=!1,r,i,o;for(let a=0;a<n.length;a++){r=n[a];for(let s=0,l=r.length-1;s<r.length;l=s++)i=r[s],o=r[l],i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(e=!e)}return e}u(Cf,"multiPolygonContainsPoint");function Gr(n,t){let e=!1;for(let r=0,i=n.length-1;r<n.length;i=r++){let o=n[r],a=n[i];o.y>t.y!=a.y>t.y&&t.x<(a.x-o.x)*(t.y-o.y)/(a.y-o.y)+o.x&&(e=!e)}return e}u(Gr,"polygonContainsPoint");function kf(n,t,e,r,i){for(let a of n)if(t<=a.x&&e<=a.y&&r>=a.x&&i>=a.y)return!0;let o=[new Xi.default(t,e),new Xi.default(t,i),new Xi.default(r,i),new Xi.default(r,e)];if(n.length>2){for(let a of o)if(Gr(n,a))return!0}for(let a=0;a<n.length-1;a++){let s=n[a],l=n[a+1];if(M_(s,l,o))return!0}return!1}u(kf,"polygonIntersectsBox");function M_(n,t,e){let r=e[0],i=e[2];if(n.x<r.x&&t.x<r.x||n.x>i.x&&t.x>i.x||n.y<r.y&&t.y<r.y||n.y>i.y&&t.y>i.y)return!1;let o=Pt(n,t,e[0]);return o!==Pt(n,t,e[1])||o!==Pt(n,t,e[2])||o!==Pt(n,t,e[3])}u(M_,"edgeIntersectsBox");f();var xo=te(be(),1);function yr(n,t,e){let r=t.paint.get(n).value;return r.kind==="constant"?r.value:e.programConfigurations.get(t.id).getMaxValue(n)}u(yr,"getMaximumPaintValue");function Ht(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])}u(Ht,"translateDistance");function Zt(n,t,e,r,i){if(!t[0]&&!t[1])return n;let o=xo.default.convert(t)._mult(i);e==="viewport"&&o._rotate(-r);let a=[];for(let s=0;s<n.length;s++){let l=n[s];a.push(l.sub(o))}return a}u(Zt,"translate");function Df(n,t){let e=[];for(let r=0;r<n.length;r++){let i=n[r],o=[];for(let a=0;a<i.length;a++){let s=i[a-1],l=i[a],c=i[a+1],p=a===0?new xo.default(0,0):l.sub(s)._unit()._perp(),m=a===i.length-1?new xo.default(0,0):c.sub(l)._unit()._perp(),h=p._add(m)._unit(),d=h.x*m.x+h.y*m.y;d!==0&&h._mult(1/d),o.push(h._mult(t)._add(l))}e.push(o)}return e}u(Df,"offsetLine");f();var Ff,k_=u(()=>Ff=Ff||new Ie({"circle-sort-key":new H(T.layout_circle["circle-sort-key"])}),"getLayout"),zf,D_=u(()=>zf=zf||new Ie({"circle-radius":new H(T.paint_circle["circle-radius"]),"circle-color":new H(T.paint_circle["circle-color"]),"circle-blur":new H(T.paint_circle["circle-blur"]),"circle-opacity":new H(T.paint_circle["circle-opacity"]),"circle-translate":new q(T.paint_circle["circle-translate"]),"circle-translate-anchor":new q(T.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new q(T.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new q(T.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new H(T.paint_circle["circle-stroke-width"]),"circle-stroke-color":new H(T.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new H(T.paint_circle["circle-stroke-opacity"])}),"getPaint"),Bf={get paint(){return D_()},get layout(){return k_()}};var Rf=te(be(),1);var ec=class ec extends Le{constructor(e){super(e,Bf)}createBucket(e){return new dr(e)}queryRadius(e){let r=e;return yr("circle-radius",this,r)+yr("circle-stroke-width",this,r)+Ht(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,i,o,a,s,l,c){let p=Zt(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,l),m=this.paint.get("circle-radius").evaluate(r,i),h=this.paint.get("circle-stroke-width").evaluate(r,i),d=m+h,g=this.paint.get("circle-pitch-alignment")==="map",y=g?p:F_(p,c),x=g?d*l:d;for(let v of o)for(let b of v){let w=g?b:Of(b,c),S=x,P=Re.transformMat4([],[b.x,b.y,0,1],c);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?S*=P[3]/s.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(S*=s.cameraToCenterDistance/P[3]),Ef(y,w,S))return!0}return!1}};u(ec,"CircleStyleLayer");var _o=ec;function Of(n,t){let e=Re.transformMat4([],[n.x,n.y,0,1],t);return new Rf.default(e[0]/e[3],e[1]/e[3])}u(Of,"projectPoint");function F_(n,t){return n.map(e=>Of(e,t))}u(F_,"projectQueryGeometry");f();f();var tc=class tc extends dr{};u(tc,"HeatmapBucket");var Ki=tc;O("HeatmapBucket",Ki,{omit:["layers"]});f();var Vf,z_=u(()=>Vf=Vf||new Ie({"heatmap-radius":new H(T.paint_heatmap["heatmap-radius"]),"heatmap-weight":new H(T.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new q(T.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ur(T.paint_heatmap["heatmap-color"]),"heatmap-opacity":new q(T.paint_heatmap["heatmap-opacity"])}),"getPaint"),Uf={get paint(){return z_()}};f();f();function rc(n,{width:t,height:e},r,i){if(!i)i=new Uint8Array(t*e*r);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==t*e*r)throw new RangeError("mismatched image size. expected: ".concat(i.length," but got: ").concat(t*e*r));return n.width=t,n.height=e,n.data=i,n}u(rc,"createImage");function Nf(n,{width:t,height:e},r){if(t===n.width&&e===n.height)return;let i=rc({},{width:t,height:e},r);ic(n,i,{x:0,y:0},{x:0,y:0},{width:Math.min(n.width,t),height:Math.min(n.height,e)},r),n.width=t,n.height=e,n.data=i.data}u(Nf,"resizeImage");function ic(n,t,e,r,i,o){if(i.width===0||i.height===0)return t;if(i.width>n.width||i.height>n.height||e.x>n.width-i.width||e.y>n.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range destination coordinates for image copy");let a=n.data,s=t.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){let c=((e.y+l)*n.width+e.x)*o,p=((r.y+l)*t.width+r.x)*o;for(let m=0;m<i.width*o;m++)s[p+m]=a[c+m]}return t}u(ic,"copyImage");var bo=class bo{constructor(t,e){rc(this,t,1,e)}resize(t){Nf(this,t,1)}clone(){return new bo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,i,o){ic(t,e,r,i,o,1)}};u(bo,"AlphaImage");var gr=bo,vo=class vo{constructor(t,e){rc(this,t,4,e)}resize(t){Nf(this,t,4)}replace(t,e){e?this.data.set(t):t instanceof Uint8ClampedArray?this.data=new Uint8Array(t.buffer):this.data=t}clone(){return new vo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,i,o){ic(t,e,r,i,o,4)}};u(vo,"RGBAImage");var _e=vo;O("AlphaImage",gr);O("RGBAImage",_e);function wo(n){let t={},e=n.resolution||256,r=n.clips?n.clips.length:1,i=n.image||new _e({width:e,height:r});if(!Xh(e))throw new Error("width is not a power of 2 - ".concat(e));let o=u((a,s,l)=>{t[n.evaluationKey]=l;let c=n.expression.evaluate(t);i.data[a+s+0]=Math.floor(c.r*255/c.a),i.data[a+s+1]=Math.floor(c.g*255/c.a),i.data[a+s+2]=Math.floor(c.b*255/c.a),i.data[a+s+3]=Math.floor(c.a*255)},"renderPixel");if(n.clips)for(let a=0,s=0;a<r;++a,s+=e*4)for(let l=0,c=0;l<e;l++,c+=4){let p=l/(e-1),{start:m,end:h}=n.clips[a],d=m*(1-p)+h*p;o(s,c,d)}else for(let a=0,s=0;a<e;a++,s+=4){let l=a/(e-1);o(0,s,l)}return i}u(wo,"renderColorRamp");var nc=class nc extends Le{constructor(e){super(e,Uf);this._updateColorRamp()}createBucket(e){return new Ki(e)}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=wo({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};u(nc,"HeatmapStyleLayer");var So=nc;f();f();var Gf,B_=u(()=>Gf=Gf||new Ie({"hillshade-illumination-direction":new q(T.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new q(T.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new q(T.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new q(T.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new q(T.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new q(T.paint_hillshade["hillshade-accent-color"])}),"getPaint"),qf={get paint(){return B_()}};var oc=class oc extends Le{constructor(e){super(e,qf)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};u(oc,"HillshadeStyleLayer");var Po=oc;f();f();f();var R_=fe([{name:"a_pos",components:2,type:"Int16"}],4);var{members:jf,size:TP,alignment:IP}=R_;var Hf=te(Bh(),1);f();function $i(n,t){let e=n.length;if(e<=1)return[n];let r=[],i,o;for(let a=0;a<e;a++){let s=Yh(n[a]);s!==0&&(n[a].area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&r.push(i),i=[n[a]]):i.push(n[a]))}if(i&&r.push(i),t>1)for(let a=0;a<r.length;a++)r[a].length<=t||(Rh(r[a],t,1,r[a].length-1,O_),r[a]=r[a].slice(0,t));return r}u($i,"classifyRings");function O_(n,t){return t.area-n.area}u(O_,"compareAreas");f();function qr(n,t,e){let r=e.patternDependencies,i=!1;for(let o of t){let a=o.paint.get("".concat(n,"-pattern"));a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,r[s.to]=!0,r[s.from]=!0)}return i}u(qr,"hasPattern");function jr(n,t,e,r,i){let o=i.patternDependencies;for(let a of t){let l=a.paint.get("".concat(n,"-pattern")).value;if(l.kind!=="constant"){let c=l.evaluate({zoom:r-1},e,{},i.availableImages),p=l.evaluate({zoom:r},e,{},i.availableImages),m=l.evaluate({zoom:r+1},e,{},i.availableImages);c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,m=m&&m.name?m.name:m,o[c]=!0,o[p]=!0,o[m]=!0,e.patterns[a.id]={min:c,mid:p,max:m}}}return e}u(jr,"addPatternDependencies");var V_=500,ac=class ac{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new to,this.indexArray=new qe,this.indexArray2=new Gt,this.programConfigurations=new Ye(t.layers,t.zoom),this.segments=new ae,this.segments2=new ae,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasPattern=qr("fill",this.layers,e);let i=this.layers[0].layout.get("fill-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:c,sourceLayerIndex:p}of t){let m=this.layers[0]._featureFilter.needGeometry,h=et(s,m);if(!this.layers[0]._featureFilter.filter(new le(this.zoom),h,r))continue;let d=o?i.evaluate(h,{},r,e.availableImages):void 0,g={id:l,properties:s.properties,type:s.type,sourceLayerIndex:p,index:c,geometry:m?h.geometry:Qe(s),patterns:{},sortKey:d};a.push(g)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:c,sourceLayerIndex:p}=s;if(this.hasPattern){let h=jr("fill",this.layers,s,this.zoom,e);this.patternFeatures.push(h)}else this.addFeature(s,l,c,r,{});let m=t[c].feature;e.featureIndex.insert(m,l,c,p,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,jf),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,i,o){for(let a of $i(e,V_)){let s=0;for(let d of a)s+=d.length;let l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),c=l.vertexLength,p=[],m=[];for(let d of a){if(d.length===0)continue;d!==a[0]&&m.push(p.length/2);let g=this.segments2.prepareSegment(d.length,this.layoutVertexArray,this.indexArray2),y=g.vertexLength;this.layoutVertexArray.emplaceBack(d[0].x,d[0].y),this.indexArray2.emplaceBack(y+d.length-1,y),p.push(d[0].x),p.push(d[0].y);for(let x=1;x<d.length;x++)this.layoutVertexArray.emplaceBack(d[x].x,d[x].y),this.indexArray2.emplaceBack(y+x-1,y+x),p.push(d[x].x),p.push(d[x].y);g.vertexLength+=d.length,g.primitiveLength+=d.length}let h=(0,Hf.default)(p,m);for(let d=0;d<h.length;d+=3)this.indexArray.emplaceBack(c+h[d],c+h[d+1],c+h[d+2]);l.vertexLength+=s,l.primitiveLength+=h.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,o,i)}};u(ac,"FillBucket");var Ji=ac;O("FillBucket",Ji,{omit:["layers","patternFeatures"]});f();var Zf,U_=u(()=>Zf=Zf||new Ie({"fill-sort-key":new H(T.layout_fill["fill-sort-key"])}),"getLayout"),Wf,N_=u(()=>Wf=Wf||new Ie({"fill-antialias":new q(T.paint_fill["fill-antialias"]),"fill-opacity":new H(T.paint_fill["fill-opacity"]),"fill-color":new H(T.paint_fill["fill-color"]),"fill-outline-color":new H(T.paint_fill["fill-outline-color"]),"fill-translate":new q(T.paint_fill["fill-translate"]),"fill-translate-anchor":new q(T.paint_fill["fill-translate-anchor"]),"fill-pattern":new Tt(T.paint_fill["fill-pattern"])}),"getPaint"),Xf={get paint(){return N_()},get layout(){return U_()}};var sc=class sc extends Le{constructor(e){super(e,Xf)}recalculate(e,r){super.recalculate(e,r);let 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(e){return new Ji(e)}queryRadius(){return Ht(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,i,o,a,s,l){let c=Zt(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,l);return go(c,o)}isTileClipped(){return!0}};u(sc,"FillStyleLayer");var To=sc;f();f();f();var G_=fe([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Kf=fe([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:$f,size:gT,alignment:xT}=G_;var Jf=te(Bh(),1),Yf=te(Dn(),1);var q_=Yf.default.VectorTileFeature.types,j_=500,lc=Math.pow(2,13);function Yi(n,t,e,r,i,o,a,s){n.emplaceBack(t,e,Math.floor(r*lc)*2+a,i*lc*2,o*lc*2,Math.round(s))}u(Yi,"addVertex");var uc=class uc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ro,this.centroidVertexArray=new Nt,this.indexArray=new qe,this.programConfigurations=new Ye(t.layers,t.zoom),this.segments=new ae,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.features=[],this.hasPattern=qr("fill-extrusion",this.layers,e);for(let{feature:i,id:o,index:a,sourceLayerIndex:s}of t){let l=this.layers[0]._featureFilter.needGeometry,c=et(i,l);if(!this.layers[0]._featureFilter.filter(new le(this.zoom),c,r))continue;let p={id:o,sourceLayerIndex:s,index:a,geometry:l?c.geometry:Qe(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(jr("fill-extrusion",this.layers,p,this.zoom,e)):this.addFeature(p,p.geometry,a,r,{}),e.featureIndex.insert(i,p.geometry,a,s,this.index,!0)}}addFeatures(t,e,r){for(let i of this.features){let{geometry:o}=i;this.addFeature(i,o,i.index,e,r)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$f),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Kf.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,i,o){let a={x:0,y:0,vertexCount:0};for(let s of $i(e,j_)){let l=0;for(let g of s)l+=g.length;let c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let g of s){if(g.length===0||Z_(g))continue;let y=0;for(let x=0;x<g.length;x++){let v=g[x];if(x>=1){let b=g[x-1];if(!H_(v,b)){c.vertexLength+4>ae.MAX_VERTEX_ARRAY_LENGTH&&(c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let w=v.sub(b)._perp()._unit(),S=b.dist(v);y+S>32768&&(y=0),Yi(this.layoutVertexArray,v.x,v.y,w.x,w.y,0,0,y),Yi(this.layoutVertexArray,v.x,v.y,w.x,w.y,0,1,y),a.x+=2*v.x,a.y+=2*v.y,a.vertexCount+=2,y+=S,Yi(this.layoutVertexArray,b.x,b.y,w.x,w.y,0,0,y),Yi(this.layoutVertexArray,b.x,b.y,w.x,w.y,0,1,y),a.x+=2*b.x,a.y+=2*b.y,a.vertexCount+=2;let P=c.vertexLength;this.indexArray.emplaceBack(P,P+2,P+1),this.indexArray.emplaceBack(P+1,P+2,P+3),c.vertexLength+=4,c.primitiveLength+=2}}}}if(c.vertexLength+l>ae.MAX_VERTEX_ARRAY_LENGTH&&(c=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),q_[t.type]!=="Polygon")continue;let p=[],m=[],h=c.vertexLength;for(let g of s)if(g.length!==0){g!==s[0]&&m.push(p.length/2);for(let y=0;y<g.length;y++){let x=g[y];Yi(this.layoutVertexArray,x.x,x.y,0,0,1,1,0),a.x+=x.x,a.y+=x.y,a.vertexCount+=1,p.push(x.x),p.push(x.y)}}let d=(0,Jf.default)(p,m);for(let g=0;g<d.length;g+=3)this.indexArray.emplaceBack(h+d[g],h+d[g+2],h+d[g+1]);c.primitiveLength+=d.length/3,c.vertexLength+=l}for(let s=0;s<a.vertexCount;s++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,o,i)}};u(uc,"FillExtrusionBucket");var Qi=uc;O("FillExtrusionBucket",Qi,{omit:["layers","features"]});function H_(n,t){return n.x===t.x&&(n.x<0||n.x>8192)||n.y===t.y&&(n.y<0||n.y>8192)}u(H_,"isBoundaryEdge");function Z_(n){return n.every(t=>t.x<0)||n.every(t=>t.x>8192)||n.every(t=>t.y<0)||n.every(t=>t.y>8192)}u(Z_,"isEntirelyOutside");f();var Qf,W_=u(()=>Qf=Qf||new Ie({"fill-extrusion-opacity":new q(T["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new H(T["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new q(T["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new q(T["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Tt(T["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new H(T["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new H(T["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new q(T["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),"getPaint"),ed={get paint(){return W_()}};var Io=te(be(),1);var cc=class cc extends Le{constructor(e){super(e,ed)}createBucket(e){return new Qi(e)}queryRadius(){return Ht(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,i,o,a,s,l,c){let p=Zt(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,l),m=this.paint.get("fill-extrusion-height").evaluate(r,i),h=this.paint.get("fill-extrusion-base").evaluate(r,i),d=$_(p,c,s,0),g=K_(o,h,m,c),y=g[0],x=g[1];return X_(y,x,d)}};u(cc,"FillExtrusionStyleLayer");var Ao=cc;function en(n,t){return n.x*t.x+n.y*t.y}u(en,"dot");function td(n,t){if(n.length===1){let e=0,r=t[e++],i;for(;!i||r.equals(i);)if(i=t[e++],!i)return 1/0;for(;e<t.length;e++){let o=t[e],a=n[0],s=i.sub(r),l=o.sub(r),c=a.sub(r),p=en(s,s),m=en(s,l),h=en(l,l),d=en(c,s),g=en(c,l),y=p*h-m*m,x=(h*d-m*g)/y,v=(p*g-m*d)/y,b=1-x-v,w=r.z*b+i.z*x+o.z*v;if(isFinite(w))return w}return 1/0}else{let e=1/0;for(let r of t)e=Math.min(e,r.z);return e}}u(td,"getIntersectionDistance");function X_(n,t,e){let r=1/0;go(e,t)&&(r=td(e,t[0]));for(let i=0;i<t.length;i++){let o=t[i],a=n[i];for(let s=0;s<o.length-1;s++){let l=o[s],c=o[s+1],p=a[s],m=a[s+1],h=[l,c,m,p,l];yo(e,h)&&(r=Math.min(r,td(e,h)))}}return r===1/0?!1:r}u(X_,"checkIntersection");function K_(n,t,e,r){let i=[],o=[],a=r[8]*t,s=r[9]*t,l=r[10]*t,c=r[11]*t,p=r[8]*e,m=r[9]*e,h=r[10]*e,d=r[11]*e;for(let g of n){let y=[],x=[];for(let v of g){let b=v.x,w=v.y,S=r[0]*b+r[4]*w+r[12],P=r[1]*b+r[5]*w+r[13],I=r[2]*b+r[6]*w+r[14],C=r[3]*b+r[7]*w+r[15],z=S+a,D=P+s,A=I+l,R=C+c,U=S+p,L=P+m,N=I+h,V=C+d,W=new Io.default(z/R,D/R);W.z=A/R,y.push(W);let Z=new Io.default(U/V,L/V);Z.z=N/V,x.push(Z)}i.push(y),o.push(x)}return[i,o]}u(K_,"projectExtrusion");function $_(n,t,e,r){let i=[];for(let o of n){let a=[o.x,o.y,r,1];Re.transformMat4(a,a,t),i.push(new Io.default(a[0]/a[3],a[1]/a[3]))}return i}u($_,"projectQueryGeometry");f();f();f();var J_=fe([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:rd,size:i2,alignment:n2}=J_;f();var Y_=fe([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:id,size:l2,alignment:u2}=Y_;var ad=te(Dn(),1);var Q_=ad.default.VectorTileFeature.types,nd=63,eb=Math.cos(75/2*(Math.PI/180)),tb=15,rb=20,ib=15,sd=1/2,od=Math.pow(2,ib-1)/sd,pc=class pc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new io,this.layoutVertexArray2=new no,this.indexArray=new qe,this.programConfigurations=new Ye(t.layers,t.zoom),this.segments=new ae,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasPattern=qr("line",this.layers,e);let i=this.layers[0].layout.get("line-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:c,sourceLayerIndex:p}of t){let m=this.layers[0]._featureFilter.needGeometry,h=et(s,m);if(!this.layers[0]._featureFilter.filter(new le(this.zoom),h,r))continue;let d=o?i.evaluate(h,{},r):void 0,g={id:l,properties:s.properties,type:s.type,sourceLayerIndex:p,index:c,geometry:m?h.geometry:Qe(s),patterns:{},sortKey:d};a.push(g)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:c,sourceLayerIndex:p}=s;if(this.hasPattern){let h=jr("line",this.layers,s,this.zoom,e);this.patternFeatures.push(h)}else this.addFeature(s,l,c,r,{});let m=t[c].feature;e.featureIndex.insert(m,l,c,p,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,id)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,rd),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end")){let e=+t.properties.mapbox_clip_start,r=+t.properties.mapbox_clip_end;return{start:e,end:r}}}addFeature(t,e,r,i,o){let a=this.layers[0].layout,s=a.get("line-join").evaluate(t,{}),l=a.get("line-cap"),c=a.get("line-miter-limit"),p=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let m of e)this.addLine(m,t,s,l,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,o,i)}addLine(t,e,r,i,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<t.length-1;v++)this.totalDistance+=t[v].dist(t[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s=Q_[e.type]==="Polygon",l=t.length;for(;l>=2&&t[l-1].equals(t[l-2]);)l--;let c=0;for(;c<l-1&&t[c].equals(t[c+1]);)c++;if(l<(s?3:2))return;r==="bevel"&&(o=1.05);let p=this.overscaling<=16?tb*8192/(512*this.overscaling):0,m=this.segments.prepareSegment(l*10,this.layoutVertexArray,this.indexArray),h,d,g,y,x;this.e1=this.e2=-1,s&&(h=t[l-2],x=t[c].sub(h)._unit()._perp());for(let v=c;v<l;v++){if(g=v===l-1?s?t[c+1]:void 0:t[v+1],g&&t[v].equals(g))continue;x&&(y=x),h&&(d=h),h=t[v],x=g?g.sub(h)._unit()._perp():y,y=y||x;let b=y.add(x);(b.x!==0||b.y!==0)&&b._unit();let w=y.x*x.x+y.y*x.y,S=b.x*x.x+b.y*x.y,P=S!==0?1/S:1/0,I=2*Math.sqrt(2-2*S),C=S<eb&&d&&g,z=y.x*x.y-y.y*x.x>0;if(C&&v>c){let R=h.dist(d);if(R>2*p){let U=h.sub(h.sub(d)._mult(p/R)._round());this.updateDistance(d,U),this.addCurrentVertex(U,y,0,0,m),d=U}}let D=d&&g,A=D?r:s?"butt":i;if(D&&A==="round"&&(P<a?A="miter":P<=2&&(A="fakeround")),A==="miter"&&P>o&&(A="bevel"),A==="bevel"&&(P>2&&(A="flipbevel"),P<o&&(A="miter")),d&&this.updateDistance(d,h),A==="miter")b._mult(P),this.addCurrentVertex(h,b,0,0,m);else if(A==="flipbevel"){if(P>100)b=x.mult(-1);else{let R=P*y.add(x).mag()/y.sub(x).mag();b._perp()._mult(R*(z?-1:1))}this.addCurrentVertex(h,b,0,0,m),this.addCurrentVertex(h,b.mult(-1),0,0,m)}else if(A==="bevel"||A==="fakeround"){let R=-Math.sqrt(P*P-1),U=z?R:0,L=z?0:R;if(d&&this.addCurrentVertex(h,y,U,L,m),A==="fakeround"){let N=Math.round(I*180/Math.PI/rb);for(let V=1;V<N;V++){let W=V/N;if(W!==.5){let ue=W-.5,Y=1.0904+w*(-3.2452+w*(3.55645-w*1.43519)),Oe=.848013+w*(-1.06021+w*.215638);W=W+W*ue*(W-1)*(Y*ue*ue+Oe)}let Z=x.sub(y)._mult(W)._add(y)._unit()._mult(z?-1:1);this.addHalfVertex(h,Z.x,Z.y,!1,z,0,m)}}g&&this.addCurrentVertex(h,x,-U,-L,m)}else if(A==="butt")this.addCurrentVertex(h,b,0,0,m);else if(A==="square"){let R=d?1:-1;this.addCurrentVertex(h,b,R,R,m)}else A==="round"&&(d&&(this.addCurrentVertex(h,y,0,0,m),this.addCurrentVertex(h,y,1,1,m,!0)),g&&(this.addCurrentVertex(h,x,-1,-1,m,!0),this.addCurrentVertex(h,x,0,0,m)));if(C&&v<l-1){let R=h.dist(g);if(R>2*p){let U=h.add(g.sub(h)._mult(p/R)._round());this.updateDistance(h,U),this.addCurrentVertex(U,x,0,0,m),h=U}}}}addCurrentVertex(t,e,r,i,o,a=!1){let s=e.x+e.y*r,l=e.y-e.x*r,c=-e.x+e.y*i,p=-e.y-e.x*i;this.addHalfVertex(t,s,l,a,!1,r,o),this.addHalfVertex(t,c,p,a,!0,-i,o),this.distance>od/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,o,a))}addHalfVertex({x:t,y:e},r,i,o,a,s,l){let p=(this.lineClips?this.scaledDistance*(od-1):this.scaledDistance)*sd;if(this.layoutVertexArray.emplaceBack((t<<1)+(o?1:0),(e<<1)+(a?1:0),Math.round(nd*r)+128,Math.round(nd*i)+128,(s===0?0:s<0?-1:1)+1|(p&63)<<2,p>>6),this.lineClips){let h=this.scaledDistance-this.lineClips.start,d=this.lineClips.end-this.lineClips.start,g=h/d;this.layoutVertexArray2.emplaceBack(g,this.lineClipsArray.length)}let m=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,m),l.primitiveLength++),a?this.e2=m:this.e1=m}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}};u(pc,"LineBucket");var tn=pc;O("LineBucket",tn,{omit:["layers","patternFeatures"]});f();var ld,nb=u(()=>ld=ld||new Ie({"line-cap":new q(T.layout_line["line-cap"]),"line-join":new H(T.layout_line["line-join"]),"line-miter-limit":new q(T.layout_line["line-miter-limit"]),"line-round-limit":new q(T.layout_line["line-round-limit"]),"line-sort-key":new H(T.layout_line["line-sort-key"])}),"getLayout"),ud,ob=u(()=>ud=ud||new Ie({"line-opacity":new H(T.paint_line["line-opacity"]),"line-color":new H(T.paint_line["line-color"]),"line-translate":new q(T.paint_line["line-translate"]),"line-translate-anchor":new q(T.paint_line["line-translate-anchor"]),"line-width":new H(T.paint_line["line-width"]),"line-gap-width":new H(T.paint_line["line-gap-width"]),"line-offset":new H(T.paint_line["line-offset"]),"line-blur":new H(T.paint_line["line-blur"]),"line-dasharray":new lr(T.paint_line["line-dasharray"]),"line-pattern":new Tt(T.paint_line["line-pattern"]),"line-gradient":new ur(T.paint_line["line-gradient"])}),"getPaint"),mc={get paint(){return ob()},get layout(){return nb()}};var fc=class fc extends H{possiblyEvaluate(e,r){return r=new le(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,i,o){return r=k({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,i,o)}};u(fc,"LineFloorwidthProperty");var hc=fc,Co,dc=class dc extends Le{constructor(e){super(e,mc);this.gradientVersion=0,Co||(Co=new hc(mc.paint.properties["line-width"].specification),Co.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=r._styleExpression.expression instanceof Ah,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=Co.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new tn(e)}queryRadius(e){let r=e,i=cd(yr("line-width",this,r),yr("line-gap-width",this,r)),o=yr("line-offset",this,r);return i/2+Math.abs(o)+Ht(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,i,o,a,s,l){let c=Zt(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,l),p=l/2*cd(this.paint.get("line-width").evaluate(r,i),this.paint.get("line-gap-width").evaluate(r,i)),m=this.paint.get("line-offset").evaluate(r,i);return m&&(o=Df(o,m*l)),Mf(c,o,p)}isTileClipped(){return!0}};u(dc,"LineStyleLayer");var Eo=dc;function cd(n,t){return t>0?t+2*n:n}u(cd,"getLineWidth");f();f();f();var pd=fe([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),md=fe([{name:"a_projected_pos",components:3,type:"Float32"}],4),Q2=fe([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),hd=fe([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),eI=fe([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),yc=fe([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),fd=fe([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),tI=fe([{name:"triangle",components:3,type:"Uint16"}]),rI=fe([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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"}]),iI=fe([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),nI=fe([{type:"Float32",name:"offsetX"}]),oI=fe([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var nn=te(be(),1);f();function ab(n,t,e){let r=t.layout.get("text-transform").evaluate(e,{});return r==="uppercase"?n=n.toLocaleUpperCase():r==="lowercase"&&(n=n.toLocaleLowerCase()),Je.applyArabicShaping&&(n=Je.applyArabicShaping(n)),n}u(ab,"transformTextInternal");function dd(n,t,e){return n.sections.forEach(r=>{r.text=ab(r.text,t,e)}),n}u(dd,"transformText");f();function yd(n){let t={},e={},r=[],i=0;function o(c){r.push(n[c]),i++}u(o,"add");function a(c,p,m){let h=e[c];return delete e[c],e[p]=h,r[h].geometry[0].pop(),r[h].geometry[0]=r[h].geometry[0].concat(m[0]),h}u(a,"mergeFromRight");function s(c,p,m){let h=t[p];return delete t[p],t[c]=h,r[h].geometry[0].shift(),r[h].geometry[0]=m[0].concat(r[h].geometry[0]),h}u(s,"mergeFromLeft");function l(c,p,m){let h=m?p[0][p[0].length-1]:p[0][0];return"".concat(c,":").concat(h.x,":").concat(h.y)}u(l,"getKey");for(let c=0;c<n.length;c++){let p=n[c],m=p.geometry,h=p.text?p.text.toString():null;if(!h){o(c);continue}let d=l(h,m),g=l(h,m,!0);if(d in e&&g in t&&e[d]!==t[g]){let y=s(d,g,m),x=a(d,g,r[y].geometry);delete t[d],delete e[g],e[l(h,r[x].geometry,!0)]=x,r[y].geometry=null}else d in e?a(d,g,m):g in t?s(d,g,m):(o(c),t[d]=i-1,e[g]=i-1)}return r.filter(c=>c.geometry)}u(yd,"mergeLines");f();f();var gd={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};f();var xr=24;f();var _d=te(Oh(),1);var xd=3;function sb(n,t,e){n===1&&e.readMessage(lb,t)}u(sb,"readFontstacks");function lb(n,t,e){if(n===3){let{id:r,bitmap:i,width:o,height:a,left:s,top:l,advance:c}=e.readMessage(ub,{});t.push({id:r,bitmap:new gr({width:o+2*xd,height:a+2*xd},i),metrics:{width:o,height:a,left:s,top:l,advance:c}})}}u(lb,"readFontstack");function ub(n,t,e){n===1?t.id=e.readVarint():n===2?t.bitmap=e.readBytes():n===3?t.width=e.readVarint():n===4?t.height=e.readVarint():n===5?t.left=e.readSVarint():n===6?t.top=e.readSVarint():n===7&&(t.advance=e.readVarint())}u(ub,"readGlyph");function bd(n){return new _d.default(n).readFields(sb,[])}u(bd,"parseGlyphPbf");f();var tt=1;var xc=class xc{constructor(t,{pixelRatio:e,version:r,stretchX:i,stretchY:o,content:a}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=i,this.stretchY=o,this.content=a,this.version=r}get tl(){return[this.paddedRect.x+tt,this.paddedRect.y+tt]}get br(){return[this.paddedRect.x+this.paddedRect.w-tt,this.paddedRect.y+this.paddedRect.h-tt]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-tt*2)/this.pixelRatio,(this.paddedRect.h-tt*2)/this.pixelRatio]}};u(xc,"ImagePosition");var Hr=xc,_c=class _c{constructor(t,e){let r={},i={};this.haveRenderCallbacks=[];let o=[];this.addImages(t,r,o),this.addImages(e,i,o);let{w:a,h:s}=Fn(o),l=new _e({width:a||1,height:s||1});for(let c in t){let p=t[c],m=r[c].paddedRect;_e.copy(p.data,l,{x:0,y:0},{x:m.x+tt,y:m.y+tt},p.data)}for(let c in e){let p=e[c],m=i[c].paddedRect,h=m.x+tt,d=m.y+tt,g=p.data.width,y=p.data.height;_e.copy(p.data,l,{x:0,y:0},{x:h,y:d},p.data),_e.copy(p.data,l,{x:0,y:y-1},{x:h,y:d-1},{width:g,height:1}),_e.copy(p.data,l,{x:0,y:0},{x:h,y:d+y},{width:g,height:1}),_e.copy(p.data,l,{x:g-1,y:0},{x:h-1,y:d},{width:1,height:y}),_e.copy(p.data,l,{x:0,y:0},{x:h+g,y:d},{width:1,height:y})}this.image=l,this.iconPositions=r,this.patternPositions=i}addImages(t,e,r){for(let i in t){let o=t[i],a={x:0,y:0,w:o.data.width+2*tt,h:o.data.height+2*tt};r.push(a),e[i]=new Hr(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}patchUpdatedImage(t,e,r){if(!t||!e||t.version===e.version)return;t.version=e.version;let[i,o]=t.tl;r.update(e.data,void 0,{x:i,y:o})}};u(_c,"ImageAtlas");var gc=_c;O("ImagePosition",Hr);O("ImageAtlas",gc);var _r=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(_r||{});function Mo(n){let t=.5,e=.5;switch(n){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0;break}switch(n){case"bottom":case"bottom-right":case"bottom-left":e=1;break;case"top":case"top-right":case"top-left":e=0;break}return{horizontalAlign:t,verticalAlign:e}}u(Mo,"getAnchorAlignment");var Sd=te(Dn(),1);f();var vd=255,rn=128,Lo=vd*rn;function bc(n,t){let{expression:e}=t;if(e.kind==="constant")return{kind:"constant",layoutSize:e.evaluate(new le(n+1))};if(e.kind==="source")return{kind:"source"};{let{zoomStops:r,interpolationType:i}=e,o=0;for(;o<r.length&&r[o]<=n;)o++;o=Math.max(0,o-1);let a=o;for(;a<r.length&&r[a]<n+1;)a++;a=Math.min(r.length-1,a);let s=r[o],l=r[a];if(e.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i};let c=e.evaluate(new le(s)),p=e.evaluate(new le(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:c,maxSize:p,interpolationType:i}}}u(bc,"getSizeData");function Zr(n,{uSize:t,uSizeT:e},{lowerSize:r,upperSize:i}){return n.kind==="source"?r/rn:n.kind==="composite"?Ae.number(r/rn,i/rn,e):t}u(Zr,"evaluateSizeForFeature");function br(n,t){let e=0,r=0;if(n.kind==="constant")r=n.layoutSize;else if(n.kind!=="source"){let{interpolationType:i,minZoom:o,maxZoom:a}=n,s=i?ye(Ch.interpolationFactor(i,t,o,a),0,1):0;n.kind==="camera"?r=Ae.number(n.minSize,n.maxSize,s):e=s}return{uSizeT:e,uSize:r}}u(br,"evaluateSizeForZoom");f();function Wr(n,t,e){let r="never",i=n.get(t);return i?r=i:n.get(e)&&(r="always"),r}u(Wr,"getOverlapMode");var pb=Sd.default.VectorTileFeature.types,mb=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ko(n,t,e,r,i,o,a,s,l,c,p,m,h){let d=s?Math.min(Lo,Math.round(s[0])):0,g=s?Math.min(Lo,Math.round(s[1])):0;n.emplaceBack(t,e,Math.round(r*32),Math.round(i*32),o,a,(d<<1)+(l?1:0),g,c*16,p*16,m*256,h*256)}u(ko,"addVertex");function vr(n,t,e){n.emplaceBack(t.x,t.y,e),n.emplaceBack(t.x,t.y,e),n.emplaceBack(t.x,t.y,e),n.emplaceBack(t.x,t.y,e)}u(vr,"addDynamicAttributes");function hb(n){for(let t of n.sections)if(df(t.text))return!0;return!1}u(hb,"containsRTLText");var vc=class vc{constructor(t){this.layoutVertexArray=new oo,this.indexArray=new qe,this.programConfigurations=t,this.segments=new ae,this.dynamicLayoutVertexArray=new ao,this.opacityVertexArray=new so,this.hasVisibleVertices=!1,this.placedSymbolArray=new Vi}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,e,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,pd.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,md.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,mb,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};u(vc,"SymbolBuffers");var on=vc;O("SymbolBuffers",on);var wc=class wc{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new ae,this.collisionVertexArray=new uo}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,hd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};u(wc,"CollisionBuffers");var an=wc;O("CollisionBuffers",an);var Sc=class Sc{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(l=>l.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=G.identity([]),this.placementViewportMatrix=G.identity([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=bc(this.zoom,r["text-size"]),this.iconSizeData=bc(this.zoom,r["icon-size"]);let i=this.layers[0].layout,o=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=Wr(i,"text-overlap","text-allow-overlap")!=="never"||Wr(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!o.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(l=>_r[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=t.sourceID}createArrays(){this.text=new on(new Ye(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new on(new Ye(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new Ni,this.lineVertexArray=new Gi,this.symbolInstances=new Ui}calculateGlyphDependencies(t,e,r,i,o){for(let a=0;a<t.length;a++)if(e[t.charCodeAt(a)]=!0,(r||i)&&o){let s=gd[t.charAt(a)];s&&(e[s.charCodeAt(0)]=!0)}}populate(t,e,r){let i=this.layers[0],o=i.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),c=(s.value.kind!=="constant"||s.value.value instanceof fi&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),p=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,m=o.get("symbol-sort-key");if(this.features=[],!c&&!p)return;let h=e.iconDependencies,d=e.glyphDependencies,g=e.availableImages,y=new le(this.zoom);for(let{feature:x,id:v,index:b,sourceLayerIndex:w}of t){let S=i._featureFilter.needGeometry,P=et(x,S);if(!i._featureFilter.filter(y,P,r))continue;S||(P.geometry=Qe(x));let I;if(c){let A=i.getValueAndResolveTokens("text-field",P,r,g),R=fi.factory(A);hb(R)&&(this.hasRTLText=!0),(!this.hasRTLText||bi()==="unavailable"||this.hasRTLText&&Je.isParsed())&&(I=dd(R,i,P))}let C;if(p){let A=i.getValueAndResolveTokens("icon-image",P,r,g);A instanceof di?C=A:C=di.fromString(A)}if(!I&&!C)continue;let z=this.sortFeaturesByKey?m.evaluate(P,{},r):void 0,D={id:v,text:I,icon:C,index:b,sourceLayerIndex:w,geometry:P.geometry,properties:x.properties,type:pb[x.type],sortKey:z};if(this.features.push(D),C&&(h[C.name]=!0),I){let A=a.evaluate(P,{},r).join(","),R=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let U of I.sections)if(U.image)h[U.image.name]=!0;else{let L=hl(I.toString()),N=U.fontStack||A,V=d[N]=d[N]||{};this.calculateGlyphDependencies(U.text,V,R,this.allowVerticalPlacement,L)}}}o.get("symbol-placement")==="line"&&(this.features=yd(this.features)),this.sortFeaturesByKey&&this.features.sort((x,v)=>x.sortKey-v.sortKey)}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){let r=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(e[t.segment+1]),o=t.dist(e[t.segment]),a={};for(let s=t.segment+1;s<e.length;s++)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s<e.length-1&&(i+=e[s+1].dist(e[s]));for(let s=t.segment||0;s>=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=e[s-1].dist(e[s]));for(let s=0;s<e.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,i,o,a,s,l,c,p,m,h){let d=t.indexArray,g=t.layoutVertexArray,y=t.segments.prepareSegment(4*e.length,g,d,this.canOverlap?a.sortKey:void 0),x=this.glyphOffsetArray.length,v=y.vertexLength,b=this.allowVerticalPlacement&&s===2?Math.PI/2:0,w=a.text&&a.text.sections;for(let S=0;S<e.length;S++){let{tl:P,tr:I,bl:C,br:z,tex:D,pixelOffsetTL:A,pixelOffsetBR:R,minFontScaleX:U,minFontScaleY:L,glyphOffset:N,isSDF:V,sectionIndex:W}=e[S],Z=y.vertexLength,ue=N[1];ko(g,l.x,l.y,P.x,ue+P.y,D.x,D.y,r,V,A.x,A.y,U,L),ko(g,l.x,l.y,I.x,ue+I.y,D.x+D.w,D.y,r,V,R.x,A.y,U,L),ko(g,l.x,l.y,C.x,ue+C.y,D.x,D.y+D.h,r,V,A.x,R.y,U,L),ko(g,l.x,l.y,z.x,ue+z.y,D.x+D.w,D.y+D.h,r,V,R.x,R.y,U,L),vr(t.dynamicLayoutVertexArray,l,b),d.emplaceBack(Z,Z+1,Z+2),d.emplaceBack(Z+1,Z+2,Z+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(N[0]),(S===e.length-1||W!==e[S+1].sectionIndex)&&t.programConfigurations.populatePaintArrays(g.length,a,a.index,{},h,w&&w[W])}t.placedSymbolArray.emplaceBack(l.x,l.y,x,this.glyphOffsetArray.length-x,v,c,p,l.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,m)}_addCollisionDebugVertex(t,e,r,i,o,a){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,i,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(t,e,r,i,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=l.vertexLength,p=o.layoutVertexArray,m=o.collisionVertexArray,h=s.anchorX,d=s.anchorY;this._addCollisionDebugVertex(p,m,a,h,d,new nn.default(t,e)),this._addCollisionDebugVertex(p,m,a,h,d,new nn.default(r,e)),this._addCollisionDebugVertex(p,m,a,h,d,new nn.default(r,i)),this._addCollisionDebugVertex(p,m,a,h,d,new nn.default(t,i)),l.vertexLength+=4;let g=o.indexArray;g.emplaceBack(c,c+1),g.emplaceBack(c+1,c+2),g.emplaceBack(c+2,c+3),g.emplaceBack(c+3,c),l.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,i){for(let o=t;o<e;o++){let a=this.collisionBoxArray.get(o),s=a.x1,l=a.y1,c=a.x2,p=a.y2;this.addCollisionDebugVertices(s,l,c,p,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new an(ji,yc.members,Gt),this.iconCollisionBox=new an(ji,yc.members,Gt);for(let t=0;t<this.symbolInstances.length;t++){let e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,r,i,o,a,s,l,c){let p={};for(let m=e;m<r;m++){let h=t.get(m);p.textBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},p.textFeatureIndex=h.featureIndex;break}for(let m=i;m<o;m++){let h=t.get(m);p.verticalTextBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},p.verticalTextFeatureIndex=h.featureIndex;break}for(let m=a;m<s;m++){let h=t.get(m);p.iconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},p.iconFeatureIndex=h.featureIndex;break}for(let m=l;m<c;m++){let h=t.get(m);p.verticalIconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},p.verticalIconFeatureIndex=h.featureIndex;break}return p}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){let r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){let r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+r.numGlyphs*4;for(let o=r.vertexStartIndex;o<i;o+=4)t.indexArray.emplaceBack(o,o+1,o+2),t.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let e=Math.sin(t),r=Math.cos(t),i=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);i.push(Math.round(e*l.anchorX+r*l.anchorY)|0),o.push(l.featureIndex)}return a.sort((s,l)=>i[s]-i[l]||o[l]-o[s]),a}addToSortKeyRanges(t,e){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let r=this.symbolInstances.get(e);this.featureSortOrder.push(r.featureIndex),[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach((i,o,a)=>{i>=0&&a.indexOf(i)===o&&this.addIndicesForPlacedSymbol(this.text,i)}),r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};u(Sc,"SymbolBucket");var yt=Sc;O("SymbolBucket",yt,{omit:["layers","collisionBoxArray","features","compareText"]});yt.MAX_GLYPHS=65535;yt.addDynamicAttributes=vr;f();function Pd(n,t){return t.replace(/{([^{}]+)}/g,(e,r)=>r in n?String(n[r]):"")}u(Pd,"resolveTokens");f();var Td,fb=u(()=>Td=Td||new Ie({"symbol-placement":new q(T.layout_symbol["symbol-placement"]),"symbol-spacing":new q(T.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new q(T.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new H(T.layout_symbol["symbol-sort-key"]),"symbol-z-order":new q(T.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new q(T.layout_symbol["icon-allow-overlap"]),"icon-overlap":new q(T.layout_symbol["icon-overlap"]),"icon-ignore-placement":new q(T.layout_symbol["icon-ignore-placement"]),"icon-optional":new q(T.layout_symbol["icon-optional"]),"icon-rotation-alignment":new q(T.layout_symbol["icon-rotation-alignment"]),"icon-size":new H(T.layout_symbol["icon-size"]),"icon-text-fit":new q(T.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new q(T.layout_symbol["icon-text-fit-padding"]),"icon-image":new H(T.layout_symbol["icon-image"]),"icon-rotate":new H(T.layout_symbol["icon-rotate"]),"icon-padding":new H(T.layout_symbol["icon-padding"]),"icon-keep-upright":new q(T.layout_symbol["icon-keep-upright"]),"icon-offset":new H(T.layout_symbol["icon-offset"]),"icon-anchor":new H(T.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new q(T.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new q(T.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new q(T.layout_symbol["text-rotation-alignment"]),"text-field":new H(T.layout_symbol["text-field"]),"text-font":new H(T.layout_symbol["text-font"]),"text-size":new H(T.layout_symbol["text-size"]),"text-max-width":new H(T.layout_symbol["text-max-width"]),"text-line-height":new q(T.layout_symbol["text-line-height"]),"text-letter-spacing":new H(T.layout_symbol["text-letter-spacing"]),"text-justify":new H(T.layout_symbol["text-justify"]),"text-radial-offset":new H(T.layout_symbol["text-radial-offset"]),"text-variable-anchor":new q(T.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new H(T.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new H(T.layout_symbol["text-anchor"]),"text-max-angle":new q(T.layout_symbol["text-max-angle"]),"text-writing-mode":new q(T.layout_symbol["text-writing-mode"]),"text-rotate":new H(T.layout_symbol["text-rotate"]),"text-padding":new q(T.layout_symbol["text-padding"]),"text-keep-upright":new q(T.layout_symbol["text-keep-upright"]),"text-transform":new H(T.layout_symbol["text-transform"]),"text-offset":new H(T.layout_symbol["text-offset"]),"text-allow-overlap":new q(T.layout_symbol["text-allow-overlap"]),"text-overlap":new q(T.layout_symbol["text-overlap"]),"text-ignore-placement":new q(T.layout_symbol["text-ignore-placement"]),"text-optional":new q(T.layout_symbol["text-optional"])}),"getLayout"),Id,db=u(()=>Id=Id||new Ie({"icon-opacity":new H(T.paint_symbol["icon-opacity"]),"icon-color":new H(T.paint_symbol["icon-color"]),"icon-halo-color":new H(T.paint_symbol["icon-halo-color"]),"icon-halo-width":new H(T.paint_symbol["icon-halo-width"]),"icon-halo-blur":new H(T.paint_symbol["icon-halo-blur"]),"icon-translate":new q(T.paint_symbol["icon-translate"]),"icon-translate-anchor":new q(T.paint_symbol["icon-translate-anchor"]),"text-opacity":new H(T.paint_symbol["text-opacity"]),"text-color":new H(T.paint_symbol["text-color"],{runtimeType:wh,getOverride:n=>n.textColor,hasOverride:n=>!!n.textColor}),"text-halo-color":new H(T.paint_symbol["text-halo-color"]),"text-halo-width":new H(T.paint_symbol["text-halo-width"]),"text-halo-blur":new H(T.paint_symbol["text-halo-blur"]),"text-translate":new q(T.paint_symbol["text-translate"]),"text-translate-anchor":new q(T.paint_symbol["text-translate-anchor"])}),"getPaint"),Do={get paint(){return db()},get layout(){return fb()}};f();var Pc=class Pc{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:vh,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let e=this.defaultValue.value;t(e._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};u(Pc,"FormatSectionOverride");var sn=Pc;O("FormatSectionOverride",sn,{omit:["defaultValue"]});var ln=class ln extends Le{constructor(e){super(e,Do)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let i=this.layout.get("text-writing-mode");if(i){let o=[];for(let a of i)o.indexOf(a)<0&&o.push(a);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,i,o){let a=this.layout.get(e).evaluate(r,{},i,o),s=this._unevaluatedLayout._values[e];return!s.isDataDriven()&&!Mh(s.value)&&a?Pd(r.properties,a):a}createBucket(e){return new yt(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Do.paint.overridableProperties){if(!ln.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),i=new sn(r),o=new En(i,r.property.specification),a=null;r.value.kind==="constant"||r.value.kind==="source"?a=new Mn("source",o):a=new Ln("composite",o,r.value.zoomStops),this.paint._values[e]=new je(r.property,a,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:ln.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let i=e.get("text-field"),o=Do.paint.properties[r],a=!1,s=u(l=>{for(let c of l)if(o.overrides&&o.overrides.hasOverride(c)){a=!0;return}},"checkSections");if(i.value.kind==="constant"&&i.value.value instanceof fi)s(i.value.value.sections);else if(i.value.kind==="source"){let l=u(p=>{if(!a)if(p instanceof Th&&Ph(p.value)===Sh){let m=p.value;s(m.sections)}else p instanceof Eh?s(p.sections):p.eachChild(l)},"checkExpression"),c=i.value;c._styleExpression&&l(c._styleExpression.expression)}return a}};u(ln,"SymbolStyleLayer");var Fo=ln;f();f();var Ad,yb=u(()=>Ad=Ad||new Ie({"background-color":new q(T.paint_background["background-color"]),"background-pattern":new lr(T.paint_background["background-pattern"]),"background-opacity":new q(T.paint_background["background-opacity"])}),"getPaint"),Cd={get paint(){return yb()}};var Tc=class Tc extends Le{constructor(e){super(e,Cd)}};u(Tc,"BackgroundStyleLayer");var zo=Tc;f();f();var Ed,gb=u(()=>Ed=Ed||new Ie({"raster-opacity":new q(T.paint_raster["raster-opacity"]),"raster-hue-rotate":new q(T.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new q(T.paint_raster["raster-brightness-min"]),"raster-brightness-max":new q(T.paint_raster["raster-brightness-max"]),"raster-saturation":new q(T.paint_raster["raster-saturation"]),"raster-contrast":new q(T.paint_raster["raster-contrast"]),"raster-resampling":new q(T.paint_raster["raster-resampling"]),"raster-fade-duration":new q(T.paint_raster["raster-fade-duration"])}),"getPaint"),Md={get paint(){return gb()}};var Ic=class Ic extends Le{constructor(e){super(e,Md)}};u(Ic,"RasterStyleLayer");var Bo=Ic;f();function Ld(n){let t=[],e=n.id;return e===void 0&&t.push({message:"layers.".concat(e,': missing required property "id"')}),n.render===void 0&&t.push({message:"layers.".concat(e,': missing required method "render"')}),n.renderingMode&&n.renderingMode!=="2d"&&n.renderingMode!=="3d"&&t.push({message:"layers.".concat(e,': property "renderingMode" must be either "2d" or "3d"')}),t}u(Ld,"validateCustomStyleLayer");var Ac=class Ac extends Le{constructor(e){super(e,{});this.onAdd=u(e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},"onAdd");this.onRemove=u(e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},"onRemove");this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};u(Ac,"CustomStyleLayer");var Ro=Ac;function Oo(n){if(n.type==="custom")return new Ro(n);switch(n.type){case"background":return new zo(n);case"circle":return new _o(n);case"fill":return new To(n);case"fill-extrusion":return new Ao(n);case"heatmap":return new So(n);case"hillshade":return new Po(n);case"line":return new Eo(n);case"raster":return new Bo(n);case"symbol":return new Fo(n)}}u(Oo,"createStyleLayer");f();f();function Xr(n){let t=[];if(typeof n=="string")t.push({id:"default",url:n});else if(n&&n.length>0){let e=[];for(let{id:r,url:i}of n){let o="".concat(r).concat(i);e.indexOf(o)===-1&&(e.push(o),t.push({id:r,url:i}))}}return t}u(Xr,"coerceSpriteToArray");function Dd(n,t,e,r){let i=Xr(n),o=i.length,a=e>1?"@2x":"",s={},l={},c={};for(let{id:p,url:m}of i){let h=t.transformRequest(t.normalizeSpriteURL(m,a,".json"),"SpriteJSON"),d="".concat(p,"_").concat(h.url);s[d]=Bt(h,(x,v)=>{delete s[d],l[p]=v,kd(r,l,c,x,o)});let g=t.transformRequest(t.normalizeSpriteURL(m,a,".png"),"SpriteImage"),y="".concat(p,"_").concat(g.url);s[y]=He.getImage(g,(x,v)=>{delete s[y],c[p]=v,kd(r,l,c,x,o)})}return{cancel(){for(let p of Object.values(s))p.cancel()}}}u(Dd,"loadSprite");function kd(n,t,e,r,i){if(r){n(r);return}if(i!==Object.values(t).length||i!==Object.values(e).length)return;let o={};for(let a in t){o[a]={};let s=ee.getImageCanvasContext(e[a]),l=t[a];for(let c in l){let{width:p,height:m,x:h,y:d,sdf:g,pixelRatio:y,stretchX:x,stretchY:v,content:b}=l[c],w={width:p,height:m,x:h,y:d,context:s};o[a][c]={data:null,pixelRatio:y,sdf:g,stretchX:x,stretchY:v,content:b,spriteData:w}}}n(null,o)}u(kd,"doOnceCompleted");f();f();var Cc=class Cc{constructor(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,i)}update(t,e,r){let{width:i,height:o}=t,a=(!this.size||this.size[0]!==i||this.size[1]!==o)&&!r,{context:s}=this,{gl:l}=s;if(this.useMipmap=!!(e&&e.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!e||e.premultiply!==!1)),a)this.size=[i,o],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||ct(t)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,t):l.texImage2D(l.TEXTURE_2D,0,this.format,i,o,0,this.format,l.UNSIGNED_BYTE,t.data);else{let{x:c,y:p}=r||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||ct(t)?l.texSubImage2D(l.TEXTURE_2D,0,c,p,l.RGBA,l.UNSIGNED_BYTE,t):l.texSubImage2D(l.TEXTURE_2D,0,c,p,i,o,l.RGBA,l.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,r){let{context:i}=this,{gl:o}=i;o.bindTexture(o.TEXTURE_2D,this.texture),r===o.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(r=o.LINEAR),t!==this.filter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,t),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,r||t),this.filter=t),e!==this.wrap&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1===0}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}};u(Cc,"Texture");var he=Cc;f();function Fd(n){let{userImage:t}=n;return t&&t.render&&t.render()?(n.data.replace(new Uint8Array(t.data.buffer)),!0):!1}u(Fd,"renderStyleImage");var Vo=1,Ec=class Ec extends se{constructor(){super();this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new _e({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:r,callback:i}of this.requestors)this._notify(r,i);this.requestors=[]}}getImage(e){let r=this.images[e];if(r&&!r.data&&r.spriteData){let i=r.spriteData;r.data=new _e({width:i.width,height:i.height},i.context.getImageData(i.x,i.y,i.width,i.height).data),r.spriteData=null}return r}addImage(e,r){if(this.images[e])throw new Error("Image id ".concat(e," already exist, use updateImage instead"));this._validate(e,r)&&(this.images[e]=r)}_validate(e,r){let i=!0,o=r.data||r.spriteData;return this._validateStretch(r.stretchX,o&&o.width)||(this.fire(new j(new Error('Image "'.concat(e,'" has invalid "stretchX" value')))),i=!1),this._validateStretch(r.stretchY,o&&o.height)||(this.fire(new j(new Error('Image "'.concat(e,'" has invalid "stretchY" value')))),i=!1),this._validateContent(r.content,r)||(this.fire(new j(new Error('Image "'.concat(e,'" has invalid "content" value')))),i=!1),i}_validateStretch(e,r){if(!e)return!0;let i=0;for(let o of e){if(o[0]<i||o[1]<o[0]||r<o[1])return!1;i=o[1]}return!0}_validateContent(e,r){if(!e)return!0;if(e.length!==4)return!1;let i=r.spriteData,o=i&&i.width||r.data.width,a=i&&i.height||r.data.height;return!(e[0]<0||o<e[0]||e[1]<0||a<e[1]||e[2]<0||o<e[2]||e[3]<0||a<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,r,i=!0){let o=this.getImage(e);if(i&&(o.data.width!==r.data.width||o.data.height!==r.data.height))throw new Error("size mismatch between old image (".concat(o.data.width,"x").concat(o.data.height,") and new image (").concat(r.data.width,"x").concat(r.data.height,")."));r.version=o.version+1,this.images[e]=r,this.updatedImages[e]=!0}removeImage(e){let r=this.images[e];delete this.images[e],delete this.patterns[e],r.userImage&&r.userImage.onRemove&&r.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e,r){let i=!0;if(!this.isLoaded())for(let o of e)this.images[o]||(i=!1);this.isLoaded()||i?this._notify(e,r):this.requestors.push({ids:e,callback:r})}_notify(e,r){let i={};for(let o of e){let a=this.getImage(o);a||(this.fire(new E("styleimagemissing",{id:o})),a=this.getImage(o)),a?i[o]={data:a.data.clone(),pixelRatio:a.pixelRatio,sdf:a.sdf,version:a.version,stretchX:a.stretchX,stretchY:a.stretchY,content:a.content,hasRenderCallback:!!(a.userImage&&a.userImage.render)}:xe('Image "'.concat(o,'" 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.'))}r(null,i)}getPixelSize(){let{width:e,height:r}=this.atlasImage;return{width:e,height:r}}getPattern(e){let r=this.patterns[e],i=this.getImage(e);if(!i)return null;if(r&&r.position.version===i.version)return r.position;if(r)r.position.version=i.version;else{let o=i.data.width+Vo*2,a=i.data.height+Vo*2,s={w:o,h:a,x:0,y:0},l=new Hr(s,i);this.patterns[e]={bin:s,position:l}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let r=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new he(e,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let a in this.patterns)e.push(this.patterns[a].bin);let{w:r,h:i}=Fn(e),o=this.atlasImage;o.resize({width:r||1,height:i||1});for(let a in this.patterns){let{bin:s}=this.patterns[a],l=s.x+Vo,c=s.y+Vo,p=this.getImage(a).data,m=p.width,h=p.height;_e.copy(p,o,{x:0,y:0},{x:l,y:c},{width:m,height:h}),_e.copy(p,o,{x:0,y:h-1},{x:l,y:c-1},{width:m,height:1}),_e.copy(p,o,{x:0,y:0},{x:l,y:c+h},{width:m,height:1}),_e.copy(p,o,{x:m-1,y:0},{x:l-1,y:c},{width:1,height:h}),_e.copy(p,o,{x:0,y:0},{x:l+m,y:c},{width:1,height:h})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let r of e){if(this.callbackDispatchedThisFrame[r])continue;this.callbackDispatchedThisFrame[r]=!0;let i=this.getImage(r);i||xe('Image with ID: "'.concat(r,'" was not found')),Fd(i)&&this.updateImage(r,i)}}};u(Ec,"ImageManager");var Uo=Ec;f();f();function zd(n,t,e,r,i){let o=t*256,a=o+255,s=r.transformRequest(e.replace("{fontstack}",n).replace("{range}","".concat(o,"-").concat(a)),"Glyphs");Nn(s,(l,c)=>{if(l)i(l);else if(c){let p={};for(let m of bd(c))p[m.id]=m;i(null,p)}})}u(zd,"loadGlyphRange");var wr=class wr{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(t,e){let r=[];for(let i in t)for(let o of t[i])r.push({stack:i,id:o});Bn(r,({stack:i,id:o},a)=>{let s=this.entries[i];s||(s=this.entries[i]={glyphs:{},requests:{},ranges:{}});let l=s.glyphs[o];if(l!==void 0){a(null,{stack:i,id:o,glyph:l});return}if(l=this._tinySDF(s,i,o),l){s.glyphs[o]=l,a(null,{stack:i,id:o,glyph:l});return}let c=Math.floor(o/256);if(c*256>65535){a(new Error("glyphs > 65535 not supported"));return}if(s.ranges[c]){a(null,{stack:i,id:o,glyph:l});return}if(!this.url){a(new Error("glyphsUrl is not set"));return}let p=s.requests[c];p||(p=s.requests[c]=[],wr.loadGlyphRange(i,c,this.url,this.requestManager,(m,h)=>{if(h){for(let d in h)this._doesCharSupportLocalGlyph(+d)||(s.glyphs[+d]=h[+d]);s.ranges[c]=!0}for(let d of p)d(m,h);delete s.requests[c]})),p.push((m,h)=>{m?a(m):h&&a(null,{stack:i,id:o,glyph:h[o]||null})})},(i,o)=>{if(i)e(i);else if(o){let a={};for(let{stack:s,id:l,glyph:c}of o)(a[s]||(a[s]={}))[l]=c&&{id:c.id,bitmap:c.bitmap.clone(),metrics:c.metrics};e(null,a)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(ne["CJK Unified Ideographs"](t)||ne["Hangul Syllables"](t)||ne.Hiragana(t)||ne.Katakana(t))}_tinySDF(t,e,r){let i=this.localIdeographFontFamily;if(!i||!this._doesCharSupportLocalGlyph(r))return;let o=t.tinySDF;if(!o){let l="400";/bold/i.test(e)?l="900":/medium/i.test(e)?l="500":/light/i.test(e)&&(l="200"),o=t.tinySDF=new wr.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:i,fontWeight:l})}let a=o.draw(String.fromCharCode(r)),s=27;return{id:r,bitmap:new gr({width:a.width||30,height:a.height||30},a.data),metrics:{width:a.glyphWidth||24,height:a.glyphHeight||24,left:a.glyphLeft||0,top:a.glyphTop-s||-8,advance:a.glyphAdvance||24}}}};u(wr,"GlyphManager"),wr.loadGlyphRange=zd,wr.TinySDF=Vh;var No=wr;f();var kc=class kc{constructor(){this.specification=T.light.position}possiblyEvaluate(t,e){return Qh(t.expression.evaluate(e))}interpolate(t,e,r){return{x:Ae.number(t.x,e.x,r),y:Ae.number(t.y,e.y,r),z:Ae.number(t.z,e.z,r)}}};u(kc,"LightPositionProperty");var Lc=kc,Bd="-transition",Mc,Dc=class Dc extends se{constructor(e){super();Mc=Mc||new Ie({anchor:new q(T.light.anchor),position:new Lc,color:new q(T.light.color),intensity:new q(T.light.intensity)}),this._transitionable=new Rr(Mc),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,r={}){if(!this._validate(uf,e,r))for(let i in e){let o=e[i];i.endsWith(Bd)?this._transitionable.setTransition(i.slice(0,-Bd.length),o):this._transitionable.setValue(i,o)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,r,i){return i&&i.validate===!1?!1:kr(this,e.call(Me,k({value:r,style:{glyphs:!0,sprite:!0},styleSpec:T})))}};u(Dc,"Light");var Go=Dc;f();var Fc=class Fc{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){let r=t.join(",")+String(e);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(t,e)),this.dashEntry[r]}getDashRanges(t,e,r){let i=t.length%2===1,o=[],a=i?-t[t.length-1]*r:0,s=t[0]*r,l=!0;o.push({left:a,right:s,isDash:l,zeroLength:t[0]===0});let c=t[0];for(let p=1;p<t.length;p++){l=!l;let m=t[p];a=c*r,c+=m,s=c*r,o.push({left:a,right:s,isDash:l,zeroLength:m===0})}return o}addRoundDash(t,e,r){let i=e/2;for(let o=-r;o<=r;o++){let a=this.nextRow+r+o,s=this.width*a,l=0,c=t[l];for(let p=0;p<this.width;p++){p/c.right>1&&(c=t[++l]);let m=Math.abs(p-c.left),h=Math.abs(p-c.right),d=Math.min(m,h),g,y=o/r*(i+1);if(c.isDash){let x=i-Math.abs(y);g=Math.sqrt(d*d+x*x)}else g=i-Math.sqrt(d*d+y*y);this.data[s+p]=Math.max(0,Math.min(255,g+128))}}}addRegularDash(t){for(let s=t.length-1;s>=0;--s){let l=t[s],c=t[s+1];l.zeroLength?t.splice(s,1):c&&c.isDash===l.isDash&&(c.left=l.left,t.splice(s,1))}let e=t[0],r=t[t.length-1];e.isDash===r.isDash&&(e.left=r.left-this.width,r.right=e.right+this.width);let i=this.width*this.nextRow,o=0,a=t[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=t[++o]);let l=Math.abs(s-a.left),c=Math.abs(s-a.right),p=Math.min(l,c),m=a.isDash?p:-p;this.data[i+s]=Math.max(0,Math.min(255,m+128))}}addDash(t,e){let r=e?7:0,i=2*r+1;if(this.nextRow+i>this.height)return xe("LineAtlas out of space"),null;let o=0;for(let s=0;s<t.length;s++)o+=t[s];if(o!==0){let s=this.width/o,l=this.getDashRanges(t,this.width,s);e?this.addRoundDash(l,s,r):this.addRegularDash(l)}let a={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:o};return this.nextRow+=i,this.dirty=!0,a}bind(t){let e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}};u(Fc,"LineAtlas");var qo=Fc;f();f();f();var zc=class zc{constructor(t){this._callback=t,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(){delete this._channel,this._callback=()=>{}}};u(zc,"ThrottledInvoker");var jo=zc;var Bc=class Bc{constructor(t,e,r){this.receive=u(t=>{let e=t.data,r=e.id;if(r&&!(e.targetMapId&&this.mapId!==e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];let i=this.cancelCallbacks[r];delete this.cancelCallbacks[r],i&&i()}else Ke()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},"receive");this.process=u(()=>{if(!this.taskQueue.length)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)},"process");this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new jo(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Ke()?t:window}send(t,e,r,i,o=!1){let a=Math.round(Math.random()*1e18).toString(36).substring(0,10);r&&(this.callbacks[a]=r);let s=ar(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!r,targetMapId:i,mustQueue:o,sourceMapId:this.mapId,data:Dr(e,s)},s),{cancel:()=>{r&&delete this.callbacks[a],this.target.postMessage({id:a,type:"<cancel>",targetMapId:i,sourceMapId:this.mapId})}}}processTask(t,e){if(e.type==="<response>"){let r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(Fr(e.error)):r(null,Fr(e.data)))}else{let r=!1,i=ar(this.globalScope)?void 0:[],o=e.hasCallback?(l,c)=>{r=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:l?Dr(l):null,data:Dr(c,i)},i)}:l=>{r=!0},a=null,s=Fr(e.data);if(this.parent[e.type])a=this.parent[e.type](e.sourceMapId,s,o);else if(this.parent.getWorkerSource){let l=e.type.split(".");a=this.parent.getWorkerSource(e.sourceMapId,l[0],s.source)[l[1]](s,o)}else o(new Error("Could not find function ".concat(e.type)));!r&&a&&a.cancel&&(this.cancelCallbacks[t]=a.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}};u(Bc,"Actor");var Ho=Bc;var Zo=class Zo{constructor(t,e,r){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=r;let i=this.workerPool.acquire(r);for(let o=0;o<i.length;o++){let a=i[o],s=new Zo.Actor(a,e,r);s.name="Worker ".concat(o),this.actors.push(s)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,e,r){r=r||function(){},Bn(this.actors,(i,o)=>{i.send(t,e,o)},r)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(e=>{e.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}};u(Zo,"Dispatcher");var un=Zo;un.Actor=Ho;f();f();f();function Wo(n,t,e){let r=u(function(i,o){if(i)return e(i);if(o){let a=ht(k(o,n),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);o.vector_layers&&(a.vectorLayers=o.vector_layers,a.vectorLayerIds=a.vectorLayers.map(s=>s.id)),e(null,a)}},"loaded");return n.url?Bt(t.transformRequest(n.url,"Source"),r):ee.frame(()=>r(null,n))}u(Wo,"loadTileJson");f();f();f();var Pr=63710088e-1,Sr=class Sr{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: (".concat(t,", ").concat(e,")"));if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Sr(St(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(t){let e=Math.PI/180,r=this.lat*e,i=t.lat*e,o=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((t.lng-this.lng)*e);return Pr*Math.acos(Math.min(o,1))}static convert(t){if(t instanceof Sr)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Sr(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Sr(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};u(Sr,"LngLat");var Q=Sr;var Wt=class Wt{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof Q?new Q(t.lng,t.lat):Q.convert(t),this}setSouthWest(t){return this._sw=t instanceof Q?new Q(t.lng,t.lat):Q.convert(t),this}extend(t){let e=this._sw,r=this._ne,i,o;if(t instanceof Q)i=t,o=t;else if(t instanceof Wt){if(i=t._sw,o=t._ne,!i||!o)return this}else{if(Array.isArray(t))if(t.length===4||t.every(Array.isArray)){let a=t;return this.extend(Wt.convert(a))}else{let a=t;return this.extend(Q.convert(a))}else if(t&&("lng"in t||"lon"in t)&&"lat"in t)return this.extend(Q.convert(t));return this}return!e&&!r?(this._sw=new Q(i.lng,i.lat),this._ne=new Q(o.lng,o.lat)):(e.lng=Math.min(i.lng,e.lng),e.lat=Math.min(i.lat,e.lat),r.lng=Math.max(o.lng,r.lng),r.lat=Math.max(o.lat,r.lat)),this}getCenter(){return new Q((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 Q(this.getWest(),this.getNorth())}getSouthEast(){return new Q(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(".concat(this._sw.toString(),", ").concat(this._ne.toString(),")")}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:e,lat:r}=Q.convert(t),i=this._sw.lat<=r&&r<=this._ne.lat,o=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=e&&e>=this._ne.lng),i&&o}static convert(t){return t instanceof Wt||!t?t:new Wt(t)}static fromLngLat(t,e=0){let i=360*e/40075017,o=i/Math.cos(Math.PI/180*t.lat);return new Wt(new Q(t.lng-o,t.lat-i),new Q(t.lng+o,t.lat+i))}};u(Wt,"LngLatBounds");var We=Wt;f();var Rd=2*Math.PI*Pr;function Od(n){return Rd*Math.cos(n*Math.PI/180)}u(Od,"circumferenceAtLatitude");function Xt(n){return(180+n)/360}u(Xt,"mercatorXfromLng");function Kt(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}u(Kt,"mercatorYfromLat");function Oc(n,t){return n/Od(t)}u(Oc,"mercatorZfromAltitude");function xb(n){return n*360-180}u(xb,"lngFromMercatorX");function Rc(n){let t=180-n*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}u(Rc,"latFromMercatorY");function _b(n,t){return n*Od(Rc(t))}u(_b,"altitudeFromMercatorZ");function bb(n){return 1/Math.cos(n*Math.PI/180)}u(bb,"mercatorScale");var Xo=class Xo{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){let r=Q.convert(t);return new Xo(Xt(r.lng),Kt(r.lat),Oc(e,r.lat))}toLngLat(){return new Q(xb(this.x),Rc(this.y))}toAltitude(){return _b(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Rd*bb(Rc(this.y))}};u(Xo,"MercatorCoordinate");var Se=Xo;var Vc=class Vc{constructor(t,e,r){this.bounds=We.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=r||24}validateBounds(t){return!Array.isArray(t)||t.length!==4?[-180,-90,180,90]:[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]}contains(t){let e=Math.pow(2,t.z),r={minX:Math.floor(Xt(this.bounds.getWest())*e),minY:Math.floor(Kt(this.bounds.getNorth())*e),maxX:Math.ceil(Xt(this.bounds.getEast())*e),maxY:Math.ceil(Kt(this.bounds.getSouth())*e)};return t.x>=r.minX&&t.x<r.maxX&&t.y>=r.minY&&t.y<r.maxY}};u(Vc,"TileBounds");var Kr=Vc;var Uc=class Uc extends se{constructor(e,r,i,o){super();this.load=u(()=>{this._loaded=!1,this.fire(new E("dataloading",{dataType:"source"})),this._tileJSONRequest=Wo(this._options,this.map._requestManager,(e,r)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new j(e)):r&&(k(this,r),r.bounds&&(this.tileBounds=new Kr(r.bounds,this.minzoom,this.maxzoom)),this.fire(new E("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new E("data",{dataType:"source",sourceDataType:"content"})))})},"load");this.serialize=u(()=>k({},this._options),"serialize");if(this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,k(this,ht(r,["url","scheme","tileSize","promoteId"])),this._options=k({type:"vector"},r),this._collectResourceTiming=r.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.cancel(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(e,r){let i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o={request:this.map._requestManager.transformRequest(i,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};o.request.collectResourceTiming=this._collectResourceTiming,!e.actor||e.state==="expired"?(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",o,a.bind(this))):e.state==="loading"?e.reloadCallback=r:e.request=e.actor.send("reloadTile",o,a.bind(this));function a(s,l){if(delete e.request,e.aborted)return r(null);if(s&&s.status!==404)return r(s);l&&l.resourceTiming&&(e.resourceTiming=l.resourceTiming),this.map._refreshExpiredTiles&&l&&e.setExpiryData(l),e.loadVectorData(l,this.map.painter),r(null),e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)}u(a,"done")}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id},void 0)}unloadTile(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}};u(Uc,"VectorTileSource");var $r=Uc;f();var Nc=class Nc extends se{constructor(e,r,i,o){super();this.id=e,this.dispatcher=i,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=k({type:"raster"},r),k(this,ht(r,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new E("dataloading",{dataType:"source"})),this._tileJSONRequest=Wo(this._options,this.map._requestManager,(e,r)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new j(e)):r&&(k(this,r),r.bounds&&(this.tileBounds=new Kr(r.bounds,this.minzoom,this.maxzoom)),this.fire(new E("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new E("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return k({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,r){let i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=He.getImage(this.map._requestManager.transformRequest(i,"Tile"),(o,a,s)=>{if(delete e.request,e.aborted)e.state="unloaded",r(null);else if(o)e.state="errored",r(o);else if(a){this.map._refreshExpiredTiles&&s&&e.setExpiryData(s);let l=this.map.painter.context,c=l.gl;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new he(l,a,c.RGBA,{useMipmap:!0}),e.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE,c.LINEAR_MIPMAP_NEAREST),l.extTextureFilterAnisotropic&&c.texParameterf(c.TEXTURE_2D,l.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,l.extTextureFilterAnisotropicMax)),e.state="loaded",r(null)}},this.map._refreshExpiredTiles)}abortTile(e,r){e.request&&(e.request.cancel(),delete e.request),r()}unloadTile(e,r){e.texture&&this.map.painter.saveTileTexture(e.texture),r()}hasTransition(){return!1}};u(Nc,"RasterTileSource");var $t=Nc;f();f();var Gc;function Vd(){return Gc==null&&(Gc=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Gc}u(Vd,"offscreenCanvasSupported");f();var Ud=te(be(),1);var qc=class qc{constructor(t,e,r){if(t<0||t>25||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error("x=".concat(e,", y=").concat(r,", z=").concat(t," outside of bounds. 0<=x<").concat(Math.pow(2,t),", 0<=y<").concat(Math.pow(2,t)," 0<=z<=25 "));this.z=t,this.x=e,this.y=r,this.key=cn(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){let i=Uh(this.x,this.y,this.z),o=vb(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(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(r==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=Math.pow(2,this.z);return new Ud.default((t.x*e-this.x)*8192,(t.y*e-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}};u(qc,"CanonicalTileID");var Jr=qc,jc=class jc{constructor(t,e){this.wrap=t,this.canonical=e,this.key=cn(t,e.z,e.z,e.x,e.y)}};u(jc,"UnwrappedTileID");var Yr=jc,ot=class ot{constructor(t,e,r,i,o){if(t<r)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(t,"; z = ").concat(r));this.overscaledZ=t,this.wrap=e,this.canonical=new Jr(r,+i,+o),this.key=cn(e,t,r,i,o)}clone(){return new ot(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let e=this.canonical.z-t;return t>this.canonical.z?new ot(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ot(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-t;return t>this.canonical.z?cn(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):cn(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let e=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new ot(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let e=this.canonical.z+1,r=this.canonical.x*2,i=this.canonical.y*2;return[new ot(e,this.wrap,e,r,i),new ot(e,this.wrap,e,r+1,i),new ot(e,this.wrap,e,r,i+1),new ot(e,this.wrap,e,r+1,i+1)]}isLessThan(t){return this.wrap<t.wrap?!0:this.wrap>t.wrap?!1:this.overscaledZ<t.overscaledZ?!0:this.overscaledZ>t.overscaledZ?!1:this.canonical.x<t.canonical.x?!0:this.canonical.x>t.canonical.x?!1:this.canonical.y<t.canonical.y}wrapped(){return new ot(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new ot(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Yr(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(t){return this.canonical.getTilePoint(new Se(t.x-this.wrap,t.y))}};u(ot,"OverscaledTileID");var Ne=ot;function cn(n,t,e,r,i){n*=2,n<0&&(n=n*-1-1);let o=1<<e;return(o*o*n+o*i+r).toString(36)+e.toString(36)+t.toString(36)}u(cn,"calculateKey");function vb(n,t,e){let r="",i;for(let o=n;o>0;o--)i=1<<o-1,r+=(t&i?1:0)+(e&i?2:0);return r}u(vb,"getQuadkey");O("CanonicalTileID",Jr);O("OverscaledTileID",Ne,{omit:["posMatrix"]});f();var Zc=class Zc{constructor(t,e,r){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&r!=="mapbox"&&r!=="terrarium"){xe('"'.concat(r,'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".'));return}this.stride=e.height;let i=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=r||"mapbox";for(let o=0;o<i;o++)this.data[this._idx(-1,o)]=this.data[this._idx(0,o)],this.data[this._idx(i,o)]=this.data[this._idx(i-1,o)],this.data[this._idx(o,-1)]=this.data[this._idx(o,0)],this.data[this._idx(o,i)]=this.data[this._idx(o,i-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(i,-1)]=this.data[this._idx(i-1,0)],this.data[this._idx(-1,i)]=this.data[this._idx(0,i-1)],this.data[this._idx(i,i)]=this.data[this._idx(i-1,i-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let o=0;o<i;o++)for(let a=0;a<i;a++){let s=this.get(o,a);s>this.max&&(this.max=s),s<this.min&&(this.min=s)}}get(t,e){let r=new Uint8Array(this.data.buffer),i=this._idx(t,e)*4;return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(r[i],r[i+1],r[i+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,r){return(t*256*256+e*256+r)/10-1e4}_unpackTerrarium(t,e,r){return t*256+e+r/256-32768}getPixels(){return new _e({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let i=e*this.dim,o=e*this.dim+this.dim,a=r*this.dim,s=r*this.dim+this.dim;switch(e){case-1:i=o-1;break;case 1:o=i+1;break}switch(r){case-1:a=s-1;break;case 1:s=a+1;break}let l=-e*this.dim,c=-r*this.dim;for(let p=a;p<s;p++)for(let m=i;m<o;m++)this.data[this._idx(m,p)]=t.data[this._idx(m+l,p+c)]}};u(Zc,"DEMData");var Hc=Zc;O("DEMData",Hc);var Wc=class Wc extends $t{constructor(e,r,i,o){super(e,r,i,o);this.type="raster-dem",this.maxzoom=22,this._options=k({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,r){let i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=He.getImage(this.map._requestManager.transformRequest(i,"Tile"),o.bind(this),this.map._refreshExpiredTiles),e.neighboringTiles=this._getNeighboringTiles(e.tileID);function o(s,l){if(delete e.request,e.aborted)e.state="unloaded",r(null);else if(s)e.state="errored",r(s);else if(l){this.map._refreshExpiredTiles&&e.setExpiryData(l),delete l.cacheControl,delete l.expires;let p=ct(l)&&Vd()?l:ee.getImageData(l,1),m={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:p,encoding:this.encoding};(!e.actor||e.state==="expired")&&(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",m,a.bind(this)))}}u(o,"imageLoaded");function a(s,l){s&&(e.state="errored",r(s)),l&&(e.dem=l,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded",r(null))}u(a,"done")}_getNeighboringTiles(e){let r=e.canonical,i=Math.pow(2,r.z),o=(r.x-1+i)%i,a=r.x===0?e.wrap-1:e.wrap,s=(r.x+1+i)%i,l=r.x+1===i?e.wrap+1:e.wrap,c={};return c[new Ne(e.overscaledZ,a,r.z,o,r.y).key]={backfilled:!1},c[new Ne(e.overscaledZ,l,r.z,s,r.y).key]={backfilled:!1},r.y>0&&(c[new Ne(e.overscaledZ,a,r.z,o,r.y-1).key]={backfilled:!1},c[new Ne(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},c[new Ne(e.overscaledZ,l,r.z,s,r.y-1).key]={backfilled:!1}),r.y+1<i&&(c[new Ne(e.overscaledZ,a,r.z,o,r.y+1).key]={backfilled:!1},c[new Ne(e.overscaledZ,e.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},c[new Ne(e.overscaledZ,l,r.z,s,r.y+1).key]={backfilled:!1}),c}unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&e.actor.send("removeDEMTile",{uid:e.uid,source:this.id})}};u(Wc,"RasterDEMTileSource");var Qr=Wc;f();var Xc=class Xc extends se{constructor(e,r,i,o){super();this.load=u(()=>{this._updateWorkerData()},"load");this.serialize=u(()=>k({},this._options,{type:this.type,data:this._data}),"serialize");this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=i.getActor(),this.setEventedParent(o),this._data=r.data,this._options=k({},r),this._collectResourceTiming=r.collectResourceTiming,r.maxzoom!==void 0&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;let a=8192/this.tileSize;this.workerOptions=k({source:this.id,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(r.buffer!==void 0?r.buffer:128)*a,tolerance:(r.tolerance!==void 0?r.tolerance:.375)*a,extent:8192,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:8192,radius:(r.clusterRadius||50)*a,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e,r){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id},r),this}getClusterChildren(e,r){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id},r),this}getClusterLeaves(e,r,i,o){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:r,offset:i},o),this}_updateWorkerData(e){let r=k({},this.workerOptions);e?r.dataDiff=e:typeof this._data=="string"?(r.request=this.map._requestManager.transformRequest(ee.resolveURL(this._data),"Source"),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new E("dataloading",{dataType:"source"})),this.actor.send("".concat(this.type,".loadData"),r,(i,o)=>{if(this._pendingLoads--,this._removed||o&&o.abandoned){this.fire(new E("dataabort",{dataType:"source"}));return}let a=null;if(o&&o.resourceTiming&&o.resourceTiming[this.id]&&(a=o.resourceTiming[this.id].slice(0)),i){this.fire(new j(i));return}let s={dataType:"source"};this._collectResourceTiming&&a&&a.length>0&&k(s,{resourceTiming:a}),this.fire(new E("data",{...s,sourceDataType:"metadata"})),this.fire(new E("data",{...s,sourceDataType:"content"}))})}loaded(){return this._pendingLoads===0}loadTile(e,r){let i=e.actor?"reloadTile":"loadTile";e.actor=this.actor;let o={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.request=this.actor.send(i,o,(a,s)=>(delete e.request,e.unloadVectorData(),e.aborted?r(null):a?r(a):(e.loadVectorData(s,this.map.painter,i==="reloadTile"),r(null))))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){e.unloadVectorData(),this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}};u(Xc,"GeoJSONSource");var ei=Xc;f();f();f();var Jt=fe([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var Kc=class Kc extends se{constructor(e,r,i,o){super();this.load=u((e,r)=>{this._loaded=!1,this.fire(new E("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=He.getImage(this.map._requestManager.transformRequest(this.url,"Image"),(i,o)=>{this._request=null,this._loaded=!0,i?this.fire(new j(i)):o&&(this.image=o,e&&(this.coordinates=e),r&&r(),this._finishLoading())})},"load");this.prepare=u(()=>{if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,r=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Jt.members)),this.boundsSegments||(this.boundsSegments=ae.simpleSegment(0,0,4,2)),this.texture||(this.texture=new he(e,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(let o in this.tiles){let a=this.tiles[o];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new E("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},"prepare");this.serialize=u(()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),"serialize");this.id=e,this.dispatcher=i,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=r}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=e.url,this.load(e.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new E("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(e){this.coordinates=e;let r=e.map(Se.fromLngLat);this.tileID=wb(r),this.minzoom=this.maxzoom=this.tileID.z;let i=r.map(o=>this.tileID.getTilePoint(o)._round());return this._boundsArray=new Nr,this._boundsArray.emplaceBack(i[0].x,i[0].y,0,0),this._boundsArray.emplaceBack(i[1].x,i[1].y,8192,0),this._boundsArray.emplaceBack(i[3].x,i[3].y,0,8192),this._boundsArray.emplaceBack(i[2].x,i[2].y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new E("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(e,r){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},r(null)):(e.state="errored",r(null))}hasTransition(){return!1}};u(Kc,"ImageSource");var at=Kc;function wb(n){let t=1/0,e=1/0,r=-1/0,i=-1/0;for(let p of n)t=Math.min(t,p.x),e=Math.min(e,p.y),r=Math.max(r,p.x),i=Math.max(i,p.y);let o=r-t,a=i-e,s=Math.max(o,a),l=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),c=Math.pow(2,l);return new Jr(l,Math.floor((t+r)/2*c),Math.floor((e+i)/2*c))}u(wb,"getCoordinatesCenterTileID");var $c=class $c extends at{constructor(e,r,i,o){super(e,r,i,o);this.load=u(()=>{this._loaded=!1;let e=this.options;this.urls=[];for(let r of e.urls)this.urls.push(this.map._requestManager.transformRequest(r,"Source").url);of(this.urls,(r,i)=>{this._loaded=!0,r?this.fire(new j(r)):i&&(this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},"load");this.prepare=u(()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,r=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Jt.members)),this.boundsSegments||(this.boundsSegments=ae.simpleSegment(0,0,4,2)),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 he(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(let o in this.tiles){let a=this.tiles[o];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new E("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},"prepare");this.serialize=u(()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),"serialize");this.roundZoom=!0,this.type="video",this.options=r}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let r=this.video.seekable;e<r.start(0)||e>r.end(0)?this.fire(new j(new Ft("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(r.start(0)," and ").concat(r.end(0),"-second mark.")))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}};u($c,"VideoSource");var ti=$c;f();var Jc=class Jc extends at{constructor(e,r,i,o){super(e,r,i,o);this.load=u(()=>{if(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 j(new Error("Canvas dimensions cannot be less than or equal to zero.")));return}this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading()},"load");this.prepare=u(()=>{let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let r=this.map.painter.context,i=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,Jt.members)),this.boundsSegments||(this.boundsSegments=ae.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new he(r,this.canvas,i.RGBA,{premultiply:!0});let o=!1;for(let a in this.tiles){let s=this.tiles[a];s.state!=="loaded"&&(s.state="loaded",s.texture=this.texture,o=!0)}o&&this.fire(new E("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},"prepare");this.serialize=u(()=>({type:"canvas",coordinates:this.coordinates}),"serialize");r.coordinates?(!Array.isArray(r.coordinates)||r.coordinates.length!==4||r.coordinates.some(a=>!Array.isArray(a)||a.length!==2||a.some(s=>typeof s!="number")))&&this.fire(new j(new Ft("sources.".concat(e),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new j(new Ft("sources.".concat(e),null,'missing required property "coordinates"'))),r.animate&&typeof r.animate!="boolean"&&this.fire(new j(new Ft("sources.".concat(e),null,'optional "animate" property must be a boolean value'))),r.canvas?typeof r.canvas!="string"&&!(r.canvas instanceof HTMLCanvasElement)&&this.fire(new j(new Ft("sources.".concat(e),null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new j(new Ft("sources.".concat(e),null,'missing required property "canvas"'))),this.options=r,this.animate=r.animate!==void 0?r.animate:!0}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};u(Jc,"CanvasSource");var ri=Jc;var Nd={},Gd=u((n,t,e,r)=>{let i=Yc(t.type),o=new i(n,t,e,r);if(o.id!==n)throw new Error("Expected Source id to be ".concat(n," instead of ").concat(o.id));return o},"create"),Yc=u(n=>{switch(n){case"geojson":return ei;case"image":return at;case"raster":return $t;case"raster-dem":return Qr;case"vector":return $r;case"video":return ti;case"canvas":return ri}return Nd[n]},"getSourceType"),qd=u((n,t)=>{Nd[n]=t},"setSourceType");f();function Sb(n,t){let e=G.create();return G.translate(e,e,[1,1,0]),G.scale(e,e,[n.width*.5,n.height*.5,1]),G.multiply(e,e,n.calculatePosMatrix(t.toUnwrapped()))}u(Sb,"getPixelPosMatrix");function Pb(n,t,e){if(n)for(let r of n){let i=t[r];if(i&&i.source===e&&i.type==="fill-extrusion")return!0}else for(let r in t){let i=t[r];if(i.source===e&&i.type==="fill-extrusion")return!0}return!1}u(Pb,"queryIncludes3DLayer");function jd(n,t,e,r,i,o){let a=Pb(i&&i.layers,t,n.id),s=o.maxPitchScaleFactor(),l=n.tilesIn(r,s,a);l.sort(Wd);let c=[];for(let m of l)c.push({wrappedTileID:m.tileID.wrapped().key,queryResults:m.tile.queryRenderedFeatures(t,e,n._state,m.queryGeometry,m.cameraQueryGeometry,m.scale,i,o,s,Sb(n.transform,m.tileID))});let p=Tb(c);for(let m in p)p[m].forEach(h=>{let d=h.feature,g=n.getFeatureState(d.layer["source-layer"],d.id);d.source=d.layer.source,d.layer["source-layer"]&&(d.sourceLayer=d.layer["source-layer"]),d.state=g});return p}u(jd,"queryRenderedFeatures");function Hd(n,t,e,r,i,o,a){let s={},l=o.queryRenderedSymbols(r),c=[];for(let p of Object.keys(l).map(Number))c.push(a[p]);c.sort(Wd);for(let p of c){let m=p.featureIndex.lookupSymbolFeatures(l[p.bucketInstanceId],t,p.bucketIndex,p.sourceLayerIndex,i.filter,i.layers,i.availableImages,n);for(let h in m){let d=s[h]=s[h]||[],g=m[h];g.sort((y,x)=>{let v=p.featureSortOrder;if(v){let b=v.indexOf(y.featureIndex);return v.indexOf(x.featureIndex)-b}else return x.featureIndex-y.featureIndex});for(let y of g)d.push(y)}}for(let p in s)s[p].forEach(m=>{let h=m.feature,d=n[p],y=e[d.source].getFeatureState(h.layer["source-layer"],h.id);h.source=h.layer.source,h.layer["source-layer"]&&(h.sourceLayer=h.layer["source-layer"]),h.state=y});return s}u(Hd,"queryRenderedSymbols");function Zd(n,t){let e=n.getRenderableIds().map(o=>n.getTileByID(o)),r=[],i={};for(let o=0;o<e.length;o++){let a=e[o],s=a.tileID.canonical.key;i[s]||(i[s]=!0,a.querySourceFeatures(r,t))}return r}u(Zd,"querySourceFeatures");function Wd(n,t){let e=n.tileID,r=t.tileID;return e.overscaledZ-r.overscaledZ||e.canonical.y-r.canonical.y||e.wrap-r.wrap||e.canonical.x-r.canonical.x}u(Wd,"sortTilesIn");function Tb(n){let t={},e={};for(let r of n){let i=r.queryResults,o=r.wrappedTileID,a=e[o]=e[o]||{};for(let s in i){let l=i[s],c=a[s]=a[s]||{},p=t[s]=t[s]||[];for(let m of l)c[m.featureIndex]||(c[m.featureIndex]=!0,p.push(m))}}return t}u(Tb,"mergeRenderedFeatureLayers");f();f();f();function Xd(n,t){let e={};if(!t)return e;for(let r of n){let i=r.layerIds.map(o=>t.getLayer(o)).filter(Boolean);if(i.length!==0){r.layers=i,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(o=>i.filter(a=>a.id===o)[0]));for(let o of i)e[o.id]=r}}return e}u(Xd,"deserialize");f();f();var Qc=class Qc{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){let r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(t," can't be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[t]}};u(Qc,"DictionaryCoder");var Ko=Qc;var Jd=te(Dn(),1),Yd=te(Oh(),1);f();var ep=class ep{constructor(t,e,r,i,o){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=i,this.properties=t.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)e==="_geometry"||e==="_vectorTileFeature"||(t[e]=this[e]);return t}};u(ep,"GeoJSONFeature");var ii=ep;var rp=class rp{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new sr(8192,16,0),this.grid3D=new sr(8192,16,0),this.featureIndexArray=new qi,this.promoteId=e}insert(t,e,r,i,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,o);let l=a?this.grid3D:this.grid;for(let c=0;c<e.length;c++){let p=e[c],m=[1/0,1/0,-1/0,-1/0];for(let h=0;h<p.length;h++){let d=p[h];m[0]=Math.min(m[0],d.x),m[1]=Math.min(m[1],d.y),m[2]=Math.max(m[2],d.x),m[3]=Math.max(m[3],d.y)}m[0]<8192&&m[1]<8192&&m[2]>=0&&m[3]>=0&&l.insert(s,m[0],m[1],m[2],m[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Jd.default.VectorTile(new Yd.default(this.rawTileData)).layers,this.sourceLayerCoder=new Ko(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,r,i){this.loadVTLayers();let o=t.params||{},a=8192/t.tileSize/t.scale,s=yi(o.filter),l=t.queryGeometry,c=t.queryPadding*a,p=$d(l),m=this.grid.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c),h=$d(t.cameraQueryGeometry),d=this.grid3D.query(h.minX-c,h.minY-c,h.maxX+c,h.maxY+c,(x,v,b,w)=>kf(t.cameraQueryGeometry,x-c,v-c,b+c,w+c));for(let x of d)m.push(x);m.sort(Ib);let g={},y;for(let x=0;x<m.length;x++){let v=m[x];if(v===y)continue;y=v;let b=this.featureIndexArray.get(v),w=null;this.loadMatchingFeature(g,b.bucketIndex,b.sourceLayerIndex,b.featureIndex,s,o.layers,o.availableImages,e,r,i,(S,P,I)=>(w||(w=Qe(S)),P.queryIntersectsFeature(l,S,I,w,this.z,t.transform,a,t.pixelPosMatrix)))}return g}loadMatchingFeature(t,e,r,i,o,a,s,l,c,p,m){let h=this.bucketLayerIDs[e];if(a&&!$h(a,h))return;let d=this.sourceLayerCoder.decode(r),y=this.vtLayers[d].feature(i);if(o.needGeometry){let v=et(y,!0);if(!o.filter(new le(this.tileID.overscaledZ),v,this.tileID.canonical))return}else if(!o.filter(new le(this.tileID.overscaledZ),y))return;let x=this.getId(y,d);for(let v=0;v<h.length;v++){let b=h[v];if(a&&a.indexOf(b)<0)continue;let w=l[b];if(!w)continue;let S={};x&&p&&(S=p.getState(w.sourceLayer||"_geojsonTileLayer",x));let P=k({},c[b]);P.paint=Kd(P.paint,w.paint,y,S,s),P.layout=Kd(P.layout,w.layout,y,S,s);let I=!m||m(y,w,S);if(!I)continue;let C=new ii(y,this.z,this.x,this.y,x);C.layer=P;let z=t[b];z===void 0&&(z=t[b]=[]),z.push({featureIndex:i,feature:C,intersectionZ:I})}}lookupSymbolFeatures(t,e,r,i,o,a,s,l){let c={};this.loadVTLayers();let p=yi(o);for(let m of t)this.loadMatchingFeature(c,r,i,m,p,a,s,l,e);return c}hasLayer(t){for(let e of this.bucketLayerIDs)for(let r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[e];r=t.properties[i],typeof r=="boolean"&&(r=Number(r))}return r}};u(rp,"FeatureIndex");var tp=rp;O("FeatureIndex",tp,{omit:["rawTileData","sourceLayerCoder"]});function Kd(n,t,e,r,i){return gi(n,(o,a)=>{let s=t instanceof Vt?t.get(a):null;return s&&s.evaluate?s.evaluate(e,r,i):s})}u(Kd,"evaluateProperties");function $d(n){let t=1/0,e=1/0,r=-1/0,i=-1/0;for(let o of n)t=Math.min(t,o.x),e=Math.min(e,o.y),r=Math.max(r,o.x),i=Math.max(i,o.y);return{minX:t,minY:e,maxX:r,maxY:i}}u($d,"getBounds");function Ib(n,t){return t-n}u(Ib,"topDownFeatureComparator");var Ab=3e4,ip=class ip{constructor(t,e){this.timeAdded=0;this.fadeEndTime=0;this.tileID=t,this.uid=Rn(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){let e=t+this.timeAdded;e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,e,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!t){this.collisionBoxArray=new Oi;return}t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=Xd(t.buckets,e.style),this.hasSymbolBuckets=!1;for(let i in this.buckets){let o=this.buckets[i];if(o instanceof yt)if(this.hasSymbolBuckets=!0,r)o.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let o=this.buckets[i];if(o instanceof yt&&o.hasRTLText){this.hasRTLText=!0,bf();break}}this.queryPadding=0;for(let i in this.buckets){let o=this.buckets[i];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(i).queryRadius(o))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}unloadVectorData(){for(let t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(let r in this.buckets){let i=this.buckets[r];i.uploadPending()&&i.upload(t)}let e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new he(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new he(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,r,i,o,a,s,l,c,p){return!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData?{}:this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:o,scale:a,tileSize:this.tileSize,pixelPosMatrix:p,transform:l,params:s,queryPadding:this.queryPadding*c},t,e,r)}querySourceFeatures(t,e){let r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;let i=r.loadVTLayers(),o=e&&e.sourceLayer?e.sourceLayer:"",a=i._geojsonTileLayer||i[o];if(!a)return;let s=yi(e&&e.filter),{z:l,x:c,y:p}=this.tileID.canonical,m={z:l,x:c,y:p};for(let h=0;h<a.length;h++){let d=a.feature(h);if(s.needGeometry){let x=et(d,!0);if(!s.filter(new le(this.tileID.overscaledZ),x,this.tileID.canonical))continue}else if(!s.filter(new le(this.tileID.overscaledZ),d))continue;let g=r.getId(d,o),y=new ii(d,l,c,p,g);y.tile=m,t.push(y)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){let e=this.expirationTime;if(t.cacheControl){let r=ef(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+r["max-age"]*1e3)}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){let r=Date.now(),i=!1;if(this.expirationTime>r)i=!1;else if(!e)i=!0;else if(this.expirationTime<e)i=!0;else{let o=this.expirationTime-e;o?this.expirationTime=r+Math.max(o,Ab):i=!0}i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;let r=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!e.style.hasLayer(i))continue;let o=this.buckets[i],a=o.layers[0].sourceLayer||"_geojsonTileLayer",s=r[a],l=t[a];if(!s||!l||Object.keys(l).length===0)continue;o.update(l,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});let c=e&&e.style&&e.style.getLayer(i);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(o)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ee.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=ee.now()+t}setDependencies(t,e){let r={};for(let i of e)r[i]=!0;this.dependencies[t]=r}hasDependency(t,e){for(let r of t){let i=this.dependencies[r];if(i){for(let o of e)if(i[o])return!0}}return!1}};u(ip,"Tile");var ni=ip;f();var np=class np{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(let t in this.data)for(let e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,r){let i=t.wrapped().key;this.data[i]===void 0&&(this.data[i]=[]);let o={value:e,timeout:void 0};if(r!==void 0&&(o.timeout=setTimeout(()=>{this.remove(t,o)},r)),this.data[i].push(o),this.order.push(i),this.order.length>this.max){let a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){let e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){let e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;let r=t.wrapped().key,i=e===void 0?0:this.data[r].indexOf(e),o=this.data[r][i];return this.data[r].splice(i,1),o.timeout&&clearTimeout(o.timeout),this.data[r].length===0&&delete this.data[r],this.onRemove(o.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(t){let e=[];for(let r in this.data)for(let i of this.data[r])t(i.value)||e.push(i);for(let r of e)this.remove(r.value.tileID,r)}};u(np,"TileCache");var $o=np;var ap=te(be(),1);f();var op=class op{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,e,r){let i=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][i]=this.stateChanges[t][i]||{},k(this.stateChanges[t][i],r),this.deletedStates[t]===null){this.deletedStates[t]={};for(let o in this.state[t])o!==i&&(this.deletedStates[t][o]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][i]===null){this.deletedStates[t][i]={};for(let a in this.state[t][i])r[a]||(this.deletedStates[t][i][a]=null)}else for(let a in r)this.deletedStates[t]&&this.deletedStates[t][i]&&this.deletedStates[t][i][a]===null&&delete this.deletedStates[t][i][a]}removeFeatureState(t,e,r){if(this.deletedStates[t]===null)return;let o=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},r&&e!==void 0)this.deletedStates[t][o]!==null&&(this.deletedStates[t][o]=this.deletedStates[t][o]||{},this.deletedStates[t][o][r]=null);else if(e!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][o]){this.deletedStates[t][o]={};for(r in this.stateChanges[t][o])this.deletedStates[t][o][r]=null}else this.deletedStates[t][o]=null;else this.deletedStates[t]=null}getState(t,e){let r=String(e),i=this.state[t]||{},o=this.stateChanges[t]||{},a=k({},i[r],o[r]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){let s=this.deletedStates[t][e];if(s===null)return{};for(let l in s)delete a[l]}return a}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,e){let r={};for(let i in this.stateChanges){this.state[i]=this.state[i]||{};let o={};for(let a in this.stateChanges[i])this.state[i][a]||(this.state[i][a]={}),k(this.state[i][a],this.stateChanges[i][a]),o[a]=this.state[i][a];r[i]=o}for(let i in this.deletedStates){this.state[i]=this.state[i]||{};let o={};if(this.deletedStates[i]===null)for(let a in this.state[i])o[a]={},this.state[i][a]={};else for(let a in this.deletedStates[i]){if(this.deletedStates[i][a]===null)this.state[i][a]={};else for(let l of Object.keys(this.deletedStates[i][a]))delete this.state[i][a][l];o[a]=this.state[i][a]}r[i]=r[i]||{},k(r[i],o)}if(this.stateChanges={},this.deletedStates={},Object.keys(r).length!==0)for(let i in t)t[i].setFeatureState(r,e)}};u(op,"SourceFeatureState");var Jo=op;var Tr=class Tr extends se{constructor(e,r,i){super();this.id=e,this.dispatcher=i,this.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,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=Gd(e,r,i,this),this._tiles={},this._cache=new $o(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Jo,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if((this.used!==void 0||this.usedForTerrain!==void 0)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let e in this._tiles){let r=this._tiles[e];if(r.state!=="loaded"&&r.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,r){return this._source.loadTile(e,r)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,()=>{})}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,()=>{}),this._source.fire(new E("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}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(let r in this._tiles){let i=this._tiles[r];i.upload(e),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(Qd).map(e=>e.key)}getRenderableIds(e){let r=[];for(let i in this._tiles)this._isIdRenderable(i,e)&&r.push(this._tiles[i]);return e?r.sort((i,o)=>{let a=i.tileID,s=o.tileID,l=new ap.default(a.canonical.x,a.canonical.y)._rotate(this.transform.angle),c=new ap.default(s.canonical.x,s.canonical.y)._rotate(this.transform.angle);return a.overscaledZ-s.overscaledZ||c.y-l.y||c.x-l.x}).map(i=>i.tileID.key):r.map(i=>i.tileID).sort(Qd).map(i=>i.key)}hasRenderableParent(e){let r=this.findLoadedParent(e,0);return r?this._isIdRenderable(r.tileID.key):!1}_isIdRenderable(e,r){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(r||!this._tiles[e].holdingForFade())}reload(){if(this._paused){this._shouldReloadOnResume=!0;return}this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}_reloadTile(e,r){let i=this._tiles[e];i&&(i.state!=="loading"&&(i.state=r),this._loadTile(i,this._tileLoaded.bind(this,i,e,r)))}_tileLoaded(e,r,i,o){if(o){e.state="errored",o.status!==404?this._source.fire(new j(o,{tile:e})):this.update(this.transform,this.terrain);return}e.timeAdded=ee.now(),i==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(r,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new E("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let r=this.getRenderableIds();for(let o=0;o<r.length;o++){let a=r[o];if(e.neighboringTiles&&e.neighboringTiles[a]){let s=this.getTileByID(a);i(e,s),i(s,e)}}function i(o,a){o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0;let s=a.tileID.canonical.x-o.tileID.canonical.x,l=a.tileID.canonical.y-o.tileID.canonical.y,c=Math.pow(2,o.tileID.canonical.z),p=a.tileID.key;s===0&&l===0||Math.abs(l)>1||(Math.abs(s)>1&&(Math.abs(s+c)===1?s+=c:Math.abs(s-c)===1&&(s-=c)),!(!a.dem||!o.dem)&&(o.dem.backfillBorder(a.dem,s,l),o.neighboringTiles&&o.neighboringTiles[p]&&(o.neighboringTiles[p].backfilled=!0)))}u(i,"fillBorder")}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,r,i,o){for(let a in this._tiles){let s=this._tiles[a];if(o[a]||!s.hasData()||s.tileID.overscaledZ<=r||s.tileID.overscaledZ>i)continue;let l=s.tileID;for(;s&&s.tileID.overscaledZ>r+1;){let p=s.tileID.scaledTo(s.tileID.overscaledZ-1);s=this._tiles[p.key],s&&s.hasData()&&(l=p)}let c=l;for(;c.overscaledZ>r;)if(c=c.scaledTo(c.overscaledZ-1),e[c.key]){o[l.key]=l;break}}}findLoadedParent(e,r){if(e.key in this._loadedParentTiles){let i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=r?i:null}for(let i=e.overscaledZ-1;i>=r;i--){let o=e.scaledTo(i),a=this._getLoadedTile(o);if(a)return a}}_getLoadedTile(e){let r=this._tiles[e.key];return r&&r.hasData()?r:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let r=Math.ceil(e.width/this._source.tileSize)+1,i=Math.ceil(e.height/this._source.tileSize)+1,o=r*i,a=this._maxTileCacheZoomLevels===null?Ge.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,s=Math.floor(o*a),l=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,s):s;this._cache.setMaxSize(l)}handleWrapJump(e){let r=this._prevLng===void 0?e:this._prevLng,o=(e-r)/360,a=Math.round(o);if(this._prevLng=e,a){let s={};for(let l in this._tiles){let c=this._tiles[l];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+a),s[c.tileID.key]=c}this._tiles=s;for(let l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(let l in this._tiles){let c=this._tiles[l];this._setTileReloadTimer(l,c)}}}update(e,r){if(this.transform=e,this.terrain=r,!this._sourceLoaded||this._paused)return;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={};let i;!this.used&&!this.usedForTerrain?i=[]:this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(m=>new Ne(m.canonical.z,m.wrap,m.canonical.z,m.canonical.x,m.canonical.y)):(i=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this.usedForTerrain?!1:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r}),this._source.hasTile&&(i=i.filter(m=>this._source.hasTile(m))));let o=e.coveringZoomLevel(this._source),a=Math.max(o-Tr.maxOverzooming,this._source.minzoom),s=Math.max(o+Tr.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let m={};for(let h of i)if(h.canonical.z>this._source.minzoom){let d=h.scaledTo(h.canonical.z-1);m[d.key]=d;let g=h.scaledTo(Math.max(this._source.minzoom,Math.min(h.canonical.z,5)));m[g.key]=g}i=i.concat(Object.values(m))}let l=i.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,l&&this.fire(new E("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let c=this._updateRetainedTiles(i,o);if(ey(this._source.type)){let m={},h={},d=Object.keys(c),g=ee.now();for(let y of d){let x=c[y],v=this._tiles[y];if(!v||v.fadeEndTime!==0&&v.fadeEndTime<=g)continue;let b=this.findLoadedParent(x,a);b&&(this._addTile(b.tileID),m[b.tileID.key]=b.tileID),h[y]=x}this._retainLoadedChildren(h,o,s,c);for(let y in m)c[y]||(this._coveredTiles[y]=!0,c[y]=m[y]);if(r){let y={},x={};for(let v of i)this._tiles[v.key].hasData()?y[v.key]=v:x[v.key]=v;for(let v in x){let b=x[v].children(this._source.maxzoom);this._tiles[b[0].key]&&this._tiles[b[1].key]&&this._tiles[b[2].key]&&this._tiles[b[3].key]&&(y[b[0].key]=c[b[0].key]=b[0],y[b[1].key]=c[b[1].key]=b[1],y[b[2].key]=c[b[2].key]=b[2],y[b[3].key]=c[b[3].key]=b[3],delete x[v])}for(let v in x){let b=this.findLoadedParent(x[v],this._source.minzoom);if(b){y[b.tileID.key]=c[b.tileID.key]=b.tileID;for(let w in y)y[w].isChildOf(b.tileID)&&delete y[w]}}for(let v in this._tiles)y[v]||(this._coveredTiles[v]=!0)}}for(let m in c)this._tiles[m].clearFadeHold();let p=Wh(this._tiles,c);for(let m of p){let h=this._tiles[m];h.hasSymbolBuckets&&!h.holdingForFade()?h.setHoldDuration(this.map._fadeDuration):(!h.hasSymbolBuckets||h.symbolFadeFinished())&&this._removeTile(m)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,r){let i={},o={},a=Math.max(r-Tr.maxOverzooming,this._source.minzoom),s=Math.max(r+Tr.maxUnderzooming,this._source.minzoom),l={};for(let c of e){let p=this._addTile(c);i[c.key]=c,!p.hasData()&&r<this._source.maxzoom&&(l[c.key]=c)}this._retainLoadedChildren(l,r,s,i);for(let c of e){let p=this._tiles[c.key];if(p.hasData())continue;if(r+1>this._source.maxzoom){let h=c.children(this._source.maxzoom)[0],d=this.getTile(h);if(d&&d.hasData()){i[h.key]=h;continue}}else{let h=c.children(this._source.maxzoom);if(i[h[0].key]&&i[h[1].key]&&i[h[2].key]&&i[h[3].key])continue}let m=p.wasRequested();for(let h=c.overscaledZ-1;h>=a;--h){let d=c.scaledTo(h);if(o[d.key])break;if(o[d.key]=!0,p=this.getTile(d),!p&&m&&(p=this._addTile(d)),p){let g=p.hasData();if((m||g)&&(i[d.key]=d),m=p.wasRequested(),g)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let r=[],i,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){i=this._loadedParentTiles[o.key];break}r.push(o.key);let a=o.scaledTo(o.overscaledZ-1);if(i=this._getLoadedTile(a),i)break;o=a}for(let a of r)this._loadedParentTiles[a]=i}}_addTile(e){let r=this._tiles[e.key];if(r)return r;r=this._cache.getAndRemove(e),r&&(this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,r)));let i=r;return r||(r=new ni(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,this._tileLoaded.bind(this,r,e.key,r.state))),r.uses++,this._tiles[e.key]=r,i||this._source.fire(new E("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r}_setTileReloadTimer(e,r){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let i=r.getExpiryTimeout();i&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},i))}_removeTile(e){let r=this._tiles[e];r&&(r.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),!(r.uses>0)&&(r.hasData()&&r.state!=="reloading"?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,r,i){let o=[],a=this.transform;if(!a)return o;let s=i?a.getCameraQueryGeometry(e):e,l=e.map(y=>a.pointCoordinate(y,this.terrain)),c=s.map(y=>a.pointCoordinate(y,this.terrain)),p=this.getIds(),m=1/0,h=1/0,d=-1/0,g=-1/0;for(let y of c)m=Math.min(m,y.x),h=Math.min(h,y.y),d=Math.max(d,y.x),g=Math.max(g,y.y);for(let y=0;y<p.length;y++){let x=this._tiles[p[y]];if(x.holdingForFade())continue;let v=x.tileID,b=Math.pow(2,a.zoom-x.tileID.overscaledZ),w=r*x.queryPadding*8192/x.tileSize/b,S=[v.getTilePoint(new Se(m,h)),v.getTilePoint(new Se(d,g))];if(S[0].x-w<8192&&S[0].y-w<8192&&S[1].x+w>=0&&S[1].y+w>=0){let P=l.map(C=>v.getTilePoint(C)),I=c.map(C=>v.getTilePoint(C));o.push({tile:x,tileID:v,queryGeometry:P,cameraQueryGeometry:I,scale:b})}}return o}getVisibleCoordinates(e){let r=this.getRenderableIds(e).map(i=>this._tiles[i].tileID);for(let i of r)i.posMatrix=this.transform.calculatePosMatrix(i.toUnwrapped());return r}hasTransition(){if(this._source.hasTransition())return!0;if(ey(this._source.type)){let e=ee.now();for(let r in this._tiles)if(this._tiles[r].fadeEndTime>=e)return!0}return!1}setFeatureState(e,r,i){e=e||"_geojsonTileLayer",this._state.updateState(e,r,i)}removeFeatureState(e,r,i){e=e||"_geojsonTileLayer",this._state.removeFeatureState(e,r,i)}getFeatureState(e,r){return e=e||"_geojsonTileLayer",this._state.getState(e,r)}setDependencies(e,r,i){let o=this._tiles[e];o&&o.setDependencies(r,i)}reloadTilesForDependencies(e,r){for(let i in this._tiles)this._tiles[i].hasDependency(e,r)&&this._reloadTile(i,"reloading");this._cache.filter(i=>!i.hasDependency(e,r))}};u(Tr,"SourceCache");var Ct=Tr;Ct.maxOverzooming=10;Ct.maxUnderzooming=3;function Qd(n,t){let e=Math.abs(n.wrap*2)-+(n.wrap<0),r=Math.abs(t.wrap*2)-+(t.wrap<0);return n.overscaledZ-t.overscaledZ||r-e||t.canonical.y-n.canonical.y||t.canonical.x-n.canonical.x}u(Qd,"compareTileId");function ey(n){return n==="raster"||n==="image"||n==="video"}u(ey,"isRasterType");f();f();f();f();var ty='(()=>{var Tf=Object.create;var da=Object.defineProperty;var Ef=Object.getOwnPropertyDescriptor;var Ff=Object.getOwnPropertyNames;var Mf=Object.getPrototypeOf,Lf=Object.prototype.hasOwnProperty;var we=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),sl=(e,t)=>{for(var r in t)da(e,r,{get:t[r],enumerable:!0})},Df=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ff(t))!Lf.call(e,i)&&i!==r&&da(e,i,{get:()=>t[i],enumerable:!(n=Ef(t,i))||n.enumerable});return e};var Z=(e,t,r)=>(r=e!=null?Tf(Mf(e)):{},Df(t||!e||!e.__esModule?da(r,"default",{value:e,enumerable:!0}):r,e));var he=we((Kx,ll)=>{"use strict";ll.exports=rr;function rr(e,t){this.x=e,this.y=t}rr.prototype={clone:function(){return new rr(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),r=Math.sin(e),n=t*this.x-r*this.y,i=r*this.x+t*this.y;return this.x=n,this.y=i,this},_rotateAround:function(e,t){var r=Math.cos(e),n=Math.sin(e),i=t.x+r*(this.x-t.x)-n*(this.y-t.y),o=t.y+n*(this.x-t.x)+r*(this.y-t.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};rr.convert=function(e){return e instanceof rr?e:Array.isArray(e)?new rr(e[0],e[1]):e}});var ga=we((Yx,cl)=>{"use strict";cl.exports=ul;function ul(e,t,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=n}ul.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,n=0;n<8;n++){var i=this.sampleCurveX(r)-e;if(Math.abs(i)<t)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-i/o}var a=0,s=1;for(r=e,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-e)<t));n++)e>i?a=r:s=r,r=(s-a)*.5+a;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}}});var Du=we((w0,es)=>{function Jm(e,t){var r,n,i,o,a,s,l,u,c,p;for(r=e.length&3,n=e.length-r,i=t,a=3432918353,l=461845907,p=0;p<n;)c=e.charCodeAt(p)&255|(e.charCodeAt(++p)&255)<<8|(e.charCodeAt(++p)&255)<<16|(e.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c,i=i<<13|i>>>19,o=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(c=0,r){case 3:c^=(e.charCodeAt(p+2)&255)<<16;case 2:c^=(e.charCodeAt(p+1)&255)<<8;case 1:c^=e.charCodeAt(p)&255,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c}return i^=e.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}typeof es<"u"&&(es.exports=Jm)});var Vu=we((A0,ts)=>{function Wm(e,t){for(var r=e.length,n=t^r,i=0,o;r>=4;)o=e.charCodeAt(i)&255|(e.charCodeAt(++i)&255)<<8|(e.charCodeAt(++i)&255)<<16|(e.charCodeAt(++i)&255)<<24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)^o,r-=4,++i;switch(r){case 3:n^=(e.charCodeAt(i+2)&255)<<16;case 2:n^=(e.charCodeAt(i+1)&255)<<8;case 1:n^=e.charCodeAt(i)&255,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)}return n^=n>>>13,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16),n^=n>>>15,n>>>0}typeof ts!==void 0&&(ts.exports=Wm)});var rs=we((_0,fo)=>{var Bu=Du(),Hm=Vu();fo.exports=Bu;fo.exports.murmur3=Bu;fo.exports.murmur2=Hm});var hs=we((g1,ms)=>{"use strict";ms.exports=Io;ms.exports.default=Io;function Io(e,t,r){r=r||2;var n=t&&t.length,i=n?t[0]*r:e.length,o=Sc(e,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;var s,l,u,c,p,f,y;if(n&&(o=Vd(e,t,o,r)),e.length>80*r){s=u=e[0],l=c=e[1];for(var m=r;m<i;m+=r)p=e[m],f=e[m+1],p<s&&(s=p),f<l&&(l=f),p>u&&(u=p),f>c&&(c=f);y=Math.max(u-s,c-l),y=y!==0?32767/y:0}return Bn(o,a,r,s,l,y,0),a}function Sc(e,t,r,n,i){var o,a;if(i===ys(e,t,r,n)>0)for(o=t;o<r;o+=n)a=Pc(o,e[o],e[o+1],a);else for(o=r-n;o>=t;o-=n)a=Pc(o,e[o],e[o+1],a);return a&&Co(a,a.next)&&(Rn(a),a=a.next),a}function Ht(e,t){if(!e)return e;t||(t=e);var r=e,n;do if(n=!1,!r.steiner&&(Co(r,r.next)||se(r.prev,r,r.next)===0)){if(Rn(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function Bn(e,t,r,n,i,o,a){if(e){!a&&o&&Nd(e,n,i,o);for(var s=e,l,u;e.prev!==e.next;){if(l=e.prev,u=e.next,o?Md(e,n,i,o):Fd(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(u.i/r|0),Rn(e),e=u.next,s=u.next;continue}if(e=u,e===s){a?a===1?(e=Ld(Ht(e),t,r),Bn(e,t,r,n,i,o,2)):a===2&&Dd(e,t,r,n,i,o):Bn(Ht(e),t,r,n,i,o,1);break}}}}function Fd(e){var t=e.prev,r=e,n=e.next;if(se(t,r,n)>=0)return!1;for(var i=t.x,o=r.x,a=n.x,s=t.y,l=r.y,u=n.y,c=i<o?i<a?i:a:o<a?o:a,p=s<l?s<u?s:u:l<u?l:u,f=i>o?i>a?i:a:o>a?o:a,y=s>l?s>u?s:u:l>u?l:u,m=n.next;m!==t;){if(m.x>=c&&m.x<=f&&m.y>=p&&m.y<=y&&Pr(i,s,o,l,a,u,m.x,m.y)&&se(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Md(e,t,r,n){var i=e.prev,o=e,a=e.next;if(se(i,o,a)>=0)return!1;for(var s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,f=a.y,y=s<l?s<u?s:u:l<u?l:u,m=c<p?c<f?c:f:p<f?p:f,h=s>l?s>u?s:u:l>u?l:u,d=c>p?c>f?c:f:p>f?p:f,g=ps(y,m,t,r,n),v=ps(h,d,t,r,n),b=e.prevZ,x=e.nextZ;b&&b.z>=g&&x&&x.z<=v;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=d&&b!==i&&b!==a&&Pr(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0||(b=b.prevZ,x.x>=y&&x.x<=h&&x.y>=m&&x.y<=d&&x!==i&&x!==a&&Pr(s,c,l,p,u,f,x.x,x.y)&&se(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;b&&b.z>=g;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=d&&b!==i&&b!==a&&Pr(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;x&&x.z<=v;){if(x.x>=y&&x.x<=h&&x.y>=m&&x.y<=d&&x!==i&&x!==a&&Pr(s,c,l,p,u,f,x.x,x.y)&&se(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Ld(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!Co(i,o)&&wc(i,n,n.next,o)&&zn(i,o)&&zn(o,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),Rn(n),Rn(n.next),n=e=o),n=n.next}while(n!==e);return Ht(n)}function Dd(e,t,r,n,i,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Gd(a,s)){var l=Ac(a,s);a=Ht(a,a.next),l=Ht(l,l.next),Bn(a,t,r,n,i,o,0),Bn(l,t,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==e)}function Vd(e,t,r,n){var i=[],o,a,s,l,u;for(o=0,a=t.length;o<a;o++)s=t[o]*n,l=o<a-1?t[o+1]*n:e.length,u=Sc(e,s,l,n,!1),u===u.next&&(u.steiner=!0),i.push($d(u));for(i.sort(Bd),o=0;o<i.length;o++)r=zd(i[o],r);return r}function Bd(e,t){return e.x-t.x}function zd(e,t){var r=Rd(e,t);if(!r)return t;var n=Ac(r,e);return Ht(n,n.next),Ht(r,r.next)}function Rd(e,t){var r=t,n=e.x,i=e.y,o=-1/0,a;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,a=r.x<r.next.x?r:r.next,s===n))return a}r=r.next}while(r!==t);if(!a)return null;var l=a,u=a.x,c=a.y,p=1/0,f;r=a;do n>=r.x&&r.x>=u&&n!==r.x&&Pr(i<c?n:o,i,u,c,i<c?o:n,i,r.x,r.y)&&(f=Math.abs(i-r.y)/(n-r.x),zn(r,e)&&(f<p||f===p&&(r.x>a.x||r.x===a.x&&Od(a,r)))&&(a=r,p=f)),r=r.next;while(r!==l);return a}function Od(e,t){return se(e.prev,e,t.prev)<0&&se(t.next,e,e.next)<0}function Nd(e,t,r,n){var i=e;do i.z===0&&(i.z=ps(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,Ud(i)}function Ud(e){var t,r,n,i,o,a,s,l,u=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,n=r,s=0,t=0;t<u&&(s++,n=n.nextZ,!!n);t++);for(l=u;s>0||l>0&&n;)s!==0&&(l===0||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>1);return e}function ps(e,t,r,n,i){return e=(e-r)*i|0,t=(t-n)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function $d(e){var t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function Pr(e,t,r,n,i,o,a,s){return(i-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(n-s)>=(r-a)*(t-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function Gd(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!qd(e,t)&&(zn(e,t)&&zn(t,e)&&jd(e,t)&&(se(e.prev,e,t.prev)||se(e,t.prev,t))||Co(e,t)&&se(e.prev,e,e.next)>0&&se(t.prev,t,t.next)>0)}function se(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Co(e,t){return e.x===t.x&&e.y===t.y}function wc(e,t,r,n){var i=_o(se(e,t,r)),o=_o(se(e,t,n)),a=_o(se(r,n,e)),s=_o(se(r,n,t));return!!(i!==o&&a!==s||i===0&&Ao(e,r,t)||o===0&&Ao(e,n,t)||a===0&&Ao(r,e,n)||s===0&&Ao(r,t,n))}function Ao(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function _o(e){return e>0?1:e<0?-1:0}function qd(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&wc(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function zn(e,t){return se(e.prev,e,e.next)<0?se(e,t,e.next)>=0&&se(e,e.prev,t)>=0:se(e,t,e.prev)<0||se(e,e.next,t)<0}function jd(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function Ac(e,t){var r=new fs(e.i,e.x,e.y),n=new fs(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Pc(e,t,r,n){var i=new fs(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Rn(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function fs(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Io.deviation=function(e,t,r,n){var i=t&&t.length,o=i?t[0]*r:e.length,a=Math.abs(ys(e,0,o,r));if(i)for(var s=0,l=t.length;s<l;s++){var u=t[s]*r,c=s<l-1?t[s+1]*r:e.length;a-=Math.abs(ys(e,u,c,r))}var p=0;for(s=0;s<n.length;s+=3){var f=n[s]*r,y=n[s+1]*r,m=n[s+2]*r;p+=Math.abs((e[f]-e[m])*(e[y+1]-e[f+1])-(e[f]-e[y])*(e[m+1]-e[f+1]))}return a===0&&p===0?0:Math.abs((p-a)/a)};function ys(e,t,r,n){for(var i=0,o=t,a=r-n;o<r;o+=n)i+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return i}Io.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var a=0;a<t;a++)r.vertices.push(e[i][o][a]);i>0&&(n+=e[i-1].length,r.holes.push(n))}return r}});var gs=we((eP,Mc)=>{"use strict";var Xd=he();Mc.exports=_r;function _r(e,t,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=i,e.readFields(Qd,this,t)}function Qd(e,t,r){e==1?t.id=r.readVarint():e==2?eg(r,t):e==3?t.type=r.readVarint():e==4&&(t._geometry=r.pos)}function eg(e,t){for(var r=e.readVarint()+e.pos;e.pos<r;){var n=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[n]=i}}_r.types=["Unknown","Point","LineString","Polygon"];_r.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,n=0,i=0,o=0,a=[],s;e.pos<t;){if(n<=0){var l=e.readVarint();r=l&7,n=l>>3}if(n--,r===1||r===2)i+=e.readSVarint(),o+=e.readSVarint(),r===1&&(s&&a.push(s),s=[]),s.push(new Xd(i,o));else if(r===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+r)}return s&&a.push(s),a};_r.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;e.pos<t;){if(n<=0){var c=e.readVarint();r=c&7,n=c>>3}if(n--,r===1||r===2)i+=e.readSVarint(),o+=e.readSVarint(),i<a&&(a=i),i>s&&(s=i),o<l&&(l=o),o>u&&(u=o);else if(r!==7)throw new Error("unknown command "+r)}return[a,l,s,u]};_r.prototype.toGeoJSON=function(e,t,r){var n=this.extent*Math.pow(2,r),i=this.extent*e,o=this.extent*t,a=this.loadGeometry(),s=_r.types[this.type],l,u;function c(y){for(var m=0;m<y.length;m++){var h=y[m],d=180-(h.y+o)*360/n;y[m]=[(h.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(d*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(l=0;l<a.length;l++)p[l]=a[l][0];a=p,c(a);break;case 2:for(l=0;l<a.length;l++)c(a[l]);break;case 3:for(a=tg(a),l=0;l<a.length;l++)for(u=0;u<a[l].length;u++)c(a[l][u]);break}a.length===1?a=a[0]:s="Multi"+s;var f={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(f.id=this.id),f};function tg(e){var t=e.length;if(t<=1)return[e];for(var r=[],n,i,o=0;o<t;o++){var a=rg(e[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&r.push(n),n=[e[o]]):n.push(e[o]))}return n&&r.push(n),r}function rg(e){for(var t=0,r=0,n=e.length,i=n-1,o,a;r<n;i=r++)o=e[r],a=e[i],t+=(a.x-o.x)*(o.y+a.y);return t}});var xs=we((tP,Dc)=>{"use strict";var ng=gs();Dc.exports=Lc;function Lc(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(ig,this,t),this.length=this._features.length}function ig(e,t,r){e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(og(r))}function og(e){for(var t=null,r=e.readVarint()+e.pos;e.pos<r;){var n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}Lc.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new ng(this._pbf,t,this.extent,this._keys,this._values)}});var Bc=we((rP,Vc)=>{"use strict";var ag=xs();Vc.exports=sg;function sg(e,t){this.layers=e.readFields(lg,{},t)}function lg(e,t,r){if(e===3){var n=new ag(r,r.readVarint()+r.pos);n.length&&(t[n.name]=n)}}});var It=we((nP,To)=>{To.exports.VectorTile=Bc();To.exports.VectorTileFeature=gs();To.exports.VectorTileLayer=xs()});var np=we(ws=>{ws.read=function(e,t,r,n,i){var o,a,s=i*8-n-1,l=(1<<s)-1,u=l>>1,c=-7,p=r?i-1:0,f=r?-1:1,y=e[t+p];for(p+=f,o=y&(1<<-c)-1,y>>=-c,c+=s;c>0;o=o*256+e[t+p],p+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=a*256+e[t+p],p+=f,c-=8);if(o===0)o=1-u;else{if(o===l)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-u}return(y?-1:1)*a*Math.pow(2,o-n)};ws.write=function(e,t,r,n,i,o){var a,s,l,u=o*8-i-1,c=(1<<u)-1,p=c>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:o-1,m=n?1:-1,h=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?t+=f/l:t+=f*Math.pow(2,1-p),t*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(t*l-1)*Math.pow(2,i),a=a+p):(s=t*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;e[r+y]=s&255,y+=m,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[r+y]=a&255,y+=m,a/=256,u-=8);e[r+y-m]|=h*128}});var $n=we((RS,lp)=>{"use strict";lp.exports=J;var Do=np();function J(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}J.Varint=0;J.Fixed64=1;J.Bytes=2;J.Fixed32=5;var As=65536*65536,ip=1/As,Cg=12,sp=typeof TextDecoder>"u"?null:new TextDecoder("utf8");J.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,e(i,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Vo(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=ap(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Vo(this.buf,this.pos)+Vo(this.buf,this.pos+4)*As;return this.pos+=8,e},readSFixed64:function(){var e=Vo(this.buf,this.pos)+ap(this.buf,this.pos+4)*As;return this.pos+=8,e},readFloat:function(){var e=Do.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Do.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,kg(r,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=Cg&&sp?$g(this.buf,t,e):Ug(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==J.Bytes)return e.push(this.readVarint(t));var r=ut(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==J.Bytes)return e.push(this.readSVarint());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==J.Bytes)return e.push(this.readBoolean());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==J.Bytes)return e.push(this.readFloat());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==J.Bytes)return e.push(this.readDouble());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==J.Bytes)return e.push(this.readFixed32());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==J.Bytes)return e.push(this.readSFixed32());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==J.Bytes)return e.push(this.readFixed64());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==J.Bytes)return e.push(this.readSFixed64());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===J.Varint)for(;this.buf[this.pos++]>127;);else if(t===J.Bytes)this.pos=this.readVarint()+this.pos;else if(t===J.Fixed32)this.pos+=4;else if(t===J.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),kr(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),kr(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),kr(this.buf,e&-1,this.pos),kr(this.buf,Math.floor(e*ip),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),kr(this.buf,e&-1,this.pos),kr(this.buf,Math.floor(e*ip),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){Tg(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=Gg(this.buf,e,this.pos);var r=this.pos-t;r>=128&&op(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Do.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Do.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&op(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,J.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,Mg,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,Lg,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,Bg,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Dg,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,Vg,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,zg,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,Rg,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Og,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,Ng,t)},writeBytesField:function(e,t){this.writeTag(e,J.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,J.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,J.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,J.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,J.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,J.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,J.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,J.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,J.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,J.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,!!t)}};function kg(e,t,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return Cr(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function ut(e){return e.type===J.Bytes?e.readVarint()+e.pos:e.pos+1}function Cr(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function Tg(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn\'t fit into 10 bytes");t.realloc(10),Eg(r,n,t),Fg(n,t)}function Eg(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function Fg(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function op(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function Mg(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function Lg(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function Dg(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function Vg(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function Bg(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function zg(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function Rg(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function Og(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function Ng(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Vo(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function kr(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function ap(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Ug(e,t,r){for(var n="",i=t;i<r;){var o=e[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var l,u,c;s===1?o<128&&(a=o):s===2?(l=e[i+1],(l&192)===128&&(a=(o&31)<<6|l&63,a<=127&&(a=null))):s===3?(l=e[i+1],u=e[i+2],(l&192)===128&&(u&192)===128&&(a=(o&15)<<12|(l&63)<<6|u&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(l=e[i+1],u=e[i+2],c=e[i+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(a=(o&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}function $g(e,t,r){return sp.decode(e.subarray(t,r))}function Gg(e,t,r){for(var n=0,i,o;n<t.length;n++){if(i=t.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=i;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=i&63|128)}return r}});var nf=we((k_,rf)=>{rf.exports=na;function na(e,t){var r=e&&e.type,n;if(r==="FeatureCollection")for(n=0;n<e.features.length;n++)na(e.features[n],t);else if(r==="GeometryCollection")for(n=0;n<e.geometries.length;n++)na(e.geometries[n],t);else if(r==="Feature")na(e.geometry,t);else if(r==="Polygon")ef(e.coordinates,t);else if(r==="MultiPolygon")for(n=0;n<e.coordinates.length;n++)ef(e.coordinates[n],t);return e}function ef(e,t){if(e.length!==0){tf(e[0],t);for(var r=1;r<e.length;r++)tf(e[r],!t)}}function tf(e,t){for(var r=0,n=0,i=0,o=e.length,a=o-1;i<o;a=i++){var s=(e[i][0]-e[a][0])*(e[a][1]+e[i][1]),l=r+s;n+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+n>=0!=!!t&&e.reverse()}});var lf=we((F_,sf)=>{"use strict";var Ix=he(),Cx=It().VectorTileFeature;sf.exports=af;function af(e,t){this.options=t||{},this.features=e,this.length=e.length}af.prototype.feature=function(e){return new oa(this.features[e],this.options.extent)};function oa(e,t){this.id=typeof e.id=="number"?e.id:void 0,this.type=e.type,this.rawGeometry=e.type===1?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}oa.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var r=e[t],n=[],i=0;i<r.length;i++)n.push(new Ix(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};oa.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,r=-1/0,n=1/0,i=-1/0,o=0;o<e.length;o++)for(var a=e[o],s=0;s<a.length;s++){var l=a[s];t=Math.min(t,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[t,n,r,i]};oa.prototype.toGeoJSON=Cx.prototype.toGeoJSON});var pf=we((M_,oi)=>{var kx=$n(),cf=lf();oi.exports=Us;oi.exports.fromVectorTileJs=Us;oi.exports.fromGeojsonVt=Tx;oi.exports.GeoJSONWrapper=cf;function Us(e){var t=new kx;return Ex(e,t),t.finish()}function Tx(e,t){t=t||{};var r={};for(var n in e)r[n]=new cf(e[n].features,t),r[n].name=n,r[n].version=t.version,r[n].extent=t.extent;return Us({layers:r})}function Ex(e,t){for(var r in e.layers)t.writeMessage(3,Fx,e.layers[r])}function Fx(e,t){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);var r,n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<e.length;r++)n.feature=e.feature(r),t.writeMessage(2,Mx,n);var i=n.keys;for(r=0;r<i.length;r++)t.writeStringField(3,i[r]);var o=n.values;for(r=0;r<o.length;r++)t.writeMessage(4,Vx,o[r])}function Mx(e,t){var r=e.feature;r.id!==void 0&&t.writeVarintField(1,r.id),t.writeMessage(2,Lx,e),t.writeVarintField(3,r.type),t.writeMessage(4,Dx,r)}function Lx(e,t){var r=e.feature,n=e.keys,i=e.values,o=e.keycache,a=e.valuecache;for(var s in r.properties){var l=r.properties[s],u=o[s];if(l!==null){typeof u>"u"&&(n.push(s),u=n.length-1,o[s]=u),t.writeVarint(u);var c=typeof l;c!=="string"&&c!=="boolean"&&c!=="number"&&(l=JSON.stringify(l));var p=c+":"+l,f=a[p];typeof f>"u"&&(i.push(l),f=i.length-1,a[p]=f),t.writeVarint(f)}}}function Ns(e,t){return(t<<3)+(e&7)}function uf(e){return e<<1^e>>31}function Dx(e,t){for(var r=e.loadGeometry(),n=e.type,i=0,o=0,a=r.length,s=0;s<a;s++){var l=r[s],u=1;n===1&&(u=l.length),t.writeVarint(Ns(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&t.writeVarint(Ns(2,c-1));var f=l[p].x-i,y=l[p].y-o;t.writeVarint(uf(f)),t.writeVarint(uf(y)),i+=f,o+=y}n===3&&t.writeVarint(Ns(7,1))}}function Vx(e,t){var r=typeof e;r==="string"?t.writeStringField(1,e):r==="boolean"?t.writeBooleanField(7,e):r==="number"&&(e%1!==0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}});var Vf=Z(he(),1),fl=Z(ga(),1);function yl(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function Bf(e,t,r,n){let i=new fl.default(e,t,r,n);return function(o){return i.solve(o)}}var Xx=Bf(.25,.1,.25,1);function rt(e,t,r){return Math.min(r,Math.max(t,e))}function ml(e,t,r){let n=r-t,i=((e-t)%n+n)%n+t;return i===t?r:i}function Ae(e,...t){for(let r of t)for(let n in r)e[n]=r[n];return e}function hl(e){return Math.log(e)/Math.LN2%1===0}function Rr(e,t,r){let n={};for(let i in e)n[i]=t.call(r||this,e[i],i,e);return n}function dl(e,t,r){let n={};for(let i in e)t.call(r||this,e[i],i,e)&&(n[i]=e[i]);return n}function tt(e){return Array.isArray(e)?e.map(tt):typeof e=="object"&&e?Rr(e,tt):e}function gl(e,t){for(let r=0;r<e.length;r++)if(t.indexOf(e[r])>=0)return!0;return!1}var pl={};function ce(e){pl[e]||(typeof console<"u"&&console.warn(e),pl[e]=!0)}function nt(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function xl(e){let t=0;for(let r=0,n=e.length,i=n-1,o,a;r<n;i=r++)o=e[r],a=e[i],t+=(a.x-o.x)*(o.y+a.y);return t}function Ie(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}var xa=null;function ba(e){if(xa==null){let t=e.navigator?e.navigator.userAgent:null;xa=!!e.safari||!!(t&&(/\\b(iPad|iPhone|iPod)\\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return xa}function Or(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}var Ft=class e{constructor(t,r,n){let i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let a=new Int32Array(this.arrayBuffer);t=a[0],r=a[1],n=a[2],this.d=r+2*n;for(let u=0;u<this.d*this.d;u++){let c=a[3+u],p=a[3+u+1];i.push(c===p?null:a.subarray(c,p))}let s=a[3+i.length],l=a[3+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*n;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=n,this.scale=r/t,this.uid=0;let o=n/r*t;this.min=-o,this.max=t+o}insert(t,r,n,i,o){this._forEachCell(r,n,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,n,i,o,a){this.cells[o].push(a)}query(t,r,n,i,o){let a=this.min,s=this.max;if(t<=a&&r<=a&&s<=n&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(t,r,n,i,this._queryCell,l,u,o),l}}_queryCell(t,r,n,i,o,a,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,p=this.bboxes;for(let f=0;f<u.length;f++){let y=u[f];if(s[y]===void 0){let m=y*4;(l?l(p[m+0],p[m+1],p[m+2],p[m+3]):t<=p[m+2]&&r<=p[m+3]&&n>=p[m+0]&&i>=p[m+1])?(s[y]=!0,a.push(c[y])):s[y]=!1}}}}_forEachCell(t,r,n,i,o,a,s,l){let u=this._convertToCellCoord(t),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),f=this._convertToCellCoord(i);for(let y=u;y<=p;y++)for(let m=c;m<=f;m++){let h=this.d*m+y;if(!(l&&!l(this._convertFromCellCoord(y),this._convertFromCellCoord(m),this._convertFromCellCoord(y+1),this._convertFromCellCoord(m+1)))&&o.call(this,t,r,n,i,h,a,s,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,r=3+this.cells.length+1+1,n=0;for(let a=0;a<this.cells.length;a++)n+=this.cells[a].length;let i=new Int32Array(r+n+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=r;for(let a=0;a<t.length;a++){let s=t[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+t.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+t.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(t,r){let n=t.toArrayBuffer();return r&&r.push(n),{buffer:n}}static deserialize(t){return new e(t.buffer)}};var Ll=Z(ga(),1),zf=8,Rf={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Of={"*":{type:"source"}},Nf=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],Uf={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},$f={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Gf={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},qf={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},jf={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},Zf={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},Jf={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},Wf=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],Hf={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Kf={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Yf={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Xf={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Qf={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ey={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ty={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ry={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ny={type:"array",value:"*"},iy={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},oy={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},ay={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},sy={type:"array",value:"*",minimum:1},ly={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},uy={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},cy=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],py={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},fy={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},yy={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},my={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},hy={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},dy={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},gy={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},xy={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},by={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},vy={"*":{type:"string"}},S={$version:zf,$root:Rf,sources:Of,source:Nf,source_vector:Uf,source_raster:$f,source_raster_dem:Gf,source_geojson:qf,source_video:jf,source_image:Zf,layer:Jf,layout:Wf,layout_background:Hf,layout_fill:Kf,layout_circle:Yf,layout_heatmap:Xf,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:Qf,layout_symbol:ey,layout_raster:ty,layout_hillshade:ry,filter:ny,filter_operator:iy,geometry_type:oy,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:ay,expression:sy,light:ly,terrain:uy,paint:cy,paint_fill:py,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:fy,paint_circle:yy,paint_heatmap:my,paint_symbol:hy,paint_raster:dy,paint_hillshade:gy,paint_background:xy,transition:by,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:vy},Py=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var D=class{constructor(t,r,n,i){this.message=(t?"".concat(t,": "):"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function sr(e,...t){for(let r of t)for(let n in r)e[n]=r[n];return e}var Ve=class extends Error{constructor(t,r){super(r),this.message=r,this.key=t}},Ca=class e{constructor(t,r=[]){this.parent=t,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(t){return new e(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error("".concat(t," not found in scope."))}has(t){return this.bindings[t]?!0:this.parent?this.parent.has(t):!1}},cr={kind:"null"},L={kind:"number"},G={kind:"string"},U={kind:"boolean"},ze={kind:"color"},or={kind:"object"},$={kind:"value"},Sy={kind:"error"},Fi={kind:"collator"},pr={kind:"formatted"},Mi={kind:"padding"},Xr={kind:"resolvedImage"},Li={kind:"variableAnchorOffsetCollection"};function Fe(e,t){return{kind:"array",itemType:e,N:t}}function ne(e){if(e.kind==="array"){let t=ne(e.itemType);return typeof e.N=="number"?"array<".concat(t,", ").concat(e.N,">"):e.itemType.kind==="value"?"array":"array<".concat(t,">")}else return e.kind}var wy=[cr,L,G,U,ze,pr,or,Fe($),Mi,Xr,Li];function Gr(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Gr(e.itemType,t.itemType))&&(typeof e.N!="number"||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind==="value"){for(let r of wy)if(!Gr(r,t))return null}}return"Expected ".concat(ne(e)," but found ").concat(ne(t)," instead.")}function Oa(e,t){return t.some(r=>r.kind===e.kind)}function qr(e,t){return t.some(r=>r==="null"?e===null:r==="array"?Array.isArray(e):r==="object"?e&&!Array.isArray(e)&&typeof e=="object":r===typeof e)}function Nr(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}var Dl=.96422,Vl=1,Bl=.82521,zl=4/29,ar=6/29,Rl=3*ar*ar,Ay=ar*ar*ar,_y=Math.PI/180,Iy=180/Math.PI;function Ol(e){return e=e%360,e<0&&(e+=360),e}function Nl([e,t,r,n]){e=va(e),t=va(t),r=va(r);let i,o,a=Pa((.2225045*e+.7168786*t+.0606169*r)/Vl);e===t&&t===r?i=o=a:(i=Pa((.4360747*e+.3850649*t+.1430804*r)/Dl),o=Pa((.0139322*e+.0971045*t+.7141733*r)/Bl));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function va(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Pa(e){return e>Ay?Math.pow(e,1/3):e/Rl+zl}function Ul([e,t,r,n]){let i=(e+16)/116,o=isNaN(t)?i:i+t/500,a=isNaN(r)?i:i-r/200;return i=Vl*wa(i),o=Dl*wa(o),a=Bl*wa(a),[Sa(3.1338561*o-1.6168667*i-.4906146*a),Sa(-.9787684*o+1.9161415*i+.033454*a),Sa(.0719453*o-.2289914*i+1.4052427*a),n]}function Sa(e){return e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055,e<0?0:e>1?1:e}function wa(e){return e>ar?e*e*e:Rl*(e-zl)}function Cy(e){let[t,r,n,i]=Nl(e),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?Ol(Math.atan2(n,r)*Iy):NaN,o,t,i]}function ky([e,t,r,n]){return e=isNaN(e)?0:e*_y,Ul([r,Math.cos(e)*t,Math.sin(e)*t,n])}function Ty([e,t,r,n]){e=Ol(e),t/=100,r/=100;function i(o){let a=(o+e/30)%12,s=t*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4),n]}function Ey(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=Fy[e];if(t){let[i,o,a]=t;return[i/255,o/255,a/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let o=e.length<6?1:2,a=1;return[di(e.slice(a,a+=o)),di(e.slice(a,a+=o)),di(e.slice(a,a+=o)),di(e.slice(a,a+o)||"ff")]}if(e.startsWith("rgb")){let i=/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,o=e.match(i);if(o){let[a,s,l,u,c,p,f,y,m,h,d,g]=o,v=[u||" ",f||" ",h].join("");if(v===" "||v===" /"||v===",,"||v===",,,"){let b=[l,p,m].join(""),x=b==="%%%"?100:b===""?255:0;if(x){let P=[nr(+s/x,0,1),nr(+c/x,0,1),nr(+y/x,0,1),d?bl(+d,g):1];if(vl(P))return P}}return}}let r=/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,n=e.match(r);if(n){let[i,o,a,s,l,u,c,p,f]=n,y=[a||" ",l||" ",c].join("");if(y===" "||y===" /"||y===",,"||y===",,,"){let m=[+o,nr(+s,0,100),nr(+u,0,100),p?bl(+p,f):1];if(vl(m))return Ty(m)}}}function di(e){return parseInt(e.padEnd(2,e),16)/255}function bl(e,t){return nr(t?e/100:e,0,1)}function nr(e,t,r){return Math.min(Math.max(t,e),r)}function vl(e){return!e.some(Number.isNaN)}var Fy={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},W=class e{constructor(t,r,n,i=1,o=!0){this.r=t,this.g=r,this.b=n,this.a=i,o||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[t,r,n,i]))}static parse(t){if(t instanceof e)return t;if(typeof t!="string")return;let r=Ey(t);if(r)return new e(...r,!1)}get rgb(){let{r:t,g:r,b:n,a:i}=this,o=i||1/0;return this.overwriteGetter("rgb",[t/o,r/o,n/o,i])}get hcl(){return this.overwriteGetter("hcl",Cy(this.rgb))}get lab(){return this.overwriteGetter("lab",Nl(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){let[t,r,n,i]=this.rgb;return"rgba(".concat([t,r,n].map(o=>Math.round(o*255)).join(","),",").concat(i,")")}};W.black=new W(0,0,0,1);W.white=new W(1,1,1,1);W.transparent=new W(0,0,0,0);W.red=new W(1,0,0,1);var jr=class{constructor(t,r,n){t?this.sensitivity=r?"variant":"case":this.sensitivity=r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},Zr=class{constructor(t,r,n,i,o){this.text=t,this.image=r,this.scale=n,this.fontStack=i,this.textColor=o}},Me=class e{constructor(t){this.sections=t}static fromString(t){return new e([new Zr(t,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof e?t:e.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}},je=class e{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof e)return t;if(typeof t=="number")return new e([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]];break}return new e(t)}}toString(){return JSON.stringify(this.values)}},My=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),it=class e{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof e)return t;if(!(!Array.isArray(t)||t.length<1||t.length%2!==0)){for(let r=0;r<t.length;r+=2){let n=t[r],i=t[r+1];if(typeof n!="string"||!My.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new e(t)}}toString(){return JSON.stringify(this.values)}},Ce=class e{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new e({name:t,available:!1}):null}};function $l(e,t,r,n){if(!(typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255)){let i=typeof n=="number"?[e,t,r,n]:[e,t,r];return"Invalid rgba value [".concat(i.join(", "),"]: \'r\', \'g\', and \'b\' must be between 0 and 255.")}return typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:"Invalid rgba value [".concat([e,t,r,n].join(", "),"]: \'a\' must be between 0 and 1.")}function vi(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof W||e instanceof jr||e instanceof Me||e instanceof je||e instanceof it||e instanceof Ce)return!0;if(Array.isArray(e)){for(let t of e)if(!vi(t))return!1;return!0}else if(typeof e=="object"){for(let t in e)if(!vi(e[t]))return!1;return!0}else return!1}function fe(e){if(e===null)return cr;if(typeof e=="string")return G;if(typeof e=="boolean")return U;if(typeof e=="number")return L;if(e instanceof W)return ze;if(e instanceof jr)return Fi;if(e instanceof Me)return pr;if(e instanceof je)return Mi;if(e instanceof it)return Li;if(e instanceof Ce)return Xr;if(Array.isArray(e)){let t=e.length,r;for(let n of e){let i=fe(n);if(!r)r=i;else{if(r===i)continue;r=$;break}}return Fe(r||$,t)}else return or}function Ur(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof W||e instanceof Me||e instanceof je||e instanceof it||e instanceof Ce?e.toString():JSON.stringify(e)}var mt=class e{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error("\'literal\' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(!vi(t[1]))return r.error("invalid value");let n=t[1],i=fe(n),o=r.expectedType;return i.kind==="array"&&i.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(i=o),new e(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},oe=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}},gi={string:G,number:L,boolean:U,object:or},Ge=class e{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n=1,i,o=t[0];if(o==="array"){let s;if(t.length>2){let u=t[1];if(typeof u!="string"||!(u in gi)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=gi[u],n++}else s=$;let l;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error(\'The length argument to "array" must be a positive integer literal\',2);l=t[2],n++}i=Fe(s,l)}else{if(!gi[o])throw new Error("Types doesn\'t contain name = ".concat(o));i=gi[o]}let a=[];for(;n<t.length;n++){let s=r.parse(t[n],n,$);if(!s)return null;a.push(s)}return new e(i,a)}evaluate(t){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(t);if(Gr(this.type,fe(n))){if(r===this.args.length-1)throw new oe("Expected value to be of type ".concat(ne(this.type),", but found ").concat(ne(fe(n))," instead."))}else return n}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},Pl={"to-boolean":U,"to-color":ze,"to-number":L,"to-string":G},ft=class e{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n=t[0];if(!Pl[n])throw new Error("Can\'t parse ".concat(n," as it is not part of the known types"));if((n==="to-boolean"||n==="to-string")&&t.length!==2)return r.error("Expected one argument.");let i=Pl[n],o=[];for(let a=1;a<t.length;a++){let s=r.parse(t[a],a,$);if(!s)return null;o.push(s)}return new e(i,o)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,n;for(let i of this.args){if(r=i.evaluate(t),n=null,r instanceof W)return r;if(typeof r=="string"){let o=t.parseColor(r);if(o)return o}else if(Array.isArray(r)&&(r.length<3||r.length>4?n="Invalid rbga value ".concat(JSON.stringify(r),": expected an array containing either three or four numeric values."):n=$l(r[0],r[1],r[2],r[3]),!n))return new W(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new oe(n||"Could not parse color from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"padding":{let r;for(let n of this.args){r=n.evaluate(t);let i=je.parse(r);if(i)return i}throw new oe("Could not parse padding from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(t);let i=it.parse(r);if(i)return i}throw new oe("Could not parse variableAnchorOffsetCollection from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"number":{let r=null;for(let n of this.args){if(r=n.evaluate(t),r===null)return 0;let i=Number(r);if(!isNaN(i))return i}throw new oe("Could not convert ".concat(JSON.stringify(r)," to number."))}case"formatted":return Me.fromString(Ur(this.args[0].evaluate(t)));case"resolvedImage":return Ce.fromString(Ur(this.args[0].evaluate(t)));default:return Ur(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},Ly=["Unknown","Point","LineString","Polygon"],Pi=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Ly[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=W.parse(t)),r}},Si=class e{constructor(t,r,n=[],i,o=new Ca,a=[]){this.registry=t,this.path=n,this.key=n.map(s=>"[".concat(s,"]")).join(""),this.scope=o,this.errors=a,this.expectedType=i,this._isConstant=r}parse(t,r,n,i,o={}){return r?this.concat(r,n,i)._parse(t,o):this._parse(t,o)}_parse(t,r){(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number")&&(t=["literal",t]);function n(i,o,a){return a==="assert"?new Ge(o,[i]):a==="coerce"?new ft(o,[i]):i}if(Array.isArray(t)){if(t.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let i=t[0];if(typeof i!="string")return this.error("Expression name must be a string, but found ".concat(typeof i,\' instead. If you wanted a literal array, use ["literal", [...]].\'),0),null;let o=this.registry[i];if(o){let a=o.parse(t,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,l=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")a=n(a,s,r.typeAnnotation||"assert");else if((s.kind==="color"||s.kind==="formatted"||s.kind==="resolvedImage")&&(l.kind==="value"||l.kind==="string"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="padding"&&(l.kind==="value"||l.kind==="number"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="variableAnchorOffsetCollection"&&(l.kind==="value"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof mt)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new Pi;try{a=new mt(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(\'Unknown expression "\'.concat(i,\'". If you wanted a literal array, use ["literal", [...]].\'),0)}else return typeof t>"u"?this.error("\'undefined\' value invalid. Use null instead."):typeof t=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error("Expected an array, but found ".concat(typeof t," instead."))}concat(t,r,n){let i=typeof t=="number"?this.path.concat(t):this.path,o=n?this.scope.concat(n):this.scope;return new e(this.registry,this._isConstant,i,r||null,o,this.errors)}error(t,...r){let n="".concat(this.key).concat(r.map(i=>"[".concat(i,"]")).join(""));this.errors.push(new Ve(n,t))}checkSubtype(t,r){let n=Gr(t,r);return n&&this.error(n),n}},wi=class e{constructor(t,r,n){this.type=Fi,this.locale=n,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let n=t[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");let i=r.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,U);if(!i)return null;let o=r.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,U);if(!o)return null;let a=null;return n.locale&&(a=r.parse(n.locale,1,G),!a)?null:new e(i,o,a)}evaluate(t){return new jr(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}},yt=8192;function Na(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Dy(e){return(180+e)/360}function Vy(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Ai(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function By(e,t){let r=Dy(e[0]),n=Vy(e[1]),i=Math.pow(2,t.z);return[Math.round(r*i*yt),Math.round(n*i*yt)]}function zy(e,t,r){let n=e[0]-t[0],i=e[1]-t[1],o=e[0]-r[0],a=e[1]-r[1];return n*a-o*i===0&&n*o<=0&&i*a<=0}function Ry(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function Ua(e,t){let r=!1;for(let n=0,i=t.length;n<i;n++){let o=t[n];for(let a=0,s=o.length;a<s-1;a++){if(zy(e,o[a],o[a+1]))return!1;Ry(e,o[a],o[a+1])&&(r=!r)}}return r}function Oy(e,t){for(let r=0;r<t.length;r++)if(Ua(e,t[r]))return!0;return!1}function Ny(e,t){return e[0]*t[1]-e[1]*t[0]}function Sl(e,t,r,n){let i=e[0]-r[0],o=e[1]-r[1],a=t[0]-r[0],s=t[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],c=i*u-l*o,p=a*u-l*s;return c>0&&p<0||c<0&&p>0}function Uy(e,t,r,n){let i=[t[0]-e[0],t[1]-e[1]],o=[n[0]-r[0],n[1]-r[1]];return Ny(o,i)===0?!1:!!(Sl(e,t,r,n)&&Sl(r,n,e,t))}function $y(e,t,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(Uy(e,t,n[i],n[i+1]))return!0;return!1}function Gl(e,t){for(let r=0;r<e.length;++r)if(!Ua(e[r],t))return!1;for(let r=0;r<e.length-1;++r)if($y(e[r],e[r+1],t))return!1;return!0}function Gy(e,t){for(let r=0;r<t.length;r++)if(Gl(e,t[r]))return!0;return!1}function $a(e,t,r){let n=[];for(let i=0;i<e.length;i++){let o=[];for(let a=0;a<e[i].length;a++){let s=By(e[i][a],r);Na(t,s),o.push(s)}n.push(o)}return n}function ql(e,t,r){let n=[];for(let i=0;i<e.length;i++){let o=$a(e[i],t,r);n.push(o)}return n}function jl(e,t,r,n){if(e[0]<r[0]||e[0]>r[2]){let i=n*.5,o=e[0]-r[0]>i?-n:r[0]-e[0]>i?n:0;o===0&&(o=e[0]-r[2]>i?-n:r[2]-e[0]>i?n:0),e[0]+=o}Na(t,e)}function qy(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function wl(e,t,r,n){let i=Math.pow(2,n.z)*yt,o=[n.x*yt,n.y*yt],a=[];for(let s of e)for(let l of s){let u=[l.x+o[0],l.y+o[1]];jl(u,t,r,i),a.push(u)}return a}function Al(e,t,r,n){let i=Math.pow(2,n.z)*yt,o=[n.x*yt,n.y*yt],a=[];for(let s of e){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];Na(t,c),l.push(c)}a.push(l)}if(t[2]-t[0]<=i/2){qy(t);for(let s of a)for(let l of s)jl(l,t,r,i)}return a}function jy(e,t){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type==="Polygon"){let o=$a(t.coordinates,n,i),a=wl(e.geometry(),r,n,i);if(!Ai(r,n))return!1;for(let s of a)if(!Ua(s,o))return!1}if(t.type==="MultiPolygon"){let o=ql(t.coordinates,n,i),a=wl(e.geometry(),r,n,i);if(!Ai(r,n))return!1;for(let s of a)if(!Oy(s,o))return!1}return!0}function Zy(e,t){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type==="Polygon"){let o=$a(t.coordinates,n,i),a=Al(e.geometry(),r,n,i);if(!Ai(r,n))return!1;for(let s of a)if(!Gl(s,o))return!1}if(t.type==="MultiPolygon"){let o=ql(t.coordinates,n,i),a=Al(e.geometry(),r,n,i);if(!Ai(r,n))return!1;for(let s of a)if(!Gy(s,o))return!1}return!0}var Jr=class e{constructor(t,r){this.type=U,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error("\'within\' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(vi(t[1])){let n=t[1];if(n.type==="FeatureCollection")for(let i=0;i<n.features.length;++i){let o=n.features[i].geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new e(n,n.features[i].geometry)}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new e(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new e(n,n)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return jy(t,this.geometries);if(t.geometryType()==="LineString")return Zy(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},_i=class e{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("\'var\' expression requires exactly one string literal argument.");let n=t[1];return r.scope.has(n)?new e(n,r.scope.get(n)):r.error(\'Unknown variable "\'.concat(n,\'". Make sure "\').concat(n,\'" has been bound in an enclosing "let" expression before using it.\'),1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},Ye=class e{constructor(t,r,n,i){this.name=t,this.type=r,this._evaluate=n,this.args=i}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){let n=t[0],i=e.definitions[n];if(!i)return r.error(\'Unknown expression "\'.concat(n,\'". If you wanted a literal array, use ["literal", [...]].\'),0);let o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter(([u])=>!Array.isArray(u)||u.length===t.length-1),l=null;for(let[u,c]of s){l=new Si(r.registry,Ii,r.path,null,r.scope);let p=[],f=!1;for(let y=1;y<t.length;y++){let m=t[y],h=Array.isArray(u)?u[y-1]:u.type,d=l.parse(m,1+p.length,h);if(!d){f=!0;break}p.push(d)}if(!f){if(Array.isArray(u)&&u.length!==p.length){l.error("Expected ".concat(u.length," arguments, but found ").concat(p.length," instead."));continue}for(let y=0;y<p.length;y++){let m=Array.isArray(u)?u[y]:u.type,h=p[y];l.concat(y+1).checkSubtype(m,h.type)}if(l.errors.length===0)return new e(n,o,c,p)}}if(s.length===1)r.errors.push(...l.errors);else{let c=(s.length?s:a).map(([f])=>Jy(f)).join(" | "),p=[];for(let f=1;f<t.length;f++){let y=r.parse(t[f],1+p.length);if(!y)return null;p.push(ne(y.type))}r.error("Expected arguments of type ".concat(c,", but found (").concat(p.join(", "),") instead."))}return null}static register(t,r){e.definitions=r;for(let n in r)t[n]=e}};function Jy(e){return Array.isArray(e)?"(".concat(e.map(ne).join(", "),")"):"(".concat(ne(e.type),"...)")}function Ii(e){if(e instanceof _i)return Ii(e.boundExpression);if(e instanceof Ye&&e.name==="error")return!1;if(e instanceof wi)return!1;if(e instanceof Jr)return!1;let t=e instanceof ft||e instanceof Ge,r=!0;return e.eachChild(n=>{t?r=r&&Ii(n):r=r&&n instanceof mt}),r?Di(e)&&Vi(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}function Di(e){if(e instanceof Ye){if(e.name==="get"&&e.args.length===1)return!1;if(e.name==="feature-state")return!1;if(e.name==="has"&&e.args.length===1)return!1;if(e.name==="properties"||e.name==="geometry-type"||e.name==="id")return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Jr)return!1;let t=!0;return e.eachChild(r=>{t&&!Di(r)&&(t=!1)}),t}function Wr(e){if(e instanceof Ye&&e.name==="feature-state")return!1;let t=!0;return e.eachChild(r=>{t&&!Wr(r)&&(t=!1)}),t}function Vi(e,t){if(e instanceof Ye&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(n=>{r&&!Vi(n,t)&&(r=!1)}),r}function Bi(e,t){let r=e.length-1,n=0,i=r,o=0,a,s;for(;n<=i;)if(o=Math.floor((n+i)/2),a=e[o],s=e[o+1],a<=t){if(o===r||t<s)return o;n=o+1}else if(a>t)i=o-1;else throw new oe("Input is not a number.");return 0}var lr=class e{constructor(t,r,n){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(let[i,o]of n)this.labels.push(i),this.outputs.push(o)}static parse(t,r){if(t.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!==0)return r.error("Expected an even number of arguments.");let n=r.parse(t[1],1,L);if(!n)return null;let i=[],o=null;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);for(let a=1;a<t.length;a+=2){let s=a===1?-1/0:t[a],l=t[a+1],u=a,c=a+1;if(typeof s!="number")return r.error(\'Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',u);if(i.length&&i[i.length-1][0]>=s)return r.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',u);let p=r.parse(l,c,o);if(!p)return null;o=o||p.type,i.push([s,p])}return new e(o,n,i)}evaluate(t){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(t);let i=this.input.evaluate(t);if(i<=r[0])return n[0].evaluate(t);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(t);let a=Bi(r,i);return n[a].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function Wy(e){return e==="rgb"||e==="hcl"||e==="lab"}function Lt(e,t,r){return e+r*(t-e)}function Hy(e,t,r,n="rgb"){switch(n){case"rgb":{let[i,o,a,s]=Ci(e.rgb,t.rgb,r);return new W(i,o,a,s,!1)}case"hcl":{let[i,o,a,s]=e.hcl,[l,u,c,p]=t.hcl,f,y;if(!isNaN(i)&&!isNaN(l)){let v=l-i;l>i&&v>180?v-=360:l<i&&i-l>180&&(v+=360),f=i+r*v}else isNaN(i)?isNaN(l)?f=NaN:(f=l,(a===1||a===0)&&(y=u)):(f=i,(c===1||c===0)&&(y=o));let[m,h,d,g]=ky([f,y!=null?y:Lt(o,u,r),Lt(a,c,r),Lt(s,p,r)]);return new W(m,h,d,g,!1)}case"lab":{let[i,o,a,s]=Ul(Ci(e.lab,t.lab,r));return new W(i,o,a,s,!1)}}}function Ci(e,t,r){return e.map((n,i)=>Lt(n,t[i],r))}function Ky(e,t,r){return new je(Ci(e.values,t.values,r))}function Yy(e,t,r){let n=e.values,i=t.values;if(n.length!==i.length)throw new oe("Cannot interpolate values of different length. from: ".concat(e.toString(),", to: ").concat(t.toString()));let o=[];for(let a=0;a<n.length;a+=2){if(n[a]!==i[a])throw new oe("Cannot interpolate values containing mismatched anchors. from[".concat(a,"]: ").concat(n[a],", to[").concat(a,"]: ").concat(i[a]));o.push(n[a]);let[s,l]=n[a+1],[u,c]=i[a+1];o.push([Lt(s,u,r),Lt(l,c,r)])}return new it(o)}var Re={number:Lt,color:Hy,array:Ci,padding:Ky,variableAnchorOffsetCollection:Yy},qe=class e{constructor(t,r,n,i,o){this.type=t,this.operator=r,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(let[a,s]of o)this.labels.push(a),this.outputs.push(s)}static interpolationFactor(t,r,n,i){let o=0;if(t.name==="exponential")o=Aa(r,t.base,n,i);else if(t.name==="linear")o=Aa(r,1,n,i);else if(t.name==="cubic-bezier"){let a=t.controlPoints;o=new Ll.default(a[0],a[1],a[2],a[3]).solve(Aa(r,1,n,i))}return o}static parse(t,r){let[n,i,o,...a]=t;if(!Array.isArray(i)||i.length===0)return r.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let u=i[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){let u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return r.error("Unknown interpolation type ".concat(String(i[0])),1,0);if(t.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!==0)return r.error("Expected an even number of arguments.");if(o=r.parse(o,2,L),!o)return null;let s=[],l=null;n==="interpolate-hcl"||n==="interpolate-lab"?l=ze:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<a.length;u+=2){let c=a[u],p=a[u+1],f=u+3,y=u+4;if(typeof c!="number")return r.error(\'Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',f);if(s.length&&s[s.length-1][0]>=c)return r.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',f);let m=r.parse(p,y,l);if(!m)return null;l=l||m.type,s.push([c,m])}return!Nr(l,L)&&!Nr(l,ze)&&!Nr(l,Mi)&&!Nr(l,Li)&&!Nr(l,Fe(L))?r.error("Type ".concat(ne(l)," is not interpolatable.")):new e(l,n,i,o,s)}evaluate(t){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(t);let i=this.input.evaluate(t);if(i<=r[0])return n[0].evaluate(t);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(t);let a=Bi(r,i),s=r[a],l=r[a+1],u=e.interpolationFactor(this.interpolation,i,s,l),c=n[a].evaluate(t),p=n[a+1].evaluate(t);switch(this.operator){case"interpolate":return Re[this.type.kind](c,p,u);case"interpolate-hcl":return Re.color(c,p,u,"hcl");case"interpolate-lab":return Re.color(c,p,u,"lab")}}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function Aa(e,t,r,n){let i=n-r,o=e-r;return i===0?0:t===1?o/i:(Math.pow(t,o)-1)/(Math.pow(t,i)-1)}var ki=class e{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let n=null,i=r.expectedType;i&&i.kind!=="value"&&(n=i);let o=[];for(let s of t.slice(1)){let l=r.parse(s,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,o.push(l)}if(!n)throw new Error("No output type");return i&&o.some(s=>Gr(i,s.type))?new e($,o):new e(n,o)}evaluate(t){let r=null,n=0,i;for(let o of this.args)if(n++,r=o.evaluate(t),r&&r instanceof Ce&&!r.available&&(i||(i=r.name),r=null,n===this.args.length&&(r=i)),r!==null)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},Ti=class e{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error("Expected at least 3 arguments, but found ".concat(t.length-1," instead."));let n=[];for(let o=1;o<t.length-1;o+=2){let a=t[o];if(typeof a!="string")return r.error("Expected string, but found ".concat(typeof a," instead."),o);if(/[^a-zA-Z0-9_]/.test(a))return r.error("Variable names must contain only alphanumeric characters or \'_\'.",o);let s=r.parse(t[o+1],o+1);if(!s)return null;n.push([a,s])}let i=r.parse(t[t.length-1],t.length-1,r.expectedType,n);return i?new e(n,i):null}outputDefined(){return this.result.outputDefined()}},ka=class e{constructor(t,r,n){this.type=t,this.index=r,this.input=n}static parse(t,r){if(t.length!==3)return r.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1,L),i=r.parse(t[2],2,Fe(r.expectedType||$));if(!n||!i)return null;let o=i.type;return new e(o.itemType,n,i)}evaluate(t){let r=this.index.evaluate(t),n=this.input.evaluate(t);if(r<0)throw new oe("Array index out of bounds: ".concat(r," < 0."));if(r>=n.length)throw new oe("Array index out of bounds: ".concat(r," > ").concat(n.length-1,"."));if(r!==Math.floor(r))throw new oe("Array index must be an integer, but found ".concat(r," instead."));return n[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},Ta=class e{constructor(t,r){this.type=U,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1,$),i=r.parse(t[2],2,$);return!n||!i?null:Oa(n.type,[U,G,L,cr,$])?new e(n,i):r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(ne(n.type)," instead"))}evaluate(t){let r=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!n)return!1;if(!qr(r,["boolean","string","number","null"]))throw new oe("Expected first argument to be of type boolean, string, number or null, but found ".concat(ne(fe(r))," instead."));if(!qr(n,["string","array"]))throw new oe("Expected second argument to be of type array or string, but found ".concat(ne(fe(n))," instead."));return n.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},Ea=class e{constructor(t,r,n){this.type=L,this.needle=t,this.haystack=r,this.fromIndex=n}static parse(t,r){if(t.length<=2||t.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1,$),i=r.parse(t[2],2,$);if(!n||!i)return null;if(!Oa(n.type,[U,G,L,cr,$]))return r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(ne(n.type)," instead"));if(t.length===4){let o=r.parse(t[3],3,L);return o?new e(n,i,o):null}else return new e(n,i)}evaluate(t){let r=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!qr(r,["boolean","string","number","null"]))throw new oe("Expected first argument to be of type boolean, string, number or null, but found ".concat(ne(fe(r))," instead."));if(!qr(n,["string","array"]))throw new oe("Expected second argument to be of type array or string, but found ".concat(ne(fe(n))," instead."));if(this.fromIndex){let i=this.fromIndex.evaluate(t);return n.indexOf(r,i)}return n.indexOf(r)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},Fa=class e{constructor(t,r,n,i,o,a){this.inputType=t,this.type=r,this.input=n,this.cases=i,this.outputs=o,this.otherwise=a}static parse(t,r){if(t.length<5)return r.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!==1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let o={},a=[];for(let u=2;u<t.length-1;u+=2){let c=t[u],p=t[u+1];Array.isArray(c)||(c=[c]);let f=r.concat(u);if(c.length===0)return f.error("Expected at least one branch label.");for(let m of c){if(typeof m!="number"&&typeof m!="string")return f.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return f.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if(typeof m=="number"&&Math.floor(m)!==m)return f.error("Numeric branch labels must be integer values.");if(!n)n=fe(m);else if(f.checkSubtype(n,fe(m)))return null;if(typeof o[String(m)]<"u")return f.error("Branch labels must be unique.");o[String(m)]=a.length}let y=r.parse(p,u,i);if(!y)return null;i=i||y.type,a.push(y)}let s=r.parse(t[1],1,$);if(!s)return null;let l=r.parse(t[t.length-1],t.length-1,i);return!l||s.type.kind!=="value"&&r.concat(1).checkSubtype(n,s.type)?null:new e(n,i,s,o,a,l)}evaluate(t){let r=this.input.evaluate(t);return(fe(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}},Ma=class e{constructor(t,r,n){this.type=t,this.branches=r,this.otherwise=n}static parse(t,r){if(t.length<4)return r.error("Expected at least 3 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!==0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let i=[];for(let a=1;a<t.length-1;a+=2){let s=r.parse(t[a],a,U);if(!s)return null;let l=r.parse(t[a+1],a+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let o=r.parse(t[t.length-1],t.length-1,n);if(!o)return null;if(!n)throw new Error("Can\'t infer output type");return new e(n,i,o)}evaluate(t){for(let[r,n]of this.branches)if(r.evaluate(t))return n.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[r,n]of this.branches)t(r),t(n);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},La=class e{constructor(t,r,n,i){this.type=t,this.input=r,this.beginIndex=n,this.endIndex=i}static parse(t,r){if(t.length<=2||t.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1,$),i=r.parse(t[2],2,L);if(!n||!i)return null;if(!Oa(n.type,[Fe($),G,$]))return r.error("Expected first argument to be of type array or string, but found ".concat(ne(n.type)," instead"));if(t.length===4){let o=r.parse(t[3],3,L);return o?new e(n.type,n,i,o):null}else return new e(n.type,n,i)}evaluate(t){let r=this.input.evaluate(t),n=this.beginIndex.evaluate(t);if(!qr(r,["string","array"]))throw new oe("Expected first argument to be of type array or string, but found ".concat(ne(fe(r))," instead."));if(this.endIndex){let i=this.endIndex.evaluate(t);return r.slice(n,i)}return r.slice(n)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}};function _l(e,t){return e==="=="||e==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function Xy(e,t,r){return t===r}function Qy(e,t,r){return t!==r}function em(e,t,r){return t<r}function tm(e,t,r){return t>r}function rm(e,t,r){return t<=r}function nm(e,t,r){return t>=r}function Zl(e,t,r,n){return n.compare(t,r)===0}function im(e,t,r,n){return!Zl(e,t,r,n)}function om(e,t,r,n){return n.compare(t,r)<0}function am(e,t,r,n){return n.compare(t,r)>0}function sm(e,t,r,n){return n.compare(t,r)<=0}function lm(e,t,r,n){return n.compare(t,r)>=0}function fr(e,t,r){let n=e!=="=="&&e!=="!=";return class Jl{constructor(o,a,s){this.type=U,this.lhs=o,this.rhs=a,this.collator=s,this.hasUntypedArgument=o.type.kind==="value"||a.type.kind==="value"}static parse(o,a){if(o.length!==3&&o.length!==4)return a.error("Expected two or three arguments.");let s=o[0],l=a.parse(o[1],1,$);if(!l)return null;if(!_l(s,l.type))return a.concat(1).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(ne(l.type),"\'."));let u=a.parse(o[2],2,$);if(!u)return null;if(!_l(s,u.type))return a.concat(2).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(ne(u.type),"\'."));if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot compare types \'".concat(ne(l.type),"\' and \'").concat(ne(u.type),"\'."));n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new Ge(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new Ge(l.type,[u])));let c=null;if(o.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot use collator to compare non-string types.");if(c=a.parse(o[3],3,Fi),!c)return null}return new Jl(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=fe(a),u=fe(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new oe(\'Expected arguments for "\'.concat(e,\'" to be (string, string) or (number, number), but found (\').concat(l.kind,", ").concat(u.kind,") instead."))}if(this.collator&&!n&&this.hasUntypedArgument){let l=fe(a),u=fe(s);if(l.kind!=="string"||u.kind!=="string")return t(o,a,s)}return this.collator?r(o,a,s,this.collator.evaluate(o)):t(o,a,s)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}var um=fr("==",Xy,Zl),cm=fr("!=",Qy,im),pm=fr("<",em,om),fm=fr(">",tm,am),ym=fr("<=",rm,sm),mm=fr(">=",nm,lm),Da=class e{constructor(t,r,n,i,o){this.type=G,this.number=t,this.locale=r,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=o}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let n=r.parse(t[1],1,L);if(!n)return null;let i=t[2];if(typeof i!="object"||Array.isArray(i))return r.error("NumberFormat options argument must be an object.");let o=null;if(i.locale&&(o=r.parse(i.locale,1,G),!o))return null;let a=null;if(i.currency&&(a=r.parse(i.currency,1,G),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,L),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,L),!l)?null:new e(n,o,a,s,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},Hr=class e{constructor(t){this.type=pr,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n=t[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");let i=[],o=!1;for(let a=1;a<=t.length-1;++a){let s=t[a];if(o&&typeof s=="object"&&!Array.isArray(s)){o=!1;let l=null;if(s["font-scale"]&&(l=r.parse(s["font-scale"],1,L),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,Fe(G)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,ze),!c))return null;let p=i[i.length-1];p.scale=l,p.font=u,p.textColor=c}else{let l=r.parse(t[a],1,$);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");o=!0,i.push({content:l,scale:null,font:null,textColor:null})}}return new e(i)}evaluate(t){let r=n=>{let i=n.content.evaluate(t);return fe(i)===Xr?new Zr("",i,null,null,null):new Zr(Ur(i),null,n.scale?n.scale.evaluate(t):null,n.font?n.font.evaluate(t).join(","):null,n.textColor?n.textColor.evaluate(t):null)};return new Me(this.sections.map(r))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}},Va=class e{constructor(t){this.type=Xr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let n=r.parse(t[1],1,G);return n?new e(n):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),n=Ce.fromString(r);return n&&t.availableImages&&(n.available=t.availableImages.indexOf(r)>-1),n}eachChild(t){t(this.input)}outputDefined(){return!1}},Ba=class e{constructor(t){this.type=L,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected 1 argument, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error("Expected argument of type string or array, but found ".concat(ne(n.type)," instead.")):new e(n):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r=="string")return r.length;if(Array.isArray(r))return r.length;throw new oe("Expected value to be of type string or array, but found ".concat(ne(fe(r))," instead."))}eachChild(t){t(this.input)}outputDefined(){return!1}},zt={"==":um,"!=":cm,">":fm,"<":pm,">=":mm,"<=":ym,array:Ge,at:ka,boolean:Ge,case:Ma,coalesce:ki,collator:wi,format:Hr,image:Va,in:Ta,"index-of":Ea,interpolate:qe,"interpolate-hcl":qe,"interpolate-lab":qe,length:Ba,let:Ti,literal:mt,match:Fa,number:Ge,"number-format":Da,object:Ge,slice:La,step:lr,string:Ge,"to-boolean":ft,"to-color":ft,"to-number":ft,"to-string":ft,var:_i,within:Jr};function Il(e,[t,r,n,i]){t=t.evaluate(e),r=r.evaluate(e),n=n.evaluate(e);let o=i?i.evaluate(e):1,a=$l(t,r,n,o);if(a)throw new oe(a);return new W(t/255,r/255,n/255,o,!1)}function Cl(e,t){return e in t}function _a(e,t){let r=t[e];return typeof r>"u"?null:r}function hm(e,t,r,n){for(;r<=n;){let i=r+n>>1;if(t[i]===e)return!0;t[i]>e?n=i-1:r=i+1}return!1}function Mt(e){return{type:e}}Ye.register(zt,{error:[Sy,[G],(e,[t])=>{throw new oe(t.evaluate(e))}],typeof:[G,[$],(e,[t])=>ne(fe(t.evaluate(e)))],"to-rgba":[Fe(L,4),[ze],(e,[t])=>{let[r,n,i,o]=t.evaluate(e).rgb;return[r*255,n*255,i*255,o]}],rgb:[ze,[L,L,L],Il],rgba:[ze,[L,L,L,L],Il],has:{type:U,overloads:[[[G],(e,[t])=>Cl(t.evaluate(e),e.properties())],[[G,or],(e,[t,r])=>Cl(t.evaluate(e),r.evaluate(e))]]},get:{type:$,overloads:[[[G],(e,[t])=>_a(t.evaluate(e),e.properties())],[[G,or],(e,[t,r])=>_a(t.evaluate(e),r.evaluate(e))]]},"feature-state":[$,[G],(e,[t])=>_a(t.evaluate(e),e.featureState||{})],properties:[or,[],e=>e.properties()],"geometry-type":[G,[],e=>e.geometryType()],id:[$,[],e=>e.id()],zoom:[L,[],e=>e.globals.zoom],"heatmap-density":[L,[],e=>e.globals.heatmapDensity||0],"line-progress":[L,[],e=>e.globals.lineProgress||0],accumulated:[$,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[L,Mt(L),(e,t)=>{let r=0;for(let n of t)r+=n.evaluate(e);return r}],"*":[L,Mt(L),(e,t)=>{let r=1;for(let n of t)r*=n.evaluate(e);return r}],"-":{type:L,overloads:[[[L,L],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[L],(e,[t])=>-t.evaluate(e)]]},"/":[L,[L,L],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[L,[L,L],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[L,[],()=>Math.LN2],pi:[L,[],()=>Math.PI],e:[L,[],()=>Math.E],"^":[L,[L,L],(e,[t,r])=>Math.pow(t.evaluate(e),r.evaluate(e))],sqrt:[L,[L],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[L,[L],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[L,[L],(e,[t])=>Math.log(t.evaluate(e))],log2:[L,[L],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[L,[L],(e,[t])=>Math.sin(t.evaluate(e))],cos:[L,[L],(e,[t])=>Math.cos(t.evaluate(e))],tan:[L,[L],(e,[t])=>Math.tan(t.evaluate(e))],asin:[L,[L],(e,[t])=>Math.asin(t.evaluate(e))],acos:[L,[L],(e,[t])=>Math.acos(t.evaluate(e))],atan:[L,[L],(e,[t])=>Math.atan(t.evaluate(e))],min:[L,Mt(L),(e,t)=>Math.min(...t.map(r=>r.evaluate(e)))],max:[L,Mt(L),(e,t)=>Math.max(...t.map(r=>r.evaluate(e)))],abs:[L,[L],(e,[t])=>Math.abs(t.evaluate(e))],round:[L,[L],(e,[t])=>{let r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[L,[L],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[L,[L],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[U,[G,$],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[U,[$],(e,[t])=>e.id()===t.value],"filter-type-==":[U,[G],(e,[t])=>e.geometryType()===t.value],"filter-<":[U,[G,$],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[U,[$],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r<n}],"filter->":[U,[G,$],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[U,[$],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r>n}],"filter-<=":[U,[G,$],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[U,[$],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r<=n}],"filter->=":[U,[G,$],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[U,[$],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r>=n}],"filter-has":[U,[$],(e,[t])=>t.value in e.properties()],"filter-has-id":[U,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[U,[Fe(G)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[U,[Fe($)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[U,[G,Fe($)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[U,[G,Fe($)],(e,[t,r])=>hm(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:U,overloads:[[[U,U],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Mt(U),(e,t)=>{for(let r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:U,overloads:[[[U,U],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Mt(U),(e,t)=>{for(let r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[U,[U],(e,[t])=>!t.evaluate(e)],"is-supported-script":[U,[G],(e,[t])=>{let r=e.globals&&e.globals.isSupportedScript;return r?r(t.evaluate(e)):!0}],upcase:[G,[G],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[G,[G],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[G,Mt($),(e,t)=>t.map(r=>Ur(r.evaluate(e))).join("")],"resolved-locale":[G,[Fi],(e,[t])=>t.evaluate(e).resolvedLocale()]});function za(e){return{result:"success",value:e}}function ir(e){return{result:"error",value:e}}function ht(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function Wl(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Ga(e){return!!e.expression&&e.expression.interpolated}function j(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function zi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function dm(e){return e}function Hl(e,t){let r=t.type==="color",n=e.stops&&typeof e.stops[0][0]=="object",i=n||e.property!==void 0,o=n||!i,a=e.type||(Ga(t)?"exponential":"interval");if(r||t.type==="padding"){let c=r?W.parse:je.parse;e=sr({},e),e.stops&&(e.stops=e.stops.map(p=>[p[0],c(p[1])])),e.default?e.default=c(e.default):e.default=c(t.default)}if(e.colorSpace&&!Wy(e.colorSpace))throw new Error(\'Unknown color space: "\'.concat(e.colorSpace,\'"\'));let s,l,u;if(a==="exponential")s=kl;else if(a==="interval")s=xm;else if(a==="categorical"){s=gm,l=Object.create(null);for(let c of e.stops)l[c[0]]=c[1];u=typeof e.stops[0][0]}else if(a==="identity")s=bm;else throw new Error(\'Unknown function type "\'.concat(a,\'"\'));if(n){let c={},p=[];for(let m=0;m<e.stops.length;m++){let h=e.stops[m],d=h[0].zoom;c[d]===void 0&&(c[d]={zoom:d,type:e.type,property:e.property,default:e.default,stops:[]},p.push(d)),c[d].stops.push([h[0].value,h[1]])}let f=[];for(let m of p)f.push([c[m].zoom,Hl(c[m],t)]);let y={name:"linear"};return{kind:"composite",interpolationType:y,interpolationFactor:qe.interpolationFactor.bind(void 0,y),zoomStops:f.map(m=>m[0]),evaluate({zoom:m},h){return kl({stops:f,base:e.base},t,m).evaluate(m,h)}}}else if(o){let c=a==="exponential"?{name:"exponential",base:e.base!==void 0?e.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:qe.interpolationFactor.bind(void 0,c),zoomStops:e.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(e,t,p,l,u)}}else return{kind:"source",evaluate(c,p){let f=p&&p.properties?p.properties[e.property]:void 0;return f===void 0?Qr(e.default,t.default):s(e,t,f,l,u)}}}function Qr(e,t,r){if(e!==void 0)return e;if(t!==void 0)return t;if(r!==void 0)return r}function gm(e,t,r,n,i){let o=typeof r===i?n[r]:void 0;return Qr(o,e.default,t.default)}function xm(e,t,r){if(j(r)!=="number")return Qr(e.default,t.default);let n=e.stops.length;if(n===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];let i=Bi(e.stops.map(o=>o[0]),r);return e.stops[i][1]}function kl(e,t,r){let n=e.base!==void 0?e.base:1;if(j(r)!=="number")return Qr(e.default,t.default);let i=e.stops.length;if(i===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];let o=Bi(e.stops.map(c=>c[0]),r),a=vm(r,n,e.stops[o][0],e.stops[o+1][0]),s=e.stops[o][1],l=e.stops[o+1][1],u=Re[t.type]||dm;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),f=l.evaluate.apply(void 0,c);if(!(p===void 0||f===void 0))return u(p,f,a,e.colorSpace)}}:u(s,l,a,e.colorSpace)}function bm(e,t,r){switch(t.type){case"color":r=W.parse(r);break;case"formatted":r=Me.fromString(r.toString());break;case"resolvedImage":r=Ce.fromString(r.toString());break;case"padding":r=je.parse(r);break;default:j(r)!==t.type&&(t.type!=="enum"||!t.values[r])&&(r=void 0)}return Qr(r,e.default,t.default)}function vm(e,t,r,n){let i=n-r,o=e-r;return i===0?0:t===1?o/i:(Math.pow(t,o)-1)/(Math.pow(t,i)-1)}var Dt=class{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new Pi,this._defaultValue=r?Sm(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,n,i,o,a){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(t,r,n,i,o,a){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new oe("Expected value to be one of ".concat(Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", "),", but found ").concat(JSON.stringify(s)," instead."));return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function en(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in zt}function Rt(e,t){let r=new Si(zt,Ii,[],t?Pm(t):void 0),n=r.parse(e,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?za(new Dt(n,t)):ir(r.errors)}var dt=class{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Wr(r.expression)}evaluateWithoutErrorHandling(t,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(t,r,n,i,o,a)}evaluate(t,r,n,i,o,a){return this._styleExpression.evaluate(t,r,n,i,o,a)}},gt=class{constructor(t,r,n,i){this.kind=t,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Wr(r.expression),this.interpolationType=i}evaluateWithoutErrorHandling(t,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(t,r,n,i,o,a)}evaluate(t,r,n,i,o,a){return this._styleExpression.evaluate(t,r,n,i,o,a)}interpolationFactor(t,r,n){return this.interpolationType?qe.interpolationFactor(this.interpolationType,t,r,n):0}};function Kl(e,t){let r=Rt(e,t);if(r.result==="error")return r;let n=r.value.expression,i=Di(n);if(!i&&!ht(t))return ir([new Ve("","data expressions not supported")]);let o=Vi(n,["zoom"]);if(!o&&!Wl(t))return ir([new Ve("","zoom expressions not supported")]);let a=bi(n);if(!a&&!o)return ir([new Ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof Ve)return ir([a]);if(a instanceof qe&&!Ga(t))return ir([new Ve("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return za(i?new dt("constant",r.value):new dt("source",r.value));let s=a instanceof qe?a.interpolation:void 0;return za(i?new gt("camera",r.value,a.labels,s):new gt("composite",r.value,a.labels,s))}var Kr=class e{constructor(t,r){this._parameters=t,this._specification=r,sr(this,Hl(this._parameters,this._specification))}static deserialize(t){return new e(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}};function Yl(e,t){if(zi(e))return new Kr(e,t);if(en(e)){let r=Kl(e,t);if(r.result==="error")throw new Error(r.value.map(n=>"".concat(n.key,": ").concat(n.message)).join(", "));return r.value}else{let r=e;return t.type==="color"&&typeof e=="string"?r=W.parse(e):t.type==="padding"&&(typeof e=="number"||Array.isArray(e))?r=je.parse(e):t.type==="variableAnchorOffsetCollection"&&Array.isArray(e)&&(r=it.parse(e)),{kind:"constant",evaluate:()=>r}}}function bi(e){let t=null;if(e instanceof Ti)t=bi(e.result);else if(e instanceof ki){for(let r of e.args)if(t=bi(r),t)break}else(e instanceof lr||e instanceof qe)&&e.input instanceof Ye&&e.input.name==="zoom"&&(t=e);return t instanceof Ve||e.eachChild(r=>{let n=bi(r);n instanceof Ve?t=n:!t&&n?t=new Ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):t&&n&&t!==n&&(t=new Ve("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),t}function Pm(e){let t={color:ze,string:G,number:L,enum:G,boolean:U,formatted:pr,padding:Mi,resolvedImage:Xr,variableAnchorOffsetCollection:Li};return e.type==="array"?Fe(t[e.value]||$,e.length):t[e.type]}function Sm(e){return e.type==="color"&&zi(e.default)?new W(0,0,0,0):e.type==="color"?W.parse(e.default)||null:e.type==="padding"?je.parse(e.default)||null:e.type==="variableAnchorOffsetCollection"?it.parse(e.default)||null:e.default===void 0?null:e.default}function qa(e){if(e===!0||e===!1)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case"has":return e.length>=2&&e[1]!=="$id"&&e[1]!=="$type";case"in":return e.length>=3&&(typeof e[1]!="string"||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let t of e.slice(1))if(!qa(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}var wm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function tn(e){if(e==null)return{filter:()=>!0,needGeometry:!1};qa(e)||(e=Ei(e));let t=Rt(e,wm);if(t.result==="error")throw new Error(t.value.map(r=>"".concat(r.key,": ").concat(r.message)).join(", "));{let r=Xl(e);return{filter:(n,i,o)=>t.value.evaluate(n,i,{},o),needGeometry:r}}}function Am(e,t){return e<t?-1:e>t?1:0}function Xl(e){if(!Array.isArray(e))return!1;if(e[0]==="within")return!0;for(let t=1;t<e.length;t++)if(Xl(e[t]))return!0;return!1}function Ei(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?Ia(e[1],e[2],"=="):t==="!="?xi(Ia(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Ia(e[1],e[2],t):t==="any"?_m(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(Ei)):t==="none"?["all"].concat(e.slice(1).map(Ei).map(xi)):t==="in"?Tl(e[1],e.slice(2)):t==="!in"?xi(Tl(e[1],e.slice(2))):t==="has"?El(e[1]):t==="!has"?xi(El(e[1])):t==="within"?e:!0}function Ia(e,t,r){switch(e){case"$type":return["filter-type-".concat(r),t];case"$id":return["filter-id-".concat(r),t];default:return["filter-".concat(r),e,t]}}function _m(e){return["any"].concat(e.map(Ei))}function Tl(e,t){if(t.length===0)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",e,["literal",t.sort(Am)]]:["filter-in-small",e,["literal",t]]}}function El(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function xi(e){return["!",e]}function Ra(e){let t=typeof e;if(t==="number"||t==="boolean"||t==="string"||e===void 0||e===null)return JSON.stringify(e);if(Array.isArray(e)){let i="[";for(let o of e)i+="".concat(Ra(o),",");return"".concat(i,"]")}let r=Object.keys(e).sort(),n="{";for(let i=0;i<r.length;i++)n+="".concat(JSON.stringify(r[i]),":").concat(Ra(e[r[i]]),",");return"".concat(n,"}")}function Im(e){let t="";for(let r of Py)t+="/".concat(Ra(e[r]));return t}function Ql(e,t){let r={};for(let i=0;i<e.length;i++){let o=t&&t[e[i].id]||Im(e[i]);t&&(t[e[i].id]=o);let a=r[o];a||(a=r[o]=[]),a.push(e[i])}let n=[];for(let i in r)n.push(r[i]);return n}function eu(e){let t=e.key,r=e.value;return r?[new D(t,r,"constants have been deprecated as of v8")]:[]}function pe(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Vt(e){if(Array.isArray(e))return e.map(Vt);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let r in e)t[r]=Vt(e[r]);return t}return pe(e)}function Be(e){let t=e.key,r=e.value,n=e.valueSpec||{},i=e.objectElementValidators||{},o=e.style,a=e.styleSpec,s=e.validateSpec,l=[],u=j(r);if(u!=="object")return[new D(t,r,"object expected, ".concat(u," found"))];for(let c in r){let p=c.split(".")[0],f=n[p]||n["*"],y;if(i[p])y=i[p];else if(n[p])y=s;else if(i["*"])y=i["*"];else if(n["*"])y=s;else{l.push(new D(t,r[c],\'unknown property "\'.concat(c,\'"\')));continue}l=l.concat(y({key:(t&&"".concat(t,"."))+c,value:r[c],valueSpec:f,style:o,styleSpec:a,object:r,objectKey:c,validateSpec:s},r))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&r[c]===void 0&&l.push(new D(t,r,\'missing required property "\'.concat(c,\'"\')));return l}function ja(e){let t=e.value,r=e.valueSpec,n=e.validateSpec,i=e.style,o=e.styleSpec,a=e.key,s=e.arrayElementValidator||n;if(j(t)!=="array")return[new D(a,t,"array expected, ".concat(j(t)," found"))];if(r.length&&t.length!==r.length)return[new D(a,t,"array length ".concat(r.length," expected, length ").concat(t.length," found"))];if(r["min-length"]&&t.length<r["min-length"])return[new D(a,t,"array length at least ".concat(r["min-length"]," expected, length ").concat(t.length," found"))];let l={type:r.value,values:r.values};o.$version<7&&(l.function=r.function),j(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<t.length;c++)u=u.concat(s({array:t,arrayIndex:c,value:t[c],valueSpec:l,validateSpec:e.validateSpec,style:i,styleSpec:o,key:"".concat(a,"[").concat(c,"]")}));return u}function Za(e){let t=e.key,r=e.value,n=e.valueSpec,i=j(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new D(t,r,"number expected, ".concat(i," found"))]:"minimum"in n&&r<n.minimum?[new D(t,r,"".concat(r," is less than the minimum value ").concat(n.minimum))]:"maximum"in n&&r>n.maximum?[new D(t,r,"".concat(r," is greater than the maximum value ").concat(n.maximum))]:[]}function tu(e){let t=e.valueSpec,r=pe(e.value.type),n,i={},o,a,s=r!=="categorical"&&e.value.property===void 0,l=!s,u=j(e.value.stops)==="array"&&j(e.value.stops[0])==="array"&&j(e.value.stops[0][0])==="object",c=Be({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:p,default:m}});return r==="identity"&&s&&c.push(new D(e.key,e.value,\'missing required property "property"\')),r!=="identity"&&!e.value.stops&&c.push(new D(e.key,e.value,\'missing required property "stops"\')),r==="exponential"&&e.valueSpec.expression&&!Ga(e.valueSpec)&&c.push(new D(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!ht(e.valueSpec)?c.push(new D(e.key,e.value,"property functions not supported")):s&&!Wl(e.valueSpec)&&c.push(new D(e.key,e.value,"zoom functions not supported"))),(r==="categorical"||u)&&e.value.property===void 0&&c.push(new D(e.key,e.value,\'"property" property is required\')),c;function p(h){if(r==="identity")return[new D(h.key,h.value,\'identity function may not have a "stops" property\')];let d=[],g=h.value;return d=d.concat(ja({key:h.key,value:g,valueSpec:h.valueSpec,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,arrayElementValidator:f})),j(g)==="array"&&g.length===0&&d.push(new D(h.key,g,"array must have at least one stop")),d}function f(h){let d=[],g=h.value,v=h.key;if(j(g)!=="array")return[new D(v,g,"array expected, ".concat(j(g)," found"))];if(g.length!==2)return[new D(v,g,"array length 2 expected, length ".concat(g.length," found"))];if(u){if(j(g[0])!=="object")return[new D(v,g,"object expected, ".concat(j(g[0])," found"))];if(g[0].zoom===void 0)return[new D(v,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new D(v,g,"object stop key must have value")];if(a&&a>pe(g[0].zoom))return[new D(v,g[0].zoom,"stop zoom values must appear in ascending order")];pe(g[0].zoom)!==a&&(a=pe(g[0].zoom),o=void 0,i={}),d=d.concat(Be({key:"".concat(v,"[0]"),value:g[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:Za,value:y}}))}else d=d.concat(y({key:"".concat(v,"[0]"),value:g[0],valueSpec:{},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},g));return en(Vt(g[1]))?d.concat([new D("".concat(v,"[1]"),g[1],"expressions are not allowed in function stops.")]):d.concat(h.validateSpec({key:"".concat(v,"[1]"),value:g[1],valueSpec:t,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function y(h,d){let g=j(h.value),v=pe(h.value),b=h.value!==null?h.value:d;if(!n)n=g;else if(g!==n)return[new D(h.key,b,"".concat(g," stop domain type must match previous stop domain type ").concat(n))];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new D(h.key,b,"stop domain value must be a number, string, or boolean")];if(g!=="number"&&r!=="categorical"){let x="number expected, ".concat(g," found");return ht(t)&&r===void 0&&(x+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new D(h.key,b,x)]}return r==="categorical"&&g==="number"&&(!isFinite(v)||Math.floor(v)!==v)?[new D(h.key,b,"integer expected, found ".concat(v))]:r!=="categorical"&&g==="number"&&o!==void 0&&v<o?[new D(h.key,b,"stop domain values must appear in ascending order")]:(o=v,r==="categorical"&&v in i?[new D(h.key,b,"stop domain values must be unique")]:(i[v]=!0,[]))}function m(h){return h.validateSpec({key:h.key,value:h.value,valueSpec:t,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec})}}function ur(e){let t=(e.expressionContext==="property"?Kl:Rt)(Vt(e.value),e.valueSpec);if(t.result==="error")return t.value.map(n=>new D("".concat(e.key).concat(n.key),e.value,n.message));let r=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext==="property"&&e.propertyKey==="text-font"&&!r.outputDefined())return[new D(e.key,e.value,\'Invalid data expression for "\'.concat(e.propertyKey,\'". Output values must be contained as literals within the expression.\'))];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!Wr(r))return[new D(e.key,e.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(e.expressionContext==="filter"&&!Wr(r))return[new D(e.key,e.value,\'"feature-state" data expressions are not supported with filters.\')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!Vi(r,["zoom","feature-state"]))return[new D(e.key,e.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(e.expressionContext==="cluster-initial"&&!Di(r))return[new D(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Cm(e){let t=e.value,r=e.key,n=j(t);return n!=="boolean"?[new D(r,t,"boolean expected, ".concat(n," found"))]:[]}function km(e){let t=e.key,r=e.value,n=j(r);return n!=="string"?[new D(t,r,"color expected, ".concat(n," found"))]:W.parse(String(r))?[]:[new D(t,r,\'color expected, "\'.concat(r,\'" found\'))]}function Yr(e){let t=e.key,r=e.value,n=e.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(pe(r))===-1&&i.push(new D(t,r,"expected one of [".concat(n.values.join(", "),"], ").concat(JSON.stringify(r)," found"))):Object.keys(n.values).indexOf(pe(r))===-1&&i.push(new D(t,r,"expected one of [".concat(Object.keys(n.values).join(", "),"], ").concat(JSON.stringify(r)," found"))),i}function Ja(e){return qa(Vt(e.value))?ur(sr({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):ru(e)}function ru(e){let t=e.value,r=e.key;if(j(t)!=="array")return[new D(r,t,"array expected, ".concat(j(t)," found"))];let n=e.styleSpec,i,o=[];if(t.length<1)return[new D(r,t,"filter array must have at least 1 element")];switch(o=o.concat(Yr({key:"".concat(r,"[0]"),value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),pe(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&pe(t[1])==="$type"&&o.push(new D(r,t,\'"$type" cannot be use with operator "\'.concat(t[0],\'"\')));case"==":case"!=":t.length!==3&&o.push(new D(r,t,\'filter array for operator "\'.concat(t[0],\'" must have 3 elements\')));case"in":case"!in":t.length>=2&&(i=j(t[1]),i!=="string"&&o.push(new D("".concat(r,"[1]"),t[1],"string expected, ".concat(i," found"))));for(let a=2;a<t.length;a++)i=j(t[a]),pe(t[1])==="$type"?o=o.concat(Yr({key:"".concat(r,"[").concat(a,"]"),value:t[a],valueSpec:n.geometry_type,style:e.style,styleSpec:e.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new D("".concat(r,"[").concat(a,"]"),t[a],"string, number, or boolean expected, ".concat(i," found")));break;case"any":case"all":case"none":for(let a=1;a<t.length;a++)o=o.concat(ru({key:"".concat(r,"[").concat(a,"]"),value:t[a],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":i=j(t[1]),t.length!==2?o.push(new D(r,t,\'filter array for "\'.concat(t[0],\'" operator must have 2 elements\'))):i!=="string"&&o.push(new D("".concat(r,"[1]"),t[1],"string expected, ".concat(i," found")));break;case"within":i=j(t[1]),t.length!==2?o.push(new D(r,t,\'filter array for "\'.concat(t[0],\'" operator must have 2 elements\'))):i!=="object"&&o.push(new D("".concat(r,"[1]"),t[1],"object expected, ".concat(i," found")));break}return o}function nu(e,t){let r=e.key,n=e.validateSpec,i=e.style,o=e.styleSpec,a=e.value,s=e.objectKey,l=o["".concat(t,"_").concat(e.layerType)];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(t==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:a,valueSpec:o.transition,style:i,styleSpec:o});let c=e.valueSpec||l[s];if(!c)return[new D(r,a,\'unknown property "\'.concat(s,\'"\'))];let p;if(j(a)==="string"&&ht(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new D(r,a,\'"\'.concat(s,\'" does not support interpolation syntax\\n\')+\'Use an identity property function instead: `{ "type": "identity", "property": \'.concat(JSON.stringify(p[1])," }`."))];let f=[];return e.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&f.push(new D(r,a,\'use of "text-field" requires a style "glyphs" property\')),s==="text-font"&&zi(Vt(a))&&pe(a.type)==="identity"&&f.push(new D(r,a,\'"text-font" does not support identity functions\'))),f.concat(n({key:e.key,value:a,valueSpec:c,style:i,styleSpec:o,expressionContext:"property",propertyType:t,propertyKey:s}))}function iu(e){return nu(e,"paint")}function ou(e){return nu(e,"layout")}function au(e){let t=[],r=e.value,n=e.key,i=e.style,o=e.styleSpec;!r.type&&!r.ref&&t.push(new D(n,r,\'either "type" or "ref" is required\'));let a=pe(r.type),s=pe(r.ref);if(r.id){let l=pe(r.id);for(let u=0;u<e.arrayIndex;u++){let c=i.layers[u];pe(c.id)===l&&t.push(new D(n,r.id,\'duplicate layer id "\'.concat(r.id,\'", previously used at line \').concat(c.id.__line__)))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&t.push(new D(n,r[u],\'"\'.concat(u,\'" is prohibited for ref layers\')))});let l;i.layers.forEach(u=>{pe(u.id)===s&&(l=u)}),l?l.ref?t.push(new D(n,r.ref,"ref cannot reference another ref layer")):a=pe(l.type):t.push(new D(n,r.ref,\'ref layer "\'.concat(s,\'" not found\')))}else if(a!=="background")if(!r.source)t.push(new D(n,r,\'missing required property "source"\'));else{let l=i.sources&&i.sources[r.source],u=l&&pe(l.type);l?u==="vector"&&a==="raster"?t.push(new D(n,r.source,\'layer "\'.concat(r.id,\'" requires a raster source\'))):u==="raster"&&a!=="raster"?t.push(new D(n,r.source,\'layer "\'.concat(r.id,\'" requires a vector source\'))):u==="vector"&&!r["source-layer"]?t.push(new D(n,r,\'layer "\'.concat(r.id,\'" must specify a "source-layer"\'))):u==="raster-dem"&&a!=="hillshade"?t.push(new D(n,r.source,"raster-dem source can only be used with layer type \'hillshade\'.")):a==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&t.push(new D(n,r,\'layer "\'.concat(r.id,\'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.\'))):t.push(new D(n,r.source,\'source "\'.concat(r.source,\'" not found\')))}return t=t.concat(Be({key:n,value:r,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*"(){return[]},type(){return e.validateSpec({key:"".concat(n,".type"),value:r.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:"type"})},filter:Ja,layout(l){return Be({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return ou(sr({layerType:a},u))}}})},paint(l){return Be({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return iu(sr({layerType:a},u))}}})}}})),t}function Bt(e){let t=e.value,r=e.key,n=j(t);return n!=="string"?[new D(r,t,"string expected, ".concat(n," found"))]:[]}var Fl={promoteId:Tm};function su(e){let t=e.value,r=e.key,n=e.styleSpec,i=e.style,o=e.validateSpec;if(!t.type)return[new D(r,t,\'"type" is required\')];let a=pe(t.type),s;switch(a){case"vector":case"raster":case"raster-dem":return s=Be({key:r,value:t,valueSpec:n["source_".concat(a.replace("-","_"))],style:e.style,styleSpec:n,objectElementValidators:Fl,validateSpec:o}),s;case"geojson":if(s=Be({key:r,value:t,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:Fl}),t.cluster)for(let l in t.clusterProperties){let[u,c]=t.clusterProperties[l],p=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...ur({key:"".concat(r,".").concat(l,".map"),value:c,validateSpec:o,expressionContext:"cluster-map"})),s.push(...ur({key:"".concat(r,".").concat(l,".reduce"),value:p,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return Be({key:r,value:t,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return Be({key:r,value:t,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new D(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Yr({key:"".concat(r,".type"),value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:o,styleSpec:n})}}function Tm({key:e,value:t}){if(j(t)==="string")return Bt({key:e,value:t});{let r=[];for(let n in t)r.push(...Bt({key:"".concat(e,".").concat(n),value:t[n]}));return r}}function lu(e){let t=e.value,r=e.styleSpec,n=r.light,i=e.style,o=[],a=j(t);if(t===void 0)return o;if(a!=="object")return o=o.concat([new D("light",t,"object expected, ".concat(a," found"))]),o;for(let s in t){let l=s.match(/^(.*)-transition$/);l&&n[l[1]]&&n[l[1]].transition?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r.transition,validateSpec:e.validateSpec,style:i,styleSpec:r})):n[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:n[s],validateSpec:e.validateSpec,style:i,styleSpec:r})):o=o.concat([new D(s,t[s],\'unknown property "\'.concat(s,\'"\'))])}return o}function uu(e){let t=e.value,r=e.styleSpec,n=r.terrain,i=e.style,o=[],a=j(t);if(t===void 0)return o;if(a!=="object")return o=o.concat([new D("terrain",t,"object expected, ".concat(a," found"))]),o;for(let s in t)n[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:n[s],validateSpec:e.validateSpec,style:i,styleSpec:r})):o=o.concat([new D(s,t[s],\'unknown property "\'.concat(s,\'"\'))]);return o}function Em(e){return Bt(e).length===0?[]:ur(e)}function Fm(e){return Bt(e).length===0?[]:ur(e)}function Mm(e){let t=e.key,r=e.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new D(t,r,"padding requires 1 to 4 values; ".concat(r.length," values found"))];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(e.validateSpec({key:"".concat(t,"[").concat(a,"]"),value:r[a],validateSpec:e.validateSpec,valueSpec:i}));return o}else return Za({key:t,value:r,valueSpec:{}})}function Lm(e){let t=e.key,r=e.value,n=j(r),i=e.styleSpec;if(n!=="array"||r.length<1||r.length%2!==0)return[new D(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<r.length;a+=2)o=o.concat(Yr({key:"".concat(t,"[").concat(a,"]"),value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(ja({key:"".concat(t,"[").concat(a+1,"]"),value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:i}));return o}function cu(e){let t=[],r=e.value,n=e.key;if(Array.isArray(r)){let i=[],o=[];for(let a in r){r[a].id&&i.includes(r[a].id)&&t.push(new D(n,r,"all the sprites\' ids must be unique, but ".concat(r[a].id," is duplicated"))),i.push(r[a].id),r[a].url&&o.includes(r[a].url)&&t.push(new D(n,r,"all the sprites\' URLs must be unique, but ".concat(r[a].url," is duplicated"))),o.push(r[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};t=t.concat(Be({key:"".concat(n,"[").concat(a,"]"),value:r[a],valueSpec:s,validateSpec:e.validateSpec}))}return t}else return Bt({key:n,value:r})}var Ml={"*"(){return[]},array:ja,boolean:Cm,number:Za,color:km,constants:eu,enum:Yr,filter:Ja,function:tu,layer:au,object:Be,source:su,light:lu,terrain:uu,string:Bt,formatted:Em,resolvedImage:Fm,padding:Mm,variableAnchorOffsetCollection:Lm,sprite:cu};function $r(e){let t=e.value,r=e.valueSpec,n=e.styleSpec;return e.validateSpec=$r,r.expression&&zi(pe(t))?tu(e):r.expression&&en(Vt(t))?ur(e):r.type&&Ml[r.type]?Ml[r.type](e):Be(sr({},e,{valueSpec:r.type?n[r.type]:r}))}function pu(e){let t=e.value,r=e.key,n=Bt(e);return n.length||(t.indexOf("{fontstack}")===-1&&n.push(new D(r,t,\'"glyphs" url must include a "{fontstack}" token\')),t.indexOf("{range}")===-1&&n.push(new D(r,t,\'"glyphs" url must include a "{range}" token\'))),n}function Ze(e,t=S){let r=[];return r=r.concat($r({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:$r,objectElementValidators:{glyphs:pu,"*"(){return[]}}})),e.constants&&(r=r.concat(eu({key:"constants",value:e.constants,style:e,styleSpec:t,validateSpec:$r}))),fu(r)}Ze.source=at(ot(su));Ze.sprite=at(ot(cu));Ze.glyphs=at(ot(pu));Ze.light=at(ot(lu));Ze.terrain=at(ot(uu));Ze.layer=at(ot(au));Ze.filter=at(ot(Ja));Ze.paintProperty=at(ot(iu));Ze.layoutProperty=at(ot(ou));function ot(e){return function(t){return e({...t,validateSpec:$r})}}function fu(e){return[].concat(e).sort((t,r)=>t.line-r.line)}function at(e){return function(...t){return fu(e.apply(this,t))}}var yu={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};var yr=class extends Error{constructor(r,n,i,o){super("AJAXError: ".concat(n," (").concat(r,"): ").concat(i));this.status=r,this.statusText=n,this.url=i,this.body=o}},hu=Ie()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Dm=e=>yu.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))],Vm=e=>/^file:/.test(e)||/^file:/.test(hu())&&!/^\\w+:/.test(e);function mu(e,t){let r=new AbortController,n=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:hu(),signal:r.signal}),i=!1,o=!1;e.type==="json"&&n.headers.set("Accept","application/json");let a=(l,u,c)=>{if(!o){if(l&&l.message!=="SecurityError"&&ce(l),u&&c)return s(u);fetch(n).then(p=>p.ok?s(p):p.blob().then(f=>t(new yr(p.status,p.statusText,e.url,f)))).catch(p=>{p.code!==20&&t(new Error(p.message))})}},s=l=>{(e.type==="arrayBuffer"||e.type==="image"?l.arrayBuffer():e.type==="json"?l.json():l.text()).then(u=>{o||(i=!0,t(null,u,l.headers.get("Cache-Control"),l.headers.get("Expires")))}).catch(u=>{o||t(new Error(u.message))})};return a(null,null),{cancel:()=>{o=!0,i||r.abort()}}}function Bm(e,t){let r=new XMLHttpRequest;r.open(e.method||"GET",e.url,!0),(e.type==="arrayBuffer"||e.type==="image")&&(r.responseType="arraybuffer");for(let n in e.headers)r.setRequestHeader(n,e.headers[n]);return e.type==="json"&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials=e.credentials==="include",r.onerror=()=>{t(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||r.status===0)&&r.response!==null){let n=r.response;if(e.type==="json")try{n=JSON.parse(r.response)}catch(i){return t(i)}t(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else{let n=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});t(new yr(r.status,r.statusText,e.url,n))}},r.send(e.body),{cancel:()=>r.abort()}}var du=function(e,t){if(/:\\/\\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){if(Ie()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t);if(!Ie())return(Dm(e.url)||mu)(e,t)}if(!Vm(e.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return mu(e,t);if(Ie()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}return Bm(e,t)},gu=function(e,t){return du(Ae(e,{type:"json"}),t)},Wa=function(e,t){return du(Ae(e,{type:"arrayBuffer"}),t)};var xt={};function k(e,t,r={}){if(xt[e])throw new Error("".concat(e," is already registered."));Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),xt[e]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}k("Object",Object);k("TransferableGridIndex",Ft);k("Color",W);k("Error",Error);k("AJAXError",yr);k("ResolvedImage",Ce);k("StylePropertyFunction",Kr);k("StyleExpression",Dt,{omit:["_evaluator"]});k("ZoomDependentExpression",gt);k("ZoomConstantExpression",dt);k("CompoundExpression",Ye,{omit:["_evaluate"]});for(let e in zt)zt[e]._classRegistryKey||k("Expression_".concat(e),zt[e]);function xu(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}function mr(e,t){if(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob)return e;if(xu(e)||Or(e))return t&&t.push(e),e;if(ArrayBuffer.isView(e)){let r=e;return t&&t.push(r.buffer),r}if(e instanceof ImageData)return t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let r=[];for(let n of e)r.push(mr(n,t));return r}if(typeof e=="object"){let r=e.constructor,n=r._classRegistryKey;if(!n)throw new Error("can\'t serialize object of unregistered class");if(!xt[n])throw new Error("".concat(n," is not registered."));let i=r.serialize?r.serialize(e,t):{};if(r.serialize){if(t&&i===t[t.length-1])throw new Error("statically serialized object won\'t survive transfer of $name property")}else{for(let o in e){if(!e.hasOwnProperty(o)||xt[n].omit.indexOf(o)>=0)continue;let a=e[o];i[o]=xt[n].shallow.indexOf(o)>=0?a:mr(a,t)}e instanceof Error&&(i.message=e.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(i.$name=n),i}throw new Error("can\'t serialize object of type ".concat(typeof e))}function hr(e){if(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||xu(e)||Or(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(hr);if(typeof e=="object"){let t=e.$name||"Object";if(!xt[t])throw new Error("can\'t deserialize unregistered class ".concat(t));let{klass:r}=xt[t];if(!r)throw new Error("can\'t deserialize unregistered class ".concat(t));if(r.deserialize)return r.deserialize(e);let n=Object.create(r.prototype);for(let i of Object.keys(e)){if(i==="$name")continue;let o=e[i];n[i]=xt[t].shallow.indexOf(i)>=0?o:hr(o)}return n}throw new Error("can\'t deserialize object of type ".concat(typeof e))}var Ri=class{constructor(t){this._callback=t,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(){delete this._channel,this._callback=()=>{}}};var Oi=class{constructor(t,r,n){this.receive=t=>{let r=t.data,n=r.id;if(n&&!(r.targetMapId&&this.mapId!==r.targetMapId))if(r.type==="<cancel>"){delete this.tasks[n];let i=this.cancelCallbacks[n];delete this.cancelCallbacks[n],i&&i()}else Ie()||r.mustQueue?(this.tasks[n]=r,this.taskQueue.push(n),this.invoker.trigger()):this.processTask(n,r)};this.process=()=>{if(!this.taskQueue.length)return;let t=this.taskQueue.shift(),r=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),r&&this.processTask(t,r)};this.target=t,this.parent=r,this.mapId=n,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new Ri(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Ie()?t:window}send(t,r,n,i,o=!1){let a=Math.round(Math.random()*1e18).toString(36).substring(0,10);n&&(this.callbacks[a]=n);let s=ba(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!n,targetMapId:i,mustQueue:o,sourceMapId:this.mapId,data:mr(r,s)},s),{cancel:()=>{n&&delete this.callbacks[a],this.target.postMessage({id:a,type:"<cancel>",targetMapId:i,sourceMapId:this.mapId})}}}processTask(t,r){if(r.type==="<response>"){let n=this.callbacks[t];delete this.callbacks[t],n&&(r.error?n(hr(r.error)):n(null,hr(r.data)))}else{let n=!1,i=ba(this.globalScope)?void 0:[],o=r.hasCallback?(l,u)=>{n=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:l?mr(l):null,data:mr(u,i)},i)}:l=>{n=!0},a=null,s=hr(r.data);if(this.parent[r.type])a=this.parent[r.type](r.sourceMapId,s,o);else if(this.parent.getWorkerSource){let l=r.type.split(".");a=this.parent.getWorkerSource(r.sourceMapId,l[0],s.source)[l[1]](s,o)}else o(new Error("Could not find function ".concat(r.type)));!n&&a&&a.cancel&&(this.cancelCallbacks[t]=a.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}};function bu(e,t,r){r[e]&&r[e].indexOf(t)!==-1||(r[e]=r[e]||[],r[e].push(t))}function Ha(e,t,r){if(r&&r[e]){let n=r[e].indexOf(t);n!==-1&&r[e].splice(n,1)}}var rn=class{constructor(t,r={}){Ae(this,r),this.type=t}},nn=class extends rn{constructor(r,n={}){super("error",Ae({error:r},n))}},dr=class{on(t,r){return this._listeners=this._listeners||{},bu(t,r,this._listeners),this}off(t,r){return Ha(t,r,this._listeners),Ha(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},bu(t,r,this._oneTimeListeners),this):new Promise(n=>this.once(t,n))}fire(t,r){typeof t=="string"&&(t=new rn(t,r||{}));let n=t.type;if(this.listens(n)){t.target=this;let i=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let s of i)s.call(this,t);let o=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let s of o)Ha(n,s,this._oneTimeListeners),s.call(this,t);let a=this._eventedParent;a&&(Ae(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(t))}else t instanceof nn&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}};var bt=Ze,vb=bt.source,Pb=bt.light,Sb=bt.terrain,wb=bt.filter,vu=bt.paintProperty,Pu=bt.layoutProperty;function Su(e,t){let r=!1;if(t&&t.length)for(let n of t)e.fire(new nn(new Error(n.message))),r=!0;return r}var Ni=class{constructor(){this.first=!0}update(t,r){let n=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),t!==this.lastZoom?(this.lastZoom=t,this.lastFloorZoom=n,!0):!1)}};var V={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function on(e){for(let t of e)if(Ui(t.charCodeAt(0)))return!0;return!1}function wu(e){for(let t of e)if(!zm(t.charCodeAt(0)))return!1;return!0}function zm(e){return!(V.Arabic(e)||V["Arabic Supplement"](e)||V["Arabic Extended-A"](e)||V["Arabic Presentation Forms-A"](e)||V["Arabic Presentation Forms-B"](e))}function Au(e){return e<11904?!1:!!(V["Bopomofo Extended"](e)||V.Bopomofo(e)||V["CJK Compatibility Forms"](e)||V["CJK Compatibility Ideographs"](e)||V["CJK Compatibility"](e)||V["CJK Radicals Supplement"](e)||V["CJK Strokes"](e)||V["CJK Symbols and Punctuation"](e)||V["CJK Unified Ideographs Extension A"](e)||V["CJK Unified Ideographs"](e)||V["Enclosed CJK Letters and Months"](e)||V["Halfwidth and Fullwidth Forms"](e)||V.Hiragana(e)||V["Ideographic Description Characters"](e)||V["Kangxi Radicals"](e)||V["Katakana Phonetic Extensions"](e)||V.Katakana(e)||V["Vertical Forms"](e)||V["Yi Radicals"](e)||V["Yi Syllables"](e))}function Ui(e){return e===746||e===747?!0:e<4352?!1:!!(V["Bopomofo Extended"](e)||V.Bopomofo(e)||V["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||V["CJK Compatibility Ideographs"](e)||V["CJK Compatibility"](e)||V["CJK Radicals Supplement"](e)||V["CJK Strokes"](e)||V["CJK Symbols and Punctuation"](e)&&!(e>=12296&&e<=12305)&&!(e>=12308&&e<=12319)&&e!==12336||V["CJK Unified Ideographs Extension A"](e)||V["CJK Unified Ideographs"](e)||V["Enclosed CJK Letters and Months"](e)||V["Hangul Compatibility Jamo"](e)||V["Hangul Jamo Extended-A"](e)||V["Hangul Jamo Extended-B"](e)||V["Hangul Jamo"](e)||V["Hangul Syllables"](e)||V.Hiragana(e)||V["Ideographic Description Characters"](e)||V.Kanbun(e)||V["Kangxi Radicals"](e)||V["Katakana Phonetic Extensions"](e)||V.Katakana(e)&&e!==12540||V["Halfwidth and Fullwidth Forms"](e)&&e!==65288&&e!==65289&&e!==65293&&!(e>=65306&&e<=65310)&&e!==65339&&e!==65341&&e!==65343&&!(e>=65371&&e<=65503)&&e!==65507&&!(e>=65512&&e<=65519)||V["Small Form Variants"](e)&&!(e>=65112&&e<=65118)&&!(e>=65123&&e<=65126)||V["Unified Canadian Aboriginal Syllabics"](e)||V["Unified Canadian Aboriginal Syllabics Extended"](e)||V["Vertical Forms"](e)||V["Yijing Hexagram Symbols"](e)||V["Yi Syllables"](e)||V["Yi Radicals"](e))}function Rm(e){return!!(V["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||V["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)||V["Letterlike Symbols"](e)||V["Number Forms"](e)||V["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)||V["Control Pictures"](e)&&e!==9251||V["Optical Character Recognition"](e)||V["Enclosed Alphanumerics"](e)||V["Geometric Shapes"](e)||V["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||V["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||V["CJK Symbols and Punctuation"](e)||V.Katakana(e)||V["Private Use Area"](e)||V["CJK Compatibility Forms"](e)||V["Small Form Variants"](e)||V["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}function Ka(e){return!(Ui(e)||Rm(e))}function _u(e){return V.Arabic(e)||V["Arabic Supplement"](e)||V["Arabic Extended-A"](e)||V["Arabic Presentation Forms-A"](e)||V["Arabic Presentation Forms-B"](e)}function Iu(e){return e>=1424&&e<=2303||V["Arabic Presentation Forms-A"](e)||V["Arabic Presentation Forms-B"](e)}function Om(e,t){return!(!t&&Iu(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||V.Khmer(e))}function Cu(e){for(let t of e)if(Iu(t.charCodeAt(0)))return!0;return!1}function ku(e,t){for(let r of e)if(!Om(r.charCodeAt(0),t))return!1;return!0}var Nm=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),$i,Ya,Um={now:Nm,frame(e){let t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement("canvas"),r=t.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0,e.width,e.height),r},resolveURL(e){return $i||($i=document.createElement("a")),$i.href=e,$i.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(Ya==null&&(Ya=matchMedia("(prefers-reduced-motion: reduce)")),Ya.matches):!1}};var Xa={unavailable:"unavailable",deferred:"deferred",loading:"loading",loaded:"loaded",error:"error"};var Gi=Xa.unavailable,Tu=null;var Db=new dr,Eu=function(){return Gi};var ae={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded(){return Gi===Xa.loaded||ae.applyArabicShaping!=null},isLoading(){return Gi===Xa.loading},setState(e){if(!Ie())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Gi=e.pluginStatus,Tu=e.pluginURL},isParsed(){if(!Ie())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return ae.applyArabicShaping!=null&&ae.processBidirectionalText!=null&&ae.processStyledBidirectionalText!=null},getPluginURL(){if(!Ie())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Tu}};var q=class{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ni,this.transition={})}isSupportedScript(t){return ku(t,ae.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,r=t-Math.floor(t),n=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}};var gr=class{constructor(t,r){this.property=t,this.value=r,this.expression=Yl(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,n){return this.property.possiblyEvaluate(this,t,r,n)}},an=class{constructor(t){this.property=t,this.value=new gr(t,void 0)}transitioned(t,r){return new ji(this.property,this.value,r,Ae({},t.transition,this.transition),t.now)}untransitioned(){return new ji(this.property,this.value,null,{},0)}},qi=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return tt(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new an(this._values[t].property)),this._values[t].value=new gr(this._values[t].property,r===null?void 0:tt(r))}getTransition(t){return tt(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new an(this._values[t].property)),this._values[t].transition=tt(r)||void 0}serialize(){let t={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(t[r]=n);let i=this.getTransition(r);i!==void 0&&(t["".concat(r,"-transition")]=i)}return t}transitioned(t,r){let n=new Zi(this._properties);for(let i of Object.keys(this._values))n._values[i]=this._values[i].transitioned(t,r._values[i]);return n}untransitioned(){let t=new Zi(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}},ji=class{constructor(t,r,n,i,o){this.property=t,this.value=r,this.begin=o+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=n)}possiblyEvaluate(t,r,n){let i=t.now||0,o=this.value.possiblyEvaluate(t,r,n),a=this.prior;if(a){if(i>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(i<this.begin)return a.possiblyEvaluate(t,r,n);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(t,r,n),o,yl(s))}}else return o}},Zi=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,n){let i=new vt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(t,r,n);return i}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}},Ji=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return tt(this._values[t].value)}setValue(t,r){this._values[t]=new gr(this._values[t].property,r===null?void 0:tt(r))}serialize(){let t={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(t[r]=n)}return t}possiblyEvaluate(t,r,n){let i=new vt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(t,r,n);return i}},be=class{constructor(t,r,n){this.property=t,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,n,i){return this.property.evaluate(this.value,this.parameters,t,r,n,i)}},vt=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}},z=class{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,n){let i=this.specification.type,o=Re[i];return o?o(t,r,n):t}},R=class{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,n,i){return t.expression.kind==="constant"||t.expression.kind==="camera"?new be(this,{kind:"constant",value:t.expression.evaluate(r,null,{},n,i)},r):new be(this,t.expression,r)}interpolate(t,r,n){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new be(this,{kind:"constant",value:void 0},t.parameters);let i=this.specification.type,o=Re[i];if(o){let a=o(t.value.value,r.value.value,n);return new be(this,{kind:"constant",value:a},t.parameters)}else return t}evaluate(t,r,n,i,o,a){return t.kind==="constant"?t.value:t.evaluate(r,n,i,o,a)}},st=class extends R{possiblyEvaluate(t,r,n,i){if(t.value===void 0)return new be(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){let o=t.expression.evaluate(r,null,{},n,i),s=t.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,r);return new be(this,{kind:"constant",value:l},r)}else if(t.expression.kind==="camera"){let o=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new be(this,{kind:"constant",value:o},r)}else return new be(this,t.expression,r)}evaluate(t,r,n,i,o,a){if(t.kind==="source"){let s=t.evaluate(r,n,i,o,a);return this._calculate(s,s,s,r)}else return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},n,i),t.evaluate({zoom:Math.floor(r.zoom)},n,i),t.evaluate({zoom:Math.floor(r.zoom)+1},n,i),r):t.value}_calculate(t,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:n,to:r}}interpolate(t){return t}},Ot=class{constructor(t){this.specification=t}possiblyEvaluate(t,r,n,i){if(t.value!==void 0)if(t.expression.kind==="constant"){let o=t.expression.evaluate(r,null,{},n,i);return this._calculate(o,o,o,r)}else return this._calculate(t.expression.evaluate(new q(Math.floor(r.zoom-1),r)),t.expression.evaluate(new q(Math.floor(r.zoom),r)),t.expression.evaluate(new q(Math.floor(r.zoom+1),r)),r)}_calculate(t,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:n,to:r}}interpolate(t){return t}},Nt=class{constructor(t){this.specification=t}possiblyEvaluate(t,r,n,i){return!!t.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},ie=class{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in t){let n=t[r];n.specification.overridable&&this.overridableProperties.push(r);let i=this.defaultPropertyValues[r]=new gr(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new an(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};k("DataDrivenProperty",R);k("DataConstantProperty",z);k("CrossFadedDataDrivenProperty",st);k("CrossFadedProperty",Ot);k("ColorRampProperty",Nt);var Wi="-transition",le=class extends dr{constructor(r,n){super();if(this.id=r.id,this.type=r.type,this._featureFilter={filter:()=>!0,needGeometry:!1},r.type!=="custom"&&(r=r,this.metadata=r.metadata,this.minzoom=r.minzoom,this.maxzoom=r.maxzoom,r.type!=="background"&&(this.source=r.source,this.sourceLayer=r["source-layer"],this.filter=r.filter),n.layout&&(this._unevaluatedLayout=new Ji(n.layout)),n.paint)){this._transitionablePaint=new qi(n.paint);for(let i in r.paint)this.setPaintProperty(i,r.paint[i],{validate:!1});for(let i in r.layout)this.setLayoutProperty(i,r.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new vt(n.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(r){return r==="visibility"?this.visibility:this._unevaluatedLayout.getValue(r)}setLayoutProperty(r,n,i={}){if(n!=null){let o="layers.".concat(this.id,".layout.").concat(r);if(this._validate(Pu,o,r,n,i))return}if(r==="visibility"){this.visibility=n;return}this._unevaluatedLayout.setValue(r,n)}getPaintProperty(r){return r.endsWith(Wi)?this._transitionablePaint.getTransition(r.slice(0,-Wi.length)):this._transitionablePaint.getValue(r)}setPaintProperty(r,n,i={}){if(n!=null){let o="layers.".concat(this.id,".paint.").concat(r);if(this._validate(vu,o,r,n,i))return!1}if(r.endsWith(Wi))return this._transitionablePaint.setTransition(r.slice(0,-Wi.length),n||void 0),!1;{let o=this._transitionablePaint._values[r],a=o.property.specification["property-type"]==="cross-faded-data-driven",s=o.value.isDataDriven(),l=o.value;this._transitionablePaint.setValue(r,n),this._handleSpecialPaintPropertyUpdate(r);let u=this._transitionablePaint._values[r].value;return u.isDataDriven()||s||a||this._handleOverridablePaintPropertyUpdate(r,l,u)}}_handleSpecialPaintPropertyUpdate(r){}_handleOverridablePaintPropertyUpdate(r,n,i){return!1}isHidden(r){return this.minzoom&&r<this.minzoom||this.maxzoom&&r>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(r){this._transitioningPaint=this._transitionablePaint.transitioned(r,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(r,n){r.getCrossfadeParameters&&(this._crossfadeParameters=r.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(r,void 0,n)),this.paint=this._transitioningPaint.possiblyEvaluate(r,void 0,n)}serialize(){let r={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(r.layout=r.layout||{},r.layout.visibility=this.visibility),dl(r,(n,i)=>n!==void 0&&!(i==="layout"&&!Object.keys(n).length)&&!(i==="paint"&&!Object.keys(n).length))}_validate(r,n,i,o,a={}){return a&&a.validate===!1?!1:Su(this,r.call(bt,{key:n,layerType:this.type,objectKey:i,value:o,styleSpec:S,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let r in this.paint._values){let n=this.paint.get(r);if(!(!(n instanceof be)||!ht(n.property.specification))&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}};var $m={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Ut=class{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},Gm=128,qm=5,te=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*qm),Gm),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function ee(e,t=1){let r=0,n=0,i=e.map(a=>{let s=jm(a.type),l=r=Fu(r,Math.max(t,s)),u=a.components||1;return n=Math.max(n,s),r+=s*u,{name:a.name,type:a.type,components:u,offset:l}}),o=Fu(r,Math.max(n,t));return{members:i,size:o,alignment:t}}function jm(e){return $m[e].BYTES_PER_ELEMENT}function Fu(e,t){return Math.ceil(e/t)*t}var Mu=Z(he(),1),$t=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n){let i=this.length;return this.resize(i+1),this.emplace(i,r,n)}emplace(r,n,i){let o=r*2;return this.int16[o+0]=n,this.int16[o+1]=i,r}};$t.prototype.bytesPerElement=4;k("StructArrayLayout2i4",$t);var sn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,r,n,i)}emplace(r,n,i,o){let a=r*3;return this.int16[a+0]=n,this.int16[a+1]=i,this.int16[a+2]=o,r}};sn.prototype.bytesPerElement=6;k("StructArrayLayout3i6",sn);var Hi=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,r,n,i,o)}emplace(r,n,i,o,a){let s=r*4;return this.int16[s+0]=n,this.int16[s+1]=i,this.int16[s+2]=o,this.int16[s+3]=a,r}};Hi.prototype.bytesPerElement=8;k("StructArrayLayout4i8",Hi);var ln=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,r,n,i,o,a,s)}emplace(r,n,i,o,a,s,l){let u=r*6;return this.int16[u+0]=n,this.int16[u+1]=i,this.int16[u+2]=o,this.int16[u+3]=a,this.int16[u+4]=s,this.int16[u+5]=l,r}};ln.prototype.bytesPerElement=12;k("StructArrayLayout2i4i12",ln);var un=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,r,n,i,o,a,s)}emplace(r,n,i,o,a,s,l){let u=r*4,c=r*8;return this.int16[u+0]=n,this.int16[u+1]=i,this.uint8[c+4]=o,this.uint8[c+5]=a,this.uint8[c+6]=s,this.uint8[c+7]=l,r}};un.prototype.bytesPerElement=8;k("StructArrayLayout2i4ub8",un);var Pt=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n){let i=this.length;return this.resize(i+1),this.emplace(i,r,n)}emplace(r,n,i){let o=r*2;return this.float32[o+0]=n,this.float32[o+1]=i,r}};Pt.prototype.bytesPerElement=8;k("StructArrayLayout2f8",Pt);var cn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c,p){let f=this.length;return this.resize(f+1),this.emplace(f,r,n,i,o,a,s,l,u,c,p)}emplace(r,n,i,o,a,s,l,u,c,p,f){let y=r*10;return this.uint16[y+0]=n,this.uint16[y+1]=i,this.uint16[y+2]=o,this.uint16[y+3]=a,this.uint16[y+4]=s,this.uint16[y+5]=l,this.uint16[y+6]=u,this.uint16[y+7]=c,this.uint16[y+8]=p,this.uint16[y+9]=f,r}};cn.prototype.bytesPerElement=20;k("StructArrayLayout10ui20",cn);var pn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c,p,f,y){let m=this.length;return this.resize(m+1),this.emplace(m,r,n,i,o,a,s,l,u,c,p,f,y)}emplace(r,n,i,o,a,s,l,u,c,p,f,y,m){let h=r*12;return this.int16[h+0]=n,this.int16[h+1]=i,this.int16[h+2]=o,this.int16[h+3]=a,this.uint16[h+4]=s,this.uint16[h+5]=l,this.uint16[h+6]=u,this.uint16[h+7]=c,this.int16[h+8]=p,this.int16[h+9]=f,this.int16[h+10]=y,this.int16[h+11]=m,r}};pn.prototype.bytesPerElement=24;k("StructArrayLayout4i4ui4i24",pn);var fn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,r,n,i)}emplace(r,n,i,o){let a=r*3;return this.float32[a+0]=n,this.float32[a+1]=i,this.float32[a+2]=o,r}};fn.prototype.bytesPerElement=12;k("StructArrayLayout3f12",fn);var yn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r){let n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){let i=r*1;return this.uint32[i+0]=n,r}};yn.prototype.bytesPerElement=4;k("StructArrayLayout1ul4",yn);var mn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,r,n,i,o,a,s,l,u,c)}emplace(r,n,i,o,a,s,l,u,c,p){let f=r*10,y=r*5;return this.int16[f+0]=n,this.int16[f+1]=i,this.int16[f+2]=o,this.int16[f+3]=a,this.int16[f+4]=s,this.int16[f+5]=l,this.uint32[y+3]=u,this.uint16[f+8]=c,this.uint16[f+9]=p,r}};mn.prototype.bytesPerElement=20;k("StructArrayLayout6i1ul2ui20",mn);var hn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,r,n,i,o,a,s)}emplace(r,n,i,o,a,s,l){let u=r*6;return this.int16[u+0]=n,this.int16[u+1]=i,this.int16[u+2]=o,this.int16[u+3]=a,this.int16[u+4]=s,this.int16[u+5]=l,r}};hn.prototype.bytesPerElement=12;k("StructArrayLayout2i2i2i12",hn);var Ki=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,r,n,i,o,a)}emplace(r,n,i,o,a,s){let l=r*4,u=r*8;return this.float32[l+0]=n,this.float32[l+1]=i,this.float32[l+2]=o,this.int16[u+6]=a,this.int16[u+7]=s,r}};Ki.prototype.bytesPerElement=16;k("StructArrayLayout2f1f2i16",Ki);var dn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,r,n,i,o)}emplace(r,n,i,o,a){let s=r*12,l=r*3;return this.uint8[s+0]=n,this.uint8[s+1]=i,this.float32[l+1]=o,this.float32[l+2]=a,r}};dn.prototype.bytesPerElement=12;k("StructArrayLayout2ub2f12",dn);var gn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,r,n,i)}emplace(r,n,i,o){let a=r*3;return this.uint16[a+0]=n,this.uint16[a+1]=i,this.uint16[a+2]=o,r}};gn.prototype.bytesPerElement=6;k("StructArrayLayout3ui6",gn);var xn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v){let b=this.length;return this.resize(b+1),this.emplace(b,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v)}emplace(r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,b){let x=r*24,P=r*12,w=r*48;return this.int16[x+0]=n,this.int16[x+1]=i,this.uint16[x+2]=o,this.uint16[x+3]=a,this.uint32[P+2]=s,this.uint32[P+3]=l,this.uint32[P+4]=u,this.uint16[x+10]=c,this.uint16[x+11]=p,this.uint16[x+12]=f,this.float32[P+7]=y,this.float32[P+8]=m,this.uint8[w+36]=h,this.uint8[w+37]=d,this.uint8[w+38]=g,this.uint32[P+10]=v,this.int16[x+22]=b,r}};xn.prototype.bytesPerElement=48;k("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xn);var bn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,b,x,P,w,A,T,I,E,_,F,M){let B=this.length;return this.resize(B+1),this.emplace(B,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,b,x,P,w,A,T,I,E,_,F,M)}emplace(r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,b,x,P,w,A,T,I,E,_,F,M,B){let C=r*34,O=r*17;return this.int16[C+0]=n,this.int16[C+1]=i,this.int16[C+2]=o,this.int16[C+3]=a,this.int16[C+4]=s,this.int16[C+5]=l,this.int16[C+6]=u,this.int16[C+7]=c,this.uint16[C+8]=p,this.uint16[C+9]=f,this.uint16[C+10]=y,this.uint16[C+11]=m,this.uint16[C+12]=h,this.uint16[C+13]=d,this.uint16[C+14]=g,this.uint16[C+15]=v,this.uint16[C+16]=b,this.uint16[C+17]=x,this.uint16[C+18]=P,this.uint16[C+19]=w,this.uint16[C+20]=A,this.uint16[C+21]=T,this.uint16[C+22]=I,this.uint32[O+12]=E,this.float32[O+13]=_,this.float32[O+14]=F,this.float32[O+15]=M,this.float32[O+16]=B,r}};bn.prototype.bytesPerElement=68;k("StructArrayLayout8i15ui1ul4f68",bn);var Gt=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r){let n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){let i=r*1;return this.float32[i+0]=n,r}};Gt.prototype.bytesPerElement=4;k("StructArrayLayout1f4",Gt);var vn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,r,n,i)}emplace(r,n,i,o){let a=r*2,s=r*4;return this.uint32[a+0]=n,this.uint16[s+2]=i,this.uint16[s+3]=o,r}};vn.prototype.bytesPerElement=8;k("StructArrayLayout1ul2ui8",vn);var Pn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n){let i=this.length;return this.resize(i+1),this.emplace(i,r,n)}emplace(r,n,i){let o=r*2;return this.uint16[o+0]=n,this.uint16[o+1]=i,r}};Pn.prototype.bytesPerElement=4;k("StructArrayLayout2ui4",Pn);var Yi=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r){let n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){let i=r*1;return this.uint16[i+0]=n,r}};Yi.prototype.bytesPerElement=2;k("StructArrayLayout1ui2",Yi);var xr=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,r,n,i,o)}emplace(r,n,i,o,a){let s=r*4;return this.float32[s+0]=n,this.float32[s+1]=i,this.float32[s+2]=o,this.float32[s+3]=a,r}};xr.prototype.bytesPerElement=16;k("StructArrayLayout4f16",xr);var Xi=class extends Ut{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new Mu.default(this.anchorPointX,this.anchorPointY)}};Xi.prototype.size=20;var Sn=class extends mn{get(t){return new Xi(this,t)}};k("CollisionBoxArray",Sn);var Qi=class extends Ut{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(r){this._structArray.uint8[this._pos1+37]=r}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(r){this._structArray.uint8[this._pos1+38]=r}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(r){this._structArray.uint32[this._pos4+10]=r}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};Qi.prototype.size=48;var wn=class extends xn{get(t){return new Qi(this,t)}};k("PlacedSymbolArray",wn);var eo=class extends Ut{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(r){this._structArray.uint32[this._pos4+12]=r}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}};eo.prototype.size=68;var An=class extends bn{get(t){return new eo(this,t)}};k("SymbolInstanceArray",An);var _n=class extends Gt{getoffsetX(t){return this.float32[t*1+0]}};k("GlyphOffsetArray",_n);var In=class extends sn{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};k("SymbolLineVertexArray",In);var to=class extends Ut{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]}};to.prototype.size=8;var Cn=class extends vn{get(t){return new to(this,t)}};k("FeatureIndexArray",Cn);var ro=class extends $t{};var no=class extends $t{},io=class extends $t{},oo=class extends ln{};var ao=class extends un{},so=class extends Pt{},lt=class extends cn{},lo=class extends pn{},uo=class extends fn{},co=class extends yn{},kn=class extends hn{};var po=class extends dn{};var Le=class extends gn{},St=class extends Pn{};var Zm=ee([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Lu,size:y0,alignment:m0}=Zm;var me=class e{constructor(t=[]){this.segments=t}prepareSegment(t,r,n,i){let o=this.segments[this.segments.length-1];return t>e.MAX_VERTEX_ARRAY_LENGTH&&ce("Max vertices per segment is ".concat(e.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(t)),(!o||o.vertexLength+t>e.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i)&&(o={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},i!==void 0&&(o.sortKey=i),this.segments.push(o)),o}get(){return this.segments}destroy(){for(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,n,i){return new e([{vertexOffset:t,primitiveOffset:r,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}};me.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;k("SegmentVector",me);function Qa(e,t){return e=rt(Math.floor(e),0,255),t=rt(Math.floor(t),0,255),256*e+t}var Tn=ee([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Ru=Z(rs(),1);var En=class e{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,n,i){this.ids.push(zu(t)),this.positions.push(r,n,i)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=zu(t),n=0,i=this.ids.length-1;for(;n<i;){let a=n+i>>1;this.ids[a]>=r?i=a:n=a+1}let o=[];for(;this.ids[n]===r;){let a=this.positions[3*n],s=this.positions[3*n+1],l=this.positions[3*n+2];o.push({index:a,start:s,end:l}),n++}return o}static serialize(t,r){let n=new Float64Array(t.ids),i=new Uint32Array(t.positions);return ns(n,i,0,n.length-1),r&&r.push(n.buffer,i.buffer),{ids:n,positions:i}}static deserialize(t){let r=new e;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}};function zu(e){let t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:(0,Ru.default)(String(e))}function ns(e,t,r,n){for(;r<n;){let i=e[r+n>>1],o=r-1,a=n+1;for(;;){do o++;while(e[o]<i);do a--;while(e[a]>i);if(o>=a)break;yo(e,o,a),yo(t,3*o,3*a),yo(t,3*o+1,3*a+1),yo(t,3*o+2,3*a+2)}a-r<n-a?(ns(e,t,r,a),r=a+1):(ns(e,t,a+1,n),n=a)}}function yo(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}k("FeaturePositionMap",En);var Fn=class{constructor(t,r){this.gl=t.gl,this.location=r}};var br=class extends Fn{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}};var mo=class extends Fn{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2]||t[3]!==this.current[3])&&(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}},ho=class extends Fn{constructor(t,r){super(t,r),this.current=W.transparent}set(t){(t.r!==this.current.r||t.g!==this.current.g||t.b!==this.current.b||t.a!==this.current.a)&&(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}},T0=new Float32Array(16);function is(e){return[Qa(255*e.r,255*e.g),Qa(255*e.b,255*e.a)]}var qt=class{constructor(t,r,n){this.value=t,this.uniformNames=r.map(i=>"u_".concat(i)),this.type=n}setUniform(t,r,n){t.set(n.constantOr(this.value))}getBinding(t,r,n){return this.type==="color"?new ho(t,r):new br(t,r)}},wt=class{constructor(t,r){this.uniformNames=r.map(n=>"u_".concat(n)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,n,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&t.set(o)}getBinding(t,r,n){return n.substr(0,9)==="u_pattern"?new mo(t,r):new br(t,r)}},Je=class{constructor(t,r,n,i){this.expression=t,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(o=>({name:"a_".concat(o),type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,r,n,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new q(0),r,{},i,[],o);this.paintVertexArray.resize(t),this._setPaintValue(a,t,s)}updatePaintArray(t,r,n,i){let o=this.expression.evaluate({zoom:0},n,i);this._setPaintValue(t,r,o)}_setPaintValue(t,r,n){if(this.type==="color"){let i=is(n);for(let o=t;o<r;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=t;i<r;i++)this.paintVertexArray.emplace(i,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},De=class{constructor(t,r,n,i,o,a){this.expression=t,this.uniformNames=r.map(s=>"u_".concat(s,"_t")),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:"a_".concat(s),type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,r,n,i,o){let a=this.expression.evaluate(new q(this.zoom),r,{},i,[],o),s=this.expression.evaluate(new q(this.zoom+1),r,{},i,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(l,t,a,s)}updatePaintArray(t,r,n,i){let o=this.expression.evaluate({zoom:this.zoom},n,i),a=this.expression.evaluate({zoom:this.zoom+1},n,i);this._setPaintValue(t,r,o,a)}_setPaintValue(t,r,n,i){if(this.type==="color"){let o=is(n),a=is(i);for(let s=t;s<r;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=t;o<r;o++)this.paintVertexArray.emplace(o,n,i);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){let n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,i=rt(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,r,n){return new br(t,r)}},Xe=class{constructor(t,r,n,i,o,a){this.expression=t,this.type=r,this.useIntegerZoom=n,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(t,r,n){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(i,t,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(t,r,n,i,o){this._setPaintValues(t,r,n.patterns&&n.patterns[this.layerId],o)}_setPaintValues(t,r,n,i){if(!i||!n)return;let{min:o,mid:a,max:s}=n,l=i[o],u=i[a],c=i[s];if(!(!l||!u||!c))for(let p=t;p<r;p++)this.zoomInPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],u.pixelRatio,l.pixelRatio),this.zoomOutPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],u.pixelRatio,c.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Tn.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Tn.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},go=class{constructor(t,r,n){this.binders={},this._buffers=[];let i=[];for(let o in t.paint._values){if(!n(o))continue;let a=t.paint.get(o);if(!(a instanceof be)||!ht(a.property.specification))continue;let s=Km(o,t.type),l=a.value,u=a.property.specification.type,c=a.property.useIntegerZoom,p=a.property.specification["property-type"],f=p==="cross-faded"||p==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=f?new wt(l.value,s):new qt(l.value,s,u),i.push("/u_".concat(o));else if(l.kind==="source"||f){let y=Ou(o,u,"source");this.binders[o]=f?new Xe(l,u,c,r,y,t.id):new Je(l,s,u,y),i.push("/a_".concat(o))}else{let y=Ou(o,u,"composite");this.binders[o]=new De(l,s,u,c,r,y),i.push("/z_".concat(o))}}this.cacheKey=i.sort().join("")}getMaxValue(t){let r=this.binders[t];return r instanceof Je||r instanceof De?r.maxValue:0}populatePaintArrays(t,r,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof Je||s instanceof De||s instanceof Xe)&&s.populatePaintArray(t,r,n,i,o)}}setConstantPatternPositions(t,r){for(let n in this.binders){let i=this.binders[n];i instanceof wt&&i.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,n,i,o){let a=!1;for(let s in t){let l=r.getPositions(s);for(let u of l){let c=n.feature(u.index);for(let p in this.binders){let f=this.binders[p];if((f instanceof Je||f instanceof De||f instanceof Xe)&&f.expression.isStateDependent===!0){let y=i.paint.get(p);f.expression=y.value,f.updatePaintArray(u.start,u.end,c,t[s],o),a=!0}}}}return a}defines(){let t=[];for(let r in this.binders){let n=this.binders[r];(n instanceof qt||n instanceof wt)&&t.push(...n.uniformNames.map(i=>"#define HAS_UNIFORM_".concat(i)))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof Je||n instanceof De)for(let i=0;i<n.paintVertexAttributes.length;i++)t.push(n.paintVertexAttributes[i].name);else if(n instanceof Xe)for(let i=0;i<Tn.members.length;i++)t.push(Tn.members[i].name)}return t}getBinderUniforms(){let t=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof qt||n instanceof wt||n instanceof De)for(let i of n.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){let n=[];for(let i in this.binders){let o=this.binders[i];if(o instanceof qt||o instanceof wt||o instanceof De){for(let a of o.uniformNames)if(r[a]){let s=o.getBinding(t,r[a],a);n.push({name:a,property:i,binding:s})}}}return n}setUniforms(t,r,n,i){for(let{name:o,property:a,binding:s}of r)this.binders[a].setUniform(s,i,n.get(a),o)}updatePaintBuffers(t){this._buffers=[];for(let r in this.binders){let n=this.binders[r];if(t&&n instanceof Xe){let i=t.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof Je||n instanceof De)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(t){for(let r in this.binders){let n=this.binders[r];(n instanceof Je||n instanceof De||n instanceof Xe)&&n.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let r=this.binders[t];(r instanceof Je||r instanceof De||r instanceof Xe)&&r.destroy()}}},ke=class{constructor(t,r,n=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new go(i,r,n);this.needsUpload=!1,this._featureMap=new En,this._bufferOffset=0}populatePaintArrays(t,r,n,i,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(t,r,i,o,a);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,n,i){for(let o of n)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(t,this._featureMap,r,o,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function Km(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace("".concat(t,"-"),"").replace(/-/g,"_")]}function Ym(e){return{"line-pattern":{source:lt,composite:lt},"fill-pattern":{source:lt,composite:lt},"fill-extrusion-pattern":{source:lt,composite:lt}}[e]}function Ou(e,t,r){let n={color:{source:Pt,composite:xr},number:{source:Gt,composite:Pt}},i=Ym(e);return i&&i[r]||n[t][r]}k("ConstantBinder",qt);k("CrossFadedConstantBinder",wt);k("SourceExpressionBinder",Je);k("CrossFadedCompositeBinder",Xe);k("CompositeExpressionBinder",De);k("ProgramConfiguration",go,{omit:["_buffers"]});k("ProgramConfigurationSet",ke);var Xm=15,os=Math.pow(2,Xm-1)-1,Nu=-os-1;function Te(e){let t=8192/e.extent,r=e.loadGeometry();for(let n=0;n<r.length;n++){let i=r[n];for(let o=0;o<i.length;o++){let a=i[o],s=Math.round(a.x*t),l=Math.round(a.y*t);a.x=rt(s,Nu,os),a.y=rt(l,Nu,os),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&ce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Oe(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Te(e):[]}}function xo(e,t,r,n,i){e.emplaceBack(t*2+(n+1)/2,r*2+(i+1)/2)}var jt=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new no,this.indexArray=new Le,this.segments=new me,this.programConfigurations=new ke(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){let i=this.layers[0],o=[],a=null,s=!1;i.type==="circle"&&(a=i.layout.get("circle-sort-key"),s=!a.isConstant());for(let{feature:l,id:u,index:c,sourceLayerIndex:p}of t){let f=this.layers[0]._featureFilter.needGeometry,y=Oe(l,f);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),y,n))continue;let m=s?a.evaluate(y,{},n):void 0,h={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:c,geometry:f?y.geometry:Te(l),patterns:{},sortKey:m};o.push(h)}s&&o.sort((l,u)=>l.sortKey-u.sortKey);for(let l of o){let{geometry:u,index:c,sourceLayerIndex:p}=l,f=t[c].feature;this.addFeature(l,u,c,n),r.featureIndex.insert(f,u,c,p,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Lu),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,n,i){for(let o of r)for(let a of o){let s=a.x,l=a.y;if(s<0||s>=8192||l<0||l>=8192)continue;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),c=u.vertexLength;xo(this.layoutVertexArray,s,l,-1,-1),xo(this.layoutVertexArray,s,l,1,-1),xo(this.layoutVertexArray,s,l,1,1),xo(this.layoutVertexArray,s,l,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),u.vertexLength+=4,u.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{},i)}};k("CircleBucket",jt,{omit:["layers"]});var Mn=Z(he(),1);function $u(e,t){for(let r=0;r<e.length;r++)if(vr(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(vr(e,t[r]))return!0;return!!ss(e,t)}function Gu(e,t,r){return!!(vr(e,t)||as(t,e,r))}function bo(e,t){if(e.length===1)return Uu(t,e[0]);for(let r=0;r<t.length;r++){let n=t[r];for(let i=0;i<n.length;i++)if(vr(e,n[i]))return!0}for(let r=0;r<e.length;r++)if(Uu(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(ss(e,t[r]))return!0;return!1}function qu(e,t,r){for(let n=0;n<t.length;n++){let i=t[n];if(e.length>=3){for(let o=0;o<i.length;o++)if(vr(e,i[o]))return!0}if(Qm(e,i,r))return!0}return!1}function Qm(e,t,r){if(e.length>1){if(ss(e,t))return!0;for(let n=0;n<t.length;n++)if(as(t[n],e,r))return!0}for(let n=0;n<e.length;n++)if(as(e[n],t,r))return!0;return!1}function ss(e,t){if(e.length===0||t.length===0)return!1;for(let r=0;r<e.length-1;r++){let n=e[r],i=e[r+1];for(let o=0;o<t.length-1;o++){let a=t[o],s=t[o+1];if(eh(n,i,a,s))return!0}}return!1}function eh(e,t,r,n){return nt(e,r,n)!==nt(t,r,n)&&nt(e,t,r)!==nt(e,t,n)}function as(e,t,r){let n=r*r;if(t.length===1)return e.distSqr(t[0])<n;for(let i=1;i<t.length;i++){let o=t[i-1],a=t[i];if(ls(e,o,a)<n)return!0}return!1}function ls(e,t,r){let n=t.distSqr(r);if(n===0)return e.distSqr(t);let i=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/n;return i<0?e.distSqr(t):i>1?e.distSqr(r):e.distSqr(r.sub(t)._mult(i)._add(t))}function Uu(e,t){let r=!1,n,i,o;for(let a=0;a<e.length;a++){n=e[a];for(let s=0,l=n.length-1;s<n.length;l=s++)i=n[s],o=n[l],i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r)}return r}function vr(e,t){let r=!1;for(let n=0,i=e.length-1;n<e.length;i=n++){let o=e[n],a=e[i];o.y>t.y!=a.y>t.y&&t.x<(a.x-o.x)*(t.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function ju(e,t,r,n,i){for(let a of e)if(t<=a.x&&r<=a.y&&n>=a.x&&i>=a.y)return!0;let o=[new Mn.default(t,r),new Mn.default(t,i),new Mn.default(n,i),new Mn.default(n,r)];if(e.length>2){for(let a of o)if(vr(e,a))return!0}for(let a=0;a<e.length-1;a++){let s=e[a],l=e[a+1];if(th(s,l,o))return!0}return!1}function th(e,t,r){let n=r[0],i=r[2];if(e.x<n.x&&t.x<n.x||e.x>i.x&&t.x>i.x||e.y<n.y&&t.y<n.y||e.y>i.y&&t.y>i.y)return!1;let o=nt(e,t,r[0]);return o!==nt(e,t,r[1])||o!==nt(e,t,r[2])||o!==nt(e,t,r[3])}var vo=Z(he(),1);function Zt(e,t,r){let n=t.paint.get(e).value;return n.kind==="constant"?n.value:r.programConfigurations.get(t.id).getMaxValue(e)}function At(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function _t(e,t,r,n,i){if(!t[0]&&!t[1])return e;let o=vo.default.convert(t)._mult(i);r==="viewport"&&o._rotate(-n);let a=[];for(let s=0;s<e.length;s++){let l=e[s];a.push(l.sub(o))}return a}function Zu(e,t){let r=[];for(let n=0;n<e.length;n++){let i=e[n],o=[];for(let a=0;a<i.length;a++){let s=i[a-1],l=i[a],u=i[a+1],c=a===0?new vo.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new vo.default(0,0):u.sub(l)._unit()._perp(),f=c._add(p)._unit(),y=f.x*p.x+f.y*p.y;y!==0&&f._mult(1/y),o.push(f._mult(t)._add(l))}r.push(o)}return r}var Ju,rh=()=>Ju=Ju||new ie({"circle-sort-key":new R(S.layout_circle["circle-sort-key"])}),Wu,nh=()=>Wu=Wu||new ie({"circle-radius":new R(S.paint_circle["circle-radius"]),"circle-color":new R(S.paint_circle["circle-color"]),"circle-blur":new R(S.paint_circle["circle-blur"]),"circle-opacity":new R(S.paint_circle["circle-opacity"]),"circle-translate":new z(S.paint_circle["circle-translate"]),"circle-translate-anchor":new z(S.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new z(S.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new z(S.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new R(S.paint_circle["circle-stroke-width"]),"circle-stroke-color":new R(S.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new R(S.paint_circle["circle-stroke-opacity"])}),Hu={get paint(){return nh()},get layout(){return rh()}};var X=1e-6,Ne=typeof Float32Array<"u"?Float32Array:Array,Ln=Math.random;var Pv=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Dn={};sl(Dn,{add:()=>Uh,adjoint:()=>ph,clone:()=>oh,copy:()=>ah,create:()=>ih,determinant:()=>fh,equals:()=>jh,exactEquals:()=>qh,frob:()=>Nh,fromQuat:()=>Eh,fromQuat2:()=>_h,fromRotation:()=>Ph,fromRotationTranslation:()=>Qu,fromRotationTranslationScale:()=>kh,fromRotationTranslationScaleOrigin:()=>Th,fromScaling:()=>vh,fromTranslation:()=>bh,fromValues:()=>sh,fromXRotation:()=>Sh,fromYRotation:()=>wh,fromZRotation:()=>Ah,frustum:()=>Fh,getRotation:()=>Ch,getScaling:()=>ec,getTranslation:()=>Ih,identity:()=>Yu,invert:()=>ch,lookAt:()=>zh,mul:()=>Zh,multiply:()=>Xu,multiplyScalar:()=>$h,multiplyScalarAndAdd:()=>Gh,ortho:()=>Vh,orthoNO:()=>rc,orthoZO:()=>Bh,perspective:()=>Mh,perspectiveFromFieldOfView:()=>Dh,perspectiveNO:()=>tc,perspectiveZO:()=>Lh,rotate:()=>hh,rotateX:()=>dh,rotateY:()=>gh,rotateZ:()=>xh,scale:()=>mh,set:()=>lh,str:()=>Oh,sub:()=>Jh,subtract:()=>nc,targetTo:()=>Rh,translate:()=>yh,transpose:()=>uh});function ih(){var e=new Ne(16);return Ne!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function oh(e){var t=new Ne(16);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}function ah(e,t){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}function sh(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m,h){var d=new Ne(16);return d[0]=e,d[1]=t,d[2]=r,d[3]=n,d[4]=i,d[5]=o,d[6]=a,d[7]=s,d[8]=l,d[9]=u,d[10]=c,d[11]=p,d[12]=f,d[13]=y,d[14]=m,d[15]=h,d}function lh(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=o,e[5]=a,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=p,e[11]=f,e[12]=y,e[13]=m,e[14]=h,e[15]=d,e}function Yu(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function uh(e,t){if(e===t){var r=t[1],n=t[2],i=t[3],o=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=o,e[11]=t[14],e[12]=i,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function ch(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],p=t[9],f=t[10],y=t[11],m=t[12],h=t[13],d=t[14],g=t[15],v=r*s-n*a,b=r*l-i*a,x=r*u-o*a,P=n*l-i*s,w=n*u-o*s,A=i*u-o*l,T=c*h-p*m,I=c*d-f*m,E=c*g-y*m,_=p*d-f*h,F=p*g-y*h,M=f*g-y*d,B=v*M-b*F+x*_+P*E-w*I+A*T;return B?(B=1/B,e[0]=(s*M-l*F+u*_)*B,e[1]=(i*F-n*M-o*_)*B,e[2]=(h*A-d*w+g*P)*B,e[3]=(f*w-p*A-y*P)*B,e[4]=(l*E-a*M-u*I)*B,e[5]=(r*M-i*E+o*I)*B,e[6]=(d*x-m*A-g*b)*B,e[7]=(c*A-f*x+y*b)*B,e[8]=(a*F-s*E+u*T)*B,e[9]=(n*E-r*F-o*T)*B,e[10]=(m*w-h*x+g*v)*B,e[11]=(p*x-c*w-y*v)*B,e[12]=(s*I-a*_-l*T)*B,e[13]=(r*_-n*I+i*T)*B,e[14]=(h*b-m*P-d*v)*B,e[15]=(c*P-p*b+f*v)*B,e):null}function ph(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],p=t[9],f=t[10],y=t[11],m=t[12],h=t[13],d=t[14],g=t[15];return e[0]=s*(f*g-y*d)-p*(l*g-u*d)+h*(l*y-u*f),e[1]=-(n*(f*g-y*d)-p*(i*g-o*d)+h*(i*y-o*f)),e[2]=n*(l*g-u*d)-s*(i*g-o*d)+h*(i*u-o*l),e[3]=-(n*(l*y-u*f)-s*(i*y-o*f)+p*(i*u-o*l)),e[4]=-(a*(f*g-y*d)-c*(l*g-u*d)+m*(l*y-u*f)),e[5]=r*(f*g-y*d)-c*(i*g-o*d)+m*(i*y-o*f),e[6]=-(r*(l*g-u*d)-a*(i*g-o*d)+m*(i*u-o*l)),e[7]=r*(l*y-u*f)-a*(i*y-o*f)+c*(i*u-o*l),e[8]=a*(p*g-y*h)-c*(s*g-u*h)+m*(s*y-u*p),e[9]=-(r*(p*g-y*h)-c*(n*g-o*h)+m*(n*y-o*p)),e[10]=r*(s*g-u*h)-a*(n*g-o*h)+m*(n*u-o*s),e[11]=-(r*(s*y-u*p)-a*(n*y-o*p)+c*(n*u-o*s)),e[12]=-(a*(p*d-f*h)-c*(s*d-l*h)+m*(s*f-l*p)),e[13]=r*(p*d-f*h)-c*(n*d-i*h)+m*(n*f-i*p),e[14]=-(r*(s*d-l*h)-a*(n*d-i*h)+m*(n*l-i*s)),e[15]=r*(s*f-l*p)-a*(n*f-i*p)+c*(n*l-i*s),e}function fh(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],p=e[10],f=e[11],y=e[12],m=e[13],h=e[14],d=e[15],g=t*a-r*o,v=t*s-n*o,b=t*l-i*o,x=r*s-n*a,P=r*l-i*a,w=n*l-i*s,A=u*m-c*y,T=u*h-p*y,I=u*d-f*y,E=c*h-p*m,_=c*d-f*m,F=p*d-f*h;return g*F-v*_+b*E+x*I-P*T+w*A}function Xu(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],p=t[8],f=t[9],y=t[10],m=t[11],h=t[12],d=t[13],g=t[14],v=t[15],b=r[0],x=r[1],P=r[2],w=r[3];return e[0]=b*n+x*s+P*p+w*h,e[1]=b*i+x*l+P*f+w*d,e[2]=b*o+x*u+P*y+w*g,e[3]=b*a+x*c+P*m+w*v,b=r[4],x=r[5],P=r[6],w=r[7],e[4]=b*n+x*s+P*p+w*h,e[5]=b*i+x*l+P*f+w*d,e[6]=b*o+x*u+P*y+w*g,e[7]=b*a+x*c+P*m+w*v,b=r[8],x=r[9],P=r[10],w=r[11],e[8]=b*n+x*s+P*p+w*h,e[9]=b*i+x*l+P*f+w*d,e[10]=b*o+x*u+P*y+w*g,e[11]=b*a+x*c+P*m+w*v,b=r[12],x=r[13],P=r[14],w=r[15],e[12]=b*n+x*s+P*p+w*h,e[13]=b*i+x*l+P*f+w*d,e[14]=b*o+x*u+P*y+w*g,e[15]=b*a+x*c+P*m+w*v,e}function yh(e,t,r){var n=r[0],i=r[1],o=r[2],a,s,l,u,c,p,f,y,m,h,d,g;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*o+t[12],e[13]=t[1]*n+t[5]*i+t[9]*o+t[13],e[14]=t[2]*n+t[6]*i+t[10]*o+t[14],e[15]=t[3]*n+t[7]*i+t[11]*o+t[15]):(a=t[0],s=t[1],l=t[2],u=t[3],c=t[4],p=t[5],f=t[6],y=t[7],m=t[8],h=t[9],d=t[10],g=t[11],e[0]=a,e[1]=s,e[2]=l,e[3]=u,e[4]=c,e[5]=p,e[6]=f,e[7]=y,e[8]=m,e[9]=h,e[10]=d,e[11]=g,e[12]=a*n+c*i+m*o+t[12],e[13]=s*n+p*i+h*o+t[13],e[14]=l*n+f*i+d*o+t[14],e[15]=u*n+y*i+g*o+t[15]),e}function mh(e,t,r){var n=r[0],i=r[1],o=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function hh(e,t,r,n){var i=n[0],o=n[1],a=n[2],s=Math.hypot(i,o,a),l,u,c,p,f,y,m,h,d,g,v,b,x,P,w,A,T,I,E,_,F,M,B,C;return s<X?null:(s=1/s,i*=s,o*=s,a*=s,l=Math.sin(r),u=Math.cos(r),c=1-u,p=t[0],f=t[1],y=t[2],m=t[3],h=t[4],d=t[5],g=t[6],v=t[7],b=t[8],x=t[9],P=t[10],w=t[11],A=i*i*c+u,T=o*i*c+a*l,I=a*i*c-o*l,E=i*o*c-a*l,_=o*o*c+u,F=a*o*c+i*l,M=i*a*c+o*l,B=o*a*c-i*l,C=a*a*c+u,e[0]=p*A+h*T+b*I,e[1]=f*A+d*T+x*I,e[2]=y*A+g*T+P*I,e[3]=m*A+v*T+w*I,e[4]=p*E+h*_+b*F,e[5]=f*E+d*_+x*F,e[6]=y*E+g*_+P*F,e[7]=m*E+v*_+w*F,e[8]=p*M+h*B+b*C,e[9]=f*M+d*B+x*C,e[10]=y*M+g*B+P*C,e[11]=m*M+v*B+w*C,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function dh(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],p=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*i+u*n,e[5]=a*i+c*n,e[6]=s*i+p*n,e[7]=l*i+f*n,e[8]=u*i-o*n,e[9]=c*i-a*n,e[10]=p*i-s*n,e[11]=f*i-l*n,e}function gh(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[0],a=t[1],s=t[2],l=t[3],u=t[8],c=t[9],p=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i-u*n,e[1]=a*i-c*n,e[2]=s*i-p*n,e[3]=l*i-f*n,e[8]=o*n+u*i,e[9]=a*n+c*i,e[10]=s*n+p*i,e[11]=l*n+f*i,e}function xh(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[0],a=t[1],s=t[2],l=t[3],u=t[4],c=t[5],p=t[6],f=t[7];return t!==e&&(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[0]=o*i+u*n,e[1]=a*i+c*n,e[2]=s*i+p*n,e[3]=l*i+f*n,e[4]=u*i-o*n,e[5]=c*i-a*n,e[6]=p*i-s*n,e[7]=f*i-l*n,e}function bh(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function vh(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ph(e,t,r){var n=r[0],i=r[1],o=r[2],a=Math.hypot(n,i,o),s,l,u;return a<X?null:(a=1/a,n*=a,i*=a,o*=a,s=Math.sin(t),l=Math.cos(t),u=1-l,e[0]=n*n*u+l,e[1]=i*n*u+o*s,e[2]=o*n*u-i*s,e[3]=0,e[4]=n*i*u-o*s,e[5]=i*i*u+l,e[6]=o*i*u+n*s,e[7]=0,e[8]=n*o*u+i*s,e[9]=i*o*u-n*s,e[10]=o*o*u+l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function Sh(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function wh(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ah(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Qu(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],s=n+n,l=i+i,u=o+o,c=n*s,p=n*l,f=n*u,y=i*l,m=i*u,h=o*u,d=a*s,g=a*l,v=a*u;return e[0]=1-(y+h),e[1]=p+v,e[2]=f-g,e[3]=0,e[4]=p-v,e[5]=1-(c+h),e[6]=m+d,e[7]=0,e[8]=f+g,e[9]=m-d,e[10]=1-(c+y),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function _h(e,t){var r=new Ne(3),n=-t[0],i=-t[1],o=-t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],p=n*n+i*i+o*o+a*a;return p>0?(r[0]=(s*a+c*n+l*o-u*i)*2/p,r[1]=(l*a+c*i+u*n-s*o)*2/p,r[2]=(u*a+c*o+s*i-l*n)*2/p):(r[0]=(s*a+c*n+l*o-u*i)*2,r[1]=(l*a+c*i+u*n-s*o)*2,r[2]=(u*a+c*o+s*i-l*n)*2),Qu(e,t,r),e}function Ih(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function ec(e,t){var r=t[0],n=t[1],i=t[2],o=t[4],a=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(r,n,i),e[1]=Math.hypot(o,a,s),e[2]=Math.hypot(l,u,c),e}function Ch(e,t){var r=new Ne(3);ec(r,t);var n=1/r[0],i=1/r[1],o=1/r[2],a=t[0]*n,s=t[1]*i,l=t[2]*o,u=t[4]*n,c=t[5]*i,p=t[6]*o,f=t[8]*n,y=t[9]*i,m=t[10]*o,h=a+c+m,d=0;return h>0?(d=Math.sqrt(h+1)*2,e[3]=.25*d,e[0]=(p-y)/d,e[1]=(f-l)/d,e[2]=(s-u)/d):a>c&&a>m?(d=Math.sqrt(1+a-c-m)*2,e[3]=(p-y)/d,e[0]=.25*d,e[1]=(s+u)/d,e[2]=(f+l)/d):c>m?(d=Math.sqrt(1+c-a-m)*2,e[3]=(f-l)/d,e[0]=(s+u)/d,e[1]=.25*d,e[2]=(p+y)/d):(d=Math.sqrt(1+m-a-c)*2,e[3]=(s-u)/d,e[0]=(f+l)/d,e[1]=(p+y)/d,e[2]=.25*d),e}function kh(e,t,r,n){var i=t[0],o=t[1],a=t[2],s=t[3],l=i+i,u=o+o,c=a+a,p=i*l,f=i*u,y=i*c,m=o*u,h=o*c,d=a*c,g=s*l,v=s*u,b=s*c,x=n[0],P=n[1],w=n[2];return e[0]=(1-(m+d))*x,e[1]=(f+b)*x,e[2]=(y-v)*x,e[3]=0,e[4]=(f-b)*P,e[5]=(1-(p+d))*P,e[6]=(h+g)*P,e[7]=0,e[8]=(y+v)*w,e[9]=(h-g)*w,e[10]=(1-(p+m))*w,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function Th(e,t,r,n,i){var o=t[0],a=t[1],s=t[2],l=t[3],u=o+o,c=a+a,p=s+s,f=o*u,y=o*c,m=o*p,h=a*c,d=a*p,g=s*p,v=l*u,b=l*c,x=l*p,P=n[0],w=n[1],A=n[2],T=i[0],I=i[1],E=i[2],_=(1-(h+g))*P,F=(y+x)*P,M=(m-b)*P,B=(y-x)*w,C=(1-(f+g))*w,O=(d+v)*w,N=(m+b)*A,K=(d-v)*A,Y=(1-(f+h))*A;return e[0]=_,e[1]=F,e[2]=M,e[3]=0,e[4]=B,e[5]=C,e[6]=O,e[7]=0,e[8]=N,e[9]=K,e[10]=Y,e[11]=0,e[12]=r[0]+T-(_*T+B*I+N*E),e[13]=r[1]+I-(F*T+C*I+K*E),e[14]=r[2]+E-(M*T+O*I+Y*E),e[15]=1,e}function Eh(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,p=n*s,f=i*a,y=i*s,m=i*l,h=o*a,d=o*s,g=o*l;return e[0]=1-p-m,e[1]=c+g,e[2]=f-d,e[3]=0,e[4]=c-g,e[5]=1-u-m,e[6]=y+h,e[7]=0,e[8]=f+d,e[9]=y-h,e[10]=1-u-p,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Fh(e,t,r,n,i,o,a){var s=1/(r-t),l=1/(i-n),u=1/(o-a);return e[0]=o*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*l,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(i+n)*l,e[10]=(a+o)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*o*2*u,e[15]=0,e}function tc(e,t,r,n,i){var o=1/Math.tan(t/2),a;return e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0?(a=1/(n-i),e[10]=(i+n)*a,e[14]=2*i*n*a):(e[10]=-1,e[14]=-2*n),e}var Mh=tc;function Lh(e,t,r,n,i){var o=1/Math.tan(t/2),a;return e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0?(a=1/(n-i),e[10]=i*a,e[14]=i*n*a):(e[10]=-1,e[14]=-n),e}function Dh(e,t,r,n){var i=Math.tan(t.upDegrees*Math.PI/180),o=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(i+o);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-((a-s)*l*.5),e[9]=(i-o)*u*.5,e[10]=n/(r-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*r/(r-n),e[15]=0,e}function rc(e,t,r,n,i,o,a){var s=1/(t-r),l=1/(n-i),u=1/(o-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*s,e[13]=(i+n)*l,e[14]=(a+o)*u,e[15]=1,e}var Vh=rc;function Bh(e,t,r,n,i,o,a){var s=1/(t-r),l=1/(n-i),u=1/(o-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+r)*s,e[13]=(i+n)*l,e[14]=o*u,e[15]=1,e}function zh(e,t,r,n){var i,o,a,s,l,u,c,p,f,y,m=t[0],h=t[1],d=t[2],g=n[0],v=n[1],b=n[2],x=r[0],P=r[1],w=r[2];return Math.abs(m-x)<X&&Math.abs(h-P)<X&&Math.abs(d-w)<X?Yu(e):(c=m-x,p=h-P,f=d-w,y=1/Math.hypot(c,p,f),c*=y,p*=y,f*=y,i=v*f-b*p,o=b*c-g*f,a=g*p-v*c,y=Math.hypot(i,o,a),y?(y=1/y,i*=y,o*=y,a*=y):(i=0,o=0,a=0),s=p*a-f*o,l=f*i-c*a,u=c*o-p*i,y=Math.hypot(s,l,u),y?(y=1/y,s*=y,l*=y,u*=y):(s=0,l=0,u=0),e[0]=i,e[1]=s,e[2]=c,e[3]=0,e[4]=o,e[5]=l,e[6]=p,e[7]=0,e[8]=a,e[9]=u,e[10]=f,e[11]=0,e[12]=-(i*m+o*h+a*d),e[13]=-(s*m+l*h+u*d),e[14]=-(c*m+p*h+f*d),e[15]=1,e)}function Rh(e,t,r,n){var i=t[0],o=t[1],a=t[2],s=n[0],l=n[1],u=n[2],c=i-r[0],p=o-r[1],f=a-r[2],y=c*c+p*p+f*f;y>0&&(y=1/Math.sqrt(y),c*=y,p*=y,f*=y);var m=l*f-u*p,h=u*c-s*f,d=s*p-l*c;return y=m*m+h*h+d*d,y>0&&(y=1/Math.sqrt(y),m*=y,h*=y,d*=y),e[0]=m,e[1]=h,e[2]=d,e[3]=0,e[4]=p*d-f*h,e[5]=f*m-c*d,e[6]=c*h-p*m,e[7]=0,e[8]=c,e[9]=p,e[10]=f,e[11]=0,e[12]=i,e[13]=o,e[14]=a,e[15]=1,e}function Oh(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Nh(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Uh(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function nc(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function $h(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function Gh(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e[9]=t[9]+r[9]*n,e[10]=t[10]+r[10]*n,e[11]=t[11]+r[11]*n,e[12]=t[12]+r[12]*n,e[13]=t[13]+r[13]*n,e[14]=t[14]+r[14]*n,e[15]=t[15]+r[15]*n,e}function qh(e,t){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]}function jh(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],f=e[10],y=e[11],m=e[12],h=e[13],d=e[14],g=e[15],v=t[0],b=t[1],x=t[2],P=t[3],w=t[4],A=t[5],T=t[6],I=t[7],E=t[8],_=t[9],F=t[10],M=t[11],B=t[12],C=t[13],O=t[14],N=t[15];return Math.abs(r-v)<=X*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-b)<=X*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-x)<=X*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(o-P)<=X*Math.max(1,Math.abs(o),Math.abs(P))&&Math.abs(a-w)<=X*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-A)<=X*Math.max(1,Math.abs(s),Math.abs(A))&&Math.abs(l-T)<=X*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-I)<=X*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(c-E)<=X*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(p-_)<=X*Math.max(1,Math.abs(p),Math.abs(_))&&Math.abs(f-F)<=X*Math.max(1,Math.abs(f),Math.abs(F))&&Math.abs(y-M)<=X*Math.max(1,Math.abs(y),Math.abs(M))&&Math.abs(m-B)<=X*Math.max(1,Math.abs(m),Math.abs(B))&&Math.abs(h-C)<=X*Math.max(1,Math.abs(h),Math.abs(C))&&Math.abs(d-O)<=X*Math.max(1,Math.abs(d),Math.abs(O))&&Math.abs(g-N)<=X*Math.max(1,Math.abs(g),Math.abs(N))}var Zh=Xu,Jh=nc;var Jt={};sl(Jt,{add:()=>Xh,ceil:()=>Qh,clone:()=>Wh,copy:()=>Kh,create:()=>ic,cross:()=>cd,dist:()=>Sd,distance:()=>lc,div:()=>Pd,divide:()=>sc,dot:()=>ud,equals:()=>xd,exactEquals:()=>gd,floor:()=>ed,forEach:()=>Id,fromValues:()=>Hh,inverse:()=>sd,len:()=>Ad,length:()=>cc,lerp:()=>pd,max:()=>rd,min:()=>td,mul:()=>vd,multiply:()=>ac,negate:()=>ad,normalize:()=>ld,random:()=>fd,round:()=>nd,scale:()=>id,scaleAndAdd:()=>od,set:()=>Yh,sqrDist:()=>wd,sqrLen:()=>_d,squaredDistance:()=>uc,squaredLength:()=>pc,str:()=>dd,sub:()=>bd,subtract:()=>oc,transformMat4:()=>yd,transformQuat:()=>md,zero:()=>hd});function ic(){var e=new Ne(4);return Ne!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Wh(e){var t=new Ne(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Hh(e,t,r,n){var i=new Ne(4);return i[0]=e,i[1]=t,i[2]=r,i[3]=n,i}function Kh(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Yh(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e}function Xh(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function oc(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function ac(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function sc(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e}function Qh(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e}function ed(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e}function td(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e}function rd(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e}function nd(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e}function id(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function od(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e}function lc(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],o=t[3]-e[3];return Math.hypot(r,n,i,o)}function uc(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],o=t[3]-e[3];return r*r+n*n+i*i+o*o}function cc(e){var t=e[0],r=e[1],n=e[2],i=e[3];return Math.hypot(t,r,n,i)}function pc(e){var t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function ad(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function sd(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function ld(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=r*a,e[1]=n*a,e[2]=i*a,e[3]=o*a,e}function ud(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function cd(e,t,r,n){var i=r[0]*n[1]-r[1]*n[0],o=r[0]*n[2]-r[2]*n[0],a=r[0]*n[3]-r[3]*n[0],s=r[1]*n[2]-r[2]*n[1],l=r[1]*n[3]-r[3]*n[1],u=r[2]*n[3]-r[3]*n[2],c=t[0],p=t[1],f=t[2],y=t[3];return e[0]=p*u-f*l+y*s,e[1]=-(c*u)+f*a-y*o,e[2]=c*l-p*a+y*i,e[3]=-(c*s)+p*o-f*i,e}function pd(e,t,r,n){var i=t[0],o=t[1],a=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=o+n*(r[1]-o),e[2]=a+n*(r[2]-a),e[3]=s+n*(r[3]-s),e}function fd(e,t){t=t||1;var r,n,i,o,a,s;do r=Ln()*2-1,n=Ln()*2-1,a=r*r+n*n;while(a>=1);do i=Ln()*2-1,o=Ln()*2-1,s=i*i+o*o;while(s>=1);var l=Math.sqrt((1-a)/s);return e[0]=t*r,e[1]=t*n,e[2]=t*i*l,e[3]=t*o*l,e}function yd(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,e[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,e[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,e[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,e}function md(e,t,r){var n=t[0],i=t[1],o=t[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,p=u*i+l*n-a*o,f=u*o+a*i-s*n,y=-a*n-s*i-l*o;return e[0]=c*u+y*-a+p*-l-f*-s,e[1]=p*u+y*-s+f*-a-c*-l,e[2]=f*u+y*-l+c*-s-p*-a,e[3]=t[3],e}function hd(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function dd(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function gd(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function xd(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=t[0],s=t[1],l=t[2],u=t[3];return Math.abs(r-a)<=X*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=X*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=X*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=X*Math.max(1,Math.abs(o),Math.abs(u))}var bd=oc,vd=ac,Pd=sc,Sd=lc,wd=uc,Ad=cc,_d=pc,Id=function(){var e=ic();return function(t,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),i?l=Math.min(i*r+n,t.length):l=t.length,s=n;s<l;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],o(e,e,a),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}}();var fc=Z(he(),1),Po=class extends le{constructor(r){super(r,Hu)}createBucket(r){return new jt(r)}queryRadius(r){let n=r;return Zt("circle-radius",this,n)+Zt("circle-stroke-width",this,n)+At(this.paint.get("circle-translate"))}queryIntersectsFeature(r,n,i,o,a,s,l,u){let c=_t(r,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,l),p=this.paint.get("circle-radius").evaluate(n,i),f=this.paint.get("circle-stroke-width").evaluate(n,i),y=p+f,m=this.paint.get("circle-pitch-alignment")==="map",h=m?c:Cd(c,u),d=m?y*l:y;for(let g of o)for(let v of g){let b=m?v:yc(v,u),x=d,P=Jt.transformMat4([],[v.x,v.y,0,1],u);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?x*=P[3]/s.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(x*=s.cameraToCenterDistance/P[3]),Gu(h,b,x))return!0}return!1}};function yc(e,t){let r=Jt.transformMat4([],[e.x,e.y,0,1],t);return new fc.default(r[0]/r[3],r[1]/r[3])}function Cd(e,t){return e.map(r=>yc(r,t))}var Vn=class extends jt{};k("HeatmapBucket",Vn,{omit:["layers"]});var mc,kd=()=>mc=mc||new ie({"heatmap-radius":new R(S.paint_heatmap["heatmap-radius"]),"heatmap-weight":new R(S.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new z(S.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Nt(S.paint_heatmap["heatmap-color"]),"heatmap-opacity":new z(S.paint_heatmap["heatmap-opacity"])}),hc={get paint(){return kd()}};function us(e,{width:t,height:r},n,i){if(!i)i=new Uint8Array(t*r*n);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==t*r*n)throw new RangeError("mismatched image size. expected: ".concat(i.length," but got: ").concat(t*r*n));return e.width=t,e.height=r,e.data=i,e}function dc(e,{width:t,height:r},n){if(t===e.width&&r===e.height)return;let i=us({},{width:t,height:r},n);cs(e,i,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,r)},n),e.width=t,e.height=r,e.data=i.data}function cs(e,t,r,n,i,o){if(i.width===0||i.height===0)return t;if(i.width>e.width||i.height>e.height||r.x>e.width-i.width||r.y>e.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>t.width||i.height>t.height||n.x>t.width-i.width||n.y>t.height-i.height)throw new RangeError("out of range destination coordinates for image copy");let a=e.data,s=t.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){let u=((r.y+l)*e.width+r.x)*o,c=((n.y+l)*t.width+n.x)*o;for(let p=0;p<i.width*o;p++)s[c+p]=a[u+p]}return t}var Wt=class e{constructor(t,r){us(this,t,1,r)}resize(t){dc(this,t,1)}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,n,i,o){cs(t,r,n,i,o,1)}},de=class e{constructor(t,r){us(this,t,4,r)}resize(t){dc(this,t,4)}replace(t,r){r?this.data.set(t):t instanceof Uint8ClampedArray?this.data=new Uint8Array(t.buffer):this.data=t}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,n,i,o){cs(t,r,n,i,o,4)}};k("AlphaImage",Wt);k("RGBAImage",de);function gc(e){let t={},r=e.resolution||256,n=e.clips?e.clips.length:1,i=e.image||new de({width:r,height:n});if(!hl(r))throw new Error("width is not a power of 2 - ".concat(r));let o=(a,s,l)=>{t[e.evaluationKey]=l;let u=e.expression.evaluate(t);i.data[a+s+0]=Math.floor(u.r*255/u.a),i.data[a+s+1]=Math.floor(u.g*255/u.a),i.data[a+s+2]=Math.floor(u.b*255/u.a),i.data[a+s+3]=Math.floor(u.a*255)};if(e.clips)for(let a=0,s=0;a<n;++a,s+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let c=l/(r-1),{start:p,end:f}=e.clips[a],y=p*(1-c)+f*c;o(s,u,y)}else for(let a=0,s=0;a<r;a++,s+=4){let l=a/(r-1);o(0,s,l)}return i}var So=class extends le{constructor(r){super(r,hc);this._updateColorRamp()}createBucket(r){return new Vn(r)}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let r=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=gc({expression:r,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};var xc,Td=()=>xc=xc||new ie({"hillshade-illumination-direction":new z(S.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new z(S.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new z(S.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new z(S.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new z(S.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new z(S.paint_hillshade["hillshade-accent-color"])}),bc={get paint(){return Td()}};var wo=class extends le{constructor(r){super(r,bc)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var Ed=ee([{name:"a_pos",components:2,type:"Int16"}],4);var{members:vc,size:m1,alignment:h1}=Ed;var Ic=Z(hs(),1);function ds(e,t,r,n,i){_c(e,t,r||0,n||e.length-1,i||Zd)}function _c(e,t,r,n,i){for(;n>r;){if(n-r>600){var o=n-r+1,a=t-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1),c=Math.max(r,Math.floor(t-a*l/o+u)),p=Math.min(n,Math.floor(t+(o-a)*l/o+u));_c(e,t,c,p,i)}var f=e[t],y=r,m=n;for(On(e,r,t),i(e[n],f)>0&&On(e,r,n);y<m;){for(On(e,y,m),y++,m--;i(e[y],f)<0;)y++;for(;i(e[m],f)>0;)m--}i(e[r],f)===0?On(e,r,m):(m++,On(e,m,n)),m<=t&&(r=m+1),t<=m&&(n=m-1)}}function On(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Zd(e,t){return e<t?-1:e>t?1:0}function Sr(e,t){let r=e.length;if(r<=1)return[e];let n=[],i,o;for(let a=0;a<r;a++){let s=xl(e[a]);s!==0&&(e[a].area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[e[a]]):i.push(e[a]))}if(i&&n.push(i),t>1)for(let a=0;a<n.length;a++)n[a].length<=t||(ds(n[a],t,1,n[a].length-1,Jd),n[a]=n[a].slice(0,t));return n}function Jd(e,t){return t.area-e.area}function wr(e,t,r){let n=r.patternDependencies,i=!1;for(let o of t){let a=o.paint.get("".concat(e,"-pattern"));a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Ar(e,t,r,n,i){let o=i.patternDependencies;for(let a of t){let l=a.paint.get("".concat(e,"-pattern")).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:n-1},r,{},i.availableImages),c=l.evaluate({zoom:n},r,{},i.availableImages),p=l.evaluate({zoom:n+1},r,{},i.availableImages);u=u&&u.name?u.name:u,c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,o[u]=!0,o[c]=!0,o[p]=!0,r.patterns[a.id]={min:u,mid:c,max:p}}}return r}var Wd=500,Kt=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new io,this.indexArray=new Le,this.indexArray2=new St,this.programConfigurations=new ke(t.layers,t.zoom),this.segments=new me,this.segments2=new me,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){this.hasPattern=wr("fill",this.layers,r);let i=this.layers[0].layout.get("fill-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of t){let p=this.layers[0]._featureFilter.needGeometry,f=Oe(s,p);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),f,n))continue;let y=o?i.evaluate(f,{},n,r.availableImages):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:Te(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Ar("fill",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});let p=t[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}addFeatures(t,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,vc),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,r,n,i,o){for(let a of Sr(r,Wd)){let s=0;for(let y of a)s+=y.length;let l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),u=l.vertexLength,c=[],p=[];for(let y of a){if(y.length===0)continue;y!==a[0]&&p.push(c.length/2);let m=this.segments2.prepareSegment(y.length,this.layoutVertexArray,this.indexArray2),h=m.vertexLength;this.layoutVertexArray.emplaceBack(y[0].x,y[0].y),this.indexArray2.emplaceBack(h+y.length-1,h),c.push(y[0].x),c.push(y[0].y);for(let d=1;d<y.length;d++)this.layoutVertexArray.emplaceBack(y[d].x,y[d].y),this.indexArray2.emplaceBack(h+d-1,h+d),c.push(y[d].x),c.push(y[d].y);m.vertexLength+=y.length,m.primitiveLength+=y.length}let f=(0,Ic.default)(c,p);for(let y=0;y<f.length;y+=3)this.indexArray.emplaceBack(u+f[y],u+f[y+1],u+f[y+2]);l.vertexLength+=s,l.primitiveLength+=f.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,o,i)}};k("FillBucket",Kt,{omit:["layers","patternFeatures"]});var Cc,Hd=()=>Cc=Cc||new ie({"fill-sort-key":new R(S.layout_fill["fill-sort-key"])}),kc,Kd=()=>kc=kc||new ie({"fill-antialias":new z(S.paint_fill["fill-antialias"]),"fill-opacity":new R(S.paint_fill["fill-opacity"]),"fill-color":new R(S.paint_fill["fill-color"]),"fill-outline-color":new R(S.paint_fill["fill-outline-color"]),"fill-translate":new z(S.paint_fill["fill-translate"]),"fill-translate-anchor":new z(S.paint_fill["fill-translate-anchor"]),"fill-pattern":new st(S.paint_fill["fill-pattern"])}),Tc={get paint(){return Kd()},get layout(){return Hd()}};var ko=class extends le{constructor(r){super(r,Tc)}recalculate(r,n){super.recalculate(r,n);let i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(r){return new Kt(r)}queryRadius(){return At(this.paint.get("fill-translate"))}queryIntersectsFeature(r,n,i,o,a,s,l){let u=_t(r,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,l);return bo(u,o)}isTileClipped(){return!0}};var Yd=ee([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ec=ee([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:Fc,size:Y1,alignment:X1}=Yd;var zc=Z(hs(),1),Rc=Z(It(),1);var ug=Rc.default.VectorTileFeature.types,cg=500,bs=Math.pow(2,13);function Nn(e,t,r,n,i,o,a,s){e.emplaceBack(t,r,Math.floor(n*bs)*2+a,i*bs*2,o*bs*2,Math.round(s))}var Yt=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new oo,this.centroidVertexArray=new ro,this.indexArray=new Le,this.programConfigurations=new ke(t.layers,t.zoom),this.segments=new me,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){this.features=[],this.hasPattern=wr("fill-extrusion",this.layers,r);for(let{feature:i,id:o,index:a,sourceLayerIndex:s}of t){let l=this.layers[0]._featureFilter.needGeometry,u=Oe(i,l);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:Te(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(Ar("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,a,n,{}),r.featureIndex.insert(i,c.geometry,a,s,this.index,!0)}}addFeatures(t,r,n){for(let i of this.features){let{geometry:o}=i;this.addFeature(i,o,i.index,r,n)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Fc),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ec.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,n,i,o){let a={x:0,y:0,vertexCount:0};for(let s of Sr(r,cg)){let l=0;for(let m of s)l+=m.length;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let m of s){if(m.length===0||fg(m))continue;let h=0;for(let d=0;d<m.length;d++){let g=m[d];if(d>=1){let v=m[d-1];if(!pg(g,v)){u.vertexLength+4>me.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let b=g.sub(v)._perp()._unit(),x=v.dist(g);h+x>32768&&(h=0),Nn(this.layoutVertexArray,g.x,g.y,b.x,b.y,0,0,h),Nn(this.layoutVertexArray,g.x,g.y,b.x,b.y,0,1,h),a.x+=2*g.x,a.y+=2*g.y,a.vertexCount+=2,h+=x,Nn(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,0,h),Nn(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,1,h),a.x+=2*v.x,a.y+=2*v.y,a.vertexCount+=2;let P=u.vertexLength;this.indexArray.emplaceBack(P,P+2,P+1),this.indexArray.emplaceBack(P+1,P+2,P+3),u.vertexLength+=4,u.primitiveLength+=2}}}}if(u.vertexLength+l>me.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),ug[t.type]!=="Polygon")continue;let c=[],p=[],f=u.vertexLength;for(let m of s)if(m.length!==0){m!==s[0]&&p.push(c.length/2);for(let h=0;h<m.length;h++){let d=m[h];Nn(this.layoutVertexArray,d.x,d.y,0,0,1,1,0),a.x+=d.x,a.y+=d.y,a.vertexCount+=1,c.push(d.x),c.push(d.y)}}let y=(0,zc.default)(c,p);for(let m=0;m<y.length;m+=3)this.indexArray.emplaceBack(f+y[m],f+y[m+2],f+y[m+1]);u.primitiveLength+=y.length/3,u.vertexLength+=l}for(let s=0;s<a.vertexCount;s++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,o,i)}};k("FillExtrusionBucket",Yt,{omit:["layers","features"]});function pg(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function fg(e){return e.every(t=>t.x<0)||e.every(t=>t.x>8192)||e.every(t=>t.y<0)||e.every(t=>t.y>8192)}var Oc,yg=()=>Oc=Oc||new ie({"fill-extrusion-opacity":new z(S["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new R(S["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new z(S["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new z(S["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new st(S["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new R(S["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new R(S["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new z(S["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),Nc={get paint(){return yg()}};var Eo=Z(he(),1);var Fo=class extends le{constructor(r){super(r,Nc)}createBucket(r){return new Yt(r)}queryRadius(){return At(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(r,n,i,o,a,s,l,u){let c=_t(r,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,l),p=this.paint.get("fill-extrusion-height").evaluate(n,i),f=this.paint.get("fill-extrusion-base").evaluate(n,i),y=dg(c,u,s,0),m=hg(o,f,p,u),h=m[0],d=m[1];return mg(h,d,y)}};function Un(e,t){return e.x*t.x+e.y*t.y}function Uc(e,t){if(e.length===1){let r=0,n=t[r++],i;for(;!i||n.equals(i);)if(i=t[r++],!i)return 1/0;for(;r<t.length;r++){let o=t[r],a=e[0],s=i.sub(n),l=o.sub(n),u=a.sub(n),c=Un(s,s),p=Un(s,l),f=Un(l,l),y=Un(u,s),m=Un(u,l),h=c*f-p*p,d=(f*y-p*m)/h,g=(c*m-p*y)/h,v=1-d-g,b=n.z*v+i.z*d+o.z*g;if(isFinite(b))return b}return 1/0}else{let r=1/0;for(let n of t)r=Math.min(r,n.z);return r}}function mg(e,t,r){let n=1/0;bo(r,t)&&(n=Uc(r,t[0]));for(let i=0;i<t.length;i++){let o=t[i],a=e[i];for(let s=0;s<o.length-1;s++){let l=o[s],u=o[s+1],c=a[s],p=a[s+1],f=[l,u,p,c,l];$u(r,f)&&(n=Math.min(n,Uc(r,f)))}}return n===1/0?!1:n}function hg(e,t,r,n){let i=[],o=[],a=n[8]*t,s=n[9]*t,l=n[10]*t,u=n[11]*t,c=n[8]*r,p=n[9]*r,f=n[10]*r,y=n[11]*r;for(let m of e){let h=[],d=[];for(let g of m){let v=g.x,b=g.y,x=n[0]*v+n[4]*b+n[12],P=n[1]*v+n[5]*b+n[13],w=n[2]*v+n[6]*b+n[14],A=n[3]*v+n[7]*b+n[15],T=x+a,I=P+s,E=w+l,_=A+u,F=x+c,M=P+p,B=w+f,C=A+y,O=new Eo.default(T/_,I/_);O.z=E/_,h.push(O);let N=new Eo.default(F/C,M/C);N.z=B/C,d.push(N)}i.push(h),o.push(d)}return[i,o]}function dg(e,t,r,n){let i=[];for(let o of e){let a=[o.x,o.y,n,1];Jt.transformMat4(a,a,t),i.push(new Eo.default(a[0]/a[3],a[1]/a[3]))}return i}var gg=ee([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:$c,size:DP,alignment:VP}=gg;var xg=ee([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Gc,size:RP,alignment:OP}=xg;var Zc=Z(It(),1);var bg=Zc.default.VectorTileFeature.types,qc=63,vg=Math.cos(75/2*(Math.PI/180)),Pg=15,Sg=20,wg=15,Jc=1/2,jc=Math.pow(2,wg-1)/Jc,Xt=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new ao,this.layoutVertexArray2=new so,this.indexArray=new Le,this.programConfigurations=new ke(t.layers,t.zoom),this.segments=new me,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){this.hasPattern=wr("line",this.layers,r);let i=this.layers[0].layout.get("line-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of t){let p=this.layers[0]._featureFilter.needGeometry,f=Oe(s,p);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),f,n))continue;let y=o?i.evaluate(f,{},n):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:Te(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Ar("line",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});let p=t[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}addFeatures(t,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Gc)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$c),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end")){let r=+t.properties.mapbox_clip_start,n=+t.properties.mapbox_clip_end;return{start:r,end:n}}}addFeature(t,r,n,i,o){let a=this.layers[0].layout,s=a.get("line-join").evaluate(t,{}),l=a.get("line-cap"),u=a.get("line-miter-limit"),c=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let p of r)this.addLine(p,t,s,l,u,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,o,i)}addLine(t,r,n,i,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let g=0;g<t.length-1;g++)this.totalDistance+=t[g].dist(t[g+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s=bg[r.type]==="Polygon",l=t.length;for(;l>=2&&t[l-1].equals(t[l-2]);)l--;let u=0;for(;u<l-1&&t[u].equals(t[u+1]);)u++;if(l<(s?3:2))return;n==="bevel"&&(o=1.05);let c=this.overscaling<=16?Pg*8192/(512*this.overscaling):0,p=this.segments.prepareSegment(l*10,this.layoutVertexArray,this.indexArray),f,y,m,h,d;this.e1=this.e2=-1,s&&(f=t[l-2],d=t[u].sub(f)._unit()._perp());for(let g=u;g<l;g++){if(m=g===l-1?s?t[u+1]:void 0:t[g+1],m&&t[g].equals(m))continue;d&&(h=d),f&&(y=f),f=t[g],d=m?m.sub(f)._unit()._perp():h,h=h||d;let v=h.add(d);(v.x!==0||v.y!==0)&&v._unit();let b=h.x*d.x+h.y*d.y,x=v.x*d.x+v.y*d.y,P=x!==0?1/x:1/0,w=2*Math.sqrt(2-2*x),A=x<vg&&y&&m,T=h.x*d.y-h.y*d.x>0;if(A&&g>u){let _=f.dist(y);if(_>2*c){let F=f.sub(f.sub(y)._mult(c/_)._round());this.updateDistance(y,F),this.addCurrentVertex(F,h,0,0,p),y=F}}let I=y&&m,E=I?n:s?"butt":i;if(I&&E==="round"&&(P<a?E="miter":P<=2&&(E="fakeround")),E==="miter"&&P>o&&(E="bevel"),E==="bevel"&&(P>2&&(E="flipbevel"),P<o&&(E="miter")),y&&this.updateDistance(y,f),E==="miter")v._mult(P),this.addCurrentVertex(f,v,0,0,p);else if(E==="flipbevel"){if(P>100)v=d.mult(-1);else{let _=P*h.add(d).mag()/h.sub(d).mag();v._perp()._mult(_*(T?-1:1))}this.addCurrentVertex(f,v,0,0,p),this.addCurrentVertex(f,v.mult(-1),0,0,p)}else if(E==="bevel"||E==="fakeround"){let _=-Math.sqrt(P*P-1),F=T?_:0,M=T?0:_;if(y&&this.addCurrentVertex(f,h,F,M,p),E==="fakeround"){let B=Math.round(w*180/Math.PI/Sg);for(let C=1;C<B;C++){let O=C/B;if(O!==.5){let K=O-.5,Y=1.0904+b*(-3.2452+b*(3.55645-b*1.43519)),Q=.848013+b*(-1.06021+b*.215638);O=O+O*K*(O-1)*(Y*K*K+Q)}let N=d.sub(h)._mult(O)._add(h)._unit()._mult(T?-1:1);this.addHalfVertex(f,N.x,N.y,!1,T,0,p)}}m&&this.addCurrentVertex(f,d,-F,-M,p)}else if(E==="butt")this.addCurrentVertex(f,v,0,0,p);else if(E==="square"){let _=y?1:-1;this.addCurrentVertex(f,v,_,_,p)}else E==="round"&&(y&&(this.addCurrentVertex(f,h,0,0,p),this.addCurrentVertex(f,h,1,1,p,!0)),m&&(this.addCurrentVertex(f,d,-1,-1,p,!0),this.addCurrentVertex(f,d,0,0,p)));if(A&&g<l-1){let _=f.dist(m);if(_>2*c){let F=f.add(m.sub(f)._mult(c/_)._round());this.updateDistance(f,F),this.addCurrentVertex(F,d,0,0,p),f=F}}}}addCurrentVertex(t,r,n,i,o,a=!1){let s=r.x+r.y*n,l=r.y-r.x*n,u=-r.x+r.y*i,c=-r.y-r.x*i;this.addHalfVertex(t,s,l,a,!1,n,o),this.addHalfVertex(t,u,c,a,!0,-i,o),this.distance>jc/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,n,i,o,a))}addHalfVertex({x:t,y:r},n,i,o,a,s,l){let c=(this.lineClips?this.scaledDistance*(jc-1):this.scaledDistance)*Jc;if(this.layoutVertexArray.emplaceBack((t<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(qc*n)+128,Math.round(qc*i)+128,(s===0?0:s<0?-1:1)+1|(c&63)<<2,c>>6),this.lineClips){let f=this.scaledDistance-this.lineClips.start,y=this.lineClips.end-this.lineClips.start,m=f/y;this.layoutVertexArray2.emplaceBack(m,this.lineClipsArray.length)}let p=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,p),l.primitiveLength++),a?this.e2=p:this.e1=p}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}};k("LineBucket",Xt,{omit:["layers","patternFeatures"]});var Wc,Ag=()=>Wc=Wc||new ie({"line-cap":new z(S.layout_line["line-cap"]),"line-join":new R(S.layout_line["line-join"]),"line-miter-limit":new z(S.layout_line["line-miter-limit"]),"line-round-limit":new z(S.layout_line["line-round-limit"]),"line-sort-key":new R(S.layout_line["line-sort-key"])}),Hc,_g=()=>Hc=Hc||new ie({"line-opacity":new R(S.paint_line["line-opacity"]),"line-color":new R(S.paint_line["line-color"]),"line-translate":new z(S.paint_line["line-translate"]),"line-translate-anchor":new z(S.paint_line["line-translate-anchor"]),"line-width":new R(S.paint_line["line-width"]),"line-gap-width":new R(S.paint_line["line-gap-width"]),"line-offset":new R(S.paint_line["line-offset"]),"line-blur":new R(S.paint_line["line-blur"]),"line-dasharray":new Ot(S.paint_line["line-dasharray"]),"line-pattern":new st(S.paint_line["line-pattern"]),"line-gradient":new Nt(S.paint_line["line-gradient"])}),vs={get paint(){return _g()},get layout(){return Ag()}};var Ps=class extends R{possiblyEvaluate(r,n){return n=new q(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),super.possiblyEvaluate(r,n)}evaluate(r,n,i,o){return n=Ae({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(r,n,i,o)}},Mo,Lo=class extends le{constructor(r){super(r,vs);this.gradientVersion=0,Mo||(Mo=new Ps(vs.paint.properties["line-width"].specification),Mo.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){let n=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=n._styleExpression.expression instanceof lr,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(r,n){super.recalculate(r,n),this.paint._values["line-floorwidth"]=Mo.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new Xt(r)}queryRadius(r){let n=r,i=Kc(Zt("line-width",this,n),Zt("line-gap-width",this,n)),o=Zt("line-offset",this,n);return i/2+Math.abs(o)+At(this.paint.get("line-translate"))}queryIntersectsFeature(r,n,i,o,a,s,l){let u=_t(r,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,l),c=l/2*Kc(this.paint.get("line-width").evaluate(n,i),this.paint.get("line-gap-width").evaluate(n,i)),p=this.paint.get("line-offset").evaluate(n,i);return p&&(o=Zu(o,p*l)),qu(u,o,c)}isTileClipped(){return!0}};function Kc(e,t){return t>0?t+2*e:e}var Yc=ee([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Xc=ee([{name:"a_projected_pos",components:3,type:"Float32"}],4),SS=ee([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Qc=ee([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),wS=ee([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Ss=ee([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),AS=ee([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),_S=ee([{name:"triangle",components:3,type:"Uint16"}]),IS=ee([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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"}]),CS=ee([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),kS=ee([{type:"Float32",name:"offsetX"}]),TS=ee([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var Jn=Z(he(),1);function Ig(e,t,r){let n=t.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?e=e.toLocaleUpperCase():n==="lowercase"&&(e=e.toLocaleLowerCase()),ae.applyArabicShaping&&(e=ae.applyArabicShaping(e)),e}function ep(e,t,r){return e.sections.forEach(n=>{n.text=Ig(n.text,t,r)}),e}function tp(e){let t={},r={},n=[],i=0;function o(u){n.push(e[u]),i++}function a(u,c,p){let f=r[u];return delete r[u],r[c]=f,n[f].geometry[0].pop(),n[f].geometry[0]=n[f].geometry[0].concat(p[0]),f}function s(u,c,p){let f=t[c];return delete t[c],t[u]=f,n[f].geometry[0].shift(),n[f].geometry[0]=p[0].concat(n[f].geometry[0]),f}function l(u,c,p){let f=p?c[0][c[0].length-1]:c[0][0];return"".concat(u,":").concat(f.x,":").concat(f.y)}for(let u=0;u<e.length;u++){let c=e[u],p=c.geometry,f=c.text?c.text.toString():null;if(!f){o(u);continue}let y=l(f,p),m=l(f,p,!0);if(y in r&&m in t&&r[y]!==t[m]){let h=s(y,m,p),d=a(y,m,n[h].geometry);delete t[y],delete r[m],r[l(f,n[d].geometry,!0)]=d,n[h].geometry=null}else y in r?a(y,m,p):m in t?s(y,m,p):(o(u),t[y]=i-1,r[m]=i-1)}return n.filter(u=>u.geometry)}var Ir={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function rp(e){let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r+1)||null,i=e.charCodeAt(r-1)||null;(!n||!Ka(n)||Ir[e[r+1]])&&(!i||!Ka(i)||Ir[e[r-1]])&&Ir[e[r]]?t+=Ir[e[r]]:t+=e[r]}return t}var ue=24;var qg=Z($n(),1),jg=3;var Bo=jg;function Gn(e){let t=0,r=0;for(let s of e)t+=s.w*s.h,r=Math.max(r,s.w);e.sort((s,l)=>l.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],o=0,a=0;for(let s of e)for(let l=i.length-1;l>=0;l--){let u=i[l];if(!(s.w>u.w||s.h>u.h)){if(s.x=u.x,s.y=u.y,a=Math.max(a,s.y+s.h),o=Math.max(o,s.x+s.w),s.w===u.w&&s.h===u.h){let c=i.pop();l<i.length&&(i[l]=c)}else s.h===u.h?(u.x+=s.w,u.w-=s.w):s.w===u.w?(u.y+=s.h,u.h-=s.h):(i.push({x:u.x+s.w,y:u.y,w:u.w-s.w,h:s.h}),u.y+=s.h,u.h-=s.h);break}}return{w:o,h:a,fill:t/(o*a)||0}}var ge=1;var zo=class{constructor(t,{pixelRatio:r,version:n,stretchX:i,stretchY:o,content:a}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n}get tl(){return[this.paddedRect.x+ge,this.paddedRect.y+ge]}get br(){return[this.paddedRect.x+this.paddedRect.w-ge,this.paddedRect.y+this.paddedRect.h-ge]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-ge*2)/this.pixelRatio,(this.paddedRect.h-ge*2)/this.pixelRatio]}},qn=class{constructor(t,r){let n={},i={};this.haveRenderCallbacks=[];let o=[];this.addImages(t,n,o),this.addImages(r,i,o);let{w:a,h:s}=Gn(o),l=new de({width:a||1,height:s||1});for(let u in t){let c=t[u],p=n[u].paddedRect;de.copy(c.data,l,{x:0,y:0},{x:p.x+ge,y:p.y+ge},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,f=p.x+ge,y=p.y+ge,m=c.data.width,h=c.data.height;de.copy(c.data,l,{x:0,y:0},{x:f,y},c.data),de.copy(c.data,l,{x:0,y:h-1},{x:f,y:y-1},{width:m,height:1}),de.copy(c.data,l,{x:0,y:0},{x:f,y:y+h},{width:m,height:1}),de.copy(c.data,l,{x:m-1,y:0},{x:f-1,y},{width:1,height:h}),de.copy(c.data,l,{x:0,y:0},{x:f+m,y},{width:1,height:h})}this.image=l,this.iconPositions=n,this.patternPositions=i}addImages(t,r,n){for(let i in t){let o=t[i],a={x:0,y:0,w:o.data.width+2*ge,h:o.data.height+2*ge};n.push(a),r[i]=new zo(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in t.updatedImages)this.patchUpdatedImage(this.iconPositions[n],t.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],t.getImage(n),r)}patchUpdatedImage(t,r,n){if(!t||!r||t.version===r.version)return;t.version=r.version;let[i,o]=t.tl;n.update(r.data,void 0,{x:i,y:o})}};k("ImagePosition",zo);k("ImageAtlas",qn);var No=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(No||{}),Tr=-17;function Zg(e){for(let t of e)if(t.positionedGlyphs.length!==0)return!1;return!0}var up=57344,cp=63743,Ro=class e{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,r){let n=new e;return n.scale=t||1,n.fontStack=r,n}static forImage(t){let r=new e;return r.imageName=t,r}},jn=class e{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){let n=new e;for(let i=0;i<t.sections.length;i++){let o=t.sections[i];o.image?n.addImageSection(o):n.addTextSection(o,r)}return n}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=rp(this.text)}trim(){let t=0;for(let n=0;n<this.text.length&&Oo[this.text.charCodeAt(n)];n++)t++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=t&&Oo[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){let n=new e;return n.text=this.text.substring(t,r),n.sectionIndex=this.sectionIndex.slice(t,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(Ro.forText(t.scale,t.fontStack||r));let n=this.sections.length-1;for(let i=0;i<t.text.length;++i)this.sectionIndex.push(n)}addImageSection(t){let r=t.image?t.image.name:"";if(r.length===0){ce("Can\'t add FormattedSection with an empty image.");return}let n=this.getNextImageSectionCharCode();if(!n){ce("Reached maximum number of images ".concat(cp-up+2));return}this.text+=String.fromCharCode(n),this.sections.push(Ro.forImage(r)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=cp?null:++this.imageSectionID:(this.imageSectionID=up,this.imageSectionID)}};function Jg(e,t){let r=[],n=e.text,i=0;for(let o of t)r.push(e.substring(i,o)),i=o;return i<n.length&&r.push(e.substring(i,n.length)),r}function Zn(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m,h){let d=jn.fromFeature(e,i);p===2&&d.verticalizePunctuation();let g,{processBidirectionalText:v,processStyledBidirectionalText:b}=ae;if(v&&d.sections.length===1){g=[];let w=v(d.toString(),_s(d,u,o,t,n,y,m));for(let A of w){let T=new jn;T.text=A,T.sections=d.sections;for(let I=0;I<A.length;I++)T.sectionIndex.push(0);g.push(T)}}else if(b){g=[];let w=b(d.text,d.sectionIndex,_s(d,u,o,t,n,y,m));for(let A of w){let T=new jn;T.text=A[0],T.sectionIndex=A[1],T.sections=d.sections,g.push(T)}}else g=Jg(d,_s(d,u,o,t,n,y,m));let x=[],P={positionedLines:x,text:d.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return Yg(P,t,r,n,g,a,s,l,p,u,f,h),Zg(x)?!1:P}var Oo={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Wg={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 yp(e,t,r,n,i,o){if(t.imageName){let a=n[t.imageName];return a?a.displaySize[0]*t.scale*ue/o+i:0}else{let a=r[t.fontStack],s=a&&a[e];return s?s.metrics.advance*t.scale+i:0}}function Hg(e,t,r,n,i,o){let a=0;for(let l=0;l<e.length();l++){let u=e.getSection(l);a+=yp(e.getCharCode(l),u,n,i,t,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function pp(e,t,r,n){let i=Math.pow(e-t,2);return n?e<t?i/2:i*2:i+Math.abs(r)*r}function Kg(e,t,r){let n=0;return e===10&&(n-=1e4),r&&(n+=150),(e===40||e===65288)&&(n+=50),(t===41||t===65289)&&(n+=50),n}function fp(e,t,r,n,i,o){let a=null,s=pp(t,r,i,o);for(let l of n){let u=t-l.x,c=pp(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:e,x:t,priorBreak:a,badness:s}}function mp(e){return e?mp(e.priorBreak).concat(e.index):[]}function _s(e,t,r,n,i,o,a){if(o!=="point")return[];if(!e)return[];let s=[],l=Hg(e,t,r,n,i,a),u=e.text.indexOf("\\u200B")>=0,c=0;for(let p=0;p<e.length();p++){let f=e.getSection(p),y=e.getCharCode(p);if(Oo[y]||(c+=yp(y,f,n,i,t,a)),p<e.length()-1){let m=Au(y);(Wg[y]||m||f.imageName)&&s.push(fp(p+1,c,l,s,Kg(y,e.getCharCode(p+1),m&&u),!1))}}return mp(fp(e.length(),c,l,s,0,!0))}function hp(e){let t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0;break}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0;break}return{horizontalAlign:t,verticalAlign:r}}function Yg(e,t,r,n,i,o,a,s,l,u,c,p){let f=0,y=Tr,m=0,h=0,d=s==="right"?1:s==="left"?0:.5,g=0;for(let P of i){P.trim();let w=P.getMaxScale(),A=(w-1)*ue,T={positionedGlyphs:[],lineOffset:0};e.positionedLines[g]=T;let I=T.positionedGlyphs,E=0;if(!P.length()){y+=o,++g;continue}for(let F=0;F<P.length();F++){let M=P.getSection(F),B=P.getSectionIndex(F),C=P.getCharCode(F),O=0,N=null,K=null,Y=null,Q=ue,ye=!(l===1||!c&&!Ui(C)||c&&(Oo[C]||_u(C)));if(M.imageName){let _e=n[M.imageName];if(!_e)continue;Y=M.imageName,e.iconsInText=e.iconsInText||!0,K=_e.paddedRect;let re=_e.displaySize;M.scale=M.scale*ue/p,N={width:re[0],height:re[1],left:ge,top:-Bo,advance:ye?re[1]:re[0]};let Pe=ue-re[1]*M.scale;O=A+Pe,Q=N.advance;let $e=ye?re[0]*M.scale-ue*w:re[1]*M.scale-ue*w;$e>0&&$e>E&&(E=$e)}else{let _e=r[M.fontStack],re=_e&&_e[C];if(re&&re.rect)K=re.rect,N=re.metrics;else{let Pe=t[M.fontStack],$e=Pe&&Pe[C];if(!$e)continue;N=$e.metrics}O=(w-M.scale)*ue}ye?(e.verticalizable=!0,I.push({glyph:C,imageName:Y,x:f,y:y+O,vertical:ye,scale:M.scale,fontStack:M.fontStack,sectionIndex:B,metrics:N,rect:K}),f+=Q*M.scale+u):(I.push({glyph:C,imageName:Y,x:f,y:y+O,vertical:ye,scale:M.scale,fontStack:M.fontStack,sectionIndex:B,metrics:N,rect:K}),f+=N.advance*M.scale+u)}if(I.length!==0){let F=f-u;m=Math.max(F,m),Xg(I,0,I.length-1,d,E)}f=0;let _=o*w+E;T.lineOffset=Math.max(E,A),y+=_,h=Math.max(_,h),++g}let v=y-Tr,{horizontalAlign:b,verticalAlign:x}=hp(a);Qg(e.positionedLines,d,b,x,m,h,o,v,i.length),e.top+=-x*v,e.bottom=e.top+v,e.left+=-b*m,e.right=e.left+m}function Xg(e,t,r,n,i){if(!n&&!i)return;let o=e[r],a=o.metrics.advance*o.scale,s=(e[r].x+a)*n;for(let l=t;l<=r;l++)e[l].x-=s,e[l].y+=i}function Qg(e,t,r,n,i,o,a,s,l){let u=(t-r)*i,c=0;o!==a?c=-s*n-Tr:c=(-n*l+.5)*a;for(let p of e)for(let f of p.positionedGlyphs)f.x+=u,f.y+=c}function dp(e,t,r){let{horizontalAlign:n,verticalAlign:i}=hp(r),o=t[0],a=t[1],s=o-e.displaySize[0]*n,l=s+e.displaySize[0],u=a-e.displaySize[1]*i,c=u+e.displaySize[1];return{image:e,top:u,bottom:c,left:s,right:l}}function Is(e,t,r,n,i,o){let a=e.image,s;if(a.content){let d=a.content,g=a.pixelRatio||1;s=[d[0]/g,d[1]/g,a.displaySize[0]-d[2]/g,a.displaySize[1]-d[3]/g]}let l=t.left*o,u=t.right*o,c,p,f,y;r==="width"||r==="both"?(y=i[0]+l-n[3],p=i[0]+u+n[1]):(y=i[0]+(l+u-a.displaySize[0])/2,p=y+a.displaySize[0]);let m=t.top*o,h=t.bottom*o;return r==="height"||r==="both"?(c=i[1]+m-n[0],f=i[1]+h+n[2]):(c=i[1]+(m+h-a.displaySize[1])/2,f=c+a.displaySize[1]),{image:a,top:c,right:p,bottom:f,left:y,collisionPadding:s}}var gp=Z(It(),1);var Er=255,Ct=128,Qe=Er*Ct;function Cs(e,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new q(e+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:n,interpolationType:i}=r,o=0;for(;o<n.length&&n[o]<=e;)o++;o=Math.max(0,o-1);let a=o;for(;a<n.length&&n[a]<e+1;)a++;a=Math.min(n.length-1,a);let s=n[o],l=n[a];if(r.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i};let u=r.evaluate(new q(s)),c=r.evaluate(new q(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:i}}}function ks(e,t,r){let n="never",i=e.get(t);return i?n=i:e.get(r)&&(n="always"),n}var ex=gp.default.VectorTileFeature.types,tx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Uo(e,t,r,n,i,o,a,s,l,u,c,p,f){let y=s?Math.min(Qe,Math.round(s[0])):0,m=s?Math.min(Qe,Math.round(s[1])):0;e.emplaceBack(t,r,Math.round(n*32),Math.round(i*32),o,a,(y<<1)+(l?1:0),m,u*16,c*16,p*256,f*256)}function xp(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}function rx(e){for(let t of e.sections)if(Cu(t.text))return!0;return!1}var Wn=class{constructor(t){this.layoutVertexArray=new lo,this.indexArray=new Le,this.programConfigurations=t,this.segments=new me,this.dynamicLayoutVertexArray=new uo,this.opacityVertexArray=new co,this.hasVisibleVertices=!1,this.placedSymbolArray=new wn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,n,i){this.isEmpty()||(n&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Yc.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Xc.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,tx,!0),this.opacityVertexBuffer.itemSize=1),(n||i)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};k("SymbolBuffers",Wn);var Hn=class{constructor(t,r,n){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new n,this.segments=new me,this.collisionVertexArray=new po}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Qc.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};k("CollisionBuffers",Hn);var We=class{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(l=>l.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Dn.identity([]),this.placementViewportMatrix=Dn.identity([]);let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Cs(this.zoom,n["text-size"]),this.iconSizeData=Cs(this.zoom,n["icon-size"]);let i=this.layers[0].layout,o=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=ks(i,"text-overlap","text-allow-overlap")!=="never"||ks(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!o.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(l=>No[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=t.sourceID}createArrays(){this.text=new Wn(new ke(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Wn(new ke(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new _n,this.lineVertexArray=new In,this.symbolInstances=new An}calculateGlyphDependencies(t,r,n,i,o){for(let a=0;a<t.length;a++)if(r[t.charCodeAt(a)]=!0,(n||i)&&o){let s=Ir[t.charAt(a)];s&&(r[s.charCodeAt(0)]=!0)}}populate(t,r,n){let i=this.layers[0],o=i.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),u=(s.value.kind!=="constant"||s.value.value instanceof Me&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),c=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let f=r.iconDependencies,y=r.glyphDependencies,m=r.availableImages,h=new q(this.zoom);for(let{feature:d,id:g,index:v,sourceLayerIndex:b}of t){let x=i._featureFilter.needGeometry,P=Oe(d,x);if(!i._featureFilter.filter(h,P,n))continue;x||(P.geometry=Te(d));let w;if(u){let E=i.getValueAndResolveTokens("text-field",P,n,m),_=Me.factory(E);rx(_)&&(this.hasRTLText=!0),(!this.hasRTLText||Eu()==="unavailable"||this.hasRTLText&&ae.isParsed())&&(w=ep(_,i,P))}let A;if(c){let E=i.getValueAndResolveTokens("icon-image",P,n,m);E instanceof Ce?A=E:A=Ce.fromString(E)}if(!w&&!A)continue;let T=this.sortFeaturesByKey?p.evaluate(P,{},n):void 0,I={id:g,text:w,icon:A,index:v,sourceLayerIndex:b,geometry:P.geometry,properties:d.properties,type:ex[d.type],sortKey:T};if(this.features.push(I),A&&(f[A.name]=!0),w){let E=a.evaluate(P,{},n).join(","),_=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let F of w.sections)if(F.image)f[F.image.name]=!0;else{let M=on(w.toString()),B=F.fontStack||E,C=y[B]=y[B]||{};this.calculateGlyphDependencies(F.text,C,_,this.allowVerticalPlacement,M)}}}o.get("symbol-placement")==="line"&&(this.features=tp(this.features)),this.sortFeaturesByKey&&this.features.sort((d,g)=>d.sortKey-g.sortKey)}update(t,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,r){let n=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(r[t.segment+1]),o=t.dist(r[t.segment]),a={};for(let s=t.segment+1;s<r.length;s++)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:i},s<r.length-1&&(i+=r[s+1].dist(r[s]));for(let s=t.segment||0;s>=0;s--)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=r[s-1].dist(r[s]));for(let s=0;s<r.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,r,n,i,o,a,s,l,u,c,p,f){let y=t.indexArray,m=t.layoutVertexArray,h=t.segments.prepareSegment(4*r.length,m,y,this.canOverlap?a.sortKey:void 0),d=this.glyphOffsetArray.length,g=h.vertexLength,v=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let x=0;x<r.length;x++){let{tl:P,tr:w,bl:A,br:T,tex:I,pixelOffsetTL:E,pixelOffsetBR:_,minFontScaleX:F,minFontScaleY:M,glyphOffset:B,isSDF:C,sectionIndex:O}=r[x],N=h.vertexLength,K=B[1];Uo(m,l.x,l.y,P.x,K+P.y,I.x,I.y,n,C,E.x,E.y,F,M),Uo(m,l.x,l.y,w.x,K+w.y,I.x+I.w,I.y,n,C,_.x,E.y,F,M),Uo(m,l.x,l.y,A.x,K+A.y,I.x,I.y+I.h,n,C,E.x,_.y,F,M),Uo(m,l.x,l.y,T.x,K+T.y,I.x+I.w,I.y+I.h,n,C,_.x,_.y,F,M),xp(t.dynamicLayoutVertexArray,l,v),y.emplaceBack(N,N+1,N+2),y.emplaceBack(N+1,N+2,N+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(B[0]),(x===r.length-1||O!==r[x+1].sectionIndex)&&t.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,b&&b[O])}t.placedSymbolArray.emplaceBack(l.x,l.y,d,this.glyphOffsetArray.length-d,g,u,c,l.segment,n?n[0]:0,n?n[1]:0,i[0],i[1],s,0,!1,0,p)}_addCollisionDebugVertex(t,r,n,i,o,a){return r.emplaceBack(0,0),t.emplaceBack(n.x,n.y,i,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(t,r,n,i,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,c=o.layoutVertexArray,p=o.collisionVertexArray,f=s.anchorX,y=s.anchorY;this._addCollisionDebugVertex(c,p,a,f,y,new Jn.default(t,r)),this._addCollisionDebugVertex(c,p,a,f,y,new Jn.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new Jn.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new Jn.default(t,i)),l.vertexLength+=4;let m=o.indexArray;m.emplaceBack(u,u+1),m.emplaceBack(u+1,u+2),m.emplaceBack(u+2,u+3),m.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(t,r,n,i){for(let o=t;o<r;o++){let a=this.collisionBoxArray.get(o),s=a.x1,l=a.y1,u=a.x2,c=a.y2;this.addCollisionDebugVertices(s,l,u,c,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Hn(kn,Ss.members,St),this.iconCollisionBox=new Hn(kn,Ss.members,St);for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,n,i,o,a,s,l,u){let c={};for(let p=r;p<n;p++){let f=t.get(p);c.textBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.textFeatureIndex=f.featureIndex;break}for(let p=i;p<o;p++){let f=t.get(p);c.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalTextFeatureIndex=f.featureIndex;break}for(let p=a;p<s;p++){let f=t.get(p);c.iconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.iconFeatureIndex=f.featureIndex;break}for(let p=l;p<u;p++){let f=t.get(p);c.verticalIconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalIconFeatureIndex=f.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,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}addIndicesForPlacedSymbol(t,r){let n=t.placedSymbolArray.get(r),i=n.vertexStartIndex+n.numGlyphs*4;for(let o=n.vertexStartIndex;o<i;o+=4)t.indexArray.emplaceBack(o,o+1,o+2),t.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(t),n=Math.cos(t),i=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);i.push(Math.round(r*l.anchorX+n*l.anchorY)|0),o.push(l.featureIndex)}return a.sort((s,l)=>i[s]-i[l]||o[l]-o[s]),a}addToSortKeyRanges(t,r){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((i,o,a)=>{i>=0&&a.indexOf(i)===o&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};k("SymbolBucket",We,{omit:["layers","collisionBoxArray","features","compareText"]});We.MAX_GLYPHS=65535;We.addDynamicAttributes=xp;function bp(e,t){return t.replace(/{([^{}]+)}/g,(r,n)=>n in e?String(e[n]):"")}var vp,nx=()=>vp=vp||new ie({"symbol-placement":new z(S.layout_symbol["symbol-placement"]),"symbol-spacing":new z(S.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new z(S.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new R(S.layout_symbol["symbol-sort-key"]),"symbol-z-order":new z(S.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new z(S.layout_symbol["icon-allow-overlap"]),"icon-overlap":new z(S.layout_symbol["icon-overlap"]),"icon-ignore-placement":new z(S.layout_symbol["icon-ignore-placement"]),"icon-optional":new z(S.layout_symbol["icon-optional"]),"icon-rotation-alignment":new z(S.layout_symbol["icon-rotation-alignment"]),"icon-size":new R(S.layout_symbol["icon-size"]),"icon-text-fit":new z(S.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new z(S.layout_symbol["icon-text-fit-padding"]),"icon-image":new R(S.layout_symbol["icon-image"]),"icon-rotate":new R(S.layout_symbol["icon-rotate"]),"icon-padding":new R(S.layout_symbol["icon-padding"]),"icon-keep-upright":new z(S.layout_symbol["icon-keep-upright"]),"icon-offset":new R(S.layout_symbol["icon-offset"]),"icon-anchor":new R(S.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new z(S.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new z(S.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new z(S.layout_symbol["text-rotation-alignment"]),"text-field":new R(S.layout_symbol["text-field"]),"text-font":new R(S.layout_symbol["text-font"]),"text-size":new R(S.layout_symbol["text-size"]),"text-max-width":new R(S.layout_symbol["text-max-width"]),"text-line-height":new z(S.layout_symbol["text-line-height"]),"text-letter-spacing":new R(S.layout_symbol["text-letter-spacing"]),"text-justify":new R(S.layout_symbol["text-justify"]),"text-radial-offset":new R(S.layout_symbol["text-radial-offset"]),"text-variable-anchor":new z(S.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new R(S.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new R(S.layout_symbol["text-anchor"]),"text-max-angle":new z(S.layout_symbol["text-max-angle"]),"text-writing-mode":new z(S.layout_symbol["text-writing-mode"]),"text-rotate":new R(S.layout_symbol["text-rotate"]),"text-padding":new z(S.layout_symbol["text-padding"]),"text-keep-upright":new z(S.layout_symbol["text-keep-upright"]),"text-transform":new R(S.layout_symbol["text-transform"]),"text-offset":new R(S.layout_symbol["text-offset"]),"text-allow-overlap":new z(S.layout_symbol["text-allow-overlap"]),"text-overlap":new z(S.layout_symbol["text-overlap"]),"text-ignore-placement":new z(S.layout_symbol["text-ignore-placement"]),"text-optional":new z(S.layout_symbol["text-optional"])}),Pp,ix=()=>Pp=Pp||new ie({"icon-opacity":new R(S.paint_symbol["icon-opacity"]),"icon-color":new R(S.paint_symbol["icon-color"]),"icon-halo-color":new R(S.paint_symbol["icon-halo-color"]),"icon-halo-width":new R(S.paint_symbol["icon-halo-width"]),"icon-halo-blur":new R(S.paint_symbol["icon-halo-blur"]),"icon-translate":new z(S.paint_symbol["icon-translate"]),"icon-translate-anchor":new z(S.paint_symbol["icon-translate-anchor"]),"text-opacity":new R(S.paint_symbol["text-opacity"]),"text-color":new R(S.paint_symbol["text-color"],{runtimeType:ze,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new R(S.paint_symbol["text-halo-color"]),"text-halo-width":new R(S.paint_symbol["text-halo-width"]),"text-halo-blur":new R(S.paint_symbol["text-halo-blur"]),"text-translate":new z(S.paint_symbol["text-translate"]),"text-translate-anchor":new z(S.paint_symbol["text-translate-anchor"])}),$o={get paint(){return ix()},get layout(){return nx()}};var Kn=class{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:cr,this.defaultValue=t}evaluate(t){if(t.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let r=this.defaultValue.value;t(r._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};k("FormatSectionOverride",Kn,{omit:["defaultValue"]});var Go=class e extends le{constructor(r){super(r,$o)}recalculate(r,n){if(super.recalculate(r,n),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let i=this.layout.get("text-writing-mode");if(i){let o=[];for(let a of i)o.indexOf(a)<0&&o.push(a);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(r,n,i,o){let a=this.layout.get(r).evaluate(n,{},i,o),s=this._unevaluatedLayout._values[r];return!s.isDataDriven()&&!en(s.value)&&a?bp(n.properties,a):a}createBucket(r){return new We(r)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let r of $o.paint.overridableProperties){if(!e.hasPaintOverride(this.layout,r))continue;let n=this.paint.get(r),i=new Kn(n),o=new Dt(i,n.property.specification),a=null;n.value.kind==="constant"||n.value.kind==="source"?a=new dt("source",o):a=new gt("composite",o,n.value.zoomStops),this.paint._values[r]=new be(n.property,a,n.parameters)}}_handleOverridablePaintPropertyUpdate(r,n,i){return!this.layout||n.isDataDriven()||i.isDataDriven()?!1:e.hasPaintOverride(this.layout,r)}static hasPaintOverride(r,n){let i=r.get("text-field"),o=$o.paint.properties[n],a=!1,s=l=>{for(let u of l)if(o.overrides&&o.overrides.hasOverride(u)){a=!0;return}};if(i.value.kind==="constant"&&i.value.value instanceof Me)s(i.value.value.sections);else if(i.value.kind==="source"){let l=c=>{if(!a)if(c instanceof mt&&fe(c.value)===pr){let p=c.value;s(p.sections)}else c instanceof Hr?s(c.sections):c.eachChild(l)},u=i.value;u._styleExpression&&l(u._styleExpression.expression)}return a}};function Sp(e,t,r,n=1){let i=e.get("icon-padding").evaluate(t,{},r),o=i&&i.values;return[o[0]*n,o[1]*n,o[2]*n,o[3]*n]}var wp,ox=()=>wp=wp||new ie({"background-color":new z(S.paint_background["background-color"]),"background-pattern":new Ot(S.paint_background["background-pattern"]),"background-opacity":new z(S.paint_background["background-opacity"])}),Ap={get paint(){return ox()}};var qo=class extends le{constructor(r){super(r,Ap)}};var _p,ax=()=>_p=_p||new ie({"raster-opacity":new z(S.paint_raster["raster-opacity"]),"raster-hue-rotate":new z(S.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new z(S.paint_raster["raster-brightness-min"]),"raster-brightness-max":new z(S.paint_raster["raster-brightness-max"]),"raster-saturation":new z(S.paint_raster["raster-saturation"]),"raster-contrast":new z(S.paint_raster["raster-contrast"]),"raster-resampling":new z(S.paint_raster["raster-resampling"]),"raster-fade-duration":new z(S.paint_raster["raster-fade-duration"])}),Ip={get paint(){return ax()}};var jo=class extends le{constructor(r){super(r,Ip)}};var Zo=class extends le{constructor(r){super(r,{});this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)};this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)};this.implementation=r}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function Cp(e){if(e.type==="custom")return new Zo(e);switch(e.type){case"background":return new qo(e);case"circle":return new Po(e);case"fill":return new ko(e);case"fill-extrusion":return new Fo(e);case"heatmap":return new So(e);case"hillshade":return new wo(e);case"line":return new Lo(e);case"raster":return new jo(e);case"symbol":return new Go(e)}}var Jo=class{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(t,r){for(let i of t){this._layerConfigs[i.id]=i;let o=this._layers[i.id]=Cp(i);o._featureFilter=tn(o.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(let i of r)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];this.familiesBySource={};let n=Ql(Object.values(this._layerConfigs),this.keyCache);for(let i of n){let o=i.map(p=>this._layers[p.id]),a=o[0];if(a.visibility==="none")continue;let s=a.source||"",l=this.familiesBySource[s];l||(l=this.familiesBySource[s]={});let u=a.sourceLayer||"_geojsonTileLayer",c=l[u];c||(c=l[u]=[]),c.push(o)}}};var Xp=Z(It(),1),Qp=Z($n(),1);var Fr=class{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){let n=t[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(t," can\'t be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[t]}};var Ep=Z(It(),1),Fp=Z($n(),1);var Wo=class{constructor(t,r,n,i,o){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=n,t._y=i,this.properties=t.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let r in this)r==="_geometry"||r==="_vectorTileFeature"||(t[r]=this[r]);return t}};var Yn=class{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Ft(8192,16,0),this.grid3D=new Ft(8192,16,0),this.featureIndexArray=new Cn,this.promoteId=r}insert(t,r,n,i,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,i,o);let l=a?this.grid3D:this.grid;for(let u=0;u<r.length;u++){let c=r[u],p=[1/0,1/0,-1/0,-1/0];for(let f=0;f<c.length;f++){let y=c[f];p[0]=Math.min(p[0],y.x),p[1]=Math.min(p[1],y.y),p[2]=Math.max(p[2],y.x),p[3]=Math.max(p[3],y.y)}p[0]<8192&&p[1]<8192&&p[2]>=0&&p[3]>=0&&l.insert(s,p[0],p[1],p[2],p[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ep.default.VectorTile(new Fp.default(this.rawTileData)).layers,this.sourceLayerCoder=new Fr(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,n,i){this.loadVTLayers();let o=t.params||{},a=8192/t.tileSize/t.scale,s=tn(o.filter),l=t.queryGeometry,u=t.queryPadding*a,c=Tp(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=Tp(t.cameraQueryGeometry),y=this.grid3D.query(f.minX-u,f.minY-u,f.maxX+u,f.maxY+u,(d,g,v,b)=>ju(t.cameraQueryGeometry,d-u,g-u,v+u,b+u));for(let d of y)p.push(d);p.sort(sx);let m={},h;for(let d=0;d<p.length;d++){let g=p[d];if(g===h)continue;h=g;let v=this.featureIndexArray.get(g),b=null;this.loadMatchingFeature(m,v.bucketIndex,v.sourceLayerIndex,v.featureIndex,s,o.layers,o.availableImages,r,n,i,(x,P,w)=>(b||(b=Te(x)),P.queryIntersectsFeature(l,x,w,b,this.z,t.transform,a,t.pixelPosMatrix)))}return m}loadMatchingFeature(t,r,n,i,o,a,s,l,u,c,p){let f=this.bucketLayerIDs[r];if(a&&!gl(a,f))return;let y=this.sourceLayerCoder.decode(n),h=this.vtLayers[y].feature(i);if(o.needGeometry){let g=Oe(h,!0);if(!o.filter(new q(this.tileID.overscaledZ),g,this.tileID.canonical))return}else if(!o.filter(new q(this.tileID.overscaledZ),h))return;let d=this.getId(h,y);for(let g=0;g<f.length;g++){let v=f[g];if(a&&a.indexOf(v)<0)continue;let b=l[v];if(!b)continue;let x={};d&&c&&(x=c.getState(b.sourceLayer||"_geojsonTileLayer",d));let P=Ae({},u[v]);P.paint=kp(P.paint,b.paint,h,x,s),P.layout=kp(P.layout,b.layout,h,x,s);let w=!p||p(h,b,x);if(!w)continue;let A=new Wo(h,this.z,this.x,this.y,d);A.layer=P;let T=t[v];T===void 0&&(T=t[v]=[]),T.push({featureIndex:i,feature:A,intersectionZ:w})}}lookupSymbolFeatures(t,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=tn(o);for(let p of t)this.loadMatchingFeature(u,n,i,p,c,a,s,l,r);return u}hasLayer(t){for(let r of this.bucketLayerIDs)for(let n of r)if(t===n)return!0;return!1}getId(t,r){let n=t.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[r];n=t.properties[i],typeof n=="boolean"&&(n=Number(n))}return n}};k("FeatureIndex",Yn,{omit:["rawTileData","sourceLayerCoder"]});function kp(e,t,r,n,i){return Rr(e,(o,a)=>{let s=t instanceof vt?t.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function Tp(e){let t=1/0,r=1/0,n=-1/0,i=-1/0;for(let o of e)t=Math.min(t,o.x),r=Math.min(r,o.y),n=Math.max(n,o.x),i=Math.max(i,o.y);return{minX:t,minY:r,maxX:n,maxY:i}}function sx(e,t){return t-e}var Mp=Z(he(),1);var et=class e extends Mp.default{constructor(r,n,i,o){super(r,n);this.angle=i,o!==void 0&&(this.segment=o)}clone(){return new e(this.x,this.y,this.angle,this.segment)}};k("Anchor",et);function Ts(e,t,r,n,i){if(t.segment===void 0||r===0)return!0;let o=t,a=t.segment+1,s=0;for(;s>-r/2;){if(a--,a<0)return!1;s-=e[a].dist(o),o=e[a]}s+=e[a].dist(e[a+1]),a++;let l=[],u=0;for(;s<r/2;){let c=e[a-1],p=e[a],f=e[a+1];if(!f)return!1;let y=c.angleTo(p)-p.angleTo(f);for(y=Math.abs((y+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:s,angleDelta:y}),u+=y;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=p.dist(f)}return!0}function Lp(e){let t=0;for(let r=0;r<e.length-1;r++)t+=e[r].dist(e[r+1]);return t}function Dp(e,t,r){return e?3/5*t*r:0}function Vp(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function Bp(e,t,r,n,i,o){let a=Dp(r,i,o),s=Vp(r,n)*o,l=0,u=Lp(e)/2;for(let c=0;c<e.length-1;c++){let p=e[c],f=e[c+1],y=p.dist(f);if(l+y>u){let m=(u-l)/y,h=Re.number(p.x,f.x,m),d=Re.number(p.y,f.y,m),g=new et(h,d,f.angleTo(p),c);return g._round(),!a||Ts(e,g,s,a,t)?g:void 0}l+=y}}function zp(e,t,r,n,i,o,a,s,l){let u=Dp(n,o,a),c=Vp(n,i),p=c*a,f=e[0].x===0||e[0].x===l||e[0].y===0||e[0].y===l;t-p<t/4&&(t=p+t/4);let y=o*2,m=f?t/2*s%t:(c/2+y)*a*s%t;return Rp(e,m,t,u,r,p,f,!1,l)}function Rp(e,t,r,n,i,o,a,s,l){let u=o/2,c=Lp(e),p=0,f=t-r,y=[];for(let m=0;m<e.length-1;m++){let h=e[m],d=e[m+1],g=h.dist(d),v=d.angleTo(h);for(;f+r<p+g;){f+=r;let b=(f-p)/g,x=Re.number(h.x,d.x,b),P=Re.number(h.y,d.y,b);if(x>=0&&x<l&&P>=0&&P<l&&f-u>=0&&f+u<=c){let w=new et(x,P,v,m);w._round(),(!n||Ts(e,w,o,n,i))&&y.push(w)}}p+=g}return!s&&!y.length&&!a&&(y=Rp(e,p/2,r,n,i,o,a,!0,l)),y}var ct=Z(he(),1);function Op(e,t,r,n,i){let o=[];for(let a=0;a<e.length;a++){let s=e[a],l;for(let u=0;u<s.length-1;u++){let c=s[u],p=s[u+1];c.x<t&&p.x<t||(c.x<t?c=new ct.default(t,c.y+(p.y-c.y)*((t-c.x)/(p.x-c.x)))._round():p.x<t&&(p=new ct.default(t,c.y+(p.y-c.y)*((t-c.x)/(p.x-c.x)))._round()),!(c.y<r&&p.y<r)&&(c.y<r?c=new ct.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new ct.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round()),!(c.x>=n&&p.x>=n)&&(c.x>=n?c=new ct.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new ct.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round()),!(c.y>=i&&p.y>=i)&&(c.y>=i?c=new ct.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new ct.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round()),(!l||!c.equals(l[l.length-1]))&&(l=[c],o.push(l)),l.push(p)))))}}return o}var ve=Z(he(),1);var Mr=ge;function Es(e,t,r,n){let i=[],o=e.image,a=o.pixelRatio,s=o.paddedRect.w-2*Mr,l=o.paddedRect.h-2*Mr,u=e.right-e.left,c=e.bottom-e.top,p=o.stretchX||[[0,s]],f=o.stretchY||[[0,l]],y=(_,F)=>_+F[1]-F[0],m=p.reduce(y,0),h=f.reduce(y,0),d=s-m,g=l-h,v=0,b=m,x=0,P=h,w=0,A=d,T=0,I=g;if(o.content&&n){let _=o.content;v=Ho(p,0,_[0]),x=Ho(f,0,_[1]),b=Ho(p,_[0],_[2]),P=Ho(f,_[1],_[3]),w=_[0]-v,T=_[1]-x,A=_[2]-_[0]-b,I=_[3]-_[1]-P}let E=(_,F,M,B)=>{let C=Ko(_.stretch-v,b,u,e.left),O=Yo(_.fixed-w,A,_.stretch,m),N=Ko(F.stretch-x,P,c,e.top),K=Yo(F.fixed-T,I,F.stretch,h),Y=Ko(M.stretch-v,b,u,e.left),Q=Yo(M.fixed-w,A,M.stretch,m),ye=Ko(B.stretch-x,P,c,e.top),_e=Yo(B.fixed-T,I,B.stretch,h),re=new ve.default(C,N),Pe=new ve.default(Y,N),$e=new ve.default(Y,ye),fi=new ve.default(C,ye),ya=new ve.default(O/a,K/a),ma=new ve.default(Q/a,_e/a),zr=t*Math.PI/180;if(zr){let xe=Math.sin(zr),He=Math.cos(zr),Ke=[He,-xe,xe,He];re._matMult(Ke),Pe._matMult(Ke),fi._matMult(Ke),$e._matMult(Ke)}let yi=_.stretch+_.fixed,ha=M.stretch+M.fixed,mi=F.stretch+F.fixed,Ee=B.stretch+B.fixed,tr={x:o.paddedRect.x+Mr+yi,y:o.paddedRect.y+Mr+mi,w:ha-yi,h:Ee-mi},hi=A/a/u,Se=I/a/c;return{tl:re,tr:Pe,bl:fi,br:$e,tex:tr,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ya,pixelOffsetBR:ma,minFontScaleX:hi,minFontScaleY:Se,isSDF:r}};if(!n||!o.stretchX&&!o.stretchY)i.push(E({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));else{let _=Np(p,d,m),F=Np(f,g,h);for(let M=0;M<_.length-1;M++){let B=_[M],C=_[M+1];for(let O=0;O<F.length-1;O++){let N=F[O],K=F[O+1];i.push(E(B,N,C,K))}}}return i}function Ho(e,t,r){let n=0;for(let i of e)n+=Math.max(t,Math.min(r,i[1]))-Math.max(t,Math.min(r,i[0]));return n}function Np(e,t,r){let n=[{fixed:-Mr,stretch:0}];for(let[i,o]of e){let a=n[n.length-1];n.push({fixed:i-a.stretch,stretch:a.stretch}),n.push({fixed:i-a.stretch,stretch:a.stretch+(o-i)})}return n.push({fixed:t+Mr,stretch:r}),n}function Ko(e,t,r,n){return e/t*r+n}function Yo(e,t,r,n){return e-t*r/n}function Up(e,t,r,n,i,o,a,s){let l=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(let c of t.positionedLines)for(let p of c.positionedGlyphs){if(!p.rect)continue;let f=p.rect||{},m=Bo+1,h=!0,d=1,g=0,v=(i||s)&&p.vertical,b=p.metrics.advance*p.scale/2;if(s&&t.verticalizable){let Y=(p.scale-1)*ue,Q=(ue-p.metrics.width*p.scale)/2;g=c.lineOffset/2-(p.imageName?-Q:Y)}if(p.imageName){let Y=a[p.imageName];h=Y.sdf,d=Y.pixelRatio,m=ge/d}let x=i?[p.x+b,p.y]:[0,0],P=i?[0,0]:[p.x+b+r[0],p.y+r[1]-g],w=[0,0];v&&(w=P,P=[0,0]);let A=(p.metrics.left-m)*p.scale-b+P[0],T=(-p.metrics.top-m)*p.scale+P[1],I=A+f.w*p.scale/d,E=T+f.h*p.scale/d,_=new ve.default(A,T),F=new ve.default(I,T),M=new ve.default(A,E),B=new ve.default(I,E);if(v){let Y=new ve.default(-b,b-Tr),Q=-Math.PI/2,ye=ue/2-b,_e=p.imageName?ye:0,re=new ve.default(5-Tr-ye,-_e),Pe=new ve.default(...w);_._rotateAround(Q,Y)._add(re)._add(Pe),F._rotateAround(Q,Y)._add(re)._add(Pe),M._rotateAround(Q,Y)._add(re)._add(Pe),B._rotateAround(Q,Y)._add(re)._add(Pe)}if(l){let Y=Math.sin(l),Q=Math.cos(l),ye=[Q,-Y,Y,Q];_._matMult(ye),F._matMult(ye),M._matMult(ye),B._matMult(ye)}let C=new ve.default(0,0),O=new ve.default(0,0),N=0,K=0;u.push({tl:_,tr:F,bl:M,br:B,tex:f,writingMode:t.writingMode,glyphOffset:x,sectionIndex:p.sectionIndex,isSDF:h,pixelOffsetTL:C,pixelOffsetBR:O,minFontScaleX:N,minFontScaleY:K})}return u}var Xn=Z(he(),1),Qt=class{constructor(t,r,n,i,o,a,s,l,u,c){if(this.boxStartIndex=t.length,u){let p=a.top,f=a.bottom,y=a.collisionPadding;y&&(p-=y[1],f+=y[3]);let m=f-p;m>0&&(m=Math.max(10,m),this.circleDiameter=m)}else{let p=a.top*s-l[0],f=a.bottom*s+l[2],y=a.left*s-l[3],m=a.right*s+l[1],h=a.collisionPadding;if(h&&(y-=h[0]*s,p-=h[1]*s,m+=h[2]*s,f+=h[3]*s),c){let d=new Xn.default(y,p),g=new Xn.default(m,p),v=new Xn.default(y,f),b=new Xn.default(m,f),x=c*Math.PI/180;d._rotate(x),g._rotate(x),v._rotate(x),b._rotate(x),y=Math.min(d.x,g.x,v.x,b.x),m=Math.max(d.x,g.x,v.x,b.x),p=Math.min(d.y,g.y,v.y,b.y),f=Math.max(d.y,g.y,v.y,b.y)}t.emplaceBack(r.x,r.y,y,p,m,f,n,i,o)}this.boxEndIndex=t.length}};var Qn=class{constructor(t=[],r=lx){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let t=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:r,compare:n}=this,i=r[t];for(;t>0;){let o=t-1>>1,a=r[o];if(n(i,a)>=0)break;r[t]=a,t=o}r[t]=i}_down(t){let{data:r,compare:n}=this,i=this.length>>1,o=r[t];for(;t<i;){let a=(t<<1)+1,s=r[a],l=a+1;if(l<this.length&&n(r[l],s)<0&&(a=l,s=r[l]),n(s,o)>=0)break;r[t]=s,t=a}r[t]=o}};function lx(e,t){return e<t?-1:e>t?1:0}var Fs=Z(he(),1);function $p(e,t=1,r=!1){let n=1/0,i=1/0,o=-1/0,a=-1/0,s=e[0];for(let h=0;h<s.length;h++){let d=s[h];(!h||d.x<n)&&(n=d.x),(!h||d.y<i)&&(i=d.y),(!h||d.x>o)&&(o=d.x),(!h||d.y>a)&&(a=d.y)}let l=o-n,u=a-i,c=Math.min(l,u),p=c/2,f=new Qn([],ux);if(c===0)return new Fs.default(n,i);for(let h=n;h<o;h+=c)for(let d=i;d<a;d+=c)f.push(new Lr(h+p,d+p,p,e));let y=px(e),m=f.length;for(;f.length;){let h=f.pop();(h.d>y.d||!y.d)&&(y=h,r&&console.log("found best %d after %d probes",Math.round(1e4*h.d)/1e4,m)),!(h.max-y.d<=t)&&(p=h.h/2,f.push(new Lr(h.p.x-p,h.p.y-p,p,e)),f.push(new Lr(h.p.x+p,h.p.y-p,p,e)),f.push(new Lr(h.p.x-p,h.p.y+p,p,e)),f.push(new Lr(h.p.x+p,h.p.y+p,p,e)),m+=4)}return r&&(console.log("num probes: ".concat(m)),console.log("best distance: ".concat(y.d))),y.p}function ux(e,t){return t.max-e.max}function Lr(e,t,r,n){this.p=new Fs.default(e,t),this.h=r,this.d=cx(this.p,n),this.max=this.d+this.h*Math.SQRT2}function cx(e,t){let r=!1,n=1/0;for(let i=0;i<t.length;i++){let o=t[i];for(let a=0,s=o.length,l=s-1;a<s;l=a++){let u=o[a],c=o[l];u.y>e.y!=c.y>e.y&&e.x<(c.x-u.x)*(e.y-u.y)/(c.y-u.y)+u.x&&(r=!r),n=Math.min(n,ls(e,u,c))}}return(r?1:-1)*Math.sqrt(n)}function px(e){let t=0,r=0,n=0,i=e[0];for(let o=0,a=i.length,s=a-1;o<a;s=o++){let l=i[o],u=i[s],c=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*c,n+=(l.y+u.y)*c,t+=c*3}return new Lr(r/t,n/t,0,e)}var Ms=Z(rs(),1);var Dr=7,Ls=Number.POSITIVE_INFINITY;function fx(e,t){function r(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.sqrt(2);switch(i){case"top-right":case"top-left":s=l-Dr;break;case"bottom-right":case"bottom-left":s=-l+Dr;break;case"bottom":s=-o+Dr;break;case"top":s=o-Dr;break}switch(i){case"top-right":case"bottom-right":a=-l;break;case"top-left":case"bottom-left":a=l;break;case"left":a=o;break;case"right":a=-o;break}return[a,s]}function n(i,o,a){let s=0,l=0;switch(o=Math.abs(o),a=Math.abs(a),i){case"top-right":case"top-left":case"top":l=a-Dr;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+Dr;break}switch(i){case"top-right":case"bottom-right":case"right":s=-o;break;case"top-left":case"bottom-left":case"left":s=o;break}return[s,l]}return t[1]!==Ls?n(e,t[0],t[1]):r(e,t[0])}function jp(e){e.bucket.createArrays();let t=512*e.bucket.overscaling;e.bucket.tilePixelRatio=8192/t,e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;let r=e.bucket.layers[0].layout,n=e.bucket.layers[0]._unevaluatedLayout._values,i={layoutIconSize:n["icon-size"].possiblyEvaluate(new q(e.bucket.zoom+1),e.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new q(e.bucket.zoom+1),e.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new q(18))};if(e.bucket.textSizeData.kind==="composite"){let{minZoom:u,maxZoom:c}=e.bucket.textSizeData;i.compositeTextSizes=[n["text-size"].possiblyEvaluate(new q(u),e.canonical),n["text-size"].possiblyEvaluate(new q(c),e.canonical)]}if(e.bucket.iconSizeData.kind==="composite"){let{minZoom:u,maxZoom:c}=e.bucket.iconSizeData;i.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new q(u),e.canonical),n["icon-size"].possiblyEvaluate(new q(c),e.canonical)]}let o=r.get("text-line-height")*ue,a=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",s=r.get("text-keep-upright"),l=r.get("text-size");for(let u of e.bucket.features){let c=r.get("text-font").evaluate(u,{},e.canonical).join(","),p=l.evaluate(u,{},e.canonical),f=i.layoutTextSize.evaluate(u,{},e.canonical),y=i.layoutIconSize.evaluate(u,{},e.canonical),m={horizontal:{},vertical:void 0},h=u.text,d=[0,0];if(h){let x=h.toString(),P=r.get("text-letter-spacing").evaluate(u,{},e.canonical)*ue,w=wu(x)?P:0,A=r.get("text-anchor").evaluate(u,{},e.canonical),T=r.get("text-variable-anchor");if(!T){let M=r.get("text-radial-offset").evaluate(u,{},e.canonical);M?d=fx(A,[M*ue,Ls]):d=r.get("text-offset").evaluate(u,{},e.canonical).map(B=>B*ue)}let I=a?"center":r.get("text-justify").evaluate(u,{},e.canonical),E=r.get("symbol-placement"),_=E==="point"?r.get("text-max-width").evaluate(u,{},e.canonical)*ue:0,F=()=>{e.bucket.allowVerticalPlacement&&on(x)&&(m.vertical=Zn(h,e.glyphMap,e.glyphPositions,e.imagePositions,c,_,o,A,"left",w,d,2,!0,E,f,p))};if(!a&&T){let M=I==="auto"?T.map(C=>Gp(C)):[I],B=!1;for(let C=0;C<M.length;C++){let O=M[C];if(!m.horizontal[O])if(B)m.horizontal[O]=m.horizontal[0];else{let N=Zn(h,e.glyphMap,e.glyphPositions,e.imagePositions,c,_,o,"center",O,w,d,1,!1,E,f,p);N&&(m.horizontal[O]=N,B=N.positionedLines.length===1)}}F()}else{I==="auto"&&(I=Gp(A));let M=Zn(h,e.glyphMap,e.glyphPositions,e.imagePositions,c,_,o,A,I,w,d,1,!1,E,f,p);M&&(m.horizontal[I]=M),F(),on(x)&&a&&s&&(m.vertical=Zn(h,e.glyphMap,e.glyphPositions,e.imagePositions,c,_,o,A,I,w,d,2,!1,E,f,p))}}let g,v=!1;if(u.icon&&u.icon.name){let x=e.imageMap[u.icon.name];x&&(g=dp(e.imagePositions[u.icon.name],r.get("icon-offset").evaluate(u,{},e.canonical),r.get("icon-anchor").evaluate(u,{},e.canonical)),v=!!x.sdf,e.bucket.sdfIcons===void 0?e.bucket.sdfIcons=v:e.bucket.sdfIcons!==v&&ce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(x.pixelRatio!==e.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(e.bucket.iconsNeedLinear=!0))}let b=Zp(m.horizontal)||m.vertical;e.bucket.iconsInText=b?b.iconsInText:!1,(b||g)&&yx(e.bucket,u,m,g,e.imageMap,i,f,y,d,v,e.canonical)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()}function Gp(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function yx(e,t,r,n,i,o,a,s,l,u,c){let p=o.textMaxSize.evaluate(t,{});p===void 0&&(p=a);let f=e.layers[0].layout,y=f.get("icon-offset").evaluate(t,{},c),m=Zp(r.horizontal),h=24,d=a/h,g=e.tilePixelRatio*d,v=e.tilePixelRatio*p/h,b=e.tilePixelRatio*s,x=e.tilePixelRatio*f.get("symbol-spacing"),P=f.get("text-padding")*e.tilePixelRatio,w=Sp(f,t,c,e.tilePixelRatio),A=f.get("text-max-angle")/180*Math.PI,T=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point",I=f.get("icon-rotation-alignment")==="map"&&f.get("symbol-placement")!=="point",E=f.get("symbol-placement"),_=x/2,F=f.get("icon-text-fit"),M;n&&F!=="none"&&(e.allowVerticalPlacement&&r.vertical&&(M=Is(n,r.vertical,F,f.get("icon-text-fit-padding"),y,d)),m&&(n=Is(n,m,F,f.get("icon-text-fit-padding"),y,d)));let B=(C,O)=>{O.x<0||O.x>=8192||O.y<0||O.y>=8192||mx(e,O,C,r,n,i,M,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,g,[P,P,P,P],T,l,b,w,I,y,t,o,u,c,a)};if(E==="line")for(let C of Op(t.geometry,0,0,8192,8192)){let O=zp(C,x,A,r.vertical||m,n,h,v,e.overscaling,8192);for(let N of O){let K=m;(!K||!hx(e,K.text,_,N))&&B(C,N)}}else if(E==="line-center"){for(let C of t.geometry)if(C.length>1){let O=Bp(C,A,r.vertical||m,n,h,v);O&&B(C,O)}}else if(t.type==="Polygon")for(let C of Sr(t.geometry,0)){let O=$p(C,16);B(C[0],new et(O.x,O.y,0))}else if(t.type==="LineString")for(let C of t.geometry)B(C,new et(C[0].x,C[0].y,0));else if(t.type==="Point")for(let C of t.geometry)for(let O of C)B([O],new et(O.x,O.y,0))}function qp(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=Up(t,r,s,i,o,a,n,e.allowVerticalPlacement),d=e.textSizeData,g=null;d.kind==="source"?(g=[Ct*i.layout.get("text-size").evaluate(a,{})],g[0]>Qe&&ce("".concat(e.layerIds[0],\': Value for "text-size" is >= \').concat(Er,\'. Reduce your "text-size".\'))):d.kind==="composite"&&(g=[Ct*y.compositeTextSizes[0].evaluate(a,{},m),Ct*y.compositeTextSizes[1].evaluate(a,{},m)],(g[0]>Qe||g[1]>Qe)&&ce("".concat(e.layerIds[0],\': Value for "text-size" is >= \').concat(Er,\'. Reduce your "text-size".\'))),e.addSymbols(e.text,h,g,s,o,a,u,t,l.lineStartIndex,l.lineLength,f,m);for(let v of c)p[v]=e.text.placedSymbolArray.length-1;return h.length*4}function Zp(e){for(let t in e)return e[t];return null}function mx(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,b,x,P,w,A,T){let I=e.addToLineVertexArray(t,r),E,_,F,M,B=0,C=0,O=0,N=0,K=-1,Y=-1,Q={},ye=(0,Ms.default)(""),_e=0,re=0;if(s._unevaluatedLayout.getValue("text-radial-offset")===void 0?[_e,re]=s.layout.get("text-offset").evaluate(x,{},A).map(Se=>Se*ue):(_e=s.layout.get("text-radial-offset").evaluate(x,{},A)*ue,re=Ls),e.allowVerticalPlacement&&n.vertical){let xe=s.layout.get("text-rotate").evaluate(x,{},A)+90,He=n.vertical;F=new Qt(l,t,u,c,p,He,f,y,m,xe),a&&(M=new Qt(l,t,u,c,p,a,d,g,m,xe))}if(i){let Se=s.layout.get("icon-rotate").evaluate(x,{}),xe=s.layout.get("icon-text-fit")!=="none",He=Es(i,Se,w,xe),Ke=a?Es(a,Se,w,xe):void 0;_=new Qt(l,t,u,c,p,i,d,g,!1,Se),B=He.length*4;let al=e.iconSizeData,Et=null;al.kind==="source"?(Et=[Ct*s.layout.get("icon-size").evaluate(x,{})],Et[0]>Qe&&ce("".concat(e.layerIds[0],\': Value for "icon-size" is >= \').concat(Er,\'. Reduce your "icon-size".\'))):al.kind==="composite"&&(Et=[Ct*P.compositeIconSizes[0].evaluate(x,{},A),Ct*P.compositeIconSizes[1].evaluate(x,{},A)],(Et[0]>Qe||Et[1]>Qe)&&ce("".concat(e.layerIds[0],\': Value for "icon-size" is >= \').concat(Er,\'. Reduce your "icon-size".\'))),e.addSymbols(e.icon,He,Et,b,v,x,0,t,I.lineStartIndex,I.lineLength,-1,A),K=e.icon.placedSymbolArray.length-1,Ke&&(C=Ke.length*4,e.addSymbols(e.icon,Ke,Et,b,v,x,2,t,I.lineStartIndex,I.lineLength,-1,A),Y=e.icon.placedSymbolArray.length-1)}let Pe=Object.keys(n.horizontal);for(let Se of Pe){let xe=n.horizontal[Se];if(!E){ye=(0,Ms.default)(xe.text);let Ke=s.layout.get("text-rotate").evaluate(x,{},A);E=new Qt(l,t,u,c,p,xe,f,y,m,Ke)}let He=xe.positionedLines.length===1;if(O+=qp(e,t,xe,o,s,m,x,h,I,n.vertical?1:3,He?Pe:[Se],Q,K,P,A),He)break}n.vertical&&(N+=qp(e,t,n.vertical,o,s,m,x,h,I,2,["vertical"],Q,Y,P,A));let $e=E?E.boxStartIndex:e.collisionBoxArray.length,fi=E?E.boxEndIndex:e.collisionBoxArray.length,ya=F?F.boxStartIndex:e.collisionBoxArray.length,ma=F?F.boxEndIndex:e.collisionBoxArray.length,zr=_?_.boxStartIndex:e.collisionBoxArray.length,yi=_?_.boxEndIndex:e.collisionBoxArray.length,ha=M?M.boxStartIndex:e.collisionBoxArray.length,mi=M?M.boxEndIndex:e.collisionBoxArray.length,Ee=-1,tr=(Se,xe)=>Se&&Se.circleDiameter?Math.max(Se.circleDiameter,xe):xe;Ee=tr(E,Ee),Ee=tr(F,Ee),Ee=tr(_,Ee),Ee=tr(M,Ee);let hi=Ee>-1?1:0;hi&&(Ee*=T/ue),e.glyphOffsetArray.length>=We.MAX_GLYPHS&&ce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),x.sortKey!==void 0&&e.addToSortKeyRanges(e.symbolInstances.length,x.sortKey),e.symbolInstances.emplaceBack(t.x,t.y,Q.right>=0?Q.right:-1,Q.center>=0?Q.center:-1,Q.left>=0?Q.left:-1,Q.vertical||-1,K,Y,ye,$e,fi,ya,ma,zr,yi,ha,mi,u,O,N,B,C,hi,0,f,_e,re,Ee)}function hx(e,t,r,n){let i=e.compareText;if(!(t in i))i[t]=[];else{let o=i[t];for(let a=o.length-1;a>=0;a--)if(n.dist(o[a])<r)return!0}return i[t].push(n),!1}var Xo=1,ei=class{constructor(t){let r={},n=[];for(let s in t){let l=t[s],u=r[s]={};for(let c in l){let p=l[+c];if(!p||p.bitmap.width===0||p.bitmap.height===0)continue;let f={x:0,y:0,w:p.bitmap.width+2*Xo,h:p.bitmap.height+2*Xo};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=Gn(n),a=new Wt({width:i||1,height:o||1});for(let s in t){let l=t[s];for(let u in l){let c=l[+u];if(!c||c.bitmap.width===0||c.bitmap.height===0)continue;let p=r[s][u].rect;Wt.copy(c.bitmap,a,{x:0,y:0},{x:p.x+Xo,y:p.y+Xo},c.bitmap)}}this.image=a,this.positions=r}};k("GlyphAtlas",ei);function Wp(e,t,r){t=Math.pow(2,r)-t-1;var n=Jp(e*256,t*256,r),i=Jp((e+1)*256,(t+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function Jp(e,t,r){var n=2*Math.PI*6378137/256/Math.pow(2,r),i=e*n-2*Math.PI*6378137/2,o=t*n-2*Math.PI*6378137/2;return[i,o]}var Yp=Z(he(),1);var Ds=63710088e-1,ti=class e{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error("Invalid LngLat object: (".concat(t,", ").concat(r,")"));if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new e(ml(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(t){let r=Math.PI/180,n=this.lat*r,i=t.lat*r,o=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((t.lng-this.lng)*r);return Ds*Math.acos(Math.min(o,1))}static convert(t){if(t instanceof e)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new e(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new e(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};var Hp=2*Math.PI*Ds;function Kp(e){return Hp*Math.cos(e*Math.PI/180)}function dx(e){return(180+e)/360}function gx(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function xx(e,t){return e/Kp(t)}function bx(e){return e*360-180}function Vs(e){let t=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function vx(e,t){return e*Kp(Vs(t))}function Px(e){return 1/Math.cos(e*Math.PI/180)}var Qo=class e{constructor(t,r,n=0){this.x=+t,this.y=+r,this.z=+n}static fromLngLat(t,r=0){let n=ti.convert(t);return new e(dx(n.lng),gx(n.lat),xx(r,n.lat))}toLngLat(){return new ti(bx(this.x),Vs(this.y))}toAltitude(){return vx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Hp*Px(Vs(this.y))}};var ea=class{constructor(t,r,n){if(t<0||t>25||n<0||n>=Math.pow(2,t)||r<0||r>=Math.pow(2,t))throw new Error("x=".concat(r,", y=").concat(n,", z=").concat(t," outside of bounds. 0<=x<").concat(Math.pow(2,t),", 0<=y<").concat(Math.pow(2,t)," 0<=z<=25 "));this.z=t,this.x=r,this.y=n,this.key=ri(0,t,t,r,n)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,n){let i=Wp(this.x,this.y,this.z),o=Sx(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(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(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){let r=Math.pow(2,this.z);return new Yp.default((t.x*r-this.x)*8192,(t.y*r-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}},Bs=class{constructor(t,r){this.wrap=t,this.canonical=r,this.key=ri(t,r.z,r.z,r.x,r.y)}},ni=class e{constructor(t,r,n,i,o){if(t<n)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(t,"; z = ").concat(n));this.overscaledZ=t,this.wrap=r,this.canonical=new ea(n,+i,+o),this.key=ri(r,t,n,i,o)}clone(){return new e(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-t;return t>this.canonical.z?new e(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new e(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let n=this.canonical.z-t;return t>this.canonical.z?ri(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):ri(this.wrap*+r,t,t,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new e(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,n=this.canonical.x*2,i=this.canonical.y*2;return[new e(r,this.wrap,r,n,i),new e(r,this.wrap,r,n+1,i),new e(r,this.wrap,r,n,i+1),new e(r,this.wrap,r,n+1,i+1)]}isLessThan(t){return this.wrap<t.wrap?!0:this.wrap>t.wrap?!1:this.overscaledZ<t.overscaledZ?!0:this.overscaledZ>t.overscaledZ?!1:this.canonical.x<t.canonical.x?!0:this.canonical.x>t.canonical.x?!1:this.canonical.y<t.canonical.y}wrapped(){return new e(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new e(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Bs(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(t){return this.canonical.getTilePoint(new Qo(t.x-this.wrap,t.y))}};function ri(e,t,r,n,i){e*=2,e<0&&(e=e*-1-1);let o=1<<r;return(o*o*e+o*i+n).toString(36)+r.toString(36)+t.toString(36)}function Sx(e,t,r){let n="",i;for(let o=e;o>0;o--)i=1<<o-1,n+=(t&i?1:0)+(r&i?2:0);return n}k("CanonicalTileID",ea);k("OverscaledTileID",ni,{omit:["posMatrix"]});var ta=class{constructor(t){this.tileID=new ni(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(t,r,n,i,o){this.status="parsing",this.data=t,this.collisionBoxArray=new Sn;let a=new Fr(Object.keys(t.layers).sort()),s=new Yn(this.tileID,this.promoteId);s.bucketLayerIDs=[];let l={},u={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},c=r.familiesBySource[this.source];for(let x in c){let P=t.layers[x];if(!P)continue;P.version===1&&ce(\'Vector tile source "\'.concat(this.source,\'" layer "\').concat(x,\'" \')+"does not use vector tile spec v2 and therefore may have some rendering errors.");let w=a.encode(x),A=[];for(let T=0;T<P.length;T++){let I=P.feature(T),E=s.getId(I,x);A.push({feature:I,id:E,index:T,sourceLayerIndex:w})}for(let T of c[x]){let I=T[0];if(I.source!==this.source&&ce("layer.source = ".concat(I.source," does not equal this.source = ").concat(this.source)),I.minzoom&&this.zoom<Math.floor(I.minzoom)||I.maxzoom&&this.zoom>=I.maxzoom||I.visibility==="none")continue;zs(T,this.zoom,n),(l[I.id]=I.createBucket({index:s.bucketLayerIDs.length,layers:T,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:w,sourceID:this.source})).populate(A,u,this.tileID.canonical),s.bucketLayerIDs.push(T.map(_=>_.id))}}let p,f,y,m,h=Rr(u.glyphDependencies,x=>Object.keys(x).map(Number));this.inFlightDependencies.forEach(x=>x==null?void 0:x.cancel()),this.inFlightDependencies=[];let d=++this.dependencySentinel;Object.keys(h).length?this.inFlightDependencies.push(i.send("getGlyphs",{uid:this.uid,stacks:h,source:this.source,tileID:this.tileID,type:"glyphs"},(x,P)=>{d===this.dependencySentinel&&(p||(p=x,f=P,b.call(this)))})):f={};let g=Object.keys(u.iconDependencies);g.length?this.inFlightDependencies.push(i.send("getImages",{icons:g,source:this.source,tileID:this.tileID,type:"icons"},(x,P)=>{d===this.dependencySentinel&&(p||(p=x,y=P,b.call(this)))})):y={};let v=Object.keys(u.patternDependencies);v.length?this.inFlightDependencies.push(i.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"patterns"},(x,P)=>{d===this.dependencySentinel&&(p||(p=x,m=P,b.call(this)))})):m={},b.call(this);function b(){if(p)return o(p);if(f&&y&&m){let x=new ei(f),P=new qn(y,m);for(let w in l){let A=l[w];A instanceof We?(zs(A.layers,this.zoom,n),jp({bucket:A,glyphMap:f,glyphPositions:x.positions,imageMap:y,imagePositions:P.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):A.hasPattern&&(A instanceof Xt||A instanceof Kt||A instanceof Yt)&&(zs(A.layers,this.zoom,n),A.addFeatures(u,this.tileID.canonical,P.patternPositions))}this.status="done",o(null,{buckets:Object.values(l).filter(w=>!w.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:x.image,imageAtlas:P,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?y:null,glyphPositions:this.returnDependencies?x.positions:null})}}}};function zs(e,t,r){let n=new q(t);for(let i of e)i.recalculate(n,r)}var wx=60,f_=1e3/wx;var Vr=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return t.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}};function Ax(e,t){let r=Wa(e.request,(n,i,o,a)=>{n?t(n):i&&t(null,{vectorTile:new Xp.default.VectorTile(new Qp.default(i)),rawData:i,cacheControl:o,expires:a})});return()=>{r.cancel(),t()}}var Br=class{constructor(t,r,n,i){this.actor=t,this.layerIndex=r,this.availableImages=n,this.loadVectorData=i||Ax,this.loading={},this.loaded={}}loadTile(t,r){let n=t.uid;this.loading||(this.loading={});let i=t&&t.request&&t.request.collectResourceTiming?new Vr(t.request):!1,o=this.loading[n]=new ta(t);o.abort=this.loadVectorData(t,(a,s)=>{if(delete this.loading[n],a||!s)return o.status="done",this.loaded[n]=o,r(a);let l=s.rawData,u={};s.expires&&(u.expires=s.expires),s.cacheControl&&(u.cacheControl=s.cacheControl);let c={};if(i){let p=i.finish();p&&(c.resourceTiming=JSON.parse(JSON.stringify(p)))}o.vectorTile=s.vectorTile,o.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,(p,f)=>{if(p||!f)return r(p);r(null,Ae({rawTileData:l.slice(0)},f,u,c))}),this.loaded=this.loaded||{},this.loaded[n]=o})}reloadTile(t,r){let n=this.loaded,i=t.uid,o=this;if(n&&n[i]){let a=n[i];a.showCollisionBoxes=t.showCollisionBoxes,a.status==="parsing"?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,r):a.status==="done"&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,r):r())}}abortTile(t,r){let n=this.loading,i=t.uid;n&&n[i]&&n[i].abort&&(n[i].abort(),delete n[i]),r()}removeTile(t,r){let n=this.loaded,i=t.uid;n&&n[i]&&delete n[i],r()}};var ii=class{constructor(t,r,n){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&n!=="mapbox"&&n!=="terrarium"){ce(\'"\'.concat(n,\'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".\'));return}this.stride=r.height;let i=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=n||"mapbox";for(let o=0;o<i;o++)this.data[this._idx(-1,o)]=this.data[this._idx(0,o)],this.data[this._idx(i,o)]=this.data[this._idx(i-1,o)],this.data[this._idx(o,-1)]=this.data[this._idx(o,0)],this.data[this._idx(o,i)]=this.data[this._idx(o,i-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(i,-1)]=this.data[this._idx(i-1,0)],this.data[this._idx(-1,i)]=this.data[this._idx(0,i-1)],this.data[this._idx(i,i)]=this.data[this._idx(i-1,i-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let o=0;o<i;o++)for(let a=0;a<i;a++){let s=this.get(o,a);s>this.max&&(this.max=s),s<this.min&&(this.min=s)}}get(t,r){let n=new Uint8Array(this.data.buffer),i=this._idx(t,r)*4;return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(n[i],n[i+1],n[i+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}_unpackMapbox(t,r,n){return(t*256*256+r*256+n)/10-1e4}_unpackTerrarium(t,r,n){return t*256+r+n/256-32768}getPixels(){return new de({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,n){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let i=r*this.dim,o=r*this.dim+this.dim,a=n*this.dim,s=n*this.dim+this.dim;switch(r){case-1:i=o-1;break;case 1:o=i+1;break}switch(n){case-1:a=s-1;break;case 1:s=a+1;break}let l=-r*this.dim,u=-n*this.dim;for(let c=a;c<s;c++)for(let p=i;p<o;p++)this.data[this._idx(p,c)]=t.data[this._idx(p+l,c+u)]}};k("DEMData",ii);var ra=class{constructor(){this.loaded={}}loadTile(t,r){let{uid:n,encoding:i,rawImageData:o}=t,a=Or(o)?this.getImageData(o):o,s=new ii(n,a,i);this.loaded=this.loaded||{},this.loaded[n]=s,r(null,s)}getImageData(t){(!this.offscreenCanvas||!this.offscreenCanvasContext)&&(this.offscreenCanvas=new OffscreenCanvas(t.width,t.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=t.width,this.offscreenCanvas.height=t.height,this.offscreenCanvasContext.drawImage(t,0,0,t.width,t.height);let r=this.offscreenCanvasContext.getImageData(-1,-1,t.width+2,t.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new de({width:r.width,height:r.height},r.data)}removeTile(t){let r=this.loaded,n=t.uid;r&&r[n]&&delete r[n]}};var Cf=Z(nf(),1);var Rs=Z(he(),1),of=Z(It(),1);var _x=of.default.VectorTileFeature.prototype.toGeoJSON,Os=class{constructor(t){this._feature=t,this.extent=8192,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(this._feature.type===1){let t=[];for(let r of this._feature.geometry)t.push([new Rs.default(r[0],r[1])]);return t}else{let t=[];for(let r of this._feature.geometry){let n=[];for(let i of r)n.push(new Rs.default(i[0],i[1]));t.push(n)}return t}}toGeoJSON(t,r,n){return _x.call(this,t,r,n)}},ia=class{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=8192,this.length=t.length,this._features=t}feature(t){return new Os(this._features[t])}};var kf=Z(pf(),1);var ff=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],$s=1,ai=8,li=class e{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[r,n]=new Uint8Array(t,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");let i=n>>4;if(i!==$s)throw new Error("Got v".concat(i," data when expected v").concat($s,"."));let o=ff[n&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,a,o,t)}constructor(t,r=64,n=Float64Array,i){if(isNaN(t)||t<0)throw new Error("Unpexpected numItems value: ".concat(t,"."));this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let o=ff.indexOf(this.ArrayType),a=t*2*this.ArrayType.BYTES_PER_ELEMENT,s=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error("Unexpected typed array class: ".concat(n,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,ai,t),this.coords=new this.ArrayType(this.data,ai+s+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(ai+a+s+l),this.ids=new this.IndexArrayType(this.data,ai,t),this.coords=new this.ArrayType(this.data,ai+s+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,($s<<4)+o]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=r,n}finish(){let t=this._pos>>1;if(t!==this.numItems)throw new Error("Added ".concat(t," items when expected ").concat(this.numItems,"."));return qs(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:s}=this,l=[0,o.length-1,0],u=[];for(;l.length;){let c=l.pop()||0,p=l.pop()||0,f=l.pop()||0;if(p-f<=s){for(let d=f;d<=p;d++){let g=a[2*d],v=a[2*d+1];g>=t&&g<=n&&v>=r&&v<=i&&u.push(o[d])}continue}let y=f+p>>1,m=a[2*y],h=a[2*y+1];m>=t&&m<=n&&h>=r&&h<=i&&u.push(o[y]),(c===0?t<=m:r<=h)&&(l.push(f),l.push(y-1),l.push(1-c)),(c===0?n>=m:i>=h)&&(l.push(y+1),l.push(p),l.push(1-c))}return u}within(t,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:i,coords:o,nodeSize:a}=this,s=[0,i.length-1,0],l=[],u=n*n;for(;s.length;){let c=s.pop()||0,p=s.pop()||0,f=s.pop()||0;if(p-f<=a){for(let d=f;d<=p;d++)yf(o[2*d],o[2*d+1],t,r)<=u&&l.push(i[d]);continue}let y=f+p>>1,m=o[2*y],h=o[2*y+1];yf(m,h,t,r)<=u&&l.push(i[y]),(c===0?t-n<=m:r-n<=h)&&(s.push(f),s.push(y-1),s.push(1-c)),(c===0?t+n>=m:r+n>=h)&&(s.push(y+1),s.push(p),s.push(1-c))}return l}};function qs(e,t,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;mf(e,t,a,n,i,o),qs(e,t,r,n,a-1,1-o),qs(e,t,r,a+1,i,1-o)}function mf(e,t,r,n,i,o){for(;i>n;){if(i-n>600){let u=i-n+1,c=r-n+1,p=Math.log(u),f=.5*Math.exp(2*p/3),y=.5*Math.sqrt(p*f*(u-f)/u)*(c-u/2<0?-1:1),m=Math.max(n,Math.floor(r-c*f/u+y)),h=Math.min(i,Math.floor(r+(u-c)*f/u+y));mf(e,t,r,m,h,o)}let a=t[2*r+o],s=n,l=i;for(si(e,t,n,r),t[2*i+o]>a&&si(e,t,n,i);s<l;){for(si(e,t,s,l),s++,l--;t[2*s+o]<a;)s++;for(;t[2*l+o]>a;)l--}t[2*n+o]===a?si(e,t,n,l):(l++,si(e,t,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function si(e,t,r,n){Gs(e,r,n),Gs(t,2*r,2*n),Gs(t,2*r+1,2*n+1)}function Gs(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function yf(e,t,r,n){let i=e-r,o=t-n;return i*i+o*o}var Bx={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},hf=Math.fround||(e=>t=>(e[0]=+t,e[0]))(new Float32Array(1)),er=2,Tt=3,js=4,kt=5,gf=6,ui=class{constructor(t){this.options=Object.assign(Object.create(Bx),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){let{log:r,minZoom:n,maxZoom:i}=this.options;r&&console.time("total time");let o="prepare ".concat(t.length," points");r&&console.time(o),this.points=t;let a=[];for(let l=0;l<t.length;l++){let u=t[l];if(!u.geometry)continue;let[c,p]=u.geometry.coordinates,f=hf(aa(c)),y=hf(sa(p));a.push(f,y,1/0,l,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this._createTree(a);r&&console.timeEnd(o);for(let l=i;l>=n;l--){let u=+Date.now();s=this.trees[l]=this._createTree(this._cluster(s,l)),r&&console.log("z%d: %d clusters in %dms",l,s.numItems,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(t,r){let n=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),o=t[2]===180?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)n=-180,o=180;else if(n>o){let p=this.getClusters([n,i,180,a],r),f=this.getClusters([-180,i,o,a],r);return p.concat(f)}let s=this.trees[this._limitZoom(r)],l=s.range(aa(n),sa(a),aa(o),sa(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+kt]>1?df(u,f,this.clusterProps):this.points[u[f+Tt]])}return c}getChildren(t){let r=this._getOriginId(t),n=this._getOriginZoom(t),i="No cluster with the specified id.",o=this.trees[n];if(!o)throw new Error(i);let a=o.data;if(r*this.stride>=a.length)throw new Error(i);let s=this.options.radius/(this.options.extent*Math.pow(2,n-1)),l=a[r*this.stride],u=a[r*this.stride+1],c=o.within(l,u,s),p=[];for(let f of c){let y=f*this.stride;a[y+js]===t&&p.push(a[y+kt]>1?df(a,y,this.clusterProps):this.points[a[y+Tt]])}if(p.length===0)throw new Error(i);return p}getLeaves(t,r,n){r=r||10,n=n||0;let i=[];return this._appendLeaves(i,t,r,n,0),i}getTile(t,r,n){let i=this.trees[this._limitZoom(t)],o=Math.pow(2,t),{extent:a,radius:s}=this.options,l=s/a,u=(n-l)/o,c=(n+1+l)/o,p={features:[]};return this._addTileFeatures(i.range((r-l)/o,u,(r+1+l)/o,c),i.data,r,n,o,p),r===0&&this._addTileFeatures(i.range(1-l/o,u,1,c),i.data,o,n,o,p),r===o-1&&this._addTileFeatures(i.range(0,u,l/o,c),i.data,-1,n,o,p),p.features.length?p:null}getClusterExpansionZoom(t){let r=this._getOriginZoom(t)-1;for(;r<=this.options.maxZoom;){let n=this.getChildren(t);if(r++,n.length!==1)break;t=n[0].properties.cluster_id}return r}_appendLeaves(t,r,n,i,o){let a=this.getChildren(r);for(let s of a){let l=s.properties;if(l&&l.cluster?o+l.point_count<=i?o+=l.point_count:o=this._appendLeaves(t,l.cluster_id,n,i,o):o<i?o++:t.push(s),t.length===n)break}return o}_createTree(t){let r=new li(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<t.length;n+=this.stride)r.add(t[n],t[n+1]);return r.finish(),r.data=t,r}_addTileFeatures(t,r,n,i,o,a){for(let s of t){let l=s*this.stride,u=r[l+kt]>1,c,p,f;if(u)c=xf(r,l,this.clusterProps),p=r[l],f=r[l+1];else{let h=this.points[r[l+Tt]];c=h.properties;let[d,g]=h.geometry.coordinates;p=aa(d),f=sa(g)}let y={type:1,geometry:[[Math.round(this.options.extent*(p*o-n)),Math.round(this.options.extent*(f*o-i))]],tags:c},m;u||this.options.generateId?m=r[l+Tt]:m=this.points[r[l+Tt]].id,m!==void 0&&(y.id=m),a.features.push(y)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,r){let{radius:n,extent:i,reduce:o,minPoints:a}=this.options,s=n/(i*Math.pow(2,r)),l=t.data,u=[],c=this.stride;for(let p=0;p<l.length;p+=c){if(l[p+er]<=r)continue;l[p+er]=r;let f=l[p],y=l[p+1],m=t.within(l[p],l[p+1],s),h=l[p+kt],d=h;for(let g of m){let v=g*c;l[v+er]>r&&(d+=l[v+kt])}if(d>h&&d>=a){let g=f*h,v=y*h,b,x=-1,P=((p/c|0)<<5)+(r+1)+this.points.length;for(let w of m){let A=w*c;if(l[A+er]<=r)continue;l[A+er]=r;let T=l[A+kt];g+=l[A]*T,v+=l[A+1]*T,l[A+js]=P,o&&(b||(b=this._map(l,p,!0),x=this.clusterProps.length,this.clusterProps.push(b)),o(b,this._map(l,A)))}l[p+js]=P,u.push(g/d,v/d,1/0,P,-1,d),o&&u.push(x)}else{for(let g=0;g<c;g++)u.push(l[p+g]);if(d>1)for(let g of m){let v=g*c;if(!(l[v+er]<=r)){l[v+er]=r;for(let b=0;b<c;b++)u.push(l[v+b])}}}}return u}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,r,n){if(t[r+kt]>1){let a=this.clusterProps[t[r+gf]];return n?Object.assign({},a):a}let i=this.points[t[r+Tt]].properties,o=this.options.map(i);return n&&o===i?Object.assign({},o):o}};function df(e,t,r){return{type:"Feature",id:e[t+Tt],properties:xf(e,t,r),geometry:{type:"Point",coordinates:[zx(e[t]),Rx(e[t+1])]}}}function xf(e,t,r){let n=e[t+kt],i=n>=1e4?"".concat(Math.round(n/1e3),"k"):n>=1e3?"".concat(Math.round(n/100)/10,"k"):n,o=e[t+gf],a=o===-1?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:e[t+Tt],point_count:n,point_count_abbreviated:i})}function aa(e){return e/360+.5}function sa(e){let t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function zx(e){return(e-.5)*360}function Rx(e){let t=(180-e*360)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function ci(e,t,r,n){for(var i=n,o=r-t>>1,a=r-t,s,l=e[t],u=e[t+1],c=e[r],p=e[r+1],f=t+3;f<r;f+=3){var y=Ox(e[f],e[f+1],l,u,c,p);if(y>i)s=f,i=y;else if(y===i){var m=Math.abs(f-o);m<a&&(s=f,a=m)}}i>n&&(s-t>3&&ci(e,t,s,n),e[s+2]=i,r-s>3&&ci(e,s,r,n))}function Ox(e,t,r,n,i,o){var a=i-r,s=o-n;if(a!==0||s!==0){var l=((e-r)*a+(t-n)*s)/(a*a+s*s);l>1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return a=e-r,s=t-n,a*a+s*s}function pt(e,t,r,n){var i={id:typeof e>"u"?null:e,type:t,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return Nx(i),i}function Nx(e){var t=e.geometry,r=e.type;if(r==="Point"||r==="MultiPoint"||r==="LineString")Zs(e,t);else if(r==="Polygon"||r==="MultiLineString")for(var n=0;n<t.length;n++)Zs(e,t[n]);else if(r==="MultiPolygon")for(n=0;n<t.length;n++)for(var i=0;i<t[n].length;i++)Zs(e,t[n][i])}function Zs(e,t){for(var r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function Hs(e,t){var r=[];if(e.type==="FeatureCollection")for(var n=0;n<e.features.length;n++)la(r,e.features[n],t,n);else e.type==="Feature"?la(r,e,t):la(r,{geometry:e},t);return r}function la(e,t,r,n){if(t.geometry){var i=t.geometry.coordinates,o=t.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],l=t.id;if(r.promoteId?l=t.properties[r.promoteId]:r.generateId&&(l=n||0),o==="Point")bf(i,s);else if(o==="MultiPoint")for(var u=0;u<i.length;u++)bf(i[u],s);else if(o==="LineString")Ws(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(u=0;u<i.length;u++)s=[],Ws(i[u],s,a,!1),e.push(pt(l,"LineString",s,t.properties));return}else Js(i,s,a,!1);else if(o==="Polygon")Js(i,s,a,!0);else if(o==="MultiPolygon")for(u=0;u<i.length;u++){var c=[];Js(i[u],c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(u=0;u<t.geometry.geometries.length;u++)la(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},r,n);return}else throw new Error("Input data is not a valid GeoJSON object.");e.push(pt(l,o,s,t.properties))}}function bf(e,t){t.push(vf(e[0])),t.push(Pf(e[1])),t.push(0)}function Ws(e,t,r,n){for(var i,o,a=0,s=0;s<e.length;s++){var l=vf(e[s][0]),u=Pf(e[s][1]);t.push(l),t.push(u),t.push(0),s>0&&(n?a+=(i*u-l*o)/2:a+=Math.sqrt(Math.pow(l-i,2)+Math.pow(u-o,2))),i=l,o=u}var c=t.length-3;t[2]=1,ci(t,0,c,r),t[c+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function Js(e,t,r,n){for(var i=0;i<e.length;i++){var o=[];Ws(e[i],o,r,n),t.push(o)}}function vf(e){return e/360+.5}function Pf(e){var t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function Ue(e,t,r,n,i,o,a,s){if(r/=t,n/=t,o>=r&&a<n)return e;if(a<r||o>=n)return null;for(var l=[],u=0;u<e.length;u++){var c=e[u],p=c.geometry,f=c.type,y=i===0?c.minX:c.minY,m=i===0?c.maxX:c.maxY;if(y>=r&&m<n){l.push(c);continue}else if(m<r||y>=n)continue;var h=[];if(f==="Point"||f==="MultiPoint")Ux(p,h,r,n,i);else if(f==="LineString")wf(p,h,r,n,i,!1,s.lineMetrics);else if(f==="MultiLineString")Ks(p,h,r,n,i,!1);else if(f==="Polygon")Ks(p,h,r,n,i,!0);else if(f==="MultiPolygon")for(var d=0;d<p.length;d++){var g=[];Ks(p[d],g,r,n,i,!0),g.length&&h.push(g)}if(h.length){if(s.lineMetrics&&f==="LineString"){for(d=0;d<h.length;d++)l.push(pt(c.id,f,h[d],c.tags));continue}(f==="LineString"||f==="MultiLineString")&&(h.length===1?(f="LineString",h=h[0]):f="MultiLineString"),(f==="Point"||f==="MultiPoint")&&(f=h.length===3?"Point":"MultiPoint"),l.push(pt(c.id,f,h,c.tags))}}return l.length?l:null}function Ux(e,t,r,n,i){for(var o=0;o<e.length;o+=3){var a=e[o+i];a>=r&&a<=n&&(t.push(e[o]),t.push(e[o+1]),t.push(e[o+2]))}}function wf(e,t,r,n,i,o,a){for(var s=Sf(e),l=i===0?$x:Gx,u=e.start,c,p,f=0;f<e.length-3;f+=3){var y=e[f],m=e[f+1],h=e[f+2],d=e[f+3],g=e[f+4],v=i===0?y:m,b=i===0?d:g,x=!1;a&&(c=Math.sqrt(Math.pow(y-d,2)+Math.pow(m-g,2))),v<r?b>r&&(p=l(s,y,m,d,g,r),a&&(s.start=u+c*p)):v>n?b<n&&(p=l(s,y,m,d,g,n),a&&(s.start=u+c*p)):Ys(s,y,m,h),b<r&&v>=r&&(p=l(s,y,m,d,g,r),x=!0),b>n&&v<=n&&(p=l(s,y,m,d,g,n),x=!0),!o&&x&&(a&&(s.end=u+c*p),t.push(s),s=Sf(e)),a&&(u+=c)}var P=e.length-3;y=e[P],m=e[P+1],h=e[P+2],v=i===0?y:m,v>=r&&v<=n&&Ys(s,y,m,h),P=s.length-3,o&&P>=3&&(s[P]!==s[0]||s[P+1]!==s[1])&&Ys(s,s[0],s[1],s[2]),s.length&&t.push(s)}function Sf(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function Ks(e,t,r,n,i,o){for(var a=0;a<e.length;a++)wf(e[a],t,r,n,i,o,!1)}function Ys(e,t,r,n){e.push(t),e.push(r),e.push(n)}function $x(e,t,r,n,i,o){var a=(o-t)/(n-t);return e.push(o),e.push(r+(i-r)*a),e.push(1),a}function Gx(e,t,r,n,i,o){var a=(o-r)/(i-r);return e.push(t+(n-t)*a),e.push(o),e.push(1),a}function Qs(e,t){var r=t.buffer/t.extent,n=e,i=Ue(e,1,-1-r,r,0,-1,2,t),o=Ue(e,1,1-r,2+r,0,-1,2,t);return(i||o)&&(n=Ue(e,1,-r,1+r,0,-1,2,t)||[],i&&(n=Af(i,1).concat(n)),o&&(n=n.concat(Af(o,-1)))),n}function Af(e,t){for(var r=[],n=0;n<e.length;n++){var i=e[n],o=i.type,a;if(o==="Point"||o==="MultiPoint"||o==="LineString")a=Xs(i.geometry,t);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(var s=0;s<i.geometry.length;s++)a.push(Xs(i.geometry[s],t))}else if(o==="MultiPolygon")for(a=[],s=0;s<i.geometry.length;s++){for(var l=[],u=0;u<i.geometry[s].length;u++)l.push(Xs(i.geometry[s][u],t));a.push(l)}r.push(pt(i.id,o,a,i.tags))}return r}function Xs(e,t){var r=[];r.size=e.size,e.start!==void 0&&(r.start=e.start,r.end=e.end);for(var n=0;n<e.length;n+=3)r.push(e[n]+t,e[n+1],e[n+2]);return r}function ua(e,t){if(e.transformed)return e;var r=1<<e.z,n=e.x,i=e.y,o,a,s;for(o=0;o<e.features.length;o++){var l=e.features[o],u=l.geometry,c=l.type;if(l.geometry=[],c===1)for(a=0;a<u.length;a+=2)l.geometry.push(_f(u[a],u[a+1],t,r,n,i));else for(a=0;a<u.length;a++){var p=[];for(s=0;s<u[a].length;s+=2)p.push(_f(u[a][s],u[a][s+1],t,r,n,i));l.geometry.push(p)}}return e.transformed=!0,e}function _f(e,t,r,n,i,o){return[Math.round(r*(e*n-i)),Math.round(r*(t*n-o))]}function tl(e,t,r,n,i){for(var o=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<e.length;s++){a.numFeatures++,qx(a,e[s],o,i);var l=e[s].minX,u=e[s].minY,c=e[s].maxX,p=e[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),p>a.maxY&&(a.maxY=p)}return a}function qx(e,t,r,n){var i=t.geometry,o=t.type,a=[];if(o==="Point"||o==="MultiPoint")for(var s=0;s<i.length;s+=3)a.push(i[s]),a.push(i[s+1]),e.numPoints++,e.numSimplified++;else if(o==="LineString")el(a,i,e,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(s=0;s<i.length;s++)el(a,i[s],e,r,o==="Polygon",s===0);else if(o==="MultiPolygon")for(var l=0;l<i.length;l++){var u=i[l];for(s=0;s<u.length;s++)el(a,u[s],e,r,!0,s===0)}if(a.length){var c=t.tags||null;if(o==="LineString"&&n.lineMetrics){c={};for(var p in t.tags)c[p]=t.tags[p];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var f={geometry:a,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:c};t.id!==null&&(f.id=t.id),e.features.push(f)}}function el(e,t,r,n,i,o){var a=n*n;if(n>0&&t.size<(i?a:n)){r.numPoints+=t.length/3;return}for(var s=[],l=0;l<t.length;l+=3)(n===0||t[l+2]>a)&&(r.numSimplified++,s.push(t[l]),s.push(t[l+1])),r.numPoints++;i&&jx(s,o),e.push(s)}function jx(e,t){for(var r=0,n=0,i=e.length,o=i-2;n<i;o=n,n+=2)r+=(e[n]-e[o])*(e[n+1]+e[o+1]);if(r>0===t)for(n=0,i=e.length;n<i/2;n+=2){var a=e[n],s=e[n+1];e[n]=e[i-2-n],e[n+1]=e[i-1-n],e[i-2-n]=a,e[i-1-n]=s}}function nl(e,t){return new ca(e,t)}function ca(e,t){t=this.options=Zx(Object.create(this.options),t);var r=t.debug;if(r&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=Hs(e,t);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=Qs(n,t),n.length&&this.splitTile(n,0,0,0),r&&(n.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)))}ca.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};ca.prototype.splitTile=function(e,t,r,n,i,o,a){for(var s=[e,t,r,n],l=this.options,u=l.debug;s.length;){n=s.pop(),r=s.pop(),t=s.pop(),e=s.pop();var c=1<<t,p=rl(t,r,n),f=this.tiles[p];if(!f&&(u>1&&console.time("creation"),f=this.tiles[p]=tl(e,t,r,n,l),this.tileCoords.push({z:t,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,n,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var y="z"+t;this.stats[y]=(this.stats[y]||0)+1,this.total++}if(f.source=e,i){if(t===l.maxZoom||t===i)continue;var m=1<<i-t;if(r!==Math.floor(o/m)||n!==Math.floor(a/m))continue}else if(t===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue;if(f.source=null,e.length!==0){u>1&&console.time("clipping");var h=.5*l.buffer/l.extent,d=.5-h,g=.5+h,v=1+h,b,x,P,w,A,T;b=x=P=w=null,A=Ue(e,c,r-h,r+g,0,f.minX,f.maxX,l),T=Ue(e,c,r+d,r+v,0,f.minX,f.maxX,l),e=null,A&&(b=Ue(A,c,n-h,n+g,1,f.minY,f.maxY,l),x=Ue(A,c,n+d,n+v,1,f.minY,f.maxY,l),A=null),T&&(P=Ue(T,c,n-h,n+g,1,f.minY,f.maxY,l),w=Ue(T,c,n+d,n+v,1,f.minY,f.maxY,l),T=null),u>1&&console.timeEnd("clipping"),s.push(b||[],t+1,r*2,n*2),s.push(x||[],t+1,r*2,n*2+1),s.push(P||[],t+1,r*2+1,n*2),s.push(w||[],t+1,r*2+1,n*2+1)}}};ca.prototype.getTile=function(e,t,r){var n=this.options,i=n.extent,o=n.debug;if(e<0||e>24)return null;var a=1<<e;t=(t%a+a)%a;var s=rl(e,t,r);if(this.tiles[s])return ua(this.tiles[s],i);o>1&&console.log("drilling down to z%d-%d-%d",e,t,r);for(var l=e,u=t,c=r,p;!p&&l>0;)l--,u=Math.floor(u/2),c=Math.floor(c/2),p=this.tiles[rl(l,u,c)];return!p||!p.source?null:(o>1&&console.log("found parent tile z%d-%d-%d",l,u,c),o>1&&console.time("drilling down"),this.splitTile(p.source,l,u,c,e,t,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?ua(this.tiles[s],i):null)};function rl(e,t,r){return((1<<e)*r+t)*32+e}function Zx(e,t){for(var r in t)e[r]=t[r];return e}function pi(e,t){return t?e.properties[t]:e.id}function il(e,t){if(e==null)return!0;if(e.type==="Feature")return pi(e,t)!=null;if(e.type==="FeatureCollection"){let r=new Set;for(let n of e.features){let i=pi(n,t);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function ol(e,t){let r=new Map;if(e!=null)if(e.type==="Feature")r.set(pi(e,t),e);else for(let n of e.features)r.set(pi(n,t),n);return r}function If(e,t,r){var n,i,o,a;if(t.removeAll&&e.clear(),t.remove)for(let s of t.remove)e.delete(s);if(t.add)for(let s of t.add){let l=pi(s,r);l!=null&&e.set(l,s)}if(t.update)for(let s of t.update){let l=e.get(s.id);if(l==null)continue;let u=s.newGeometry||s.removeAllProperties,c=!s.removeAllProperties&&(((n=s.removeProperties)==null?void 0:n.length)>0||((i=s.addOrUpdateProperties)==null?void 0:i.length)>0);if((u||c)&&(l={...l},e.set(s.id,l),c&&(l.properties={...l.properties})),s.newGeometry&&(l.geometry=s.newGeometry),s.removeAllProperties)l.properties={};else if(((o=s.removeProperties)==null?void 0:o.length)>0)for(let p of s.removeProperties)Object.prototype.hasOwnProperty.call(l.properties,p)&&delete l.properties[p];if(((a=s.addOrUpdateProperties)==null?void 0:a.length)>0)for(let{key:p,value:f}of s.addOrUpdateProperties)l.properties[p]=f}}function Jx(e,t){let r=e.tileID.canonical;if(!this._geoJSONIndex)return t(null,null);let n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return t(null,null);let i=new ia(n.features),o=(0,kf.default)(i);(o.byteOffset!==0||o.byteLength!==o.buffer.byteLength)&&(o=new Uint8Array(o)),t(null,{vectorTile:i,rawData:o.buffer})}var pa=class extends Br{constructor(r,n,i,o){super(r,n,i,Jx);this._dataUpdateable=new Map;this.loadGeoJSON=(r,n)=>{let{promoteId:i}=r;if(r.request)return gu(r.request,(o,a,s,l)=>{this._dataUpdateable=il(a,i)?ol(a,i):void 0,n(o,a,s,l)});if(typeof r.data=="string")try{let o=JSON.parse(r.data);this._dataUpdateable=il(o,i)?ol(o,i):void 0,n(null,o)}catch{n(new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object.")))}else r.dataDiff?this._dataUpdateable?(If(this._dataUpdateable,r.dataDiff,i),n(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):n(new Error("Cannot update existing geojson data in ".concat(r.source))):n(new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object.")));return{cancel:()=>{}}};o&&(this.loadGeoJSON=o)}loadData(r,n){var o;(o=this._pendingRequest)==null||o.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});let i=r&&r.request&&r.request.collectResourceTiming?new Vr(r.request):!1;this._pendingCallback=n,this._pendingRequest=this.loadGeoJSON(r,(a,s)=>{if(delete this._pendingCallback,delete this._pendingRequest,a||!s)return n(a);if(typeof s!="object")return n(new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object.")));{(0,Cf.default)(s,!0);try{if(r.filter){let u=Rt(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(u.result==="error")throw new Error(u.value.map(p=>"".concat(p.key,": ").concat(p.message)).join(", "));s={type:"FeatureCollection",features:s.features.filter(p=>u.value.evaluate({zoom:0},p))}}this._geoJSONIndex=r.cluster?new ui(Wx(r)).load(s.features):nl(s,r.geojsonVtOptions)}catch(u){return n(u)}this.loaded={};let l={};if(i){let u=i.finish();u&&(l.resourceTiming={},l.resourceTiming[r.source]=JSON.parse(JSON.stringify(u)))}n(null,l)}})}reloadTile(r,n){let i=this.loaded,o=r.uid;return i&&i[o]?super.reloadTile(r,n):this.loadTile(r,n)}removeSource(r,n){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),n()}getClusterExpansionZoom(r,n){try{n(null,this._geoJSONIndex.getClusterExpansionZoom(r.clusterId))}catch(i){n(i)}}getClusterChildren(r,n){try{n(null,this._geoJSONIndex.getChildren(r.clusterId))}catch(i){n(i)}}getClusterLeaves(r,n){try{n(null,this._geoJSONIndex.getLeaves(r.clusterId,r.limit,r.offset))}catch(i){n(i)}}};function Wx({superclusterOptions:e,clusterProperties:t}){if(!t||!e)return e;let r={},n={},i={accumulated:null,zoom:0},o={properties:null},a=Object.keys(t);for(let s of a){let[l,u]=t[s],c=Rt(u),p=Rt(typeof l=="string"?[l,["accumulated"],["get",s]]:l);r[s]=c.value,n[s]=p.value}return e.map=s=>{o.properties=s;let l={};for(let u of a)l[u]=r[u].evaluate(i,o);return l},e.reduce=(s,l)=>{o.properties=l;for(let u of a)i.accumulated=s[u],s[u]=n[u].evaluate(i,o)},e}var fa=class{constructor(t){this.self=t,this.actor=new Oi(t,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Br,geojson:pa},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(r,n)=>{if(this.workerSourceTypes[r])throw new Error(\'Worker source with name "\'.concat(r,\'" already registered.\'));this.workerSourceTypes[r]=n},this.self.registerRTLTextPlugin=r=>{if(ae.isParsed())throw new Error("RTL text plugin already registered.");ae.applyArabicShaping=r.applyArabicShaping,ae.processBidirectionalText=r.processBidirectionalText,ae.processStyledBidirectionalText=r.processStyledBidirectionalText}}setReferrer(t,r){this.referrer=r}setImages(t,r,n){this.availableImages[t]=r;for(let i in this.workerSources[t]){let o=this.workerSources[t][i];for(let a in o)o[a].availableImages=r}n()}setLayers(t,r,n){this.getLayerIndex(t).replace(r),n()}updateLayers(t,r,n){this.getLayerIndex(t).update(r.layers,r.removedIds),n()}loadTile(t,r,n){this.getWorkerSource(t,r.type,r.source).loadTile(r,n)}loadDEMTile(t,r,n){this.getDEMWorkerSource(t,r.source).loadTile(r,n)}reloadTile(t,r,n){this.getWorkerSource(t,r.type,r.source).reloadTile(r,n)}abortTile(t,r,n){this.getWorkerSource(t,r.type,r.source).abortTile(r,n)}removeTile(t,r,n){this.getWorkerSource(t,r.type,r.source).removeTile(r,n)}removeDEMTile(t,r){this.getDEMWorkerSource(t,r.source).removeTile(r)}removeSource(t,r,n){if(!this.workerSources[t]||!this.workerSources[t][r.type]||!this.workerSources[t][r.type][r.source])return;let i=this.workerSources[t][r.type][r.source];delete this.workerSources[t][r.type][r.source],i.removeSource!==void 0?i.removeSource(r,n):n()}loadWorkerSource(t,r,n){try{this.self.importScripts(r.url),n()}catch(i){n(i.toString())}}syncRTLPluginState(t,r,n){try{ae.setState(r);let i=ae.getPluginURL();if(ae.isLoaded()&&!ae.isParsed()&&i!=null){this.self.importScripts(i);let o=ae.isParsed(),a=o?void 0:new Error("RTL Text Plugin failed to import scripts from ".concat(i));n(a,o)}}catch(i){n(i.toString())}}getAvailableImages(t){let r=this.availableImages[t];return r||(r=[]),r}getLayerIndex(t){let r=this.layerIndexes[t];return r||(r=this.layerIndexes[t]=new Jo),r}getWorkerSource(t,r,n){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][r]||(this.workerSources[t][r]={}),!this.workerSources[t][r][n]){let i={send:(o,a,s)=>{this.actor.send(o,a,s,t)}};this.workerSources[t][r][n]=new this.workerSourceTypes[r](i,this.getLayerIndex(t),this.getAvailableImages(t))}return this.workerSources[t][r][n]}getDEMWorkerSource(t,r){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][r]||(this.demWorkerSources[t][r]=new ra),this.demWorkerSources[t][r]}};Ie()&&(self.worker=new fa(self));})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n';var Cb=u(()=>URL.createObjectURL(new Blob([ty],{type:"text/javascript"})),"getWorkerURL");function ry(){return new Worker(Cb())}u(ry,"workerFactory");var Qo="mapboxgl_preloaded_worker_pool",Yo=class Yo{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Yo.workerCount;)this.workers.push(ry());return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Qo]}numActive(){return Object.keys(this.active).length}};u(Yo,"WorkerPool");var Yt=Yo,Eb=Math.floor(ee.hardwareConcurrency/2);Yt.workerCount=ar(globalThis)?Math.max(Math.min(Eb,3),1):1;var pn;function sp(){return pn||(pn=new Yt),pn}u(sp,"getGlobalWorkerPool");function iy(){sp().acquire(Qo)}u(iy,"prewarm");function ny(){let n=pn;n&&(n.isPreloaded()&&n.numActive()===1?(n.release(Qo),pn=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()"))}u(ny,"clearPrewarmedResources");f();f();f();var _t=te(be(),1);f();var Et=te(be(),1);function lp(n,t,e,r,i){let o=[];for(let a=0;a<n.length;a++){let s=n[a],l;for(let c=0;c<s.length-1;c++){let p=s[c],m=s[c+1];p.x<t&&m.x<t||(p.x<t?p=new Et.default(t,p.y+(m.y-p.y)*((t-p.x)/(m.x-p.x)))._round():m.x<t&&(m=new Et.default(t,p.y+(m.y-p.y)*((t-p.x)/(m.x-p.x)))._round()),!(p.y<e&&m.y<e)&&(p.y<e?p=new Et.default(p.x+(m.x-p.x)*((e-p.y)/(m.y-p.y)),e)._round():m.y<e&&(m=new Et.default(p.x+(m.x-p.x)*((e-p.y)/(m.y-p.y)),e)._round()),!(p.x>=r&&m.x>=r)&&(p.x>=r?p=new Et.default(r,p.y+(m.y-p.y)*((r-p.x)/(m.x-p.x)))._round():m.x>=r&&(m=new Et.default(r,p.y+(m.y-p.y)*((r-p.x)/(m.x-p.x)))._round()),!(p.y>=i&&m.y>=i)&&(p.y>=i?p=new Et.default(p.x+(m.x-p.x)*((i-p.y)/(m.y-p.y)),i)._round():m.y>=i&&(m=new Et.default(p.x+(m.x-p.x)*((i-p.y)/(m.y-p.y)),i)._round()),(!l||!p.equals(l[l.length-1]))&&(l=[p],o.push(l)),l.push(m)))))}}return o}u(lp,"clipLine");f();var up=class up{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let r=1;r<this.points.length;r++)this._distances[r]=this._distances[r-1]+this.points[r].dist(this.points[r-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(t){if(this.points.length===1)return this.points[0];t=ye(t,0,1);let e=1,r=this._distances[e],i=t*this.paddedLength+this.padding;for(;r<i&&e<this._distances.length;)r=this._distances[++e];let o=e-1,a=this._distances[o],s=r-a,l=s>0?(i-a)/s:0;return this.points[o].mult(1-l).add(this.points[e].mult(l))}};u(up,"PathInterpolator");var ea=up;f();function ta(n,t){let e=!0;return n==="always"||(n==="never"||t==="never")&&(e=!1),e}u(ta,"overlapAllowed");var cp=class cp{constructor(t,e,r){let i=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(let a=0;a<this.xCellCount*this.yCellCount;a++)i.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,r,i,o){this._forEachCell(e,r,i,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(o)}insertCircle(t,e,r,i){this._forEachCell(e-i,r-i,e+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(i)}_insertBoxCell(t,e,r,i,o,a){this.boxCells[o].push(a)}_insertCircleCell(t,e,r,i,o,a){this.circleCells[o].push(a)}_query(t,e,r,i,o,a,s){if(r<0||t>this.width||i<0||e>this.height)return[];let l=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=i){if(o)return[{key:null,x1:t,y1:e,x2:r,y2:i}];for(let c=0;c<this.boxKeys.length;c++)l.push({key:this.boxKeys[c],x1:this.bboxes[c*4],y1:this.bboxes[c*4+1],x2:this.bboxes[c*4+2],y2:this.bboxes[c*4+3]});for(let c=0;c<this.circleKeys.length;c++){let p=this.circles[c*3],m=this.circles[c*3+1],h=this.circles[c*3+2];l.push({key:this.circleKeys[c],x1:p-h,y1:m-h,x2:p+h,y2:m+h})}}else{let c={hitTest:o,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(t,e,r,i,this._queryCell,l,c,s)}return l}query(t,e,r,i){return this._query(t,e,r,i,!1,null)}hitTest(t,e,r,i,o,a){return this._query(t,e,r,i,!0,o,a).length>0}hitTestCircle(t,e,r,i,o){let a=t-r,s=t+r,l=e-r,c=e+r;if(s<0||a>this.width||c<0||l>this.height)return!1;let p=[],m={hitTest:!0,overlapMode:i,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(a,l,s,c,this._queryCellCircle,p,m,o),p.length>0}_queryCell(t,e,r,i,o,a,s,l){let{seenUids:c,hitTest:p,overlapMode:m}=s,h=this.boxCells[o];if(h!==null){let g=this.bboxes;for(let y of h)if(!c.box[y]){c.box[y]=!0;let x=y*4,v=this.boxKeys[y];if(t<=g[x+2]&&e<=g[x+3]&&r>=g[x+0]&&i>=g[x+1]&&(!l||l(v))&&(!p||!ta(m,v.overlapMode))&&(a.push({key:v,x1:g[x],y1:g[x+1],x2:g[x+2],y2:g[x+3]}),p))return!0}}let d=this.circleCells[o];if(d!==null){let g=this.circles;for(let y of d)if(!c.circle[y]){c.circle[y]=!0;let x=y*3,v=this.circleKeys[y];if(this._circleAndRectCollide(g[x],g[x+1],g[x+2],t,e,r,i)&&(!l||l(v))&&(!p||!ta(m,v.overlapMode))){let b=g[x],w=g[x+1],S=g[x+2];if(a.push({key:v,x1:b-S,y1:w-S,x2:b+S,y2:w+S}),p)return!0}}}return!1}_queryCellCircle(t,e,r,i,o,a,s,l){let{circle:c,seenUids:p,overlapMode:m}=s,h=this.boxCells[o];if(h!==null){let g=this.bboxes;for(let y of h)if(!p.box[y]){p.box[y]=!0;let x=y*4,v=this.boxKeys[y];if(this._circleAndRectCollide(c.x,c.y,c.radius,g[x+0],g[x+1],g[x+2],g[x+3])&&(!l||l(v))&&!ta(m,v.overlapMode))return a.push(!0),!0}}let d=this.circleCells[o];if(d!==null){let g=this.circles;for(let y of d)if(!p.circle[y]){p.circle[y]=!0;let x=y*3,v=this.circleKeys[y];if(this._circlesCollide(g[x],g[x+1],g[x+2],c.x,c.y,c.radius)&&(!l||l(v))&&!ta(m,v.overlapMode))return a.push(!0),!0}}}_forEachCell(t,e,r,i,o,a,s,l){let c=this._convertToXCellCoord(t),p=this._convertToYCellCoord(e),m=this._convertToXCellCoord(r),h=this._convertToYCellCoord(i);for(let d=c;d<=m;d++)for(let g=p;g<=h;g++){let y=this.xCellCount*g+d;if(o.call(this,t,e,r,i,y,a,s,l))return}}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,r,i,o,a){let s=i-t,l=o-e,c=r+a;return c*c>s*s+l*l}_circleAndRectCollide(t,e,r,i,o,a,s){let l=(a-i)/2,c=Math.abs(t-(i+l));if(c>l+r)return!1;let p=(s-o)/2,m=Math.abs(e-(o+p));if(m>p+r)return!1;if(c<=l||m<=p)return!0;let h=c-l,d=m-p;return h*h+d*d<=r*r}};u(cp,"GridIndex");var mn=cp;f();var oi=te(be(),1);function hn(n,t,e,r,i){let o=G.create();return t?(G.scale(o,o,[1/i,1/i,1]),e||G.rotateZ(o,o,r.angle)):G.multiply(o,r.labelPlaneMatrix,n),o}u(hn,"getLabelPlaneMatrix");function ia(n,t,e,r,i){if(t){let o=G.clone(n);return G.scale(o,o,[i,i,1]),e||G.rotateZ(o,o,-r.angle),o}else return r.glCoordMatrix}u(ia,"getGlCoordMatrix");function rt(n,t,e){let r;e?(r=[n.x,n.y,e(n.x,n.y),1],Re.transformMat4(r,r,t)):(r=[n.x,n.y,0,1],na(r,r,t));let i=r[3];return{point:new oi.default(r[0]/i,r[1]/i),signedDistanceFromCamera:i}}u(rt,"project");function fn(n,t){return .5+.5*(n/t)}u(fn,"getPerspectiveRatio");function Mb(n,t){let e=n[0]/n[3],r=n[1]/n[3];return e>=-t[0]&&e<=t[0]&&r>=-t[1]&&r<=t[1]}u(Mb,"isVisible");function sy(n,t,e,r,i,o,a,s,l,c){let p=r?n.textSizeData:n.iconSizeData,m=br(p,e.transform.zoom),h=[256/e.width*2+1,256/e.height*2+1],d=r?n.text.dynamicLayoutVertexArray:n.icon.dynamicLayoutVertexArray;d.clear();let g=n.lineVertexArray,y=r?n.text.placedSymbolArray:n.icon.placedSymbolArray,x=e.transform.width/e.transform.height,v=!1;for(let b=0;b<y.length;b++){let w=y.get(b);if(w.hidden||w.writingMode===2&&!v){Ir(w.numGlyphs,d);continue}v=!1;let S;if(c?(S=[w.anchorX,w.anchorY,c(w.anchorX,w.anchorY),1],Re.transformMat4(S,S,t)):(S=[w.anchorX,w.anchorY,0,1],na(S,S,t)),!Mb(S,h)){Ir(w.numGlyphs,d);continue}let P=S[3],I=fn(e.transform.cameraToCenterDistance,P),C=Zr(p,m,w),z=a?C/I:C*I,D=new oi.default(w.anchorX,w.anchorY),A=rt(D,i,c).point,R={projections:{},offsets:{}},U=ay(w,z,!1,s,t,i,o,n.glyphOffsetArray,g,d,A,D,R,x,l,c);v=U.useVertical,(U.notEnoughRoom||v||U.needsFlipping&&ay(w,z,!0,s,t,i,o,n.glyphOffsetArray,g,d,A,D,R,x,l,c).notEnoughRoom)&&Ir(w.numGlyphs,d)}r?n.text.dynamicLayoutVertexBuffer.updateData(d):n.icon.dynamicLayoutVertexBuffer.updateData(d)}u(sy,"updateLineLabels");function hp(n,t,e,r,i,o,a,s,l,c,p,m,h){let d=s.glyphStartIndex+s.numGlyphs,g=s.lineStartIndex,y=s.lineStartIndex+s.lineLength,x=t.getoffsetX(s.glyphStartIndex),v=t.getoffsetX(d-1),b=ra(n*x,e,r,i,o,a,s.segment,g,y,l,c,p,m,h);if(!b)return null;let w=ra(n*v,e,r,i,o,a,s.segment,g,y,l,c,p,m,h);return w?{first:b,last:w}:null}u(hp,"placeFirstAndLastGlyph");function oy(n,t,e,r){if(n===1){let i=Math.abs(e.y-t.y),o=Math.abs(e.x-t.x)*r;if(i>o)return{useVertical:!0}}return(n===2?t.y<e.y:t.x>e.x)?{needsFlipping:!0}:null}u(oy,"requiresOrientationChange");function ay(n,t,e,r,i,o,a,s,l,c,p,m,h,d,g,y){let x=t/24,v=n.lineOffsetX*x,b=n.lineOffsetY*x,w;if(n.numGlyphs>1){let S=n.glyphStartIndex+n.numGlyphs,P=n.lineStartIndex,I=n.lineStartIndex+n.lineLength,C=hp(x,s,v,b,e,p,m,n,l,o,h,g,y);if(!C)return{notEnoughRoom:!0};let z=rt(C.first.point,a,y).point,D=rt(C.last.point,a,y).point;if(r&&!e){let A=oy(n.writingMode,z,D,d);if(A)return A}w=[C.first];for(let A=n.glyphStartIndex+1;A<S-1;A++)w.push(ra(x*s.getoffsetX(A),v,b,e,p,m,n.segment,P,I,l,o,h,g,y));w.push(C.last)}else{if(r&&!e){let P=rt(m,i,y).point,I=n.lineStartIndex+n.segment+1,C=new oi.default(l.getx(I),l.gety(I)),z=rt(C,i,y),D=z.signedDistanceFromCamera>0?z.point:ly(m,C,P,1,i,y),A=oy(n.writingMode,P,D,d);if(A)return A}let S=ra(x*s.getoffsetX(n.glyphStartIndex),v,b,e,p,m,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,l,o,h,g,y);if(!S)return{notEnoughRoom:!0};w=[S]}for(let S of w)vr(c,S.point,S.angle);return{}}u(ay,"placeGlyphsAlongLine");function ly(n,t,e,r,i,o){let a=rt(n.add(n.sub(t)._unit()),i,o).point,s=e.sub(a);return e.add(s._mult(r/s.mag()))}u(ly,"projectTruncatedLineSegment");function pp(n,t){let{projectionCache:e,lineVertexArray:r,labelPlaneMatrix:i,tileAnchorPoint:o,distanceFromAnchor:a,getElevation:s,previousVertex:l,direction:c,absOffsetX:p}=t;if(e.projections[n])return e.projections[n];let m=new oi.default(r.getx(n),r.gety(n)),h=rt(m,i,s);if(h.signedDistanceFromCamera>0)return e.projections[n]=h.point,h.point;let d=n-c,g=a===0?o:new oi.default(r.getx(d),r.gety(d));return ly(g,m,l,p-a+1,i,s)}u(pp,"projectVertexToViewport");function mp(n,t,e){return n._unit()._perp()._mult(t*e)}u(mp,"transformToOffsetNormal");function Lb(n,t,e,r,i,o,a,s){let{projectionCache:l,direction:c}=s;if(l.offsets[n])return l.offsets[n];let p=e.add(t);if(n+c<r||n+c>=i)return l.offsets[n]=p,p;let m=pp(n+c,s),h=mp(m.sub(e),a,c),d=e.add(h),g=m.add(h);return l.offsets[n]=Jh(o,p,d,g)||p,l.offsets[n]}u(Lb,"findOffsetIntersectionPoint");function ra(n,t,e,r,i,o,a,s,l,c,p,m,h,d){let g=r?n-t:n+t,y=g>0?1:-1,x=0;r&&(y*=-1,x=Math.PI),y<0&&(x+=Math.PI);let v=y>0?s+a:s+a+1,b=i,w=i,S,P,I=0,C=0,z=Math.abs(g),D=[],A;for(;I+C<=z;){if(v+=y,v<s||v>=l)return null;I+=C,w=b,P=S;let N={projectionCache:m,lineVertexArray:c,labelPlaneMatrix:p,tileAnchorPoint:o,distanceFromAnchor:I,getElevation:d,previousVertex:w,direction:y,absOffsetX:z};if(b=pp(v,N),e===0)D.push(w),A=b.sub(w);else{let V,W=b.sub(w);if(W.mag()===0){let Z=pp(v+y,N);V=mp(Z.sub(b),e,y)}else V=mp(W,e,y);P||(P=w.add(V)),S=Lb(v,V,b,s,l,P,e,N),D.push(P),A=S.sub(P)}C=A.mag()}let R=(z-I)/C,U=A._mult(R)._add(P||w),L=x+Math.atan2(b.y-w.y,b.x-w.x);return D.push(U),{point:U,angle:h?L:0,path:D}}u(ra,"placeGlyphAlongLine");var kb=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ir(n,t){for(let e=0;e<n;e++){let r=t.length;t.resize(r+4),t.float32.set(kb,r*3)}}u(Ir,"hideGlyphs");function na(n,t,e){let r=t[0],i=t[1];return n[0]=e[0]*r+e[4]*i+e[12],n[1]=e[1]*r+e[5]*i+e[13],n[3]=e[3]*r+e[7]*i+e[15],n}u(na,"xyTransformMat4");var ze=100,dp=class dp{constructor(t,e=new mn(t.width+2*ze,t.height+2*ze,25),r=new mn(t.width+2*ze,t.height+2*ze,25)){this.transform=t,this.grid=e,this.ignoredGrid=r,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+ze,this.screenBottomBoundary=t.height+ze,this.gridRightBoundary=t.width+2*ze,this.gridBottomBoundary=t.height+2*ze,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,r,i,o,a){let s=this.projectAndGetPerspectiveRatio(i,t.anchorPointX,t.anchorPointY,a),l=r*s.perspectiveRatio,c=t.x1*l+s.point.x,p=t.y1*l+s.point.y,m=t.x2*l+s.point.x,h=t.y2*l+s.point.y;return!this.isInsideGrid(c,p,m,h)||e!=="always"&&this.grid.hitTest(c,p,m,h,e,o)||s.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[c,p,m,h],offscreen:this.isOffscreen(c,p,m,h)}}placeCollisionCircles(t,e,r,i,o,a,s,l,c,p,m,h,d,g){let y=[],x=new _t.default(e.anchorX,e.anchorY),v=rt(x,a,g),b=fn(this.transform.cameraToCenterDistance,v.signedDistanceFromCamera),S=(p?o/b:o*b)/xr,P=rt(x,s,g).point,I={projections:{},offsets:{}},C=e.lineOffsetX*S,z=e.lineOffsetY*S,D=hp(S,i,C,z,!1,P,x,e,r,s,I,!1,g),A=!1,R=!1,U=!0;if(D){let L=h*.5*b+d,N=new _t.default(-ze,-ze),V=new _t.default(this.screenRightBoundary,this.screenBottomBoundary),W=new ea,Z=D.first,ue=D.last,Y=[];for(let ie=Z.path.length-1;ie>=1;ie--)Y.push(Z.path[ie]);for(let ie=1;ie<ue.path.length;ie++)Y.push(ue.path[ie]);let Oe=L*2.5;if(l){let ie=Y.map(ge=>rt(ge,l,g));ie.some(ge=>ge.signedDistanceFromCamera<=0)?Y=[]:Y=ie.map(ge=>ge.point)}let Be=[];if(Y.length>0){let ie=Y[0].clone(),ge=Y[0].clone();for(let Ve=1;Ve<Y.length;Ve++)ie.x=Math.min(ie.x,Y[Ve].x),ie.y=Math.min(ie.y,Y[Ve].y),ge.x=Math.max(ge.x,Y[Ve].x),ge.y=Math.max(ge.y,Y[Ve].y);ie.x>=N.x&&ge.x<=V.x&&ie.y>=N.y&&ge.y<=V.y?Be=[Y]:ge.x<N.x||ie.x>V.x||ge.y<N.y||ie.y>V.y?Be=[]:Be=lp([Y],N.x,N.y,V.x,V.y)}for(let ie of Be){W.reset(ie,L*.25);let ge=0;W.length<=.5*L?ge=1:ge=Math.ceil(W.paddedLength/Oe)+1;for(let Ve=0;Ve<ge;Ve++){let Lt=Ve/Math.max(ge-1,1),kt=W.lerp(Lt),mt=kt.x+ze,vt=kt.y+ze;y.push(mt,vt,L,0);let nr=mt-L,Ue=vt-L,De=mt+L,ce=vt+L;if(U=U&&this.isOffscreen(nr,Ue,De,ce),R=R||this.isInsideGrid(nr,Ue,De,ce),t!=="always"&&this.grid.hitTestCircle(mt,vt,L,t,m)&&(A=!0,!c))return{circles:[],offscreen:!1,collisionDetected:A}}}}return{circles:!c&&A||!R||b<this.perspectiveRatioCutoff?[]:y,offscreen:U,collisionDetected:A}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let e=[],r=1/0,i=1/0,o=-1/0,a=-1/0;for(let p of t){let m=new _t.default(p.x+ze,p.y+ze);r=Math.min(r,m.x),i=Math.min(i,m.y),o=Math.max(o,m.x),a=Math.max(a,m.y),e.push(m)}let s=this.grid.query(r,i,o,a).concat(this.ignoredGrid.query(r,i,o,a)),l={},c={};for(let p of s){let m=p.key;if(l[m.bucketInstanceId]===void 0&&(l[m.bucketInstanceId]={}),l[m.bucketInstanceId][m.featureIndex])continue;let h=[new _t.default(p.x1,p.y1),new _t.default(p.x2,p.y1),new _t.default(p.x2,p.y2),new _t.default(p.x1,p.y2)];yo(e,h)&&(l[m.bucketInstanceId][m.featureIndex]=!0,c[m.bucketInstanceId]===void 0&&(c[m.bucketInstanceId]=[]),c[m.bucketInstanceId].push(m.featureIndex))}return c}insertCollisionBox(t,e,r,i,o,a){let s=r?this.ignoredGrid:this.grid,l={bucketInstanceId:i,featureIndex:o,collisionGroupID:a,overlapMode:e};s.insert(l,t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,r,i,o,a){let s=r?this.ignoredGrid:this.grid,l={bucketInstanceId:i,featureIndex:o,collisionGroupID:a,overlapMode:e};for(let c=0;c<t.length;c+=4)s.insertCircle(l,t[c],t[c+1],t[c+2])}projectAndGetPerspectiveRatio(t,e,r,i){let o;return i?(o=[e,r,i(e,r),1],Re.transformMat4(o,o,t)):(o=[e,r,0,1],na(o,o,t)),{point:new _t.default((o[0]/o[3]+1)/2*this.transform.width+ze,(-o[1]/o[3]+1)/2*this.transform.height+ze),perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/o[3])}}isOffscreen(t,e,r,i){return r<ze||t>=this.screenRightBoundary||i<ze||e>this.screenBottomBoundary}isInsideGrid(t,e,r,i){return r>=0&&t<this.gridRightBoundary&&i>=0&&e<this.gridBottomBoundary}getViewportMatrix(){let t=G.identity([]);return G.translate(t,t,[-ze,-ze,0]),t}};u(dp,"CollisionIndex");var oa=dp;f();f();var uy=te(be(),1);var aa=class aa extends uy.default{constructor(e,r,i,o){super(e,r);this.angle=i,o!==void 0&&(this.segment=o)}clone(){return new aa(this.x,this.y,this.angle,this.segment)}};u(aa,"Anchor");var dn=aa;O("Anchor",dn);f();f();f();var Db=te(be(),1);f();var Fb=te(be(),1);f();var zb=te(be(),1);var Bb=te(zh(),1);var ai=7,Rb=Number.POSITIVE_INFINITY;function sa(n,t){function e(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.sqrt(2);switch(i){case"top-right":case"top-left":s=l-ai;break;case"bottom-right":case"bottom-left":s=-l+ai;break;case"bottom":s=-o+ai;break;case"top":s=o-ai;break}switch(i){case"top-right":case"bottom-right":a=-l;break;case"top-left":case"bottom-left":a=l;break;case"left":a=o;break;case"right":a=-o;break}return[a,s]}u(e,"fromRadialOffset");function r(i,o,a){let s=0,l=0;switch(o=Math.abs(o),a=Math.abs(a),i){case"top-right":case"top-left":case"top":l=a-ai;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+ai;break}switch(i){case"top-right":case"bottom-right":case"right":s=-o;break;case"top-left":case"bottom-left":case"left":s=o;break}return[s,l]}return u(r,"fromTextOffset"),t[1]!==Rb?r(n,t[0],t[1]):e(n,t[0])}u(sa,"evaluateVariableOffset");function cy(n){switch(n){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}u(cy,"getAnchorJustification");f();function Fe(n,t,e){return t*(8192/(n.tileSize*Math.pow(2,e-n.tileID.overscaledZ)))}u(Fe,"pixelsToTileUnits");var ma=te(be(),1);var bp=class bp{constructor(t,e,r,i){t?this.opacity=Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):this.opacity=i&&r?1:0,this.placed=r}isHidden(){return this.opacity===0&&!this.placed}};u(bp,"OpacityState");var ua=bp,vp=class vp{constructor(t,e,r,i,o){this.text=new ua(t?t.text:null,e,r,o),this.icon=new ua(t?t.icon:null,e,i,o)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}};u(vp,"JointOpacityState");var Ar=vp,wp=class wp{constructor(t,e,r){this.text=t,this.icon=e,this.skipFade=r}};u(wp,"JointPlacement");var ca=wp,Sp=class Sp{constructor(){this.invProjMatrix=G.create(),this.viewportMatrix=G.create(),this.circles=[]}};u(Sp,"CollisionCircleArray");var gp=Sp,Pp=class Pp{constructor(t,e,r,i,o){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=o}};u(Pp,"RetainedQueryData");var xp=Pp,Tp=class Tp{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){let e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:r=>r.collisionGroupID===e}}return this.collisionGroups[t]}};u(Tp,"CollisionGroups");var _p=Tp;function py(n,t,e,r,i){let{horizontalAlign:o,verticalAlign:a}=Mo(n),s=-(o-.5)*t,l=-(a-.5)*e,c=sa(n,r);return new ma.default(s+c[0]*i,l+c[1]*i)}u(py,"calculateVariableLayoutShift");function yp(n,t,e,r,i,o){let{x1:a,x2:s,y1:l,y2:c,anchorPointX:p,anchorPointY:m}=n,h=new ma.default(t,e);return r&&h._rotate(i?o:-o),{x1:a+h.x,y1:l+h.y,x2:s+h.x,y2:c+h.y,anchorPointX:p,anchorPointY:m}}u(yp,"shiftVariableCollisionBox");var Ip=class Ip{constructor(t,e,r,i,o){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new oa(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new _p(i),this.collisionCircleArrays={},this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,e,r,i){let o=r.getBucket(e),a=r.latestFeatureIndex;if(!o||!a||e.id!==o.layerIds[0])return;let s=r.collisionBoxArray,l=o.layers[0].layout,c=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),p=r.tileSize/8192,m=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),h=l.get("text-pitch-alignment")==="map",d=l.get("text-rotation-alignment")==="map",g=Fe(r,1,this.transform.zoom),y=hn(m,h,d,this.transform,g),x=null;if(h){let b=ia(m,h,d,this.transform,g);x=G.multiply([],this.transform.labelPlaneMatrix,b)}this.retainedQueryData[o.bucketInstanceId]=new xp(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,r.tileID);let v={bucket:o,layout:l,posMatrix:m,textLabelPlaneMatrix:y,labelToScreenMatrix:x,scale:c,textPixelRatio:p,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:br(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(i)for(let b of o.sortKeyRanges){let{sortKey:w,symbolInstanceStart:S,symbolInstanceEnd:P}=b;t.push({sortKey:w,symbolInstanceStart:S,symbolInstanceEnd:P,parameters:v})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:v})}attemptAnchorPlacement(t,e,r,i,o,a,s,l,c,p,m,h,d,g,y,x){let v=[h.textOffset0,h.textOffset1],b=py(t,r,i,v,o),w=this.collisionIndex.placeCollisionBox(yp(e,b.x,b.y,a,s,this.transform.angle),m,l,c,p.predicate,x);if(!(y&&this.collisionIndex.placeCollisionBox(yp(y,b.x,b.y,a,s,this.transform.angle),m,l,c,p.predicate,x).box.length===0)&&w.box.length>0){let S;if(this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(S=this.prevPlacement.variableOffsets[h.crossTileID].anchor),h.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[h.crossTileID]={textOffset:v,width:r,height:i,anchor:t,textBoxScale:o,prevAnchor:S},this.markUsedJustification(d,t,h,g),d.allowVerticalPlacement&&(this.markUsedOrientation(d,g,h),this.placedOrientations[h.crossTileID]=g),{shift:b,placedGlyphBoxes:w}}}placeLayerBucketPart(t,e,r){let{bucket:i,layout:o,posMatrix:a,textLabelPlaneMatrix:s,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:p,collisionBoxArray:m,partiallyEvaluatedTextSize:h,collisionGroup:d}=t.parameters,g=o.get("text-optional"),y=o.get("icon-optional"),x=Wr(o,"text-overlap","text-allow-overlap"),v=x==="always",b=Wr(o,"icon-overlap","icon-allow-overlap"),w=b==="always",S=o.get("text-rotation-alignment")==="map",P=o.get("text-pitch-alignment")==="map",I=o.get("icon-text-fit")!=="none",C=o.get("symbol-z-order")==="viewport-y",z=v&&(w||!i.hasIconData()||y),D=w&&(v||!i.hasTextData()||g);!i.collisionArrays&&m&&i.deserializeCollisionBoxes(m);let A=this.retainedQueryData[i.bucketInstanceId].tileID,R=this.terrain?(L,N)=>this.terrain.getElevation(A,L,N):null,U=u((L,N)=>{if(e[L.crossTileID])return;if(p){this.placements[L.crossTileID]=new ca(!1,!1,!1);return}let V=!1,W=!1,Z=!0,ue=null,Y={box:null,offscreen:null},Oe={box:null,offscreen:null},Be=null,ie=null,ge=null,Ve=0,Lt=0,kt=0;N.textFeatureIndex?Ve=N.textFeatureIndex:L.useRuntimeCollisionCircles&&(Ve=L.featureIndex),N.verticalTextFeatureIndex&&(Lt=N.verticalTextFeatureIndex);let mt=N.textBox;if(mt){let Ue=u(ce=>{let it=1;if(i.allowVerticalPlacement&&!ce&&this.prevPlacement){let st=this.prevPlacement.placedOrientations[L.crossTileID];st&&(this.placedOrientations[L.crossTileID]=st,it=st,this.markUsedOrientation(i,it,L))}return it},"updatePreviousOrientationIfNotPlaced"),De=u((ce,it)=>{if(i.allowVerticalPlacement&&L.numVerticalGlyphVertices>0&&N.verticalTextBox){for(let st of i.writingModes)if(st===2?(Y=it(),Oe=Y):Y=ce(),Y&&Y.box&&Y.box.length)break}else Y=ce()},"placeTextForPlacementModes");if(o.get("text-variable-anchor")){let ce=o.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[L.crossTileID]){let Pe=this.prevPlacement.variableOffsets[L.crossTileID];ce.indexOf(Pe.anchor)>0&&(ce=ce.filter(or=>or!==Pe.anchor),ce.unshift(Pe.anchor))}let it=u((Pe,or,Zs)=>{let t_=Pe.x2-Pe.x1,r_=Pe.y2-Pe.y1,i_=L.textBoxScale,n_=I&&b==="never"?or:null,hi={box:[],offscreen:!1},o_=x!=="never"?ce.length*2:ce.length;for(let In=0;In<o_;++In){let a_=ce[In%ce.length],s_=In>=ce.length?x:"never",Ws=this.attemptAnchorPlacement(a_,Pe,t_,r_,i_,S,P,c,a,d,s_,L,i,Zs,n_,R);if(Ws&&(hi=Ws.placedGlyphBoxes,hi&&hi.box&&hi.box.length)){V=!0,ue=Ws.shift;break}}return hi},"placeBoxForVariableAnchors");De(u(()=>it(mt,N.iconBox,1),"placeHorizontal"),u(()=>{let Pe=N.verticalTextBox,or=Y&&Y.box&&Y.box.length;return i.allowVerticalPlacement&&!or&&L.numVerticalGlyphVertices>0&&Pe?it(Pe,N.verticalIconBox,2):{box:null,offscreen:null}},"placeVertical")),Y&&(V=Y.box,Z=Y.offscreen);let lt=Ue(Y&&Y.box);if(!V&&this.prevPlacement){let Pe=this.prevPlacement.variableOffsets[L.crossTileID];Pe&&(this.variableOffsets[L.crossTileID]=Pe,this.markUsedJustification(i,Pe.anchor,L,lt))}}else{let ce=u((Dt,lt)=>{let Pe=this.collisionIndex.placeCollisionBox(Dt,x,c,a,d.predicate,R);return Pe&&Pe.box&&Pe.box.length&&(this.markUsedOrientation(i,lt,L),this.placedOrientations[L.crossTileID]=lt),Pe},"placeBox");De(u(()=>ce(mt,1),"placeHorizontal"),u(()=>{let Dt=N.verticalTextBox;return i.allowVerticalPlacement&&L.numVerticalGlyphVertices>0&&Dt?ce(Dt,2):{box:null,offscreen:null}},"placeVertical")),Ue(Y&&Y.box&&Y.box.length)}}if(Be=Y,V=Be&&Be.box&&Be.box.length>0,Z=Be&&Be.offscreen,L.useRuntimeCollisionCircles){let Ue=i.text.placedSymbolArray.get(L.centerJustifiedTextSymbolIndex),De=Zr(i.textSizeData,h,Ue),ce=o.get("text-padding"),it=L.collisionCircleDiameter;ie=this.collisionIndex.placeCollisionCircles(x,Ue,i.lineVertexArray,i.glyphOffsetArray,De,a,s,l,r,P,d.predicate,it,ce,R),ie.circles.length&&ie.collisionDetected&&!r&&xe("Collisions detected, but collision boxes are not shown"),V=v||ie.circles.length>0&&!ie.collisionDetected,Z=Z&&ie.offscreen}if(N.iconFeatureIndex&&(kt=N.iconFeatureIndex),N.iconBox){let Ue=u(De=>{let ce=I&&ue?yp(De,ue.x,ue.y,S,P,this.transform.angle):De;return this.collisionIndex.placeCollisionBox(ce,b,c,a,d.predicate,R)},"placeIconFeature");Oe&&Oe.box&&Oe.box.length&&N.verticalIconBox?(ge=Ue(N.verticalIconBox),W=ge.box.length>0):(ge=Ue(N.iconBox),W=ge.box.length>0),Z=Z&&ge.offscreen}let vt=g||L.numHorizontalGlyphVertices===0&&L.numVerticalGlyphVertices===0,nr=y||L.numIconVertices===0;if(!vt&&!nr?W=V=W&&V:nr?vt||(W=W&&V):V=W&&V,V&&Be&&Be.box&&(Oe&&Oe.box&&Lt?this.collisionIndex.insertCollisionBox(Be.box,x,o.get("text-ignore-placement"),i.bucketInstanceId,Lt,d.ID):this.collisionIndex.insertCollisionBox(Be.box,x,o.get("text-ignore-placement"),i.bucketInstanceId,Ve,d.ID)),W&&ge&&this.collisionIndex.insertCollisionBox(ge.box,b,o.get("icon-ignore-placement"),i.bucketInstanceId,kt,d.ID),ie&&(V&&this.collisionIndex.insertCollisionCircles(ie.circles,x,o.get("text-ignore-placement"),i.bucketInstanceId,Ve,d.ID),r)){let Ue=i.bucketInstanceId,De=this.collisionCircleArrays[Ue];De===void 0&&(De=this.collisionCircleArrays[Ue]=new gp);for(let ce=0;ce<ie.circles.length;ce+=4)De.circles.push(ie.circles[ce+0]),De.circles.push(ie.circles[ce+1]),De.circles.push(ie.circles[ce+2]),De.circles.push(ie.collisionDetected?1:0)}if(L.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(i.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[L.crossTileID]=new ca(V||z,W||D,Z||i.justReloaded),e[L.crossTileID]=!0},"placeSymbol");if(C){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let L=i.getSortedSymbolIndexes(this.transform.angle);for(let N=L.length-1;N>=0;--N){let V=L[N];U(i.symbolInstances.get(V),i.collisionArrays[V])}}else for(let L=t.symbolInstanceStart;L<t.symbolInstanceEnd;L++)U(i.symbolInstances.get(L),i.collisionArrays[L]);if(r&&i.bucketInstanceId in this.collisionCircleArrays){let L=this.collisionCircleArrays[i.bucketInstanceId];G.invert(L.invProjMatrix,a),L.viewportMatrix=this.collisionIndex.getViewportMatrix()}i.justReloaded=!1}markUsedJustification(t,e,r,i){let o={left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex},a;i===2?a=r.verticalPlacedTextSymbolIndex:a=o[cy(e)];let s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let l of s)l>=0&&(a>=0&&l!==a?t.text.placedSymbolArray.get(l).crossTileID=0:t.text.placedSymbolArray.get(l).crossTileID=r.crossTileID)}markUsedOrientation(t,e,r){let i=e===1||e===3?e:0,o=e===2?e:0,a=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let s of a)t.text.placedSymbolArray.get(s).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;let e=this.prevPlacement,r=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;let i=e?e.symbolFadeChange(t):1,o=e?e.opacities:{},a=e?e.variableOffsets:{},s=e?e.placedOrientations:{};for(let l in this.placements){let c=this.placements[l],p=o[l];p?(this.opacities[l]=new Ar(p,i,c.text,c.icon),r=r||c.text!==p.text.placed||c.icon!==p.icon.placed):(this.opacities[l]=new Ar(null,i,c.text,c.icon,c.skipFade),r=r||c.text||c.icon)}for(let l in o){let c=o[l];if(!this.opacities[l]){let p=new Ar(c,i,!1,!1);p.isHidden()||(this.opacities[l]=p,r=r||c.text.placed||c.icon.placed)}}for(let l in a)!this.variableOffsets[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.variableOffsets[l]=a[l]);for(let l in s)!this.placedOrientations[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.placedOrientations[l]=s[l]);if(e&&e.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){let r={};for(let i of e){let o=i.getBucket(t);o&&i.latestFeatureIndex&&t.id===o.layerIds[0]&&this.updateBucketOpacities(o,r,i.collisionBoxArray)}}updateBucketOpacities(t,e,r){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();let i=t.layers[0].layout,o=new Ar(null,0,!1,!1,!0),a=i.get("text-allow-overlap"),s=i.get("icon-allow-overlap"),l=i.get("text-variable-anchor"),c=i.get("text-rotation-alignment")==="map",p=i.get("text-pitch-alignment")==="map",m=i.get("icon-text-fit")!=="none",h=new Ar(null,0,a&&(s||!t.hasIconData()||i.get("icon-optional")),s&&(a||!t.hasTextData()||i.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);let d=u((g,y,x)=>{for(let v=0;v<y/4;v++)g.opacityVertexArray.emplaceBack(x);g.hasVisibleVertices=g.hasVisibleVertices||x!==yn},"addOpacities");for(let g=0;g<t.symbolInstances.length;g++){let y=t.symbolInstances.get(g),{numHorizontalGlyphVertices:x,numVerticalGlyphVertices:v,crossTileID:b}=y,w=e[b],S=this.opacities[b];w?S=o:S||(S=h,this.opacities[b]=S),e[b]=!0;let P=x>0||v>0,I=y.numIconVertices>0,C=this.placedOrientations[y.crossTileID],z=C===2,D=C===1||C===3;if(P){let A=my(S.text),R=z?yn:A;d(t.text,x,R);let U=D?yn:A;d(t.text,v,U);let L=S.text.isHidden();[y.rightJustifiedTextSymbolIndex,y.centerJustifiedTextSymbolIndex,y.leftJustifiedTextSymbolIndex].forEach(W=>{W>=0&&(t.text.placedSymbolArray.get(W).hidden=L||z?1:0)}),y.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(y.verticalPlacedTextSymbolIndex).hidden=L||D?1:0);let N=this.variableOffsets[y.crossTileID];N&&this.markUsedJustification(t,N.anchor,y,C);let V=this.placedOrientations[y.crossTileID];V&&(this.markUsedJustification(t,"left",y,V),this.markUsedOrientation(t,V,y))}if(I){let A=my(S.icon),R=!(m&&y.verticalPlacedIconSymbolIndex&&z);if(y.placedIconSymbolIndex>=0){let U=R?A:yn;d(t.icon,y.numIconVertices,U),t.icon.placedSymbolArray.get(y.placedIconSymbolIndex).hidden=S.icon.isHidden()}if(y.verticalPlacedIconSymbolIndex>=0){let U=R?yn:A;d(t.icon,y.numVerticalIconVertices,U),t.icon.placedSymbolArray.get(y.verticalPlacedIconSymbolIndex).hidden=S.icon.isHidden()}}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let A=t.collisionArrays[g];if(A){let R=new ma.default(0,0);if(A.textBox||A.verticalTextBox){let L=!0;if(l){let N=this.variableOffsets[b];N?(R=py(N.anchor,N.width,N.height,N.textOffset,N.textBoxScale),c&&R._rotate(p?this.transform.angle:-this.transform.angle)):L=!1}A.textBox&&la(t.textCollisionBox.collisionVertexArray,S.text.placed,!L||z,R.x,R.y),A.verticalTextBox&&la(t.textCollisionBox.collisionVertexArray,S.text.placed,!L||D,R.x,R.y)}let U=!!(!D&&A.verticalIconBox);A.iconBox&&la(t.iconCollisionBox.collisionVertexArray,S.icon.placed,U,m?R.x:0,m?R.y:0),A.verticalIconBox&&la(t.iconCollisionBox.collisionVertexArray,S.icon.placed,!U,m?R.x:0,m?R.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error("bucket.text.opacityVertexArray.length (= ".concat(t.text.opacityVertexArray.length,") !== bucket.text.layoutVertexArray.length (= ").concat(t.text.layoutVertexArray.length,") / 4"));if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error("bucket.icon.opacityVertexArray.length (= ".concat(t.icon.opacityVertexArray.length,") !== bucket.icon.layoutVertexArray.length (= ").concat(t.icon.layoutVertexArray.length,") / 4"));if(t.bucketInstanceId in this.collisionCircleArrays){let g=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=g.invProjMatrix,t.placementViewportMatrix=g.viewportMatrix,t.collisionCircleArray=g.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){let r=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*r>t}setStale(){this.stale=!0}};u(Ip,"Placement");var pa=Ip;function la(n,t,e,r,i){n.emplaceBack(t?1:0,e?1:0,r||0,i||0),n.emplaceBack(t?1:0,e?1:0,r||0,i||0),n.emplaceBack(t?1:0,e?1:0,r||0,i||0),n.emplaceBack(t?1:0,e?1:0,r||0,i||0)}u(la,"updateCollisionVertices");var Ob=Math.pow(2,25),Vb=Math.pow(2,24),Ub=Math.pow(2,17),Nb=Math.pow(2,16),Gb=Math.pow(2,9),qb=Math.pow(2,8),jb=Math.pow(2,1);function my(n){if(n.opacity===0&&!n.placed)return 0;if(n.opacity===1&&n.placed)return 4294967295;let t=n.placed?1:0,e=Math.floor(n.opacity*127);return e*Ob+t*Vb+e*Ub+t*Nb+e*Gb+t*qb+e*jb+t}u(my,"packOpacity");var yn=0;var Cp=class Cp{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,r,i,o){let a=this._bucketParts;for(;this._currentTileIndex<t.length;){let s=t[this._currentTileIndex];if(e.getBucketParts(a,i,s,this._sortAcrossTiles),this._currentTileIndex++,o())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((s,l)=>s.sortKey-l.sortKey));this._currentPartIndex<a.length;){let s=a[this._currentPartIndex];if(e.placeLayerBucketPart(s,this._seenCrossTileIDs,r),this._currentPartIndex++,o())return!0}return!1}};u(Cp,"LayerPlacement");var Ap=Cp,Ep=class Ep{constructor(t,e,r,i,o,a,s,l){this.placement=new pa(t,e,a,s,l),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=o,this._done=!1}isDone(){return this._done}continuePlacement(t,e,r){let i=ee.now(),o=u(()=>this._forceFullPlacement?!1:ee.now()-i>2,"shouldPausePlacement");for(;this._currentPlacementIndex>=0;){let a=t[this._currentPlacementIndex],s=e[a],l=this.placement.collisionIndex.transform.zoom;if(s.type==="symbol"&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new Ap(s)),this._inProgressLayer.continuePlacement(r[s.source],this.placement,this._showCollisionBoxes,s,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}};u(Ep,"PauseablePlacement");var ha=Ep;f();var gn=512/8192/2,Hb=128,Dp=class Dp{constructor(t,e,r){this.tileID=t;this.bucketInstanceId=r;this._symbolsByKey={};let i=new Map;for(let o=0;o<e.length;o++){let a=e.get(o),s=a.key,l=i.get(s);l?l.push(a):i.set(s,[a])}for(let[o,a]of i){let s=a.map(p=>({x:Math.floor(p.anchorX*gn),y:Math.floor(p.anchorY*gn)})),l=a.map(p=>p.crossTileID),c={positions:s,crossTileIDs:l};if(c.positions.length>Hb){let p=new Nh(c.positions.length,16,Uint16Array);for(let{x:m,y:h}of c.positions)p.add(m,h);p.finish(),delete c.positions,c.index=p}this._symbolsByKey[o]=c}}getScaledCoordinates(t,e){let{x:r,y:i,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=e.canonical,c=l-o,p=gn/Math.pow(2,c),m=(a*8192+t.anchorX)*p,h=(s*8192+t.anchorY)*p,d=r*8192*gn,g=i*8192*gn;return{x:Math.floor(m-d),y:Math.floor(h-g)}}findMatches(t,e,r){let i=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let o=0;o<t.length;o++){let a=t.get(o);if(a.crossTileID)continue;let s=this._symbolsByKey[a.key];if(!s)continue;let l=this.getScaledCoordinates(a,e);if(s.index){let c=s.index.range(l.x-i,l.y-i,l.x+i,l.y+i).sort();for(let p of c){let m=s.crossTileIDs[p];if(!r[m]){r[m]=!0,a.crossTileID=m;break}}}else if(s.positions)for(let c=0;c<s.positions.length;c++){let p=s.positions[c],m=s.crossTileIDs[c];if(Math.abs(p.x-l.x)<=i&&Math.abs(p.y-l.y)<=i&&!r[m]){r[m]=!0,a.crossTileID=m;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}};u(Dp,"TileLayerIndex");var Mp=Dp,Fp=class Fp{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}};u(Fp,"CrossTileIDs");var Lp=Fp,zp=class zp{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){let e=Math.round((t-this.lng)/360);if(e!==0)for(let r in this.indexes){let i=this.indexes[r],o={};for(let a in i){let s=i[a];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+e),o[s.tileID.key]=s}this.indexes[r]=o}this.lng=t}addBucket(t,e,r){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let o=0;o<e.symbolInstances.length;o++){let a=e.symbolInstances.get(o);a.crossTileID=0}this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});let i=this.usedCrossTileIDs[t.overscaledZ];for(let o in this.indexes){let a=this.indexes[o];if(Number(o)>t.overscaledZ)for(let s in a){let l=a[s];l.tileID.isChildOf(t)&&l.findMatches(e.symbolInstances,t,i)}else{let s=t.scaledTo(Number(o)),l=a[s.key];l&&l.findMatches(e.symbolInstances,t,i)}}for(let o=0;o<e.symbolInstances.length;o++){let a=e.symbolInstances.get(o);a.crossTileID||(a.crossTileID=r.generate(),i[a.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Mp(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(let r of e.getCrossTileIDsLists())for(let i of r)delete this.usedCrossTileIDs[t][i]}removeStaleBuckets(t){let e=!1;for(let r in this.indexes){let i=this.indexes[r];for(let o in i)t[i[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[o]),delete i[o],e=!0)}return e}};u(zp,"CrossTileSymbolLayerIndex");var kp=zp,Bp=class Bp{constructor(){this.layerIndexes={},this.crossTileIDs=new Lp,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,r){let i=this.layerIndexes[t.id];i===void 0&&(i=this.layerIndexes[t.id]=new kp);let o=!1,a={};i.handleWrapJump(r);for(let s of e){let l=s.getBucket(t);!l||t.id!==l.layerIds[0]||(l.bucketInstanceId||(l.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(s.tileID,l,this.crossTileIDs)&&(o=!0),a[l.bucketInstanceId]=!0)}return i.removeStaleBuckets(a)&&(o=!0),o}pruneUnusedLayers(t){let e={};t.forEach(r=>{e[r]=!0});for(let r in this.layerIndexes)e[r]||delete this.layerIndexes[r]}};u(Bp,"CrossTileSymbolIndex");var si=Bp;var fa=u((n,t)=>kr(n,t&&t.filter(e=>e.identifier!=="source.canvas")),"emitValidationErrors"),Zb=ht(Ks,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),Wb=ht(Ks,["setCenter","setZoom","setBearing","setPitch"]),Xb=Dh(),da=class da extends se{constructor(e,r={}){super();this.map=e,this.dispatcher=new un(sp(),this,e._getMapId()),this.imageManager=new Uo,this.imageManager.setEventedParent(this),this.glyphManager=new No(e._requestManager,r.localIdeographFontFamily),this.lineAtlas=new qo(256,512),this.crossTileSymbolIndex=new si,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new zr,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",Un());let i=this;this._rtlTextPluginCallback=da.registerForPluginStateChange(o=>{let a={pluginStatus:o.pluginStatus,pluginURL:o.pluginURL};i.dispatcher.broadcast("syncRTLPluginState",a,(s,l)=>{if(yl(s),l&&l.every(p=>p))for(let p in i.sourceCaches){let m=i.sourceCaches[p].getSource().type;(m==="vector"||m==="geojson")&&i.sourceCaches[p].reload()}})}),this.on("data",o=>{if(o.dataType!=="source"||o.sourceDataType!=="metadata")return;let a=this.sourceCaches[o.sourceId];if(!a)return;let s=a.getSource();if(!(!s||!s.vectorLayerIds))for(let l in this._layers){let c=this._layers[l];c.source===s.id&&this._validateLayer(c)}})}loadURL(e,r={},i){this.fire(new E("dataloading",{dataType:"style"})),r.validate=typeof r.validate=="boolean"?r.validate:!0;let o=this.map._requestManager.transformRequest(e,"Style");this._request=Bt(o,(a,s)=>{this._request=null,a?this.fire(new j(a)):s&&this._load(s,r,i)})}loadJSON(e,r={},i){this.fire(new E("dataloading",{dataType:"style"})),this._request=ee.frame(()=>{this._request=null,r.validate=r.validate!==!1,this._load(e,r,i)})}loadEmpty(){this.fire(new E("dataloading",{dataType:"style"})),this._load(Xb,{validate:!1})}_load(e,r,i){let o=r.transformStyle?r.transformStyle(i,e):e;if(!(r.validate&&fa(this,Me(o)))){this._loaded=!0,this.stylesheet=o;for(let a in o.sources)this.addSource(a,o.sources[a],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new Go(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new E("data",{dataType:"style"})),this.fire(new E("style.load"))}}_createLayers(){let e=Xs(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",e),this._order=e.map(r=>r.id),this._layers={},this._serializedLayers=null;for(let r of e){let i=Oo(r);i.setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=i}}_loadSprite(e,r=!1,i=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=Dd(e,this.map._requestManager,this.map.getPixelRatio(),(o,a)=>{if(this._spriteRequest=null,o)this.fire(new j(o));else if(a)for(let s in a){this._spritesImagesIds[s]=[];let l=this._spritesImagesIds[s]?this._spritesImagesIds[s].filter(c=>!(c in a)):[];for(let c of l)this.imageManager.removeImage(c),this._changedImages[c]=!0;for(let c in a[s]){let p=s==="default"?c:"".concat(s,":").concat(c);this._spritesImagesIds[s].push(p),p in this.imageManager.images?this.imageManager.updateImage(p,a[s][c],!1):this.imageManager.addImage(p,a[s][c]),r&&(this._changedImages[p]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),r&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new E("data",{dataType:"style"})),i&&i(o)})}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new E("data",{dataType:"style"}))}_validateLayer(e){let r=this.sourceCaches[e.source];if(!r)return;let i=e.sourceLayer;if(!i)return;let o=r.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(i)===-1)&&this.fire(new j(new Error('Source layer "'.concat(i,'" ')+'does not exist on source "'.concat(o.id,'" ')+'as specified by style layer "'.concat(e.id,'".'))))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e){let r=this._serializedAllLayers();if(!e||e.length===0)return Object.values(r);let i=[];for(let o of e)r[o]&&i.push(r[o]);return i}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let r=Object.keys(this._layers);for(let i of r){let o=this._layers[i];o.type!=="custom"&&(e[i]=o.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let r=this._changed;if(this._changed){let o=Object.keys(this._updatedLayers),a=Object.keys(this._removedLayers);(o.length||a.length)&&this._updateWorkerLayers(o,a);for(let s in this._updatedSources){let l=this._updatedSources[s];if(l==="reload")this._reloadSource(s);else if(l==="clear")this._clearSource(s);else throw new Error("Invalid action ".concat(l))}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let s in this._updatedPaintProps)this._layers[s].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}let i={};for(let o in this.sourceCaches){let a=this.sourceCaches[o];i[o]=a.used,a.used=!1}for(let o of this._order){let a=this._layers[o];a.recalculate(e,this._availableImages),!a.isHidden(e.zoom)&&a.source&&(this.sourceCaches[a.source].used=!0)}for(let o in i){let a=this.sourceCaches[o];i[o]!==a.used&&a.fire(new E("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(e),this.z=e.zoom,r&&this.fire(new E("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let r in this.sourceCaches)this.sourceCaches[r].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,r){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(e),removedIds:r})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,r={}){this._checkLoaded();let i=this.serialize();if(e=r.transformStyle?r.transformStyle(i,e):e,fa(this,Me(e)))return!1;e=Xe(e),e.layers=Xs(e.layers);let o=bh(i,e).filter(s=>!(s.command in Wb));if(o.length===0)return!1;let a=o.filter(s=>!(s.command in Zb));if(a.length>0)throw new Error("Unimplemented: ".concat(a.map(s=>s.command).join(", "),"."));for(let s of o)s.command!=="setTransition"&&this[s.command].apply(this,s.args);return this.stylesheet=e,!0}addImage(e,r){if(this.getImage(e))return this.fire(new j(new Error('An image named "'.concat(e,'" already exists.'))));this.imageManager.addImage(e,r),this._afterImageUpdated(e)}updateImage(e,r){this.imageManager.updateImage(e,r)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new j(new Error('An image named "'.concat(e,'" does not exist.'))));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new E("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,r,i={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error('Source "'.concat(e,'" already exists.'));if(!r.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(r).join(", "),"."));if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(Me.source,"sources.".concat(e),r,null,i))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);let s=this.sourceCaches[e]=new Ct(e,r,this.dispatcher);s.style=this,s.setEventedParent(this,()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:e})),s.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let i in this._layers)if(this._layers[i].source===e)return this.fire(new j(new Error('Source "'.concat(e,'" cannot be removed while layer "').concat(i,'" is using it.'))));let r=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],r.fire(new E("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,r){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID=".concat(e));let i=this.sourceCaches[e].getSource();if(i.type!=="geojson")throw new Error("geojsonSource.type is ".concat(i.type,", which is !== 'geojson"));i.setData(r),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,r,i={}){this._checkLoaded();let o=e.id;if(this.getLayer(o)){this.fire(new j(new Error('Layer "'.concat(o,'" already exists on this map.'))));return}let a;if(e.type==="custom"){if(fa(this,Ld(e)))return;a=Oo(e)}else{if(typeof e.source=="object"&&(this.addSource(o,e.source),e=Xe(e),e=k(e,{source:o})),this._validate(Me.layer,"layers.".concat(o),e,{arrayIndex:-1},i))return;a=Oo(e),this._validateLayer(a),a.setEventedParent(this,{layer:{id:o}})}let s=r?this._order.indexOf(r):this._order.length;if(r&&s===-1){this.fire(new j(new Error('Cannot add layer "'.concat(o,'" before non-existing layer "').concat(r,'".'))));return}if(this._order.splice(s,0,o),this._layerOrderChanged=!0,this._layers[o]=a,this._removedLayers[o]&&a.source&&a.type!=="custom"){let l=this._removedLayers[o];delete this._removedLayers[o],l.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(e,r){if(this._checkLoaded(),this._changed=!0,!this._layers[e]){this.fire(new j(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be moved."))));return}if(e===r)return;let o=this._order.indexOf(e);this._order.splice(o,1);let a=r?this._order.indexOf(r):this._order.length;if(r&&a===-1){this.fire(new j(new Error('Cannot move layer "'.concat(e,'" before non-existing layer "').concat(r,'".'))));return}this._order.splice(a,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let r=this._layers[e];if(!r){this.fire(new j(new Error('Cannot remove non-existing layer "'.concat(e,'".'))));return}r.setEventedParent(null);let i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.onRemove(this.map)}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,r,i){this._checkLoaded();let o=this.getLayer(e);if(!o){this.fire(new j(new Error('Cannot set the zoom range of non-existing layer "'.concat(e,'".'))));return}o.minzoom===r&&o.maxzoom===i||(r!=null&&(o.minzoom=r),i!=null&&(o.maxzoom=i),this._updateLayer(o))}setFilter(e,r,i={}){this._checkLoaded();let o=this.getLayer(e);if(!o){this.fire(new j(new Error('Cannot filter non-existing layer "'.concat(e,'".'))));return}if(!wt(o.filter,r)){if(r==null){o.filter=void 0,this._updateLayer(o);return}this._validate(Me.filter,"layers.".concat(o.id,".filter"),r,null,i)||(o.filter=Xe(r),this._updateLayer(o))}}getFilter(e){return Xe(this.getLayer(e).filter)}setLayoutProperty(e,r,i,o={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new j(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}wt(a.getLayoutProperty(r),i)||(a.setLayoutProperty(r,i,o),this._updateLayer(a))}getLayoutProperty(e,r){let i=this.getLayer(e);if(!i){this.fire(new j(new Error('Cannot get style of non-existing layer "'.concat(e,'".'))));return}return i.getLayoutProperty(r)}setPaintProperty(e,r,i,o={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new j(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}if(wt(a.getPaintProperty(r),i))return;a.setPaintProperty(r,i,o)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0}getPaintProperty(e,r){return this.getLayer(e).getPaintProperty(r)}setFeatureState(e,r){this._checkLoaded();let i=e.source,o=e.sourceLayer,a=this.sourceCaches[i];if(a===void 0){this.fire(new j(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let s=a.getSource().type;if(s==="geojson"&&o){this.fire(new j(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(s==="vector"&&!o){this.fire(new j(new Error("The sourceLayer parameter must be provided for vector source types.")));return}e.id===void 0&&this.fire(new j(new Error("The feature id parameter must be provided."))),a.setFeatureState(o,e.id,r)}removeFeatureState(e,r){this._checkLoaded();let i=e.source,o=this.sourceCaches[i];if(o===void 0){this.fire(new j(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let a=o.getSource().type,s=a==="vector"?e.sourceLayer:void 0;if(a==="vector"&&!s){this.fire(new j(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(r&&typeof e.id!="string"&&typeof e.id!="number"){this.fire(new j(new Error("A feature id is required to remove its specific state property.")));return}o.removeFeatureState(s,e.id,r)}getFeatureState(e){this._checkLoaded();let r=e.source,i=e.sourceLayer,o=this.sourceCaches[r];if(o===void 0){this.fire(new j(new Error("The source '".concat(r,"' does not exist in the map's style."))));return}if(o.getSource().type==="vector"&&!i){this.fire(new j(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return e.id===void 0&&this.fire(new j(new Error("The feature id parameter must be provided."))),o.getFeatureState(i,e.id)}getTransition(){return k({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=gi(this.sourceCaches,o=>o.serialize()),r=this._serializeByIds(this._order),i=this.stylesheet;return On({version:i.version,name:i.name,metadata:i.metadata,light:i.light,center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,sprite:i.sprite,glyphs:i.glyphs,transition:i.transition,sources:e,layers:r},o=>o!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let r=u(s=>this._layers[s].type==="fill-extrusion","isLayer3D"),i={},o=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(r(l)){i[l]=s;for(let c of e){let p=c[l];if(p)for(let m of p)o.push(m)}}}o.sort((s,l)=>l.intersectionZ-s.intersectionZ);let a=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(r(l))for(let c=o.length-1;c>=0;c--){let p=o[c].feature;if(i[p.layer.id]<s)break;a.push(p),o.pop()}else for(let c of e){let p=c[l];if(p)for(let m of p)a.push(m.feature)}}return a}queryRenderedFeatures(e,r,i){r&&r.filter&&this._validate(Me.filter,"queryRenderedFeatures.filter",r.filter,null,r);let o={};if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new j(new Error("parameters.layers must be an Array."))),[];for(let l of r.layers){let c=this._layers[l];if(!c)return this.fire(new j(new Error("The layer '".concat(l,"' does not exist in the map's style and cannot be queried for features.")))),[];o[c.source]=!0}}let a=[];r.availableImages=this._availableImages;let s=this._serializedAllLayers();for(let l in this.sourceCaches)r.layers&&!o[l]||a.push(jd(this.sourceCaches[l],this._layers,s,e,r,i));return this.placement&&a.push(Hd(this._layers,s,this.sourceCaches,e,r,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,r){r&&r.filter&&this._validate(Me.filter,"querySourceFeatures.filter",r.filter,null,r);let i=this.sourceCaches[e];return i?Zd(i,r):[]}addSourceType(e,r,i){if(Yc(e))return i(new Error('A source type called "'.concat(e,'" already exists.')));if(qd(e,r),!r.workerSourceURL)return i(null,null);this.dispatcher.broadcast("loadWorkerSource",{name:e,url:r.workerSourceURL},i)}getLight(){return this.light.getLight()}setLight(e,r={}){this._checkLoaded();let i=this.light.getLight(),o=!1;for(let s in e)if(!wt(e[s],i[s])){o=!0;break}if(!o)return;let a={now:ee.now(),transition:k({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,r),this.light.updateTransitions(a)}_validate(e,r,i,o,a={}){return a&&a.validate===!1?!1:fa(this,e.call(Me,k({key:r,style:this.serialize(),value:i,styleSpec:T},o)))}_remove(e=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),jn.off("pluginStateChange",this._rtlTextPluginCallback);for(let r in this._layers)this._layers[r].setEventedParent(null);for(let r in this.sourceCaches){let i=this.sourceCaches[r];i.setEventedParent(null),i.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let r in this.sourceCaches)this.sourceCaches[r].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,r,i,o,a=!1){let s=!1,l=!1,c={};for(let m of this._order){let h=this._layers[m];if(h.type!=="symbol")continue;if(!c[h.source]){let g=this.sourceCaches[h.source];c[h.source]=g.getRenderableIds(!0).map(y=>g.getTileByID(y)).sort((y,x)=>x.tileID.overscaledZ-y.tileID.overscaledZ||(y.tileID.isLessThan(x.tileID)?-1:1))}let d=this.crossTileSymbolIndex.addLayer(h,c[h.source],e.center.lng);s=s||d}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a=a||this._layerOrderChanged||i===0,(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(ee.now(),e.zoom))&&(this.pauseablePlacement=new ha(e,this.map.terrain,this._order,a,r,i,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,c),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ee.now()),l=!0),s&&this.pauseablePlacement.placement.setStale()),l||s)for(let m of this._order){let h=this._layers[m];h.type==="symbol"&&this.placement.updateLayerOpacities(h,c[h.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ee.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,r,i){this.imageManager.getImages(r.icons,i),this._updateTilesForChangedImages();let o=this.sourceCaches[r.source];o&&o.setDependencies(r.tileID.key,r.type,r.icons)}getGlyphs(e,r,i){this.glyphManager.getGlyphs(r.stacks,i);let o=this.sourceCaches[r.source];o&&o.setDependencies(r.tileID.key,r.type,[""])}getResource(e,r,i){return Mr(r,i)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,r={}){this._checkLoaded(),!(e&&this._validate(Me.glyphs,"glyphs",e,null,r))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,r,i={},o){this._checkLoaded();let a=[{id:e,url:r}],s=[...Xr(this.stylesheet.sprite),...a];this._validate(Me.sprite,"sprite",s,null,i)||(this.stylesheet.sprite=s,this._loadSprite(a,!0,o))}removeSprite(e){this._checkLoaded();let r=Xr(this.stylesheet.sprite);if(!r.find(i=>i.id===e)){this.fire(new j(new Error('Sprite "'.concat(e,"\" doesn't exists on this map."))));return}if(this._spritesImagesIds[e])for(let i of this._spritesImagesIds[e])this.imageManager.removeImage(i),this._changedImages[i]=!0;r.splice(r.findIndex(i=>i.id===e),1),this.stylesheet.sprite=r.length>0?r:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new E("data",{dataType:"style"}))}getSprite(){return Xr(this.stylesheet.sprite)}setSprite(e,r={},i){this._checkLoaded(),!(e&&this._validate(Me.sprite,"sprite",e,null,r))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,i):(this._unloadSprite(),i&&i(null)))}};u(da,"Style");var Qt=da;Qt.registerForPluginStateChange=gf;f();f();var ya=fe([{name:"a_pos",type:"Int16",components:2}]);f();f();var hy="#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n";f();var fy="#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}";f();var dy="uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var yy="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";f();var gy="uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var xy="uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}";f();var _y="varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var by="uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}";f();var vy="void main() {gl_FragColor=vec4(1.0);}";f();var wy="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";f();var Sy="uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Py="uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}";f();var Ty="uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}";f();var Iy="uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}";f();var Ay="varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}";f();var Cy="attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}";f();var Ey="varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}";f();var My="attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-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(0.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);}";f();var Ly="uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}";f();var ky="attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}";f();var Dy="#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Fy="attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}";f();var zy="varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var By="attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}";f();var Ry="uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Oy="uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}";f();var Vy="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Uy="uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}";f();var Ny="varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Gy="uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}";f();var qy="uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var jy="uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}";f();var Hy="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Zy="uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}";f();var Wy="uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Xy="uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}";f();var Ky="uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var $y="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}";f();var Jy="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Yy="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}";f();var Qy="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var eg="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}";f();var tg="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var rg="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}";f();var ig="uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var ng="uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}";f();var og="uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var ag="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}";f();var sg="#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var lg="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}";f();var ug="#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var cg="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}";f();var pg="varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}";f();var mg="precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}";f();var hg="uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}";f();var ga="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";var Cr={prelude:ve(hy,fy),background:ve(dy,yy),backgroundPattern:ve(gy,xy),circle:ve(_y,by),clippingMask:ve(vy,wy),heatmap:ve(Sy,Py),heatmapTexture:ve(Ty,Iy),collisionBox:ve(Ay,Cy),collisionCircle:ve(Ey,My),debug:ve(Ly,ky),fill:ve(Dy,Fy),fillOutline:ve(zy,By),fillOutlinePattern:ve(Ry,Oy),fillPattern:ve(Vy,Uy),fillExtrusion:ve(Ny,Gy),fillExtrusionPattern:ve(qy,jy),hillshadePrepare:ve(Hy,Zy),hillshade:ve(Wy,Xy),line:ve(Ky,$y),lineGradient:ve(Jy,Yy),linePattern:ve(Qy,eg),lineSDF:ve(tg,rg),raster:ve(ig,ng),symbolIcon:ve(og,ag),symbolSDF:ve(sg,lg),symbolTextAndIcon:ve(ug,cg),terrain:ve(hg,ga),terrainDepth:ve(pg,ga),terrainCoords:ve(mg,ga)};function ve(n,t){let e=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/attribute ([\w]+) ([\w]+)/g),i=n.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(i):i,s={};return n=n.replace(e,(l,c,p,m,h)=>(s[h]=!0,c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\nvarying ").concat(p," ").concat(m," ").concat(h,";\n#else\nuniform ").concat(p," ").concat(m," u_").concat(h,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(h,"\n ").concat(p," ").concat(m," ").concat(h," = u_").concat(h,";\n#endif\n"))),t=t.replace(e,(l,c,p,m,h)=>{let d=m==="float"?"vec2":"vec4",g=h.match(/color/)?"color":d;return s[h]?c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\nuniform lowp float u_").concat(h,"_t;\nattribute ").concat(p," ").concat(d," a_").concat(h,";\nvarying ").concat(p," ").concat(m," ").concat(h,";\n#else\nuniform ").concat(p," ").concat(m," u_").concat(h,";\n#endif\n"):g==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(h," = a_").concat(h,";\n#else\n ").concat(p," ").concat(m," ").concat(h," = u_").concat(h,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(h," = unpack_mix_").concat(g,"(a_").concat(h,", u_").concat(h,"_t);\n#else\n ").concat(p," ").concat(m," ").concat(h," = u_").concat(h,";\n#endif\n"):c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\nuniform lowp float u_").concat(h,"_t;\nattribute ").concat(p," ").concat(d," a_").concat(h,";\n#else\nuniform ").concat(p," ").concat(m," u_").concat(h,";\n#endif\n"):g==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(p," ").concat(m," ").concat(h," = a_").concat(h,";\n#else\n ").concat(p," ").concat(m," ").concat(h," = u_").concat(h,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(p," ").concat(m," ").concat(h," = unpack_mix_").concat(g,"(a_").concat(h,", u_").concat(h,"_t);\n#else\n ").concat(p," ").concat(m," ").concat(h," = u_").concat(h,";\n#endif\n")}),{fragmentSource:n,vertexSource:t,staticAttributes:r,staticUniforms:a}}u(ve,"compile");f();f();var Rp=class Rp{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,r,i,o,a,s,l,c){this.context=t;let p=this.boundPaintVertexBuffers.length!==i.length;for(let h=0;!p&&h<i.length;h++)this.boundPaintVertexBuffers[h]!==i[h]&&(p=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==r||p||this.boundIndexBuffer!==o||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==l||this.boundDynamicVertexBuffer3!==c?this.freshBind(e,r,i,o,a,s,l,c):(t.bindVertexArray.set(this.vao),s&&s.bind(),o&&o.dynamicDraw&&o.bind(),l&&l.bind(),c&&c.bind())}freshBind(t,e,r,i,o,a,s,l){let c=t.numAttributes,p=this.context,m=p.gl;this.vao&&this.destroy(),this.vao=p.createVertexArray(),p.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=o,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=l,e.enableAttributes(m,t);for(let h of r)h.enableAttributes(m,t);a&&a.enableAttributes(m,t),s&&s.enableAttributes(m,t),l&&l.enableAttributes(m,t),e.bind(),e.setVertexAttribPointers(m,t,o);for(let h of r)h.bind(),h.setVertexAttribPointers(m,t,o);a&&(a.bind(),a.setVertexAttribPointers(m,t,o)),i&&i.bind(),s&&(s.bind(),s.setVertexAttribPointers(m,t,o)),l&&(l.bind(),l.setVertexAttribPointers(m,t,o)),p.currentNumAttributes=c}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}};u(Rp,"VertexArrayObject");var xa=Rp;f();var fg=u((n,t)=>({u_depth:new X(n,t.u_depth),u_terrain:new X(n,t.u_terrain),u_terrain_dim:new B(n,t.u_terrain_dim),u_terrain_matrix:new J(n,t.u_terrain_matrix),u_terrain_unpack:new qt(n,t.u_terrain_unpack),u_terrain_exaggeration:new B(n,t.u_terrain_exaggeration)}),"terrainPreludeUniforms"),dg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_texture:new X(n,t.u_texture),u_ele_delta:new B(n,t.u_ele_delta)}),"terrainUniforms"),yg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_ele_delta:new B(n,t.u_ele_delta)}),"terrainDepthUniforms"),gg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_texture:new X(n,t.u_texture),u_terrain_coords_id:new B(n,t.u_terrain_coords_id),u_ele_delta:new B(n,t.u_ele_delta)}),"terrainCoordsUniforms"),xg=u((n,t)=>({u_matrix:n,u_texture:0,u_ele_delta:t}),"terrainUniformValues"),_g=u((n,t)=>({u_matrix:n,u_ele_delta:t}),"terrainDepthUniformValues"),bg=u((n,t,e)=>({u_matrix:n,u_terrain_coords_id:t/255,u_texture:0,u_ele_delta:e}),"terrainCoordsUniformValues");function Op(n){let t=[];for(let e=0;e<n.length;e++){if(n[e]===null)continue;let r=n[e].split(" ");t.push(r.pop())}return t}u(Op,"getTokenizedAttributesAndUniforms");var Vp=class Vp{constructor(t,e,r,i,o,a){let s=t.gl;this.program=s.createProgram();let l=Op(e.staticAttributes),c=r?r.getBinderAttributes():[],p=l.concat(c),m=Cr.prelude.staticUniforms?Op(Cr.prelude.staticUniforms):[],h=e.staticUniforms?Op(e.staticUniforms):[],d=r?r.getBinderUniforms():[],g=m.concat(h).concat(d),y=[];for(let I of g)y.indexOf(I)<0&&y.push(I);let x=r?r.defines():[];o&&x.push("#define OVERDRAW_INSPECTOR;"),a&&x.push("#define TERRAIN3D;");let v=x.concat(Cr.prelude.fragmentSource,e.fragmentSource).join("\n"),b=x.concat(Cr.prelude.vertexSource,e.vertexSource).join("\n"),w=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost()){this.failedToCreate=!0;return}s.shaderSource(w,v),s.compileShader(w),s.attachShader(this.program,w);let S=s.createShader(s.VERTEX_SHADER);if(s.isContextLost()){this.failedToCreate=!0;return}s.shaderSource(S,b),s.compileShader(S),s.attachShader(this.program,S),this.attributes={};let P={};this.numAttributes=p.length;for(let I=0;I<this.numAttributes;I++)p[I]&&(s.bindAttribLocation(this.program,I,p[I]),this.attributes[p[I]]=I);s.linkProgram(this.program),s.deleteShader(S),s.deleteShader(w);for(let I=0;I<y.length;I++){let C=y[I];if(C&&!P[C]){let z=s.getUniformLocation(this.program,C);z&&(P[C]=z)}}this.fixedUniforms=i(t,P),this.terrainUniforms=fg(t,P),this.binderUniforms=r?r.getUniforms(t,P):[]}draw(t,e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b){let w=t.gl;if(this.failedToCreate)return;t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(i),t.setColorMode(o),t.setCullFace(a);for(let P in this.fixedUniforms)this.fixedUniforms[P].set(s[P]);y&&y.setUniforms(t,this.binderUniforms,d,{zoom:g});let S=0;switch(e){case w.LINES:S=2;break;case w.TRIANGLES:S=3;break;case w.LINE_STRIP:S=1;break}for(let P of h.get()){let I=P.vaos||(P.vaos={});(I[c]||(I[c]=new xa)).bind(t,this,p,y?y.getPaintVertexBuffers():[],m,P.vertexOffset,x,v,b),w.drawElements(e,P.primitiveLength*S,w.UNSIGNED_SHORT,P.primitiveOffset*S*2)}}};u(Vp,"Program");var _a=Vp;f();f();f();function ba(n,t,e){let r=1/Fe(e,1,t.transform.tileZoom),i=Math.pow(2,e.tileID.overscaledZ),o=e.tileSize*Math.pow(2,t.transform.tileZoom)/i,a=o*(e.tileID.canonical.x+e.tileID.wrap*i),s=o*e.tileID.canonical.y;return{u_image:0,u_texsize:e.imageAtlasTexture.size,u_scale:[r,n.fromScale,n.toScale],u_fade:n.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[a&65535,s&65535]}}u(ba,"patternUniformValues");function vg(n,t,e,r){let i=e.imageManager.getPattern(n.from.toString()),o=e.imageManager.getPattern(n.to.toString()),{width:a,height:s}=e.imageManager.getPixelSize(),l=Math.pow(2,r.tileID.overscaledZ),c=r.tileSize*Math.pow(2,e.transform.tileZoom)/l,p=c*(r.tileID.canonical.x+r.tileID.wrap*l),m=c*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[a,s],u_mix:t.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/Fe(r,1,e.transform.tileZoom),u_pixel_coord_upper:[p>>16,m>>16],u_pixel_coord_lower:[p&65535,m&65535]}}u(vg,"bgPatternUniformValues");var wg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_lightpos:new Ze(n,t.u_lightpos),u_lightintensity:new B(n,t.u_lightintensity),u_lightcolor:new Ze(n,t.u_lightcolor),u_vertical_gradient:new B(n,t.u_vertical_gradient),u_opacity:new B(n,t.u_opacity)}),"fillExtrusionUniforms"),Sg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_lightpos:new Ze(n,t.u_lightpos),u_lightintensity:new B(n,t.u_lightintensity),u_lightcolor:new Ze(n,t.u_lightcolor),u_vertical_gradient:new B(n,t.u_vertical_gradient),u_height_factor:new B(n,t.u_height_factor),u_image:new X(n,t.u_image),u_texsize:new $(n,t.u_texsize),u_pixel_coord_upper:new $(n,t.u_pixel_coord_upper),u_pixel_coord_lower:new $(n,t.u_pixel_coord_lower),u_scale:new Ze(n,t.u_scale),u_fade:new B(n,t.u_fade),u_opacity:new B(n,t.u_opacity)}),"fillExtrusionPatternUniforms"),Up=u((n,t,e,r)=>{let i=t.style.light,o=i.properties.get("position"),a=[o.x,o.y,o.z],s=Js.create();i.properties.get("anchor")==="viewport"&&Js.fromRotation(s,-t.transform.angle),ut.transformMat3(a,a,s);let l=i.properties.get("color");return{u_matrix:n,u_lightpos:a,u_lightintensity:i.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+e,u_opacity:r}},"fillExtrusionUniformValues"),Pg=u((n,t,e,r,i,o,a)=>k(Up(n,t,e,r),ba(o,t,a),{u_height_factor:-Math.pow(2,i.overscaledZ)/a.tileSize/8}),"fillExtrusionPatternUniformValues");f();var Tg=u((n,t)=>({u_matrix:new J(n,t.u_matrix)}),"fillUniforms"),Ig=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_image:new X(n,t.u_image),u_texsize:new $(n,t.u_texsize),u_pixel_coord_upper:new $(n,t.u_pixel_coord_upper),u_pixel_coord_lower:new $(n,t.u_pixel_coord_lower),u_scale:new Ze(n,t.u_scale),u_fade:new B(n,t.u_fade)}),"fillPatternUniforms"),Ag=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_world:new $(n,t.u_world)}),"fillOutlineUniforms"),Cg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_world:new $(n,t.u_world),u_image:new X(n,t.u_image),u_texsize:new $(n,t.u_texsize),u_pixel_coord_upper:new $(n,t.u_pixel_coord_upper),u_pixel_coord_lower:new $(n,t.u_pixel_coord_lower),u_scale:new Ze(n,t.u_scale),u_fade:new B(n,t.u_fade)}),"fillOutlinePatternUniforms"),Np=u(n=>({u_matrix:n}),"fillUniformValues"),Gp=u((n,t,e,r)=>k(Np(n),ba(e,t,r)),"fillPatternUniformValues"),Eg=u((n,t)=>({u_matrix:n,u_world:t}),"fillOutlineUniformValues"),Mg=u((n,t,e,r,i)=>k(Gp(n,t,e,r),{u_world:i}),"fillOutlinePatternUniformValues");f();var Lg=u((n,t)=>({u_camera_to_center_distance:new B(n,t.u_camera_to_center_distance),u_scale_with_map:new X(n,t.u_scale_with_map),u_pitch_with_map:new X(n,t.u_pitch_with_map),u_extrude_scale:new $(n,t.u_extrude_scale),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_matrix:new J(n,t.u_matrix)}),"circleUniforms"),kg=u((n,t,e,r)=>{let i=n.transform,o,a;if(r.paint.get("circle-pitch-alignment")==="map"){let s=Fe(e,1,i.zoom);o=!0,a=[s,s]}else o=!1,a=i.pixelsToGLUnits;return{u_camera_to_center_distance:i.cameraToCenterDistance,u_scale_with_map:+(r.paint.get("circle-pitch-scale")==="map"),u_matrix:n.translatePosMatrix(t.posMatrix,e,r.paint.get("circle-translate"),r.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:n.pixelRatio,u_extrude_scale:a}},"circleUniformValues");f();var Dg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_camera_to_center_distance:new B(n,t.u_camera_to_center_distance),u_pixels_to_tile_units:new B(n,t.u_pixels_to_tile_units),u_extrude_scale:new $(n,t.u_extrude_scale),u_overscale_factor:new B(n,t.u_overscale_factor)}),"collisionUniforms"),Fg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_inv_matrix:new J(n,t.u_inv_matrix),u_camera_to_center_distance:new B(n,t.u_camera_to_center_distance),u_viewport_size:new $(n,t.u_viewport_size)}),"collisionCircleUniforms"),zg=u((n,t,e)=>{let r=Fe(e,1,t.zoom),i=Math.pow(2,t.zoom-e.tileID.overscaledZ),o=e.tileID.overscaleFactor();return{u_matrix:n,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:r,u_extrude_scale:[t.pixelsToGLUnits[0]/(r*i),t.pixelsToGLUnits[1]/(r*i)],u_overscale_factor:o}},"collisionUniformValues"),Bg=u((n,t,e)=>({u_matrix:n,u_inv_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_viewport_size:[e.width,e.height]}),"collisionCircleUniformValues");f();var Rg=u((n,t)=>({u_color:new pt(n,t.u_color),u_matrix:new J(n,t.u_matrix),u_overlay:new X(n,t.u_overlay),u_overlay_scale:new B(n,t.u_overlay_scale)}),"debugUniforms"),qp=u((n,t,e=1)=>({u_matrix:n,u_color:t,u_overlay:0,u_overlay_scale:e}),"debugUniformValues");f();var Og=u((n,t)=>({u_matrix:new J(n,t.u_matrix)}),"clippingMaskUniforms"),jp=u(n=>({u_matrix:n}),"clippingMaskUniformValues");f();var Vg=u((n,t)=>({u_extrude_scale:new B(n,t.u_extrude_scale),u_intensity:new B(n,t.u_intensity),u_matrix:new J(n,t.u_matrix)}),"heatmapUniforms"),Ug=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_world:new $(n,t.u_world),u_image:new X(n,t.u_image),u_color_ramp:new X(n,t.u_color_ramp),u_opacity:new B(n,t.u_opacity)}),"heatmapTextureUniforms"),Ng=u((n,t,e,r)=>({u_matrix:n,u_extrude_scale:Fe(t,1,e),u_intensity:r}),"heatmapUniformValues"),Gg=u((n,t,e,r)=>{let i=G.create();G.ortho(i,0,n.width,n.height,0,0,1);let o=n.context.gl;return{u_matrix:i,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:e,u_color_ramp:r,u_opacity:t.paint.get("heatmap-opacity")}},"heatmapTextureUniformValues");f();var qg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_image:new X(n,t.u_image),u_latrange:new $(n,t.u_latrange),u_light:new $(n,t.u_light),u_shadow:new pt(n,t.u_shadow),u_highlight:new pt(n,t.u_highlight),u_accent:new pt(n,t.u_accent)}),"hillshadeUniforms"),jg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_image:new X(n,t.u_image),u_dimension:new $(n,t.u_dimension),u_zoom:new B(n,t.u_zoom),u_unpack:new qt(n,t.u_unpack)}),"hillshadePrepareUniforms"),Hg=u((n,t,e,r)=>{let i=e.paint.get("hillshade-shadow-color"),o=e.paint.get("hillshade-highlight-color"),a=e.paint.get("hillshade-accent-color"),s=e.paint.get("hillshade-illumination-direction")*(Math.PI/180);e.paint.get("hillshade-illumination-anchor")==="viewport"&&(s-=n.transform.angle);let l=!n.options.moving;return{u_matrix:r?r.posMatrix:n.transform.calculatePosMatrix(t.tileID.toUnwrapped(),l),u_image:0,u_latrange:Kb(n,t.tileID),u_light:[e.paint.get("hillshade-exaggeration"),s],u_shadow:i,u_highlight:o,u_accent:a}},"hillshadeUniformValues"),Zg=u((n,t)=>{let e=t.stride,r=G.create();return G.ortho(r,0,8192,-8192,0,0,1),G.translate(r,r,[0,-8192,0]),{u_matrix:r,u_image:1,u_dimension:[e,e],u_zoom:n.overscaledZ,u_unpack:t.getUnpackVector()}},"hillshadeUniformPrepareValues");function Kb(n,t){let e=Math.pow(2,t.canonical.z),r=t.canonical.y;return[new Se(0,r/e).toLngLat().lat,new Se(0,(r+1)/e).toLngLat().lat]}u(Kb,"getTileLatRange");f();var Wg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_ratio:new B(n,t.u_ratio),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_units_to_pixels:new $(n,t.u_units_to_pixels)}),"lineUniforms"),Xg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_ratio:new B(n,t.u_ratio),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_units_to_pixels:new $(n,t.u_units_to_pixels),u_image:new X(n,t.u_image),u_image_height:new B(n,t.u_image_height)}),"lineGradientUniforms"),Kg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_texsize:new $(n,t.u_texsize),u_ratio:new B(n,t.u_ratio),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_image:new X(n,t.u_image),u_units_to_pixels:new $(n,t.u_units_to_pixels),u_scale:new Ze(n,t.u_scale),u_fade:new B(n,t.u_fade)}),"linePatternUniforms"),$g=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_ratio:new B(n,t.u_ratio),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_units_to_pixels:new $(n,t.u_units_to_pixels),u_patternscale_a:new $(n,t.u_patternscale_a),u_patternscale_b:new $(n,t.u_patternscale_b),u_sdfgamma:new B(n,t.u_sdfgamma),u_image:new X(n,t.u_image),u_tex_y_a:new B(n,t.u_tex_y_a),u_tex_y_b:new B(n,t.u_tex_y_b),u_mix:new B(n,t.u_mix)}),"lineSDFUniforms"),va=u((n,t,e,r)=>{let i=n.transform;return{u_matrix:tx(n,t,e,r),u_ratio:1/Fe(t,1,i.zoom),u_device_pixel_ratio:n.pixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},"lineUniformValues"),Jg=u((n,t,e,r,i)=>k(va(n,t,e,i),{u_image:0,u_image_height:r}),"lineGradientUniformValues"),Yg=u((n,t,e,r,i)=>{let o=n.transform,a=ex(t,o);return{u_matrix:tx(n,t,e,i),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Fe(t,1,o.zoom),u_device_pixel_ratio:n.pixelRatio,u_image:0,u_scale:[a,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},"linePatternUniformValues"),Qg=u((n,t,e,r,i,o)=>{let a=n.transform,s=n.lineAtlas,l=ex(t,a),c=e.layout.get("line-cap")==="round",p=s.getDash(r.from,c),m=s.getDash(r.to,c),h=p.width*i.fromScale,d=m.width*i.toScale;return k(va(n,t,e,o),{u_patternscale_a:[l/h,-p.height/2],u_patternscale_b:[l/d,-m.height/2],u_sdfgamma:s.width/(Math.min(h,d)*256*n.pixelRatio)/2,u_image:0,u_tex_y_a:p.y,u_tex_y_b:m.y,u_mix:i.t})},"lineSDFUniformValues");function ex(n,t){return 1/Fe(n,1,t.tileZoom)}u(ex,"calculateTileRatio");function tx(n,t,e,r){return n.translatePosMatrix(r?r.posMatrix:t.tileID.posMatrix,t,e.paint.get("line-translate"),e.paint.get("line-translate-anchor"))}u(tx,"calculateMatrix");f();var rx=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_tl_parent:new $(n,t.u_tl_parent),u_scale_parent:new B(n,t.u_scale_parent),u_buffer_scale:new B(n,t.u_buffer_scale),u_fade_t:new B(n,t.u_fade_t),u_opacity:new B(n,t.u_opacity),u_image0:new X(n,t.u_image0),u_image1:new X(n,t.u_image1),u_brightness_low:new B(n,t.u_brightness_low),u_brightness_high:new B(n,t.u_brightness_high),u_saturation_factor:new B(n,t.u_saturation_factor),u_contrast_factor:new B(n,t.u_contrast_factor),u_spin_weights:new Ze(n,t.u_spin_weights)}),"rasterUniforms"),ix=u((n,t,e,r,i)=>({u_matrix:n,u_tl_parent:t,u_scale_parent:e,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:Yb(i.paint.get("raster-saturation")),u_contrast_factor:Jb(i.paint.get("raster-contrast")),u_spin_weights:$b(i.paint.get("raster-hue-rotate"))}),"rasterUniformValues");function $b(n){n*=Math.PI/180;let t=Math.sin(n),e=Math.cos(n);return[(2*e+1)/3,(-Math.sqrt(3)*t-e+1)/3,(Math.sqrt(3)*t-e+1)/3]}u($b,"spinWeights");function Jb(n){return n>0?1/(1-n):1+n}u(Jb,"contrastFactor");function Yb(n){return n>0?1-1/(1.001-n):-n}u(Yb,"saturationFactor");f();var nx=u((n,t)=>({u_is_size_zoom_constant:new X(n,t.u_is_size_zoom_constant),u_is_size_feature_constant:new X(n,t.u_is_size_feature_constant),u_size_t:new B(n,t.u_size_t),u_size:new B(n,t.u_size),u_camera_to_center_distance:new B(n,t.u_camera_to_center_distance),u_pitch:new B(n,t.u_pitch),u_rotate_symbol:new X(n,t.u_rotate_symbol),u_aspect_ratio:new B(n,t.u_aspect_ratio),u_fade_change:new B(n,t.u_fade_change),u_matrix:new J(n,t.u_matrix),u_label_plane_matrix:new J(n,t.u_label_plane_matrix),u_coord_matrix:new J(n,t.u_coord_matrix),u_is_text:new X(n,t.u_is_text),u_pitch_with_map:new X(n,t.u_pitch_with_map),u_texsize:new $(n,t.u_texsize),u_texture:new X(n,t.u_texture)}),"symbolIconUniforms"),ox=u((n,t)=>({u_is_size_zoom_constant:new X(n,t.u_is_size_zoom_constant),u_is_size_feature_constant:new X(n,t.u_is_size_feature_constant),u_size_t:new B(n,t.u_size_t),u_size:new B(n,t.u_size),u_camera_to_center_distance:new B(n,t.u_camera_to_center_distance),u_pitch:new B(n,t.u_pitch),u_rotate_symbol:new X(n,t.u_rotate_symbol),u_aspect_ratio:new B(n,t.u_aspect_ratio),u_fade_change:new B(n,t.u_fade_change),u_matrix:new J(n,t.u_matrix),u_label_plane_matrix:new J(n,t.u_label_plane_matrix),u_coord_matrix:new J(n,t.u_coord_matrix),u_is_text:new X(n,t.u_is_text),u_pitch_with_map:new X(n,t.u_pitch_with_map),u_texsize:new $(n,t.u_texsize),u_texture:new X(n,t.u_texture),u_gamma_scale:new B(n,t.u_gamma_scale),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_is_halo:new X(n,t.u_is_halo)}),"symbolSDFUniforms"),ax=u((n,t)=>({u_is_size_zoom_constant:new X(n,t.u_is_size_zoom_constant),u_is_size_feature_constant:new X(n,t.u_is_size_feature_constant),u_size_t:new B(n,t.u_size_t),u_size:new B(n,t.u_size),u_camera_to_center_distance:new B(n,t.u_camera_to_center_distance),u_pitch:new B(n,t.u_pitch),u_rotate_symbol:new X(n,t.u_rotate_symbol),u_aspect_ratio:new B(n,t.u_aspect_ratio),u_fade_change:new B(n,t.u_fade_change),u_matrix:new J(n,t.u_matrix),u_label_plane_matrix:new J(n,t.u_label_plane_matrix),u_coord_matrix:new J(n,t.u_coord_matrix),u_is_text:new X(n,t.u_is_text),u_pitch_with_map:new X(n,t.u_pitch_with_map),u_texsize:new $(n,t.u_texsize),u_texsize_icon:new $(n,t.u_texsize_icon),u_texture:new X(n,t.u_texture),u_texture_icon:new X(n,t.u_texture_icon),u_gamma_scale:new B(n,t.u_gamma_scale),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_is_halo:new X(n,t.u_is_halo)}),"symbolTextAndIconUniforms"),Hp=u((n,t,e,r,i,o,a,s,l,c)=>{let p=i.transform;return{u_is_size_zoom_constant:+(n==="constant"||n==="source"),u_is_size_feature_constant:+(n==="constant"||n==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+e,u_aspect_ratio:p.width/p.height,u_fade_change:i.options.fadeDuration?i.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+r,u_texsize:c,u_texture:0}},"symbolIconUniformValues"),Zp=u((n,t,e,r,i,o,a,s,l,c,p)=>{let m=i.transform;return k(Hp(n,t,e,r,i,o,a,s,l,c),{u_gamma_scale:r?Math.cos(m._pitch)*m.cameraToCenterDistance:1,u_device_pixel_ratio:i.pixelRatio,u_is_halo:+p})},"symbolSDFUniformValues"),sx=u((n,t,e,r,i,o,a,s,l,c)=>k(Zp(n,t,e,r,i,o,a,s,!0,l,!0),{u_texsize_icon:c,u_texture_icon:1}),"symbolTextAndIconUniformValues");f();var lx=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_opacity:new B(n,t.u_opacity),u_color:new pt(n,t.u_color)}),"backgroundUniforms"),ux=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_opacity:new B(n,t.u_opacity),u_image:new X(n,t.u_image),u_pattern_tl_a:new $(n,t.u_pattern_tl_a),u_pattern_br_a:new $(n,t.u_pattern_br_a),u_pattern_tl_b:new $(n,t.u_pattern_tl_b),u_pattern_br_b:new $(n,t.u_pattern_br_b),u_texsize:new $(n,t.u_texsize),u_mix:new B(n,t.u_mix),u_pattern_size_a:new $(n,t.u_pattern_size_a),u_pattern_size_b:new $(n,t.u_pattern_size_b),u_scale_a:new B(n,t.u_scale_a),u_scale_b:new B(n,t.u_scale_b),u_pixel_coord_upper:new $(n,t.u_pixel_coord_upper),u_pixel_coord_lower:new $(n,t.u_pixel_coord_lower),u_tile_units_to_pixels:new B(n,t.u_tile_units_to_pixels)}),"backgroundPatternUniforms"),cx=u((n,t,e)=>({u_matrix:n,u_opacity:t,u_color:e}),"backgroundUniformValues"),px=u((n,t,e,r,i,o)=>k(vg(r,o,e,i),{u_matrix:n,u_opacity:t}),"backgroundPatternUniformValues");var mx={fillExtrusion:wg,fillExtrusionPattern:Sg,fill:Tg,fillPattern:Ig,fillOutline:Ag,fillOutlinePattern:Cg,circle:Lg,collisionBox:Dg,collisionCircle:Fg,debug:Rg,clippingMask:Og,heatmap:Vg,heatmapTexture:Ug,hillshade:qg,hillshadePrepare:jg,line:Wg,lineGradient:Xg,linePattern:Kg,lineSDF:$g,raster:rx,symbolIcon:nx,symbolSDF:ox,symbolTextAndIcon:ax,background:lx,backgroundPattern:ux,terrain:dg,terrainDepth:yg,terrainCoords:gg};f();f();var Wp=class Wp{constructor(t,e,r){this.context=t;let i=t.gl;this.buffer=i.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}};u(Wp,"IndexBuffer");var wa=Wp;f();var Qb={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Xp=class Xp{constructor(t,e,r,i){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=i,this.context=t;let o=t.gl;this.buffer=o.createBuffer(),t.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error("Length of new data is ".concat(t.length,", which doesn't match current length of ").concat(this.length));let e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let r=0;r<this.attributes.length;r++){let i=this.attributes[r],o=e.attributes[i.name];o!==void 0&&t.enableVertexAttribArray(o)}}setVertexAttribPointers(t,e,r){for(let i=0;i<this.attributes.length;i++){let o=this.attributes[i],a=e.attributes[o.name];a!==void 0&&t.vertexAttribPointer(a,o.components,t[Qb[o.type]],!1,this.itemSize,o.offset+this.itemSize*(r||0))}}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}};u(Xp,"VertexBuffer");var Sa=Xp;f();f();f();var Kp=new WeakMap;function li(n){if(Kp.has(n))return Kp.get(n);{let t=n.getParameter(n.VERSION).startsWith("WebGL 2.0");return Kp.set(n,t),t}}u(li,"isWebGL2");var $p=class $p{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}};u($p,"BaseValue");var pe=$p,Jp=class Jp extends pe{getDefault(){return me.transparent}set(t){let e=this.current;t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a&&!this.dirty||(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}};u(Jp,"ClearColor");var Pa=Jp,Yp=class Yp extends pe{getDefault(){return 1}set(t){t===this.current&&!this.dirty||(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}};u(Yp,"ClearDepth");var Ta=Yp,Qp=class Qp extends pe{getDefault(){return 0}set(t){t===this.current&&!this.dirty||(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}};u(Qp,"ClearStencil");var Ia=Qp,em=class em extends pe{getDefault(){return[!0,!0,!0,!0]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&!this.dirty||(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}};u(em,"ColorMask");var Aa=em,tm=class tm extends pe{getDefault(){return!0}set(t){t===this.current&&!this.dirty||(this.gl.depthMask(t),this.current=t,this.dirty=!1)}};u(tm,"DepthMask");var Ca=tm,rm=class rm extends pe{getDefault(){return 255}set(t){t===this.current&&!this.dirty||(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}};u(rm,"StencilMask");var Ea=rm,im=class im extends pe{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let e=this.current;t.func===e.func&&t.ref===e.ref&&t.mask===e.mask&&!this.dirty||(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}};u(im,"StencilFunc");var Ma=im,nm=class nm extends pe{getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&!this.dirty||(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}};u(nm,"StencilOp");var La=nm,om=class om extends pe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}};u(om,"StencilTest");var ka=om,am=class am extends pe{getDefault(){return[0,1]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&!this.dirty||(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}};u(am,"DepthRange");var Da=am,sm=class sm extends pe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}};u(sm,"DepthTest");var Fa=sm,lm=class lm extends pe{getDefault(){return this.gl.LESS}set(t){t===this.current&&!this.dirty||(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}};u(lm,"DepthFunc");var za=lm,um=class um extends pe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}};u(um,"Blend");var Ba=um,cm=class cm extends pe{getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&!this.dirty||(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}};u(cm,"BlendFunc");var Ra=cm,pm=class pm extends pe{getDefault(){return me.transparent}set(t){let e=this.current;t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a&&!this.dirty||(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}};u(pm,"BlendColor");var Oa=pm,mm=class mm extends pe{getDefault(){return this.gl.FUNC_ADD}set(t){t===this.current&&!this.dirty||(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}};u(mm,"BlendEquation");var Va=mm,hm=class hm extends pe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}};u(hm,"CullFace");var Ua=hm,fm=class fm extends pe{getDefault(){return this.gl.BACK}set(t){t===this.current&&!this.dirty||(this.gl.cullFace(t),this.current=t,this.dirty=!1)}};u(fm,"CullFaceSide");var Na=fm,dm=class dm extends pe{getDefault(){return this.gl.CCW}set(t){t===this.current&&!this.dirty||(this.gl.frontFace(t),this.current=t,this.dirty=!1)}};u(dm,"FrontFace");var Ga=dm,ym=class ym extends pe{getDefault(){return null}set(t){t===this.current&&!this.dirty||(this.gl.useProgram(t),this.current=t,this.dirty=!1)}};u(ym,"ProgramValue");var qa=ym,gm=class gm extends pe{getDefault(){return this.gl.TEXTURE0}set(t){t===this.current&&!this.dirty||(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}};u(gm,"ActiveTextureUnit");var ja=gm,xm=class xm extends pe{getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&!this.dirty||(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}};u(xm,"Viewport");var Ha=xm,_m=class _m extends pe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}};u(_m,"BindFramebuffer");var Za=_m,bm=class bm extends pe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}};u(bm,"BindRenderbuffer");var Wa=bm,vm=class vm extends pe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}};u(vm,"BindTexture");var Xa=vm,wm=class wm extends pe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}};u(wm,"BindVertexBuffer");var Ka=wm,Sm=class Sm extends pe{getDefault(){return null}set(t){let e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}};u(Sm,"BindElementBuffer");var $a=Sm,Pm=class Pm extends pe{getDefault(){return null}set(t){var r;if(t===this.current&&!this.dirty)return;let e=this.gl;li(e)?e.bindVertexArray(t):(r=e.getExtension("OES_vertex_array_object"))==null||r.bindVertexArrayOES(t),this.current=t,this.dirty=!1}};u(Pm,"BindVertexArray");var Ja=Pm,Tm=class Tm extends pe{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}};u(Tm,"PixelStoreUnpack");var Ya=Tm,Im=class Im extends pe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}};u(Im,"PixelStoreUnpackPremultiplyAlpha");var Qa=Im,Am=class Am extends pe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}};u(Am,"PixelStoreUnpackFlipY");var es=Am,Cm=class Cm extends pe{constructor(e,r){super(e);this.context=e,this.parent=r}getDefault(){return null}};u(Cm,"FramebufferAttachment");var xn=Cm,Em=class Em extends xn{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}};u(Em,"ColorAttachment");var ts=Em,Mm=class Mm extends xn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}};u(Mm,"DepthAttachment");var rs=Mm,Lm=class Lm extends xn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}};u(Lm,"DepthStencilAttachment");var is=Lm;var km=class km{constructor(t,e,r,i,o){this.context=t,this.width=e,this.height=r;let a=t.gl,s=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new ts(t,s),i)this.depthAttachment=o?new is(t,s):new rs(t,s);else if(o)throw new Error("Stencil cannot be setted without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){let t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){let r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r)}t.deleteFramebuffer(this.framebuffer)}};u(km,"Framebuffer");var ns=km;f();var ev=0,hx=1,tv=771,Dm=class Dm{constructor(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r}};u(Dm,"ColorMode");var we=Dm;we.Replace=[hx,ev];we.disabled=new we(we.Replace,me.transparent,[!1,!1,!1,!1]);we.unblended=new we(we.Replace,me.transparent,[!0,!0,!0,!0]);we.alphaBlended=new we([hx,tv],me.transparent,[!0,!0,!0,!0]);var Fm=class Fm{constructor(t){var e,r;if(this.gl=t,this.clearColor=new Pa(this),this.clearDepth=new Ta(this),this.clearStencil=new Ia(this),this.colorMask=new Aa(this),this.depthMask=new Ca(this),this.stencilMask=new Ea(this),this.stencilFunc=new Ma(this),this.stencilOp=new La(this),this.stencilTest=new ka(this),this.depthRange=new Da(this),this.depthTest=new Fa(this),this.depthFunc=new za(this),this.blend=new Ba(this),this.blendFunc=new Ra(this),this.blendColor=new Oa(this),this.blendEquation=new Va(this),this.cullFace=new Ua(this),this.cullFaceSide=new Na(this),this.frontFace=new Ga(this),this.program=new qa(this),this.activeTexture=new ja(this),this.viewport=new Ha(this),this.bindFramebuffer=new Za(this),this.bindRenderbuffer=new Wa(this),this.bindTexture=new Xa(this),this.bindVertexBuffer=new Ka(this),this.bindElementBuffer=new $a(this),this.bindVertexArray=new Ja(this),this.pixelStoreUnpack=new Ya(this),this.pixelStoreUnpackPremultiplyAlpha=new Qa(this),this.pixelStoreUnpackFlipY=new es(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),li(t)){this.HALF_FLOAT=t.HALF_FLOAT;let i=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(e=t.RGBA16F)!=null?e:i==null?void 0:i.RGBA16F_EXT,this.RGB16F=(r=t.RGB16F)!=null?r:i==null?void 0:i.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");let i=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=i==null?void 0:i.HALF_FLOAT_OES}}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.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new wa(this,t,e)}createVertexBuffer(t,e,r){return new Sa(this,t,e,r)}createRenderbuffer(t,e,r){let i=this.gl,o=i.createRenderbuffer();return this.bindRenderbuffer.set(o),i.renderbufferStorage(i.RENDERBUFFER,t,e,r),this.bindRenderbuffer.set(null),o}createFramebuffer(t,e,r,i){return new ns(this,t,e,r,i)}clear({color:t,depth:e,stencil:r}){let i=this.gl,o=0;t&&(o|=i.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),typeof e<"u"&&(o|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),typeof r<"u"&&(o|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(o)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func===this.gl.ALWAYS&&!t.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range))}setStencilMode(t){t.test.func===this.gl.ALWAYS&&!t.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask}))}setColorMode(t){wt(t.blendFunction,we.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return li(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return li(this.gl)?this.gl.deleteVertexArray(t):(e=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}};u(Fm,"Context");var os=Fm;f();var zm=class zm{constructor(t,e,r){this.func=t,this.mask=e,this.range=r}};u(zm,"DepthMode");var K=zm;K.ReadOnly=!1;K.ReadWrite=!0;K.disabled=new K(519,K.ReadOnly,[0,1]);f();var Bm=class Bm{constructor(t,e,r,i,o,a){this.test=t,this.ref=e,this.mask=r,this.fail=i,this.depthFail=o,this.pass=a}};u(Bm,"StencilMode");var oe=Bm;oe.disabled=new oe({func:519,mask:0},0,0,7680,7680,7680);f();var Rm=class Rm{constructor(t,e,r){this.enable=t,this.mode=e,this.frontFace=r}};u(Rm,"CullFaceMode");var re=Rm;re.disabled=new re(!1,1029,2305);re.backCCW=new re(!0,1029,2305);f();var Vm=te(be(),1);f();var as;function Om(n,t,e,r,i,o,a){let s=n.context,l=s.gl,c=n.useProgram("collisionBox"),p=[],m=0,h=0;for(let b=0;b<r.length;b++){let w=r[b],S=t.getTile(w),P=S.getBucket(e);if(!P)continue;let I=w.posMatrix;(i[0]!==0||i[1]!==0)&&(I=n.translatePosMatrix(w.posMatrix,S,i,o));let C=a?P.textCollisionBox:P.iconCollisionBox,z=P.collisionCircleArray;if(z.length>0){let D=G.create(),A=I;G.mul(D,P.placementInvProjMatrix,n.transform.glCoordMatrix),G.mul(D,D,P.placementViewportMatrix),p.push({circleArray:z,circleOffset:h,transform:A,invTransform:D,coord:w}),m+=z.length/4,h=m}C&&c.draw(s,l.LINES,K.disabled,oe.disabled,n.colorModeForRenderPass(),re.disabled,zg(I,n.transform,S),n.style.map.terrain&&n.style.map.terrain.getTerrainData(w),e.id,C.layoutVertexBuffer,C.indexBuffer,C.segments,null,n.transform.zoom,null,null,C.collisionVertexBuffer)}if(!a||!p.length)return;let d=n.useProgram("collisionCircle"),g=new lo;g.resize(m*4),g._trim();let y=0;for(let b of p)for(let w=0;w<b.circleArray.length/4;w++){let S=w*4,P=b.circleArray[S+0],I=b.circleArray[S+1],C=b.circleArray[S+2],z=b.circleArray[S+3];g.emplace(y++,P,I,C,z,0),g.emplace(y++,P,I,C,z,1),g.emplace(y++,P,I,C,z,2),g.emplace(y++,P,I,C,z,3)}(!as||as.length<m*2)&&(as=rv(m));let x=s.createIndexBuffer(as,!0),v=s.createVertexBuffer(g,fd.members,!0);for(let b of p){let w=Bg(b.transform,b.invTransform,n.transform);d.draw(s,l.TRIANGLES,K.disabled,oe.disabled,n.colorModeForRenderPass(),re.disabled,w,n.style.map.terrain&&n.style.map.terrain.getTerrainData(b.coord),e.id,v,x,ae.simpleSegment(0,b.circleOffset*2,b.circleArray.length,b.circleArray.length/2),null,n.transform.zoom,null,null,null)}v.destroy(),x.destroy()}u(Om,"drawCollisionDebug");function rv(n){let t=n*2,e=new co;e.resize(t),e._trim();for(let r=0;r<t;r++){let i=r*6;e.uint16[i+0]=r*4+0,e.uint16[i+1]=r*4+1,e.uint16[i+2]=r*4+2,e.uint16[i+3]=r*4+2,e.uint16[i+4]=r*4+3,e.uint16[i+5]=r*4+0}return e}u(rv,"createQuadTriangles");var iv=G.identity(new Float32Array(16));function yx(n,t,e,r,i){if(n.renderPass!=="translucent")return;let o=oe.disabled,a=n.colorModeForRenderPass();e.layout.get("text-variable-anchor")&&ov(r,n,e,t,e.layout.get("text-rotation-alignment"),e.layout.get("text-pitch-alignment"),i),e.paint.get("icon-opacity").constantOr(1)!==0&&fx(n,t,e,r,!1,e.paint.get("icon-translate"),e.paint.get("icon-translate-anchor"),e.layout.get("icon-rotation-alignment"),e.layout.get("icon-pitch-alignment"),e.layout.get("icon-keep-upright"),o,a),e.paint.get("text-opacity").constantOr(1)!==0&&fx(n,t,e,r,!0,e.paint.get("text-translate"),e.paint.get("text-translate-anchor"),e.layout.get("text-rotation-alignment"),e.layout.get("text-pitch-alignment"),e.layout.get("text-keep-upright"),o,a),t.map.showCollisionBoxes&&(Om(n,t,e,r,e.paint.get("text-translate"),e.paint.get("text-translate-anchor"),!0),Om(n,t,e,r,e.paint.get("icon-translate"),e.paint.get("icon-translate-anchor"),!1))}u(yx,"drawSymbols");function nv(n,t,e,r,i,o){let{horizontalAlign:a,verticalAlign:s}=Mo(n),l=-(a-.5)*t,c=-(s-.5)*e,p=sa(n,r);return new Vm.default((l/i+p[0])*o,(c/i+p[1])*o)}u(nv,"calculateVariableRenderShift");function ov(n,t,e,r,i,o,a){let s=t.transform,l=i==="map",c=o==="map";for(let p of n){let m=r.getTile(p),h=m.getBucket(e);if(!h||!h.text||!h.text.segments.get().length)continue;let d=h.textSizeData,g=br(d,s.zoom),y=Fe(m,1,t.transform.zoom),x=hn(p.posMatrix,c,l,t.transform,y),v=e.layout.get("icon-text-fit")!=="none"&&h.hasIconData();if(g){let b=Math.pow(2,s.zoom-m.tileID.overscaledZ),w=t.style.map.terrain?(S,P)=>t.style.map.terrain.getElevation(p,S,P):null;av(h,l,c,a,s,x,p.posMatrix,b,g,v,w)}}}u(ov,"updateVariableAnchors");function av(n,t,e,r,i,o,a,s,l,c,p){let m=n.text.placedSymbolArray,h=n.text.dynamicLayoutVertexArray,d=n.icon.dynamicLayoutVertexArray,g={};h.clear();for(let y=0;y<m.length;y++){let x=m.get(y),v=n.allowVerticalPlacement&&!x.placedOrientation,b=!x.hidden&&x.crossTileID&&!v?r[x.crossTileID]:null;if(!b)Ir(x.numGlyphs,h);else{let w=new Vm.default(x.anchorX,x.anchorY),S=rt(w,e?a:o,p),P=fn(i.cameraToCenterDistance,S.signedDistanceFromCamera),I=Zr(n.textSizeData,l,x)*P/xr;e&&(I*=n.tilePixelRatio/s);let{width:C,height:z,anchor:D,textOffset:A,textBoxScale:R}=b,U=nv(D,C,z,A,R,I),L=e?rt(w.add(U),o,p).point:S.point.add(t?U.rotate(-i.angle):U),N=n.allowVerticalPlacement&&x.placedOrientation===2?Math.PI/2:0;for(let V=0;V<x.numGlyphs;V++)vr(h,L,N);c&&x.associatedIconIndex>=0&&(g[x.associatedIconIndex]={shiftedAnchor:L,angle:N})}}if(c){d.clear();let y=n.icon.placedSymbolArray;for(let x=0;x<y.length;x++){let v=y.get(x);if(v.hidden)Ir(v.numGlyphs,d);else{let b=g[x];if(!b)Ir(v.numGlyphs,d);else for(let w=0;w<v.numGlyphs;w++)vr(d,b.shiftedAnchor,b.angle)}}n.icon.dynamicLayoutVertexBuffer.updateData(d)}n.text.dynamicLayoutVertexBuffer.updateData(h)}u(av,"updateVariableAnchorsForBucket");function sv(n,t,e){return e.iconsInText&&t?"symbolTextAndIcon":n?"symbolSDF":"symbolIcon"}u(sv,"getSymbolProgramName");function fx(n,t,e,r,i,o,a,s,l,c,p,m){let h=n.context,d=h.gl,g=n.transform,y=s==="map",x=l==="map",v=s!=="viewport"&&e.layout.get("symbol-placement")!=="point",b=y&&!x&&!v,w=!e.layout.get("symbol-sort-key").isConstant(),S=!1,P=n.depthModeForSublayer(0,K.ReadOnly),I=e.layout.get("text-variable-anchor"),C=[];for(let z of r){let D=t.getTile(z),A=D.getBucket(e);if(!A)continue;let R=i?A.text:A.icon;if(!R||!R.segments.get().length||!R.hasVisibleVertices)continue;let U=R.programConfigurations.get(e.id),L=i||A.sdfIcons,N=i?A.textSizeData:A.iconSizeData,V=x||g.pitch!==0,W=n.useProgram(sv(L,i,A),U),Z=br(N,g.zoom),ue=n.style.map.terrain&&n.style.map.terrain.getTerrainData(z),Y,Oe=[0,0],Be,ie,ge=null,Ve;if(i){if(Be=D.glyphAtlasTexture,ie=d.LINEAR,Y=D.glyphAtlasTexture.size,A.iconsInText){Oe=D.imageAtlasTexture.size,ge=D.imageAtlasTexture;let lt=N.kind==="composite"||N.kind==="camera";Ve=V||n.options.rotating||n.options.zooming||lt?d.LINEAR:d.NEAREST}}else{let lt=e.layout.get("icon-size").constantOr(0)!==1||A.iconsNeedLinear;Be=D.imageAtlasTexture,ie=L||n.options.rotating||n.options.zooming||lt||V?d.LINEAR:d.NEAREST,Y=D.imageAtlasTexture.size}let Lt=Fe(D,1,n.transform.zoom),kt=hn(z.posMatrix,x,y,n.transform,Lt),mt=ia(z.posMatrix,x,y,n.transform,Lt),vt=I&&A.hasTextData(),nr=e.layout.get("icon-text-fit")!=="none"&&vt&&A.hasIconData();if(v){let lt=n.style.map.terrain?(or,Zs)=>n.style.map.terrain.getElevation(z,or,Zs):null,Pe=e.layout.get("text-rotation-alignment")==="map";sy(A,z.posMatrix,n,i,kt,mt,x,c,Pe,lt)}let Ue=n.translatePosMatrix(z.posMatrix,D,o,a),De=v||i&&I||nr?iv:kt,ce=n.translatePosMatrix(mt,D,o,a,!0),it=L&&e.paint.get(i?"text-halo-width":"icon-halo-width").constantOr(1)!==0,st;L?A.iconsInText?st=sx(N.kind,Z,b,x,n,Ue,De,ce,Y,Oe):st=Zp(N.kind,Z,b,x,n,Ue,De,ce,i,Y,!0):st=Hp(N.kind,Z,b,x,n,Ue,De,ce,i,Y);let Dt={program:W,buffers:R,uniformValues:st,atlasTexture:Be,atlasTextureIcon:ge,atlasInterpolation:ie,atlasInterpolationIcon:Ve,isSDF:L,hasHalo:it};if(w&&A.canOverlap){S=!0;let lt=R.segments.get();for(let Pe of lt)C.push({segments:new ae([Pe]),sortKey:Pe.sortKey,state:Dt,terrainData:ue})}else C.push({segments:R.segments,sortKey:0,state:Dt,terrainData:ue})}S&&C.sort((z,D)=>z.sortKey-D.sortKey);for(let z of C){let D=z.state;if(h.activeTexture.set(d.TEXTURE0),D.atlasTexture.bind(D.atlasInterpolation,d.CLAMP_TO_EDGE),D.atlasTextureIcon&&(h.activeTexture.set(d.TEXTURE1),D.atlasTextureIcon&&D.atlasTextureIcon.bind(D.atlasInterpolationIcon,d.CLAMP_TO_EDGE)),D.isSDF){let A=D.uniformValues;D.hasHalo&&(A.u_is_halo=1,dx(D.buffers,z.segments,e,n,D.program,P,p,m,A,z.terrainData)),A.u_is_halo=0}dx(D.buffers,z.segments,e,n,D.program,P,p,m,D.uniformValues,z.terrainData)}}u(fx,"drawLayerSymbols");function dx(n,t,e,r,i,o,a,s,l,c){let p=r.context,m=p.gl;i.draw(p,m.TRIANGLES,o,a,s,re.disabled,l,c,e.id,n.layoutVertexBuffer,n.indexBuffer,t,e.paint,r.transform.zoom,n.programConfigurations.get(e.id),n.dynamicLayoutVertexBuffer,n.opacityVertexBuffer)}u(dx,"drawSymbolElements");f();function gx(n,t,e,r){if(n.renderPass!=="translucent")return;let i=e.paint.get("circle-opacity"),o=e.paint.get("circle-stroke-width"),a=e.paint.get("circle-stroke-opacity"),s=!e.layout.get("circle-sort-key").isConstant();if(i.constantOr(1)===0&&(o.constantOr(1)===0||a.constantOr(1)===0))return;let l=n.context,c=l.gl,p=n.depthModeForSublayer(0,K.ReadOnly),m=oe.disabled,h=n.colorModeForRenderPass(),d=[];for(let g=0;g<r.length;g++){let y=r[g],x=t.getTile(y),v=x.getBucket(e);if(!v)continue;let b=v.programConfigurations.get(e.id),w=n.useProgram("circle",b),S=v.layoutVertexBuffer,P=v.indexBuffer,I=n.style.map.terrain&&n.style.map.terrain.getTerrainData(y),C=kg(n,y,x,e),z={programConfiguration:b,program:w,layoutVertexBuffer:S,indexBuffer:P,uniformValues:C,terrainData:I};if(s){let D=v.segments.get();for(let A of D)d.push({segments:new ae([A]),sortKey:A.sortKey,state:z})}else d.push({segments:v.segments,sortKey:0,state:z})}s&&d.sort((g,y)=>g.sortKey-y.sortKey);for(let g of d){let{programConfiguration:y,program:x,layoutVertexBuffer:v,indexBuffer:b,uniformValues:w,terrainData:S}=g.state,P=g.segments;x.draw(l,c.TRIANGLES,p,m,h,re.disabled,w,S,e.id,v,b,P,e.paint,n.transform.zoom,y)}}u(gx,"drawCircles");f();function xx(n,t,e,r){if(e.paint.get("heatmap-opacity")!==0)if(n.renderPass==="offscreen"){let i=n.context,o=i.gl,a=oe.disabled,s=new we([o.ONE,o.ONE],me.transparent,[!0,!0,!0,!0]);lv(i,n,e),i.clear({color:me.transparent});for(let l=0;l<r.length;l++){let c=r[l];if(t.hasRenderableParent(c))continue;let p=t.getTile(c),m=p.getBucket(e);if(!m)continue;let h=m.programConfigurations.get(e.id),d=n.useProgram("heatmap",h),{zoom:g}=n.transform;d.draw(i,o.TRIANGLES,K.disabled,a,s,re.disabled,Ng(c.posMatrix,p,g,e.paint.get("heatmap-intensity")),null,e.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,e.paint,n.transform.zoom,h)}i.viewport.set([0,0,n.width,n.height])}else n.renderPass==="translucent"&&(n.context.setColorMode(n.colorModeForRenderPass()),cv(n,e))}u(xx,"drawHeatmap");function lv(n,t,e){let r=n.gl;n.activeTexture.set(r.TEXTURE1),n.viewport.set([0,0,t.width/4,t.height/4]);let i=e.heatmapFbo;if(i)r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),n.bindFramebuffer.set(i.framebuffer);else{let o=r.createTexture();r.bindTexture(r.TEXTURE_2D,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),i=e.heatmapFbo=n.createFramebuffer(t.width/4,t.height/4,!1,!1),uv(n,t,o,i)}}u(lv,"bindFramebuffer");function uv(n,t,e,r){var s,l;let i=n.gl,o=(s=n.HALF_FLOAT)!=null?s:i.UNSIGNED_BYTE,a=(l=n.RGBA16F)!=null?l:i.RGBA;i.texImage2D(i.TEXTURE_2D,0,a,t.width/4,t.height/4,0,i.RGBA,o,null),r.colorAttachment.set(e)}u(uv,"bindTextureToFramebuffer");function cv(n,t){let e=n.context,r=e.gl,i=t.heatmapFbo;if(!i)return;e.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),e.activeTexture.set(r.TEXTURE1);let o=t.colorRampTexture;o||(o=t.colorRampTexture=new he(e,t.colorRamp,r.RGBA)),o.bind(r.LINEAR,r.CLAMP_TO_EDGE),n.useProgram("heatmapTexture").draw(e,r.TRIANGLES,K.disabled,oe.disabled,n.colorModeForRenderPass(),re.disabled,Gg(n,t,0,1),null,t.id,n.viewportBuffer,n.quadTriangleIndexBuffer,n.viewportSegments,t.paint,n.transform.zoom)}u(cv,"renderTextureToMap");f();function _x(n,t,e,r){if(n.renderPass!=="translucent")return;let i=e.paint.get("line-opacity"),o=e.paint.get("line-width");if(i.constantOr(1)===0||o.constantOr(1)===0)return;let a=n.depthModeForSublayer(0,K.ReadOnly),s=n.colorModeForRenderPass(),l=e.paint.get("line-dasharray"),c=e.paint.get("line-pattern"),p=c.constantOr(1),m=e.paint.get("line-gradient"),h=e.getCrossfadeParameters(),d=p?"linePattern":l?"lineSDF":m?"lineGradient":"line",g=n.context,y=g.gl,x=!0;for(let v of r){let b=t.getTile(v);if(p&&!b.patternsLoaded())continue;let w=b.getBucket(e);if(!w)continue;let S=w.programConfigurations.get(e.id),P=n.context.program.get(),I=n.useProgram(d,S),C=x||I.program!==P,z=n.style.map.terrain&&n.style.map.terrain.getTerrainData(v),D=c.constantOr(null);if(D&&b.imageAtlas){let U=b.imageAtlas,L=U.patternPositions[D.to.toString()],N=U.patternPositions[D.from.toString()];L&&N&&S.setConstantPatternPositions(L,N)}let A=z?v:null,R=p?Yg(n,b,e,h,A):l?Qg(n,b,e,l,h,A):m?Jg(n,b,e,w.lineClipsArray.length,A):va(n,b,e,A);if(p)g.activeTexture.set(y.TEXTURE0),b.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),S.updatePaintBuffers(h);else if(l&&(C||n.lineAtlas.dirty))g.activeTexture.set(y.TEXTURE0),n.lineAtlas.bind(g);else if(m){let U=w.gradients[e.id],L=U.texture;if(e.gradientVersion!==U.version){let N=256;if(e.stepInterpolant){let V=t.getSource().maxzoom,W=v.canonical.z===V?Math.ceil(1<<n.transform.maxZoom-v.canonical.z):1,Y=w.maxLineLength/8192*1024*W;N=ye(Kh(Y),256,g.maxTextureSize)}U.gradient=wo({expression:e.gradientExpression(),evaluationKey:"lineProgress",resolution:N,image:U.gradient||void 0,clips:w.lineClipsArray}),U.texture?U.texture.update(U.gradient):U.texture=new he(g,U.gradient,y.RGBA),U.version=e.gradientVersion,L=U.texture}g.activeTexture.set(y.TEXTURE0),L.bind(e.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}I.draw(g,y.TRIANGLES,a,n.stencilModeForClipping(v),s,re.disabled,R,z,e.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,e.paint,n.transform.zoom,S,w.layoutVertexBuffer2),x=!1}}u(_x,"drawLine");f();f();function ss(n,t,e,r,i){if(!e||!r||!r.imageAtlas)return;let o=r.imageAtlas.patternPositions,a=o[e.to.toString()],s=o[e.from.toString()];if(!a||!s){let l=i.getPaintProperty(t);a=o[l],s=o[l]}a&&s&&n.setConstantPatternPositions(a,s)}u(ss,"updatePatternPositionsInProgram");function vx(n,t,e,r){let i=e.paint.get("fill-color"),o=e.paint.get("fill-opacity");if(o.constantOr(1)===0)return;let a=n.colorModeForRenderPass(),s=e.paint.get("fill-pattern"),l=n.opaquePassEnabledForLayer()&&!s.constantOr(1)&&i.constantOr(me.transparent).a===1&&o.constantOr(0)===1?"opaque":"translucent";if(n.renderPass===l){let c=n.depthModeForSublayer(1,n.renderPass==="opaque"?K.ReadWrite:K.ReadOnly);bx(n,t,e,r,c,a,!1)}if(n.renderPass==="translucent"&&e.paint.get("fill-antialias")){let c=n.depthModeForSublayer(e.getPaintProperty("fill-outline-color")?2:0,K.ReadOnly);bx(n,t,e,r,c,a,!0)}}u(vx,"drawFill");function bx(n,t,e,r,i,o,a){let s=n.context.gl,l="fill-pattern",c=e.paint.get(l),p=c&&c.constantOr(1),m=e.getCrossfadeParameters(),h,d,g,y,x;a?(d=p&&!e.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=s.LINES):(d=p?"fillPattern":"fill",h=s.TRIANGLES);let v=c.constantOr(null);for(let b of r){let w=t.getTile(b);if(p&&!w.patternsLoaded())continue;let S=w.getBucket(e);if(!S)continue;let P=S.programConfigurations.get(e.id),I=n.useProgram(d,P),C=n.style.map.terrain&&n.style.map.terrain.getTerrainData(b);p&&(n.context.activeTexture.set(s.TEXTURE0),w.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),P.updatePaintBuffers(m)),ss(P,l,v,w,e);let z=C?b:null,D=z?z.posMatrix:b.posMatrix,A=n.translatePosMatrix(D,w,e.paint.get("fill-translate"),e.paint.get("fill-translate-anchor"));if(!a)y=S.indexBuffer,x=S.segments,g=p?Gp(A,n,m,w):Np(A);else{y=S.indexBuffer2,x=S.segments2;let R=[s.drawingBufferWidth,s.drawingBufferHeight];g=d==="fillOutlinePattern"&&p?Mg(A,n,m,w,R):Eg(A,R)}I.draw(n.context,h,i,n.stencilModeForClipping(b),o,re.disabled,g,C,e.id,S.layoutVertexBuffer,y,x,e.paint,n.transform.zoom,P)}}u(bx,"drawFillTiles");f();function wx(n,t,e,r){let i=e.paint.get("fill-extrusion-opacity");if(i!==0&&n.renderPass==="translucent"){let o=new K(n.context.gl.LEQUAL,K.ReadWrite,n.depthRangeFor3D);if(i===1&&!e.paint.get("fill-extrusion-pattern").constantOr(1)){let a=n.colorModeForRenderPass();Um(n,t,e,r,o,oe.disabled,a)}else Um(n,t,e,r,o,oe.disabled,we.disabled),Um(n,t,e,r,o,n.stencilModeFor3D(),n.colorModeForRenderPass())}}u(wx,"drawFillExtrusion");function Um(n,t,e,r,i,o,a){let s=n.context,l=s.gl,c="fill-extrusion-pattern",p=e.paint.get(c),m=p.constantOr(1),h=e.getCrossfadeParameters(),d=e.paint.get("fill-extrusion-opacity"),g=p.constantOr(null);for(let y of r){let x=t.getTile(y),v=x.getBucket(e);if(!v)continue;let b=n.style.map.terrain&&n.style.map.terrain.getTerrainData(y),w=v.programConfigurations.get(e.id),S=n.useProgram(m?"fillExtrusionPattern":"fillExtrusion",w);m&&(n.context.activeTexture.set(l.TEXTURE0),x.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),w.updatePaintBuffers(h)),ss(w,c,g,x,e);let P=n.translatePosMatrix(y.posMatrix,x,e.paint.get("fill-extrusion-translate"),e.paint.get("fill-extrusion-translate-anchor")),I=e.paint.get("fill-extrusion-vertical-gradient"),C=m?Pg(P,n,I,d,y,h,x):Up(P,n,I,d);S.draw(s,s.gl.TRIANGLES,i,o,a,re.backCCW,C,b,e.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,e.paint,n.transform.zoom,w,n.style.map.terrain&&v.centroidVertexBuffer)}}u(Um,"drawExtrusionTiles");f();function Sx(n,t,e,r){if(n.renderPass!=="offscreen"&&n.renderPass!=="translucent")return;let i=n.context,o=n.depthModeForSublayer(0,K.ReadOnly),a=n.colorModeForRenderPass(),[s,l]=n.renderPass==="translucent"?n.stencilConfigForOverlap(r):[{},r];for(let c of l){let p=t.getTile(c);typeof p.needsHillshadePrepare<"u"&&p.needsHillshadePrepare&&n.renderPass==="offscreen"?mv(n,p,e,o,oe.disabled,a):n.renderPass==="translucent"&&pv(n,c,p,e,o,s[c.overscaledZ],a)}i.viewport.set([0,0,n.width,n.height])}u(Sx,"drawHillshade");function pv(n,t,e,r,i,o,a){let s=n.context,l=s.gl,c=e.fbo;if(!c)return;let p=n.useProgram("hillshade"),m=n.style.map.terrain&&n.style.map.terrain.getTerrainData(t);s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get());let h=m?t:null;p.draw(s,l.TRIANGLES,i,o,a,re.disabled,Hg(n,e,r,h),m,r.id,n.rasterBoundsBuffer,n.quadTriangleIndexBuffer,n.rasterBoundsSegments)}u(pv,"renderHillshade");function mv(n,t,e,r,i,o){let a=n.context,s=a.gl,l=t.dem;if(l&&l.data){let c=l.dim,p=l.stride,m=l.getPixels();if(a.activeTexture.set(s.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||n.getTileTexture(p),t.demTexture){let d=t.demTexture;d.update(m,{premultiply:!1}),d.bind(s.NEAREST,s.CLAMP_TO_EDGE)}else t.demTexture=new he(a,m,s.RGBA,{premultiply:!1}),t.demTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE);a.activeTexture.set(s.TEXTURE0);let h=t.fbo;if(!h){let d=new he(a,{width:c,height:c,data:null},s.RGBA);d.bind(s.LINEAR,s.CLAMP_TO_EDGE),h=t.fbo=a.createFramebuffer(c,c,!0,!1),h.colorAttachment.set(d.texture)}a.bindFramebuffer.set(h.framebuffer),a.viewport.set([0,0,c,c]),n.useProgram("hillshadePrepare").draw(a,s.TRIANGLES,r,i,o,re.disabled,Zg(t.tileID,l),null,e.id,n.rasterBoundsBuffer,n.quadTriangleIndexBuffer,n.rasterBoundsSegments),t.needsHillshadePrepare=!1}}u(mv,"prepareHillshade");f();function Px(n,t,e,r){if(n.renderPass!=="translucent"||e.paint.get("raster-opacity")===0||!r.length)return;let i=n.context,o=i.gl,a=t.getSource(),s=n.useProgram("raster"),l=n.colorModeForRenderPass(),[c,p]=a instanceof at?[{},r]:n.stencilConfigForOverlap(r),m=p[p.length-1].overscaledZ,h=!n.options.moving;for(let d of p){let g=n.depthModeForSublayer(d.overscaledZ-m,e.paint.get("raster-opacity")===1?K.ReadWrite:K.ReadOnly,o.LESS),y=t.getTile(d);y.registerFadeDuration(e.paint.get("raster-fade-duration"));let x=t.findLoadedParent(d,0),v=hv(y,x,t,e,n.transform,n.style.map.terrain),b,w,S=e.paint.get("raster-resampling")==="nearest"?o.NEAREST:o.LINEAR;i.activeTexture.set(o.TEXTURE0),y.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),i.activeTexture.set(o.TEXTURE1),x?(x.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),b=Math.pow(2,x.tileID.overscaledZ-y.tileID.overscaledZ),w=[y.tileID.canonical.x*b%1,y.tileID.canonical.y*b%1]):y.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);let P=n.style.map.terrain&&n.style.map.terrain.getTerrainData(d),I=P?d:null,C=I?I.posMatrix:n.transform.calculatePosMatrix(d.toUnwrapped(),h),z=ix(C,w||[0,0],b||1,v,e);a instanceof at?s.draw(i,o.TRIANGLES,g,oe.disabled,l,re.disabled,z,P,e.id,a.boundsBuffer,n.quadTriangleIndexBuffer,a.boundsSegments):s.draw(i,o.TRIANGLES,g,c[d.overscaledZ],l,re.disabled,z,P,e.id,n.rasterBoundsBuffer,n.quadTriangleIndexBuffer,n.rasterBoundsSegments)}}u(Px,"drawRaster");function hv(n,t,e,r,i,o){let a=r.paint.get("raster-fade-duration");if(!o&&a>0){let s=ee.now(),l=(s-n.timeAdded)/a,c=t?(s-t.timeAdded)/a:-1,p=e.getSource(),m=i.coveringZoomLevel({tileSize:p.tileSize,roundZoom:p.roundZoom}),h=!t||Math.abs(t.tileID.overscaledZ-m)>Math.abs(n.tileID.overscaledZ-m),d=h&&n.refreshedUponExpiration?1:ye(h?l:1-c,0,1);return n.refreshedUponExpiration&&l>=1&&(n.refreshedUponExpiration=!1),t?{opacity:1,mix:1-d}:{opacity:d,mix:0}}else return{opacity:1,mix:0}}u(hv,"getFadeValues");f();function Tx(n,t,e,r){let i=e.paint.get("background-color"),o=e.paint.get("background-opacity");if(o===0)return;let a=n.context,s=a.gl,l=n.transform,c=l.tileSize,p=e.paint.get("background-pattern");if(n.isPatternMissing(p))return;let m=!p&&i.a===1&&o===1&&n.opaquePassEnabledForLayer()?"opaque":"translucent";if(n.renderPass!==m)return;let h=oe.disabled,d=n.depthModeForSublayer(0,m==="opaque"?K.ReadWrite:K.ReadOnly),g=n.colorModeForRenderPass(),y=n.useProgram(p?"backgroundPattern":"background"),x=r||l.coveringTiles({tileSize:c,terrain:n.style.map.terrain});p&&(a.activeTexture.set(s.TEXTURE0),n.imageManager.bind(n.context));let v=e.getCrossfadeParameters();for(let b of x){let w=r?b.posMatrix:n.transform.calculatePosMatrix(b.toUnwrapped()),S=p?px(w,o,n,p,{tileID:b,tileSize:c},v):cx(w,o,i),P=n.style.map.terrain&&n.style.map.terrain.getTerrainData(b);y.draw(a,s.TRIANGLES,d,h,g,re.disabled,S,P,e.id,n.tileExtentBuffer,n.quadTriangleIndexBuffer,n.tileExtentSegments)}}u(Tx,"drawBackground");f();var fv=new me(1,0,0,1),dv=new me(0,1,0,1),yv=new me(0,0,1,1),gv=new me(1,0,1,1),xv=new me(0,1,1,1);function Cx(n){let t=n.transform.padding,e=3;Ix(n,n.transform.height-(t.top||0),e,fv),Ix(n,t.bottom||0,e,dv),Ax(n,t.left||0,e,yv),Ax(n,n.transform.width-(t.right||0),e,gv);let r=n.transform.centerPoint;_v(n,r.x,n.transform.height-r.y,xv)}u(Cx,"drawDebugPadding");function _v(n,t,e,r){ls(n,t-2/2,e-20/2,2,20,r),ls(n,t-20/2,e-2/2,20,2,r)}u(_v,"drawCrosshair");function Ix(n,t,e,r){ls(n,0,t+e/2,n.transform.width,e,r)}u(Ix,"drawHorizontalLine");function Ax(n,t,e,r){ls(n,t-e/2,0,e,n.transform.height,r)}u(Ax,"drawVerticalLine");function ls(n,t,e,r,i,o){let a=n.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*n.pixelRatio,e*n.pixelRatio,r*n.pixelRatio,i*n.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}u(ls,"drawDebugSSRect");function Ex(n,t,e){for(let r=0;r<e.length;r++)bv(n,t,e[r])}u(Ex,"drawDebug");function bv(n,t,e){let r=n.context,i=r.gl,o=e.posMatrix,a=n.useProgram("debug"),s=K.disabled,l=oe.disabled,c=n.colorModeForRenderPass(),p="$debug",m=n.style.map.terrain&&n.style.map.terrain.getTerrainData(e);r.activeTexture.set(i.TEXTURE0);let h=t.getTileByID(e.key).latestRawTileData,d=h&&h.byteLength||0,g=Math.floor(d/1024),y=t.getTile(e).tileSize,x=512/Math.min(y,512)*(e.overscaledZ/n.transform.zoom)*.5,v=e.canonical.toString();e.overscaledZ!==e.canonical.z&&(v+=" => ".concat(e.overscaledZ));let b="".concat(v," ").concat(g,"kB");vv(n,b),a.draw(r,i.TRIANGLES,s,l,we.alphaBlended,re.disabled,qp(o,me.transparent,x),null,p,n.debugBuffer,n.quadTriangleIndexBuffer,n.debugSegments),a.draw(r,i.LINE_STRIP,s,l,c,re.disabled,qp(o,me.red),m,p,n.debugBuffer,n.tileBorderIndexBuffer,n.debugSegments)}u(bv,"drawDebugTile");function vv(n,t){n.initDebugOverlayCanvas();let e=n.debugOverlayCanvas,r=n.context.gl,i=n.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,e.width,e.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(t,5,5),i.strokeText(t,5,5),n.debugOverlayTexture.update(e),n.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}u(vv,"drawTextToOverlay");function Mx(n,t){let e=null,i=Object.values(n._layers).flatMap(l=>l.source&&!l.isHidden(t)?[n.sourceCaches[l.source]]:[]),o=i.filter(l=>l.getSource().type==="vector"),a=i.filter(l=>l.getSource().type!=="vector"),s=u(l=>{(!e||e.getSource().maxzoom<l.getSource().maxzoom)&&(e=l)},"considerSource");return o.forEach(l=>s(l)),e||a.forEach(l=>s(l)),e}u(Mx,"selectDebugSource");f();function Lx(n,t,e){let r=n.context,i=e.implementation;if(n.renderPass==="offscreen"){let o=i.prerender;o&&(n.setCustomLayerDefaults(),r.setColorMode(n.colorModeForRenderPass()),o.call(i,r.gl,n.transform.customLayerMatrix()),r.setDirty(),n.setBaseState())}else if(n.renderPass==="translucent"){n.setCustomLayerDefaults(),r.setColorMode(n.colorModeForRenderPass()),r.setStencilMode(oe.disabled);let o=i.renderingMode==="3d"?new K(n.context.gl.LEQUAL,K.ReadWrite,n.depthRangeFor3D):n.depthModeForSublayer(0,K.ReadOnly);r.setDepthMode(o),i.render(r.gl,n.transform.customLayerMatrix()),r.setDirty(),n.setBaseState(),r.bindFramebuffer.set(null)}}u(Lx,"drawCustom");f();function kx(n,t){let e=n.context,r=e.gl,i=we.unblended,o=new K(r.LEQUAL,K.ReadWrite,[0,1]),a=t.getTerrainMesh(),s=t.sourceCache.getRenderableTiles(),l=n.useProgram("terrainDepth");e.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),e.viewport.set([0,0,n.width/devicePixelRatio,n.height/devicePixelRatio]),e.clear({color:me.transparent,depth:1});for(let c of s){let p=t.getTerrainData(c.tileID),m=n.transform.calculatePosMatrix(c.tileID.toUnwrapped()),h=_g(m,t.getMeshFrameDelta(n.transform.zoom));l.draw(e,r.TRIANGLES,o,oe.disabled,i,re.backCCW,h,p,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}e.bindFramebuffer.set(null),e.viewport.set([0,0,n.width,n.height])}u(kx,"drawDepth");function Dx(n,t){let e=n.context,r=e.gl,i=we.unblended,o=new K(r.LEQUAL,K.ReadWrite,[0,1]),a=t.getTerrainMesh(),s=t.getCoordsTexture(),l=t.sourceCache.getRenderableTiles(),c=n.useProgram("terrainCoords");e.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),e.viewport.set([0,0,n.width/devicePixelRatio,n.height/devicePixelRatio]),e.clear({color:me.transparent,depth:1}),t.coordsIndex=[];for(let p of l){let m=t.getTerrainData(p.tileID);e.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,s.texture);let h=n.transform.calculatePosMatrix(p.tileID.toUnwrapped()),d=bg(h,255-t.coordsIndex.length,t.getMeshFrameDelta(n.transform.zoom));c.draw(e,r.TRIANGLES,o,oe.disabled,i,re.backCCW,d,m,"terrain",a.vertexBuffer,a.indexBuffer,a.segments),t.coordsIndex.push(p.tileID.key)}e.bindFramebuffer.set(null),e.viewport.set([0,0,n.width,n.height])}u(Dx,"drawCoords");function Nm(n,t,e){let r=n.context,i=r.gl,o=n.colorModeForRenderPass(),a=new K(i.LEQUAL,K.ReadWrite,n.depthRangeFor3D),s=n.useProgram("terrain"),l=t.getTerrainMesh();r.bindFramebuffer.set(null),r.viewport.set([0,0,n.width,n.height]);for(let c of e){let p=n.renderToTexture.getTexture(c),m=t.getTerrainData(c.tileID);r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,p.texture);let h=n.transform.calculatePosMatrix(c.tileID.toUnwrapped()),d=xg(h,t.getMeshFrameDelta(n.transform.zoom));s.draw(r,i.TRIANGLES,a,oe.disabled,o,re.backCCW,d,m,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}u(Nm,"drawTerrain");var Gm=class Gm{constructor(t,e){this.context=new os(t),this.transform=e,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:G.create(),renderTime:0},this.setup(),this.numSublayers=Ct.maxUnderzooming+Ct.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new si}resize(t,e,r){if(!(t===0||e===0)&&(this.width=Math.floor(t*r),this.height=Math.floor(e*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.setupRemoteFrameRendering(this.width,this.height),this.style))for(let i of this.style._order)this.style._layers[i].resize()}setup(){let t=this.context,e=new Nt;e.emplaceBack(0,0),e.emplaceBack(8192,0),e.emplaceBack(0,8192),e.emplaceBack(8192,8192),this.tileExtentBuffer=t.createVertexBuffer(e,ya.members),this.tileExtentSegments=ae.simpleSegment(0,0,4,2);let r=new Nt;r.emplaceBack(0,0),r.emplaceBack(8192,0),r.emplaceBack(0,8192),r.emplaceBack(8192,8192),this.debugBuffer=t.createVertexBuffer(r,ya.members),this.debugSegments=ae.simpleSegment(0,0,4,5);let i=new Nr;i.emplaceBack(0,0,0,0),i.emplaceBack(8192,0,8192,0),i.emplaceBack(0,8192,0,8192),i.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=t.createVertexBuffer(i,Jt.members),this.rasterBoundsSegments=ae.simpleSegment(0,0,4,2);let o=new Nt;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(o,ya.members),this.viewportSegments=ae.simpleSegment(0,0,4,2);let a=new Hi;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(a);let s=new qe;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(s);let l=this.context.gl;this.stencilClearMode=new oe({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.setupRemoteFrameRendering(this.width,this.height)}setupRemoteFrameRendering(t,e){if(t==null||e==null||t==0||e==0)return;let r=this.context.gl;r.bindFramebuffer(r.FRAMEBUFFER,null),this.webGLRenderTargetFrameBuffer&&(r.deleteFramebuffer(this.webGLRenderTargetFrameBuffer),r.deleteRenderbuffer(this.webGLRenderTargetRenderBuffer),r.deleteTexture(this.webGLRenderTargetTexture)),this.webGLRenderTargetFrameBuffer=r.createFramebuffer(),this.webGLRenderTargetRenderBuffer=r.createRenderbuffer(),r.bindFramebuffer(r.FRAMEBUFFER,this.webGLRenderTargetFrameBuffer),this.webGLRenderTargetTexture=r.createTexture(),r.bindTexture(r.TEXTURE_2D,this.webGLRenderTargetTexture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t,e,0,r.RGBA,r.UNSIGNED_BYTE,null),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,this.webGLRenderTargetTexture,0),r.bindRenderbuffer(r.RENDERBUFFER,this.webGLRenderTargetRenderBuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t,e),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,this.webGLRenderTargetRenderBuffer),r.checkFramebufferStatus(r.FRAMEBUFFER)!==r.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is not complete")}clearStencil(){let t=this.context,e=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=G.create();G.ortho(r,0,this.width,this.height,0,0,1),G.scale(r,r,[e.drawingBufferWidth,e.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,e.TRIANGLES,K.disabled,this.stencilClearMode,we.disabled,re.disabled,jp(r),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;let r=this.context,i=r.gl;this.nextStencilID+e.length>256&&this.clearStencil(),r.setColorMode(we.disabled),r.setDepthMode(K.disabled);let o=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let a of e){let s=this._tileClippingMaskIDs[a.key]=this.nextStencilID++,l=this.style.map.terrain&&this.style.map.terrain.getTerrainData(a);o.draw(r,i.TRIANGLES,K.disabled,new oe({func:i.ALWAYS,mask:0},s,255,i.KEEP,i.KEEP,i.REPLACE),we.disabled,re.disabled,jp(a.posMatrix),l,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,e=this.context.gl;return new oe({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){let e=this.context.gl;return new oe({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){let e=this.context.gl,r=t.sort((a,s)=>s.overscaledZ-a.overscaledZ),i=r[r.length-1].overscaledZ,o=r[0].overscaledZ-i+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();let a={};for(let s=0;s<o;s++)a[s+i]=new oe({func:e.GEQUAL,mask:255},s+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=o,[a,r]}return[{[i]:oe.disabled},r]}colorModeForRenderPass(){let t=this.context.gl;return this._showOverdrawInspector?new we([t.CONSTANT_COLOR,t.ONE],new me(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?we.unblended:we.alphaBlended}depthModeForSublayer(t,e,r){if(!this.opaquePassEnabledForLayer())return K.disabled;let i=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new K(r||this.context.gl.LEQUAL,e,[i,i])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,e){this.style=t,this.options=e,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(ee.now()),this.imageManager.beginFrame();let r=this.style._order,i=this.style.sourceCaches,o={},a={},s={};for(let l in i){let c=i[l];c.used&&c.prepare(this.context),o[l]=c.getVisibleCoordinates(),a[l]=o[l].slice().reverse(),s[l]=c.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let l=0;l<r.length;l++){let c=r[l];if(this.style._layers[c].is3D()){this.opaquePassCutoff=l;break}}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;let l=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!G.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||l.length)&&(G.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,kx(this,this.style.map.terrain),Dx(this,this.style.map.terrain))}this.renderPass="offscreen";for(let l of r){let c=this.style._layers[l];if(!c.hasOffscreenPass()||c.isHidden(this.transform.zoom))continue;let p=a[c.source];c.type!=="custom"&&!p.length||this.renderLayer(this,i[c.source],c,p)}if(this.context.bindFramebuffer.set(this.webGLRenderTargetFrameBuffer),this.context.clear({color:e.showOverdrawInspector?me.black:me.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=e.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=r.length-1;this.currentLayer>=0;this.currentLayer--){let l=this.style._layers[r[this.currentLayer]],c=i[l.source],p=o[l.source];this._renderTileClippingMasks(l,p),this.renderLayer(this,c,l,p)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<r.length;this.currentLayer++){let l=this.style._layers[r[this.currentLayer]],c=i[l.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(l))continue;let p=(l.type==="symbol"?s:a)[l.source];this._renderTileClippingMasks(l,o[l.source]),this.renderLayer(this,c,l,p)}if(this.options.showTileBoundaries){let l=Mx(this.style,this.transform.zoom);l&&Ex(this,l,l.getVisibleCoordinates())}this.options.showPadding&&Cx(this),this.context.setDefault(),this.setCustomLayerDefaults(),this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,null)}renderLayer(t,e,r,i){if(!r.isHidden(this.transform.zoom)&&!(r.type!=="background"&&r.type!=="custom"&&!(i||[]).length))switch(this.id=r.id,r.type){case"symbol":yx(t,e,r,i,this.style.placement.variableOffsets);break;case"circle":gx(t,e,r,i);break;case"heatmap":xx(t,e,r,i);break;case"line":_x(t,e,r,i);break;case"fill":vx(t,e,r,i);break;case"fill-extrusion":wx(t,e,r,i);break;case"hillshade":Sx(t,e,r,i);break;case"raster":Px(t,e,r,i);break;case"background":Tx(t,e,r,i);break;case"custom":Lx(t,e,r);break}}translatePosMatrix(t,e,r,i,o){if(!r[0]&&!r[1])return t;let a=o?i==="map"?this.transform.angle:0:i==="viewport"?-this.transform.angle:0;if(a){let c=Math.sin(a),p=Math.cos(a);r=[r[0]*p-r[1]*c,r[0]*c+r[1]*p]}let s=[o?r[0]:Fe(e,r[0],this.transform.zoom),o?r[1]:Fe(e,r[1],this.transform.zoom),0],l=new Float32Array(16);return G.translate(l,t,s),l}saveTileTexture(t){let e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){let e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r}useProgram(t,e){this.cache=this.cache||{};let r=t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[r]||(this.cache[r]=new _a(this.context,Cr[t],e,mx[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[r]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t=this.context.gl;this.debugOverlayTexture=new he(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}};u(Gm,"Painter");var us=Gm;f();var Ee=te(be(),1);f();var ps=class ps{constructor(t,e){this.points=t;this.planes=e}static fromInvProjectionMatrix(t,e,r){let i=[[-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]],o=Math.pow(2,r),a=i.map(c=>{c=Re.transformMat4([],c,t);let p=1/c[3]/e*o;return Re.mul(c,c,[p,p,1/c[3],p])}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(c=>{let p=ut.sub([],a[c[0]],a[c[1]]),m=ut.sub([],a[c[2]],a[c[1]]),h=ut.normalize([],ut.cross([],p,m)),d=-ut.dot(h,a[c[1]]);return h.concat(d)});return new ps(a,l)}};u(ps,"Frustum");var cs=ps,ms=class ms{constructor(t,e){this.min=t,this.max=e,this.center=ut.scale([],ut.add([],this.min,this.max),.5)}quadrant(t){let e=[t%2===0,t<2],r=ut.clone(this.min),i=ut.clone(this.max);for(let o=0;o<e.length;o++)r[o]=e[o]?this.min[o]:this.center[o],i[o]=e[o]?this.center[o]:this.max[o];return i[2]=this.max[2],new ms(r,i)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){let e=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]],r=!0;for(let i=0;i<t.planes.length;i++){let o=t.planes[i],a=0;for(let s=0;s<e.length;s++)Re.dot(o,e[s])>=0&&a++;if(a===0)return 0;a!==e.length&&(r=!1)}if(r)return 2;for(let i=0;i<3;i++){let o=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let s=0;s<t.points.length;s++){let l=t.points[s][i]-this.min[i];o=Math.min(o,l),a=Math.max(a,l)}if(a<0||o>this.max[i]-this.min[i])return 0}return 1}};u(ms,"Aabb");var _n=ms;f();var Fx=te(be(),1);var fs=class fs{constructor(t=0,e=0,r=0,i=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(r)||r<0||isNaN(i)||i<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=r,this.right=i}interpolate(t,e,r){return e.top!=null&&t.top!=null&&(this.top=Ae.number(t.top,e.top,r)),e.bottom!=null&&t.bottom!=null&&(this.bottom=Ae.number(t.bottom,e.bottom,r)),e.left!=null&&t.left!=null&&(this.left=Ae.number(t.left,e.left,r)),e.right!=null&&t.right!=null&&(this.right=Ae.number(t.right,e.right,r)),this}getCenter(t,e){let r=ye((this.left+t-this.right)/2,0,t),i=ye((this.top+e-this.bottom)/2,0,e);return new Fx.default(r,i)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new fs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};u(fs,"EdgeInsets");var hs=fs;var ys=class ys{constructor(t,e,r,i,o){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=o===void 0?!0:!!o,this._minZoom=t||0,this._maxZoom=e||22,this._minPitch=r==null?0:r,this._maxPitch=i==null?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new Q(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.698132,this._pitch=0,this._unmodified=!0,this._edgeInsets=new hs,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){let t=new ys(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Ee.default(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){let e=-St(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=$s.create(),$s.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){let e=ye(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){let e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.tileZoom=Math.max(0,Math.floor(e)),this.scale=this.zoomScale(e),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){let e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(t){let e=[new Yr(0,t)];if(this._renderWorldCopies){let r=this.pointCoordinate(new Ee.default(0,0)),i=this.pointCoordinate(new Ee.default(this.width,0)),o=this.pointCoordinate(new Ee.default(this.width,this.height)),a=this.pointCoordinate(new Ee.default(0,this.height)),s=Math.floor(Math.min(r.x,i.x,o.x,a.x)),l=Math.floor(Math.max(r.x,i.x,o.x,a.x)),c=1;for(let p=s-c;p<=l+c;p++)p!==0&&e.push(new Yr(p,t))}return e}coveringTiles(t){var v,b;let e=this.coveringZoomLevel(t),r=e;if(t.minzoom!==void 0&&e<t.minzoom)return[];t.maxzoom!==void 0&&e>t.maxzoom&&(e=t.maxzoom);let i=this.pointCoordinate(this.getCameraPoint()),o=Se.fromLngLat(this.center),a=Math.pow(2,e),s=[a*i.x,a*i.y,0],l=[a*o.x,a*o.y,0],c=cs.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,e),p=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=e);let m=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,h=u(w=>({aabb:new _n([w*a,0,0],[(w+1)*a,a,0]),zoom:0,x:0,y:0,wrap:w,fullyVisible:!1}),"newRootTile"),d=[],g=[],y=e,x=t.reparseOverscaled?r:e;if(this._renderWorldCopies)for(let w=1;w<=3;w++)d.push(h(-w)),d.push(h(w));for(d.push(h(0));d.length>0;){let w=d.pop(),S=w.x,P=w.y,I=w.fullyVisible;if(!I){let U=w.aabb.intersects(c);if(U===0)continue;I=U===2}let C=t.terrain?s:l,z=w.aabb.distanceX(C),D=w.aabb.distanceY(C),A=Math.max(Math.abs(z),Math.abs(D)),R=m+(1<<y-w.zoom)-2;if(w.zoom===y||A>R&&w.zoom>=p){let U=y-w.zoom,L=s[0]-.5-(S<<U),N=s[1]-.5-(P<<U);g.push({tileID:new Ne(w.zoom===y?x:w.zoom,w.wrap,w.zoom,S,P),distanceSq:kn.sqrLen([l[0]-.5-S,l[1]-.5-P]),tileDistanceToCamera:Math.sqrt(L*L+N*N)});continue}for(let U=0;U<4;U++){let L=(S<<1)+U%2,N=(P<<1)+(U>>1),V=w.zoom+1,W=w.aabb.quadrant(U);if(t.terrain){let Z=new Ne(V,w.wrap,V,L,N),ue=t.terrain.getMinMaxElevation(Z),Y=(v=ue.minElevation)!=null?v:this.elevation,Oe=(b=ue.maxElevation)!=null?b:this.elevation;W=new _n([W.min[0],W.min[1],Y],[W.max[0],W.max[1],Oe])}d.push({aabb:W,zoom:V,x:L,y:N,wrap:w.wrap,fullyVisible:I})}}return g.sort((w,S)=>w.distanceSq-S.distanceSq).map(w=>w.tileID)}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){let e=ye(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new Ee.default(Xt(t.lng)*this.worldSize,Kt(e)*this.worldSize)}calculateZMercatorFromAltitude(t){let{lat:e}=this.center,r=Pr,i=this.tileSize,o=e*Math.PI/180,s=t+r,l=Math.cos(o)*2*Math.PI*r/(i*Math.pow(2,20)),c=s/l,p=Math.log2(i/c);return Math.abs(p)}unproject(t){return new Se(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=this.getElevation())}getElevation(t,e){let r=Se.fromLngLat(t.wrap()),i=(1<<this.tileZoom)*8192,o=r.x*i,a=r.y*i,s=Math.floor(o/8192),l=Math.floor(a/8192),c=new Ne(this.tileZoom,0,this.tileZoom,s,l);return e.getElevation(c,o%8192,a%8192,8192)}getCameraPosition(){let t=this.pointLocation(this.getCameraPoint()),e=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter;return{lngLat:t,altitude:e+this.elevation}}recalculateZoom(t){let e=this.pointLocation(this.centerPoint,t),r=this.getElevation(e,t);if(!(this.elevation-r))return;let o=this.getCameraPosition(),a=Se.fromLngLat(o.lngLat,o.altitude),s=Se.fromLngLat(e,r),l=a.x-s.x,c=a.y-s.y,p=a.z-s.z,m=Math.sqrt(l*l+c*c+p*p),h=this.scaleZoom(this.cameraToCenterDistance/m/this.tileSize);this._elevation=r,this._center=e,this.zoom=h}setLocationAtPoint(t,e){let r=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(t),a=new Se(o.x-(r.x-i.x),o.y-(r.y-i.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,e){return e?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,e),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,e){return this.coordinateLocation(this.pointCoordinate(t,e))}locationCoordinate(t){return Se.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,e){if(e){let y=e.pointCoordinate(t);if(y!=null)return y}let r=0,i=[t.x,t.y,0,1],o=[t.x,t.y,1,1];Re.transformMat4(i,i,this.pixelMatrixInverse),Re.transformMat4(o,o,this.pixelMatrixInverse);let a=i[3],s=o[3],l=i[0]/a,c=o[0]/s,p=i[1]/a,m=o[1]/s,h=i[2]/a,d=o[2]/s,g=h===d?0:(r-h)/(d-h);return new Se(Ae.number(l,c,g)/this.worldSize,Ae.number(p,m,g)/this.worldSize)}coordinatePoint(t,e=0,r=this.pixelMatrix){let i=[t.x*this.worldSize,t.y*this.worldSize,e,1];return Re.transformMat4(i,i,r),new Ee.default(i[0]/i[3],i[1]/i[3])}getBounds(){let t=Math.max(0,this.height/2-this.getHorizon());return new We().extend(this.pointLocation(new Ee.default(0,t))).extend(this.pointLocation(new Ee.default(this.width,t))).extend(this.pointLocation(new Ee.default(this.width,this.height))).extend(this.pointLocation(new Ee.default(0,this.height)))}getMaxBounds(){return!this.latRange||this.latRange.length!==2||!this.lngRange||this.lngRange.length!==2?null:new We([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]])}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,e=!1){let r=t.key,i=e?this._alignedPosMatrixCache:this._posMatrixCache;if(i[r])return i[r];let o=t.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*t.wrap,l=G.identity(new Float64Array(16));return G.translate(l,l,[s*a,o.y*a,0]),G.scale(l,l,[a/8192,a/8192,1]),G.multiply(l,e?this.alignedProjMatrix:this.projMatrix,l),i[r]=new Float32Array(l),i[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t=-90,e=90,r=-180,i=180,o,a,s,l,c=this.size,p=this._unmodified;if(this.latRange){let d=this.latRange;t=Kt(d[1])*this.worldSize,e=Kt(d[0])*this.worldSize,o=e-t<c.y?c.y/(e-t):0}if(this.lngRange){let d=this.lngRange;r=St(Xt(d[0])*this.worldSize,0,this.worldSize),i=St(Xt(d[1])*this.worldSize,0,this.worldSize),i<r&&(i+=this.worldSize),a=i-r<c.x?c.x/(i-r):0}let m=this.point,h=Math.max(a||0,o||0);if(h){this.center=this.unproject(new Ee.default(a?(i+r)/2:m.x,o?(e+t)/2:m.y)),this.zoom+=this.scaleZoom(h),this._unmodified=p,this._constraining=!1;return}if(this.latRange){let d=m.y,g=c.y/2;d-g<t&&(l=t+g),d+g>e&&(l=e-g)}if(this.lngRange){let d=(r+i)/2,g=St(m.x,d-this.worldSize/2,d+this.worldSize/2),y=c.x/2;g-y<r&&(s=r+y),g+y>i&&(s=i-y)}(s!==void 0||l!==void 0)&&(this.center=this.unproject(new Ee.default(s!==void 0?s:m.x,l!==void 0?l:m.y)).wrap()),this._unmodified=p,this._constraining=!1}_calcMatrices(){if(!this.height)return;let t=this._fov/2,e=this.centerOffset,r=this.point.x,i=this.point.y;this.cameraToCenterDistance=.5/Math.tan(t)*this.height,this._pixelPerMeter=Oc(1,this.center.lat)*this.worldSize;let o=G.identity(new Float64Array(16));G.scale(o,o,[this.width/2,-this.height/2,1]),G.translate(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=G.identity(new Float64Array(16)),G.scale(o,o,[1,-1,1]),G.translate(o,o,[-1,-1,0]),G.scale(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);let a=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,s=Math.PI/2+this._pitch,l=this._fov*(.5+e.y/this.height),c=Math.sin(l)*a/Math.sin(ye(Math.PI-s-l,.01,Math.PI-.01)),p=this.getHorizon(),h=2*Math.atan(p/this.cameraToCenterDistance)*(.5+e.y/(p*2)),d=Math.sin(h)*a/Math.sin(ye(Math.PI-s-h,.01,Math.PI-.01)),g=Math.min(c,d),y=(Math.cos(Math.PI/2-this._pitch)*g+a)*1.01,x=this.height/50;o=new Float64Array(16),G.perspective(o,this._fov,this.width/this.height,x,y),o[8]=-e.x*2/this.width,o[9]=e.y*2/this.height,G.scale(o,o,[1,-1,1]),G.translate(o,o,[0,0,-this.cameraToCenterDistance]),G.rotateX(o,o,this._pitch),G.rotateZ(o,o,this.angle),G.translate(o,o,[-r,-i,0]),this.mercatorMatrix=G.scale([],o,[this.worldSize,this.worldSize,this.worldSize]),G.scale(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=G.multiply(new Float64Array(16),this.labelPlaneMatrix,o),G.translate(o,o,[0,0,-this.elevation]),this.projMatrix=o,this.invProjMatrix=G.invert([],o),this.pixelMatrix3D=G.multiply(new Float64Array(16),this.labelPlaneMatrix,o);let v=this.width%2/2,b=this.height%2/2,w=Math.cos(this.angle),S=Math.sin(this.angle),P=r-Math.round(r)+w*v+S*b,I=i-Math.round(i)+w*b+S*v,C=new Float64Array(o);if(G.translate(C,C,[P>.5?P-1:P,I>.5?I-1:I,0]),this.alignedProjMatrix=C,o=G.invert(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let t=this.pointCoordinate(new Ee.default(0,0)),e=[t.x*this.worldSize,t.y*this.worldSize,0,1];return Re.transformMat4(e,e,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let t=this._pitch,e=Math.tan(t)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new Ee.default(0,e))}getCameraQueryGeometry(t){let e=this.getCameraPoint();if(t.length===1)return[t[0],e];{let r=e.x,i=e.y,o=e.x,a=e.y;for(let s of t)r=Math.min(r,s.x),i=Math.min(i,s.y),o=Math.max(o,s.x),a=Math.max(a,s.y);return[new Ee.default(r,i),new Ee.default(o,i),new Ee.default(o,a),new Ee.default(r,a),new Ee.default(r,i)]}}setCameraPosition(t){let{lng:e,lat:r,altitude:i,pitch:o,bearing:a}=t,s=o*(Math.PI/180),l=.5/Math.tan(this._fov/2)*this.height,c=Math.abs(Math.cos(s)*l),m=2*Math.PI*6378137*Math.abs(Math.cos(r*(Math.PI/180))),h=c/i*m,d=Math.tan(s)*l,g=new Ee.default(this.width/2,this.height/2+d),y=new Q(e,r);this.zoom=Math.log(h/this.tileSize)/Math.LN2,this.pitch=o,this.bearing=a,this.setLocationAtPoint(y,g)}getCameraAltitude(){let t=this._pitch,e=Math.cos(t)*this.cameraToCenterDistance,r=Math.tan(t)*this.cameraToCenterDistance,i=this.pointLocation(this.centerPoint.add(new Ee.default(0,r))),o=2*Math.PI*6378137,a=this.worldSize/(o*Math.abs(Math.cos(i.lat*(Math.PI/180))));return e/a}};u(ys,"Transform");var ds=ys;f();f();function zx(n,t){let e=!1,r=null,i=u(()=>{r=null,e&&(n(),r=setTimeout(i,t),e=!1)},"later");return()=>(e=!0,r||i(),r)}u(zx,"throttle");var qm=class qm{constructor(t){this._getCurrentHash=u(()=>{let t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map(r=>r.split("=")).forEach(r=>{r[0]===this._hashName&&(e=r)}),(e&&e[1]||"").split("/")}return t.split("/")},"_getCurrentHash");this._onHashChange=u(()=>{let t=this._getCurrentHash();if(t.length>=3&&!t.some(e=>isNaN(e))){let e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},"_onHashChange");this._updateHashUnthrottled=u(()=>{let t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}},"_updateHashUnthrottled");this._updateHash=zx(this._updateHashUnthrottled,30*1e3/100);this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){let e=this._map.getCenter(),r=Math.round(this._map.getZoom()*100)/100,i=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,i),a=Math.round(e.lng*o)/o,s=Math.round(e.lat*o)/o,l=this._map.getBearing(),c=this._map.getPitch(),p="";if(t?p+="/".concat(a,"/").concat(s,"/").concat(r):p+="".concat(r,"/").concat(s,"/").concat(a),(l||c)&&(p+="/".concat(Math.round(l*10)/10)),c&&(p+="/".concat(Math.round(c))),this._hashName){let m=this._hashName,h=!1,d=window.location.hash.slice(1).split("&").map(g=>{let y=g.split("=")[0];return y===m?(h=!0,"".concat(y,"=").concat(p)):g}).filter(g=>g);return h||d.push("".concat(m,"=").concat(p)),"#".concat(d.join("&"))}return"#".concat(p)}};u(qm,"Hash");var gs=qm;f();f();var Bx=te(be(),1);var vs={linearity:.3,easing:Qs(0,0,.3,1)},wv=k({deceleration:2500,maxSpeed:1400},vs),Sv=k({deceleration:20,maxSpeed:1400},vs),Pv=k({deceleration:1e3,maxSpeed:360},vs),Tv=k({deceleration:1e3,maxSpeed:90},vs),jm=class jm{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ee.now(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,e=ee.now(),r=160;for(;t.length>0&&e-t[0].time>r;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let e={zoom:0,bearing:0,pitch:0,pan:new Bx.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:a}of this._inertiaBuffer)e.zoom+=a.zoomDelta||0,e.bearing+=a.bearingDelta||0,e.pitch+=a.pitchDelta||0,a.panDelta&&e.pan._add(a.panDelta),a.around&&(e.around=a.around),a.pinchAround&&(e.pinchAround=a.pinchAround);let i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(e.pan.mag()){let a=_s(e.pan.mag(),i,k({},wv,t||{}));o.offset=e.pan.mult(a.amount/e.pan.mag()),o.center=this._map.transform.center,xs(o,a)}if(e.zoom){let a=_s(e.zoom,i,Sv);o.zoom=this._map.transform.zoom+a.amount,xs(o,a)}if(e.bearing){let a=_s(e.bearing,i,Pv);o.bearing=this._map.transform.bearing+ye(a.amount,-179,179),xs(o,a)}if(e.pitch){let a=_s(e.pitch,i,Tv);o.pitch=this._map.transform.pitch+a.amount,xs(o,a)}if(o.zoom||o.bearing){let a=e.pinchAround===void 0?e.around:e.pinchAround;o.around=a?this._map.unproject(a):this._map.getCenter()}return this.clear(),k(o,{noMoveStart:!0})}};u(jm,"HandlerInertia");var bs=jm;function xs(n,t){(!n.duration||n.duration<t.duration)&&(n.duration=t.duration,n.easing=t.easing)}u(xs,"extendDuration");function _s(n,t,e){let{maxSpeed:r,linearity:i,deceleration:o}=e,a=ye(n*i/(t/1e3),-r,r),s=Math.abs(a)/(o*i);return{easing:e.easing,duration:s*1e3,amount:a*(s/2)}}u(_s,"calculateEasing");var Rx=te(be(),1);var ws=u(n=>n.zoom||n.drag||n.pitch||n.rotate,"isMoving"),Wm=class Wm extends E{};u(Wm,"RenderFrameEvent");var Zm=Wm;function Hm(n){return n.panDelta&&n.panDelta.mag()||n.zoomDelta||n.bearingDelta||n.pitchDelta}u(Hm,"hasChange");var Xm=class Xm{constructor(t,e){this.handleWindowEvent=u(t=>{this.handleEvent(t,"".concat(t.type,"Window"))},"handleWindowEvent");this.handleEvent=u((t,e)=>{if(t.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let r=t.type==="renderFrame"?void 0:t,i={needsRenderFrame:!1},o={},a={},s=t.touches,l=s?this._getMapTouches(s):void 0,c=l?M.touchPos(this._el,l):M.mousePos(this._el,t);for(let{handlerName:h,handler:d,allowed:g}of this._handlers){if(!d.isEnabled())continue;let y;this._blockedByActive(a,g,h)?d.reset():d[e||t.type]&&(y=d[e||t.type](t,c,l),this.mergeHandlerResult(i,o,y,h,r),y&&y.needsRenderFrame&&this._triggerRenderFrame()),(y||d.isActive())&&(a[h]=d)}let p={};for(let h in this._previousActiveHandlers)a[h]||(p[h]=r);this._previousActiveHandlers=a,(Object.keys(p).length||Hm(i))&&(this._changes.push([i,o,p]),this._triggerRenderFrame()),(Object.keys(a).length||Hm(i))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:m}=i;m&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],m(this._map))},"handleEvent");this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new bs(t),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={};let r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]]}destroy(){}_addDefaultHandlers(t){}_add(t,e,r){this._handlers.push({handlerName:t,handler:e,allowed:r}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||!1}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ws(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,e,r){for(let i in t)if(i!==r&&(!e||e.indexOf(i)<0))return!0;return!1}_getMapTouches(t){let e=[];for(let r of t){let i=r.target;this._el.contains(i)&&e.push(r)}return e}mergeHandlerResult(t,e,r,i,o){if(!r)return;k(t,r);let a={handlerName:i,originalEvent:r.originalEvent||o};r.zoomDelta!==void 0&&(e.zoom=a),r.panDelta!==void 0&&(e.drag=a),r.pitchDelta!==void 0&&(e.pitch=a),r.bearingDelta!==void 0&&(e.rotate=a)}_applyChanges(){let t={},e={},r={};for(let[i,o,a]of this._changes)i.panDelta&&(t.panDelta=(t.panDelta||new Rx.default(0,0))._add(i.panDelta)),i.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+i.pitchDelta),i.around!==void 0&&(t.around=i.around),i.pinchAround!==void 0&&(t.pinchAround=i.pinchAround),i.noInertia&&(t.noInertia=i.noInertia),k(e,o),k(r,a);this._updateMapTransform(t,e,r),this._changes=[]}_updateMapTransform(t,e,r){let i=this._map,o=i._getTransformForUpdate(),a=i.terrain;if(!Hm(t)&&!(a&&this._terrainMovement))return this._fireEvents(e,r,!0);let{panDelta:s,zoomDelta:l,bearingDelta:c,pitchDelta:p,around:m,pinchAround:h}=t;h!==void 0&&(m=h),i._stop(!0),m=m||i.transform.centerPoint;let d=o.pointLocation(s?m.sub(s):m);c&&(o.bearing+=c),p&&(o.pitch+=p),l&&(o.zoom+=l),a?!this._terrainMovement&&(e.drag||e.zoom)?(this._terrainMovement=!0,o.freezeElevation=!0,o.setLocationAtPoint(d,m),this._map.once("moveend",()=>{o.freezeElevation=!1,this._terrainMovement=!1,o.recalculateZoom(i.terrain)})):e.drag&&this._terrainMovement?o.center=o.pointLocation(o.centerPoint.sub(s)):o.setLocationAtPoint(d,m):o.setLocationAtPoint(d,m),i._applyUpdatedTransform(o),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,r,!0)}_fireEvents(t,e,r){let i=ws(this._eventsInProgress),o=ws(t),a={};for(let p in t){let{originalEvent:m}=t[p];this._eventsInProgress[p]||(a["".concat(p,"start")]=m),this._eventsInProgress[p]=t[p]}!i&&o&&this._fireEvent("movestart",o.originalEvent);for(let p in a)this._fireEvent(p,a[p]);o&&this._fireEvent("move",o.originalEvent);for(let p in t){let{originalEvent:m}=t[p];this._fireEvent(p,m)}let s={},l;for(let p in this._eventsInProgress){let{handlerName:m,originalEvent:h}=this._eventsInProgress[p];this._handlersById[m].isActive()||(delete this._eventsInProgress[p],l=e[m]||h,s["".concat(p,"end")]=l)}for(let p in s)this._fireEvent(p,s[p]);let c=ws(this._eventsInProgress);if(r&&(i||o)&&!c){this._updatingCamera=!0;let p=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),m=u(h=>h!==0&&-this._bearingSnap<h&&h<this._bearingSnap,"shouldSnapToNorth");p?(m(p.bearing||this._map.getBearing())&&(p.bearing=0),p.freezeElevation=!0,this._map.easeTo(p,{originalEvent:l})):(this._map.fire(new E("moveend",{originalEvent:l})),m(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,e){this._map.fire(new E(t,e?{originalEvent:e}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Zm("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}};u(Xm,"HandlerManager");var Ss=Xm;f();var bt=te(be(),1);var Km=class Km extends se{constructor(e,r){super();this._renderFrameCallback=u(()=>{let e=Math.min((ee.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},"_renderFrameCallback");this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=r.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,r){return this.jumpTo({center:e},r)}panBy(e,r,i){return e=bt.default.convert(e).mult(-1),this.panTo(this.transform.center,k({offset:e},r),i)}panTo(e,r,i){return this.easeTo(k({center:e},r),i)}getZoom(){return this.transform.zoom}setZoom(e,r){return this.jumpTo({zoom:e},r),this}zoomTo(e,r,i){return this.easeTo(k({zoom:e},r),i)}zoomIn(e,r){return this.zoomTo(this.getZoom()+1,e,r),this}zoomOut(e,r){return this.zoomTo(this.getZoom()-1,e,r),this}getBearing(){return this.transform.bearing}setBearing(e,r){return this.jumpTo({bearing:e},r),this}getPadding(){return this.transform.padding}setPadding(e,r){return this.jumpTo({padding:e},r),this}rotateTo(e,r,i){return this.easeTo(k({bearing:e},r),i)}resetNorth(e,r){return this.rotateTo(0,k({duration:1e3},e),r),this}resetNorthPitch(e,r){return this.easeTo(k({bearing:0,pitch:0,duration:1e3},e),r),this}snapToNorth(e,r){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,r):this}getPitch(){return this.transform.pitch}setPitch(e,r){return this.jumpTo({pitch:e},r),this}cameraForBounds(e,r){e=We.convert(e);let i=r&&r.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,r)}_cameraForBoxAndBearing(e,r,i,o){let a={top:0,bottom:0,right:0,left:0};if(o=k({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},o),typeof o.padding=="number"){let R=o.padding;o.padding={top:R,bottom:R,right:R,left:R}}o.padding=k(a,o.padding);let s=this.transform,l=s.padding,c=s.project(Q.convert(e)),p=s.project(Q.convert(r)),m=c.rotate(-i*Math.PI/180),h=p.rotate(-i*Math.PI/180),d=new bt.default(Math.max(m.x,h.x),Math.max(m.y,h.y)),g=new bt.default(Math.min(m.x,h.x),Math.min(m.y,h.y)),y=d.sub(g),x=(s.width-(l.left+l.right+o.padding.left+o.padding.right))/y.x,v=(s.height-(l.top+l.bottom+o.padding.top+o.padding.bottom))/y.y;if(v<0||x<0){xe("Map cannot fit within canvas with the given bounds, padding, and/or offset.");return}let b=Math.min(s.scaleZoom(s.scale*Math.min(x,v)),o.maxZoom),w=bt.default.convert(o.offset),S=(o.padding.left-o.padding.right)/2,P=(o.padding.top-o.padding.bottom)/2,C=new bt.default(S,P).rotate(i*Math.PI/180),D=w.add(C).mult(s.scale/s.zoomScale(b));return{center:s.unproject(c.add(p).div(2).sub(D)),zoom:b,bearing:i}}fitBounds(e,r,i){return this._fitInternal(this.cameraForBounds(e,r),r,i)}fitScreenCoordinates(e,r,i,o,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(bt.default.convert(e)),this.transform.pointLocation(bt.default.convert(r)),i,o),o,a)}_fitInternal(e,r,i){return e?(r=k(e,r),delete r.padding,r.linear?this.easeTo(r,i):this.flyTo(r,i)):this}jumpTo(e,r){this.stop();let i=this._getTransformForUpdate(),o=!1,a=!1,s=!1;return"zoom"in e&&i.zoom!==+e.zoom&&(o=!0,i.zoom=+e.zoom),e.center!==void 0&&(i.center=Q.convert(e.center)),"bearing"in e&&i.bearing!==+e.bearing&&(a=!0,i.bearing=+e.bearing),"pitch"in e&&i.pitch!==+e.pitch&&(s=!0,i.pitch=+e.pitch),e.padding!=null&&!i.isPaddingEqual(e.padding)&&(i.padding=e.padding),this._applyUpdatedTransform(i),this.fire(new E("movestart",r)).fire(new E("move",r)),o&&this.fire(new E("zoomstart",r)).fire(new E("zoom",r)).fire(new E("zoomend",r)),a&&this.fire(new E("rotatestart",r)).fire(new E("rotate",r)).fire(new E("rotateend",r)),s&&this.fire(new E("pitchstart",r)).fire(new E("pitch",r)).fire(new E("pitchend",r)),this.fire(new E("moveend",r))}calculateCameraOptionsFromTo(e,r,i,o=0){let a=Se.fromLngLat(e,r),s=Se.fromLngLat(i,o),l=s.x-a.x,c=s.y-a.y,p=s.z-a.z,m=Math.hypot(l,c,p);if(m===0)throw new Error("Can't calculate camera options with same From and To");let h=Math.hypot(l,c),d=this.transform.scaleZoom(this.transform.cameraToCenterDistance/m/this.transform.tileSize),g=Math.atan2(l,-c)*180/Math.PI,y=Math.acos(h/m)*180/Math.PI;return y=p<0?90-y:90+y,{center:s.toLngLat(),zoom:d,pitch:y,bearing:g}}easeTo(e,r){this._stop(!1,e.easeId),e=k({offset:[0,0],duration:500,easing:el},e),(e.animate===!1||!e.essential&&ee.prefersReducedMotion)&&(e.duration=0);let i=this._getTransformForUpdate(),o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l=this.getPadding(),c="zoom"in e?+e.zoom:o,p="bearing"in e?this._normalizeBearing(e.bearing,a):a,m="pitch"in e?+e.pitch:s,h="padding"in e?e.padding:i.padding;console.log("aaaa",c),console.log("new zoom",c);let d=bt.default.convert(e.offset),g=i.centerPoint.add(d),y=i.pointLocation(g),x=Q.convert(e.center||y);this._normalizeCenter(x);let v=i.project(y),b=i.project(x).sub(v),w=i.zoomScale(c-o),S,P;e.around&&(S=Q.convert(e.around),P=i.locationPoint(S));let I={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||c!==o,this._rotating=this._rotating||a!==p,this._pitching=this._pitching||m!==s,this._padding=!i.isPaddingEqual(h),this._easeId=e.easeId,this._prepareEase(r,e.noMoveStart,I),this.terrain&&this._prepareElevation(x),this._ease(C=>{if(this._zooming&&(i.zoom=Ae.number(o,c,C)),this._rotating&&(i.bearing=Ae.number(a,p,C)),this._pitching&&(i.pitch=ye(Ae.number(s,m,C),this.transform.minPitch,this.transform.maxPitch)),this._padding&&(i.interpolatePadding(l,h,C),g=i.centerPoint.add(d)),this.terrain&&!e.freezeElevation&&this._updateElevation(C),S)i.setLocationAtPoint(S,P);else{let z=i.zoomScale(i.zoom-o),D=c>o?Math.min(2,w):Math.max(.5,w),A=Math.pow(D,1-C),R=i.unproject(v.add(b.mult(C*A)).mult(z));i.setLocationAtPoint(i.renderWorldCopies?R.wrap():R,g)}this._applyUpdatedTransform(i),this._fireMoveEvents(r)},C=>{this.terrain&&this._finalizeElevation(),this._afterEase(r,C)},e),this}_prepareEase(e,r,i={}){this._moving=!0,!r&&!i.moving&&this.fire(new E("movestart",e)),this._zooming&&!i.zooming&&this.fire(new E("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new E("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new E("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(e,this.terrain),this.transform.freezeElevation=!0}_updateElevation(e){let r=this.transform.getElevation(this._elevationCenter,this.terrain);if(e<1&&r!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,o=(r-(i*e+this._elevationStart))/(1-e);this._elevationStart+=e*(i-o),this._elevationTarget=r}this.transform.elevation=Ae.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(e){if(!this.transformCameraUpdate)return;let r=e.clone(),{center:i,zoom:o,pitch:a,bearing:s,elevation:l}=this.transformCameraUpdate(r);i&&(r.center=i),o!==void 0&&(r.zoom=o),a!==void 0&&(r.pitch=a),s!==void 0&&(r.bearing=s),l!==void 0&&(r.elevation=l),this.transform.apply(r)}_fireMoveEvents(e){this.fire(new E("move",e)),this._zooming&&this.fire(new E("zoom",e)),this._rotating&&this.fire(new E("rotate",e)),this._pitching&&this.fire(new E("pitch",e))}_afterEase(e,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;let i=this._zooming,o=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,i&&this.fire(new E("zoomend",e)),o&&this.fire(new E("rotateend",e)),a&&this.fire(new E("pitchend",e)),this.fire(new E("moveend",e))}flyTo(e,r){if(!e.essential&&ee.prefersReducedMotion){let Z=ht(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Z,r)}this.stop(),e=k({offset:[0,0],speed:1.2,curve:1.42,easing:el},e);let i=this._getTransformForUpdate(),o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l=this.getPadding(),c="zoom"in e?ye(+e.zoom,i.minZoom,i.maxZoom):o,p="bearing"in e?this._normalizeBearing(e.bearing,a):a,m="pitch"in e?+e.pitch:s,h="padding"in e?e.padding:i.padding,d=i.zoomScale(c-o),g=bt.default.convert(e.offset),y=i.centerPoint.add(g),x=i.pointLocation(y),v=Q.convert(e.center||x);this._normalizeCenter(v);let b=i.project(x),w=i.project(v).sub(b),S=e.curve,P=Math.max(i.width,i.height),I=P/d,C=w.mag();if("minZoom"in e){let Z=ye(Math.min(e.minZoom,o,c),i.minZoom,i.maxZoom),ue=P/i.zoomScale(Z-o);S=Math.sqrt(ue/C*2)}let z=S*S;function D(Z){let ue=(I*I-P*P+(Z?-1:1)*z*z*C*C)/(2*(Z?I:P)*z*C);return Math.log(Math.sqrt(ue*ue+1)-ue)}u(D,"zoomOutFactor");function A(Z){return(Math.exp(Z)-Math.exp(-Z))/2}u(A,"sinh");function R(Z){return(Math.exp(Z)+Math.exp(-Z))/2}u(R,"cosh");function U(Z){return A(Z)/R(Z)}u(U,"tanh");let L=D(!1),N=u(function(Z){return R(L)/R(L+S*Z)},"w"),V=u(function(Z){return P*((R(L)*U(L+S*Z)-A(L))/z)/C},"u"),W=(D(!0)-L)/S;if(Math.abs(C)<1e-6||!isFinite(W)){if(Math.abs(P-I)<1e-6)return this.easeTo(e,r);let Z=I<P?-1:1;W=Math.abs(Math.log(I/P))/S,V=u(function(){return 0},"u"),N=u(function(ue){return Math.exp(Z*S*ue)},"w")}if("duration"in e)e.duration=+e.duration;else{let Z="screenSpeed"in e?+e.screenSpeed/S:+e.speed;e.duration=1e3*W/Z}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=a!==p,this._pitching=m!==s,this._padding=!i.isPaddingEqual(h),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(v),this._ease(Z=>{let ue=Z*W,Y=1/N(ue);i.zoom=Z===1?c:o+i.scaleZoom(Y),this._rotating&&(i.bearing=Ae.number(a,p,Z)),this._pitching&&(i.pitch=Ae.number(s,m,Z)),this._padding&&(i.interpolatePadding(l,h,Z),y=i.centerPoint.add(g)),this.terrain&&!e.freezeElevation&&this._updateElevation(Z);let Oe=Z===1?v:i.unproject(b.add(w.mult(V(ue))).mult(Y));i.setLocationAtPoint(i.renderWorldCopies?Oe.wrap():Oe,y),this._applyUpdatedTransform(i),this._fireMoveEvents(r)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(r)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let i=this._onEaseEnd;delete this._onEaseEnd,i.call(this,r)}if(!e){let i=this.handlers;i&&i.stop(!1)}return this}_ease(e,r,i){i.animate===!1||i.duration===0?(e(1),r()):(this._easeStart=ee.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,r){e=St(e,-180,180);let i=Math.abs(e-r);return Math.abs(e-360-r)<i&&(e-=360),Math.abs(e+360-r)<i&&(e+=360),e}_normalizeCenter(e){let r=this.transform;if(!r.renderWorldCopies||r.lngRange)return;let i=e.lng-r.center.lng;e.lng+=i>180?-360:i<-180?360:0}queryTerrainElevation(e){return this.terrain?this.transform.getElevation(Q.convert(e),this.terrain)-this.transform.elevation:null}};u(Km,"Camera");var Ps=Km;var Mt=te(be(),1);f();var $m=class $m{constructor(t={}){this._toggleAttribution=u(()=>{this._container.classList.contains("outdoor-compact")&&(this._container.classList.contains("outdoor-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("outdoor-compact-show")):(this._container.classList.add("outdoor-compact-show"),this._container.removeAttribute("open")))},"_toggleAttribution");this._updateData=u(t=>{t&&(t.sourceDataType==="metadata"||t.sourceDataType==="visibility"||t.dataType==="style"||t.type==="terrain")&&this._updateAttributions()},"_updateData");this._updateCompact=u(()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("outdoor-compact")&&!this._container.classList.contains("outdoor-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("outdoor-compact","outdoor-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("outdoor-compact")&&this._container.classList.remove("outdoor-compact","outdoor-compact-show"))},"_updateCompact");this._updateCompactMinimize=u(()=>{this._container.classList.contains("outdoor-compact")&&this._container.classList.contains("outdoor-compact-show")&&this._container.classList.remove("outdoor-compact-show")},"_updateCompactMinimize");this.options=t,this.position=this.options.position||this.getDefaultPosition()}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=M.create("details","outdoor-ctrl-attrib outdoor-ctrl-attrib-".concat(this.position)),this._compactButton=M.create("summary","outdoor-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=M.create("div","outdoor-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._attributions=[],this._container}onRemove(){M.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){let r=this._map._getUIString("AttributionControl.".concat(e));t.title=r,t.setAttribute("aria-label",r)}get attributions(){return[...this._attributions]}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(i=>typeof i!="string"?"":i)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let e=this._map.style.sourceCaches;for(let i in e){let o=e[i];if(o.used||o.usedForTerrain){let a=o.getSource();a.attribution&&t.indexOf(a.attribution)<0&&t.push(a.attribution)}}t=t.filter(i=>String(i).trim()),t.sort((i,o)=>i.length-o.length),t=t.filter((i,o)=>{for(let a=o+1;a<t.length;a++)if(t[a].indexOf(i)>=0)return!1;return!0}),this._attributions=t;let r=t.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,t.length?(this._innerContainer.innerHTML=r,this._container.classList.remove("outdoor-attrib-empty")):this._container.classList.add("outdoor-attrib-empty"),this._updateCompact(),this._editLink=null)}show(){this._container.classList.remove("outdoor-ctrl-attrib-hide")}hide(){this._container.classList.add("outdoor-ctrl-attrib-hide")}setPosition(t){this._container.classList.remove("outdoor-ctrl-attrib-".concat(this.position)),this.position=t,this._container.classList.add("outdoor-ctrl-attrib-".concat(this.position))}};u($m,"AttributionControl");var ui=$m;f();var Jm=class Jm{constructor(t={}){this._updateCompact=u(()=>{let t=this._container.children;if(t.length){let e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},"_updateCompact");this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=M.create("div","maplibregl-ctrl");let e=M.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){M.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}};u(Jm,"LogoControl");var ci=Jm;f();var Iv=te(be(),1);var Ym=class Ym extends E{constructor(e,r,i,o={}){let a=M.mousePos(r.getCanvasContainer(),i),s=r.unproject(a);super(e,k({point:a,lngLat:s,originalEvent:i},o));this._defaultPrevented=!1,this.target=r}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}};u(Ym,"MapMouseEvent");var pi=Ym;f();var Qm=class Qm{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){let e=this._currentlyRunning,r=e?this._queue.concat(e):this._queue;for(let i of r)if(i.id===t){i.cancelled=!0;return}}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let e=this._currentlyRunning=this._queue;this._queue=[];for(let r of e)if(!r.cancelled&&(r.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};u(Qm,"TaskQueue");var Ts=Qm;f();var As=(r=>(r.create="create",r.load="load",r.fullLoad="fullLoad",r))(As||{}),Is=null,bn=[],Av=60,eh=1e3/Av,th="loadTime",rh="fullLoadTime",er={mark(n){"mark"in performance&&performance.mark(n)},frame(n){let t=n;if(Is!=null){let e=t-Is;bn.push(e)}Is=t},clearMetrics(){Is=null,bn=[],performance.clearMeasures(th),performance.clearMeasures(rh);for(let n in As)performance.clearMarks(As[n])},getPerformanceMetrics(){performance.measure(th,"create","load"),performance.measure(rh,"create","fullLoad");let n=performance.getEntriesByName(th)[0].duration,t=performance.getEntriesByName(rh)[0].duration,e=bn.length,i=1/(bn.reduce((s,l)=>s+l,0)/e/1e3),o=bn.filter(s=>s>eh).reduce((s,l)=>s+(l-eh)/eh,0),a=o/(e+o)*100;return{loadTime:n,fullLoadTime:t,fps:i,percentDroppedFrames:a,totalFrames:e}}};f();var Ox={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};f();f();var Vx=fe([{name:"a_pos3d",type:"Int16",components:3}]);f();var ih=class ih extends se{constructor(e){super();this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,r){this.sourceCache.update(e,r),this._renderableTilesKeys=[];let i={};for(let o of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:r}))i[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.posMatrix=new Float64Array(16),G.ortho(o.posMatrix,0,8192,0,8192,0,1),this._tiles[o.key]=new ni(o,this.tileSize));for(let o in this._tiles)i[o]||delete this._tiles[o]}freeRtt(e){for(let r in this._tiles){let i=this._tiles[r];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let r={};for(let i of this._renderableTilesKeys){let o=this._tiles[i].tileID;if(o.canonical.equals(e.canonical)){let a=e.clone();a.posMatrix=new Float64Array(16),G.ortho(a.posMatrix,0,8192,0,8192,0,1),r[i]=a}else if(o.canonical.isChildOf(e.canonical)){let a=e.clone();a.posMatrix=new Float64Array(16);let s=o.canonical.z-e.canonical.z,l=o.canonical.x-(o.canonical.x>>s<<s),c=o.canonical.y-(o.canonical.y>>s<<s),p=8192>>s;G.ortho(a.posMatrix,0,p,0,p,0,1),G.translate(a.posMatrix,a.posMatrix,[-l*p,-c*p,0]),r[i]=a}else if(e.canonical.isChildOf(o.canonical)){let a=e.clone();a.posMatrix=new Float64Array(16);let s=e.canonical.z-o.canonical.z,l=e.canonical.x-(e.canonical.x>>s<<s),c=e.canonical.y-(e.canonical.y>>s<<s),p=8192>>s;G.ortho(a.posMatrix,0,8192,0,8192,0,1),G.translate(a.posMatrix,a.posMatrix,[l*p,c*p,0]),G.scale(a.posMatrix,a.posMatrix,[1/2**s,1/2**s,0]),r[i]=a}}return r}getSourceTile(e,r){let i=this.sourceCache._source,o=e.overscaledZ-this.deltaZoom;if(o>i.maxzoom&&(o=i.maxzoom),o<i.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(o).key);let a=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if(!(a&&a.dem)&&r)for(;o>=i.minzoom&&!(a&&a.dem);)a=this.sourceCache.getTileByID(e.scaledTo(o--).key);return a}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(r=>r.timeAdded>=e)}};u(ih,"TerrainSourceCache");var Cs=ih;var nh=class nh{constructor(t,e,r){this.painter=t,this.sourceCache=new Cs(e),this.options=r,this.exaggeration=typeof r.exaggeration=="number"?r.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,e,r,i=8192){var d;if(!(e>=0&&e<i&&r>=0&&r<i))return 0;let o=this.getTerrainData(t),a=(d=o.tile)==null?void 0:d.dem;if(!a)return 0;let s=kn.transformMat4([],[e/i*8192,r/i*8192],o.u_terrain_matrix),l=[s[0]*a.dim,s[1]*a.dim],c=Math.floor(l[0]),p=Math.floor(l[1]),m=l[0]-c,h=l[1]-p;return a.get(c,p)*(1-m)*(1-h)+a.get(c+1,p)*m*(1-h)+a.get(c,p+1)*(1-m)*h+a.get(c+1,p+1)*m*h}getElevation(t,e,r,i=8192){return this.getDEMElevation(t,e,r,i)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){let i=this.painter.context,o=new _e({width:1,height:1},new Uint8Array(1*4));this._emptyDepthTexture=new he(i,o,i.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new he(i,new _e({width:1,height:1}),i.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=G.identity([])}let e=this.sourceCache.getSourceTile(t,!0);if(e&&e.dem&&(!e.demTexture||e.needsTerrainPrepare)){let i=this.painter.context;e.demTexture=this.painter.getTileTexture(e.dem.stride),e.demTexture?e.demTexture.update(e.dem.getPixels(),{premultiply:!1}):e.demTexture=new he(i,e.dem.getPixels(),i.gl.RGBA,{premultiply:!1}),e.demTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),e.needsTerrainPrepare=!1}let r=e&&e+e.tileID.key+t.key;if(r&&!this._demMatrixCache[r]){let i=this.sourceCache.sourceCache._source.maxzoom,o=t.canonical.z-e.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=i?o=t.canonical.z-i:xe("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=t.canonical.x-(t.canonical.x>>o<<o),s=t.canonical.y-(t.canonical.y>>o<<o),l=G.fromScaling(new Float64Array(16),[1/(8192<<o),1/(8192<<o),0]);G.translate(l,l,[a*8192,s*8192,0]),this._demMatrixCache[t.key]={matrix:l,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:e&&e.dem&&e.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:e&&e.dem&&e.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(e&&e.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:e}}getFramebuffer(t){let e=this.painter,r=e.width/devicePixelRatio,i=e.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==r||this._fbo.height!==i)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new he(e.context,{width:r,height:i,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new he(e.context,{width:r,height:i,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(r,i,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,r,i))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let e=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let o=0,a=0;o<this._coordsTextureSize;o++)for(let s=0;s<this._coordsTextureSize;s++,a+=4)e[a+0]=s&255,e[a+1]=o&255,e[a+2]=s>>8<<4|o>>8,e[a+3]=0;let r=new _e({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(e.buffer)),i=new he(t,r,t.gl.RGBA,{premultiply:!1});return i.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=i,i}pointCoordinate(t){let e=new Uint8Array(4),r=this.painter.context,i=r.gl;r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),i.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,e),r.bindFramebuffer.set(null);let o=e[0]+(e[2]>>4<<8),a=e[1]+((e[2]&15)<<8),s=this.coordsIndex[255-e[3]],l=s&&this.sourceCache.getTileByID(s);if(!l)return null;let c=this._coordsTextureSize,p=(1<<l.tileID.canonical.z)*c;return new Se((l.tileID.canonical.x*c+o)/p,(l.tileID.canonical.y*c+a)/p,this.getElevation(l.tileID,o,a,c))}getTerrainMesh(){if(this._mesh)return this._mesh;let t=this.painter.context,e=new Qn,r=new qe,i=this.meshSize,o=8192/i,a=i*i;for(let m=0;m<=i;m++)for(let h=0;h<=i;h++)e.emplaceBack(h*o,m*o,0);for(let m=0;m<a;m+=i+1)for(let h=0;h<i;h++)r.emplaceBack(h+m,i+h+m+1,i+h+m+2),r.emplaceBack(h+m,i+h+m+2,h+m+1);let s=e.length,l=s+(i+1)*2;for(let m of[0,1])for(let h=0;h<=i;h++)for(let d of[0,1])e.emplaceBack(h*o,m*8192,d);for(let m=0;m<i*2;m+=2)r.emplaceBack(l+m,l+m+1,l+m+3),r.emplaceBack(l+m,l+m+3,l+m+2),r.emplaceBack(s+m,s+m+3,s+m+1),r.emplaceBack(s+m,s+m+2,s+m+3);let c=e.length,p=c+(i+1)*2;for(let m of[0,1])for(let h=0;h<=i;h++)for(let d of[0,1])e.emplaceBack(m*8192,h*o,d);for(let m=0;m<i*2;m+=2)r.emplaceBack(c+m,c+m+1,c+m+3),r.emplaceBack(c+m,c+m+3,c+m+2),r.emplaceBack(p+m,p+m+3,p+m+1),r.emplaceBack(p+m,p+m+2,p+m+3);return this._mesh={indexBuffer:t.createIndexBuffer(r),vertexBuffer:t.createVertexBuffer(e,Vx.members),segments:ae.simpleSegment(0,0,e.length,r.length)},this._mesh}getMeshFrameDelta(t){return 2*Math.PI*Pr/Math.pow(2,t)/5}getMinMaxElevation(t){let e=this.getTerrainData(t).tile,r={minElevation:null,maxElevation:null};return e&&e.dem&&(r.minElevation=e.dem.min*this.exaggeration,r.maxElevation=e.dem.max*this.exaggeration),r}};u(nh,"Terrain");var Es=nh;f();f();var oh=class oh{constructor(t,e,r){this._context=t;this._size=e;this._tileSize=r;this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){let e=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),r=new he(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return r.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),e.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),e.colorAttachment.set(r.texture),{id:t,fbo:e,texture:r,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(e=>t.id!==e),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(let e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(let t of this._objects)this.freeObject(t)}isFull(){return this._objects.length<this._size?!1:this._objects.some(t=>!t.inUse)===!1}};u(oh,"RenderPool");var Ms=oh;var mi={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0},ah=class ah{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new Ms(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(r=>!t._layers[r].isHidden(e)),this._coordsDescendingInv={};for(let r in t.sourceCaches){this._coordsDescendingInv[r]={};let i=t.sourceCaches[r].getVisibleCoordinates();for(let o of i){let a=this.terrain.sourceCache.getTerrainCoords(o);for(let s in a)this._coordsDescendingInv[r][s]||(this._coordsDescendingInv[r][s]=[]),this._coordsDescendingInv[r][s].push(a[s])}}this._coordsDescendingInvStr={};for(let r of t._order){let i=t._layers[r],o=i.source;if(mi[i.type]&&!this._coordsDescendingInvStr[o]){this._coordsDescendingInvStr[o]={};for(let a in this._coordsDescendingInv[o])this._coordsDescendingInvStr[o][a]=this._coordsDescendingInv[o][a].map(s=>s.key).sort().join()}}for(let r of this._renderableTiles)for(let i in this._coordsDescendingInvStr){let o=this._coordsDescendingInvStr[i][r.tileID.key];o&&o!==r.rttCoords[i]&&(r.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;let e=t.type,r=this.painter,i=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(mi[e]&&((!this._prevType||!mi[this._prevType])&&this._stacks.push([]),this._prevType=e,this._stacks[this._stacks.length-1].push(t.id),!i))return!0;if(mi[this._prevType]||mi[e]&&i){this._prevType=e;let o=this._stacks.length-1,a=this._stacks[o]||[];for(let s of this._renderableTiles){if(this.pool.isFull()&&(Nm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(s),s.rtt[o]){let c=this.pool.getObjectForId(s.rtt[o].id);if(c.stamp===s.rtt[o].stamp){this.pool.useObject(c);continue}}let l=this.pool.getOrCreateFreeObject();this.pool.useObject(l),this.pool.stampObject(l),s.rtt[o]={id:l.id,stamp:l.stamp},r.context.bindFramebuffer.set(l.fbo.framebuffer),r.context.clear({color:me.transparent,stencil:0}),r.currentStencilSource=void 0;for(let c=0;c<a.length;c++){let p=r.style._layers[a[c]],m=p.source?this._coordsDescendingInv[p.source][s.tileID.key]:[s.tileID];r.context.viewport.set([0,0,l.fbo.width,l.fbo.height]),r._renderTileClippingMasks(p,m),r.renderLayer(r,r.style.sourceCaches[p.source],p,m),p.source&&(s.rttCoords[p.source]=this._coordsDescendingInvStr[p.source][s.tileID.key])}}return Nm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),mi[e]}return!1}};u(ah,"RenderToTexture");var Ls=ah;var Cv=zn.version,Ds=-2,Ux=22,tr=0,Nx=90,ks=90,Ev={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:Ds,maxZoom:Ux,minPitch:tr,maxPitch:Nx,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:Ge.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},sh=class sh extends Ps{constructor(e){if(er.mark("create"),e=k({},Ev,e),e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<tr)throw new Error("minPitch must be greater than or equal to ".concat(tr));if(e.maxPitch!=null&&e.maxPitch>ks)throw new Error("maxPitch must be less than or equal to ".concat(ks));let r=new ds(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);super(r,{bearingSnap:e.bearingSnap});this._cooperativeGesturesOnWheel=u(e=>{this._onCooperativeGesture(e,e[this._metaKey],1)},"_cooperativeGesturesOnWheel");this._contextLost=u(e=>{e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new E("webglcontextlost",{originalEvent:e}))},"_contextLost");this._contextRestored=u(e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new E("webglcontextrestored",{originalEvent:e}))},"_contextRestored");this._onMapScroll=u(e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},"_onMapScroll");this._onWindowOnline=u(()=>{this._update()},"_onWindowOnline");if(this._interactive=e.interactive,this._cooperativeGestures=e.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new Ts,this._controls=[],this._mapId=Rn(),this._locale=k({},Ox,e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this._imageQueueHandle=He.addThrottleControl(()=>this.isMoving()),this._requestManager=new Gn(e.transformRequest),this._canvas=e.canvas,this._canvasContainer=e.canvasContainer,typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error("Container '".concat(e.container,"' not found."))}else if(e.container instanceof HTMLElement)this._container=e.container;else throw new Error("Invalid type: 'container' must be a String or HTMLElement.");if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let o=!1;this._resizeObserver=new ResizeObserver(a=>{if(!o){o=!0;return}this._trackResize&&this.resize(a)._update()}),this._resizeObserver.observe(this._container)}this.handlers=new Ss(this,e),this._cooperativeGestures&&this._setupCooperativeGestures();let i=typeof e.hash=="string"&&e.hash||void 0;this._hash=e.hash&&new gs(i).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,k({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new ui({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new ci,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new E("".concat(o.dataType,"data"),o))}),this.on("dataloading",o=>{this.fire(new E("".concat(o.dataType,"dataloading"),o))}),this.on("dataabort",o=>{this.fire(new E("sourcedataabort",o))})}_getMapId(){return this._mapId}addControl(e,r){return r===void 0&&(e.getDefaultPosition?r=e.getDefaultPosition():r="top-right"),!e||!e.onAdd?this.fire(new j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods."))):this}removeControl(e){if(!e||!e.onRemove)return this.fire(new j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,r,i,o){return o==null&&this.terrain&&(o=this.transform.getElevation(i,this.terrain)),super.calculateCameraOptionsFromTo(e,r,i,o)}resize(e){var l;let r=this._containerDimensions(),i=r[0],o=r[1],a=this._getClampedPixelRatio(i,o);if(this.painter.resize(i,o,a),this.painter.overLimit()){let c=this.painter.context.gl;this._maxCanvasSize=[c.drawingBufferWidth,c.drawingBufferHeight];let p=this._getClampedPixelRatio(i,o);this._resizeCanvas(i,o,p),this.painter.resize(i,o,p)}this.transform.resize(i,o),(l=this._requestedCameraState)==null||l.resize(i,o);let s=!this._moving;return s&&(this.stop(),this.fire(new E("movestart",e)).fire(new E("move",e))),this.fire(new E("resize",e)),s&&this.fire(new E("moveend",e)),this}_getClampedPixelRatio(e,r){let{0:i,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),s=e*a,l=r*a,c=s>i?i/s:1,p=l>o?o/l:1;return Math.min(c,p)*a}getPixelRatio(){var e;return(e=this._overridePixelRatio)!=null?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(We.convert(e)),this._update()}setMinZoom(e){if(e=e==null?Ds:e,e>=Ds&&e<=this.transform.maxZoom)return this.transform.minZoom=e,this._update(),this.getZoom()<e&&this.setZoom(e),this;throw new Error("minZoom must be between ".concat(Ds," and the current maxZoom, inclusive"))}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if(e=e==null?Ux:e,e>=this.transform.minZoom)return this.transform.maxZoom=e,this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if(e=e==null?tr:e,e<tr)throw new Error("minPitch must be greater than or equal to ".concat(tr));if(e>=tr&&e<=this.transform.maxPitch)return this.transform.minPitch=e,this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error("minPitch must be between ".concat(tr," and the current maxPitch, inclusive"))}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if(e=e==null?Nx:e,e>ks)throw new Error("maxPitch must be less than or equal to ".concat(ks));if(e>=this.transform.minPitch)return this.transform.maxPitch=e,this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(e){return this._cooperativeGestures=e,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(e){return this.transform.locationPoint(Q.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.pointLocation(Mt.default.convert(e),this.terrain)}isMoving(){var e;return this._moving||((e=this.handlers)==null?void 0:e.isMoving())}isZooming(){return this._zooming||!1}isRotating(){var e;return this._rotating||((e=this.handlers)==null?void 0:e.isRotating())}_createDelegatedListener(e,r,i){if(e==="mouseenter"||e==="mouseover"){let o=!1;return{layer:r,listener:i,delegates:{mousemove:u(l=>{let c=this.getLayer(r)?this.queryRenderedFeatures(l.point,{layers:[r]}):[];c.length?o||(o=!0,i.call(this,new pi(e,this,l.originalEvent,{features:c}))):o=!1},"mousemove"),mouseout:u(()=>{o=!1},"mouseout")}}}else if(e==="mouseleave"||e==="mouseout"){let o=!1;return{layer:r,listener:i,delegates:{mousemove:u(l=>{(this.getLayer(r)?this.queryRenderedFeatures(l.point,{layers:[r]}):[]).length?o=!0:o&&(o=!1,i.call(this,new pi(e,this,l.originalEvent)))},"mousemove"),mouseout:u(l=>{o&&(o=!1,i.call(this,new pi(e,this,l.originalEvent)))},"mouseout")}}}else{let o=u(a=>{let s=this.getLayer(r)?this.queryRenderedFeatures(a.point,{layers:[r]}):[];s.length&&(a.features=s,i.call(this,a),delete a.features)},"delegate");return{layer:r,listener:i,delegates:{[e]:o}}}}on(e,r,i){if(i===void 0)return super.on(e,r);let o=this._createDelegatedListener(e,r,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(o);for(let a in o.delegates)this.on(a,o.delegates[a]);return this}once(e,r,i){if(i===void 0)return super.once(e,r);let o=this._createDelegatedListener(e,r,i);for(let a in o.delegates)this.once(a,o.delegates[a]);return this}off(e,r,i){if(i===void 0)return super.off(e,r);let o=u(a=>{let s=a[e];for(let l=0;l<s.length;l++){let c=s[l];if(c.layer===r&&c.listener===i){for(let p in c.delegates)this.off(p,c.delegates[p]);return s.splice(l,1),this}}},"removeDelegatedListener");return this._delegatedListeners&&this._delegatedListeners[e]&&o(this._delegatedListeners),this}queryRenderedFeatures(e,r){if(!this.style)return[];let i,o=e instanceof Mt.default||Array.isArray(e),a=o?e:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(o?{}:e)||{},a instanceof Mt.default||typeof a[0]=="number")i=[Mt.default.convert(a)];else{let s=Mt.default.convert(a[0]),l=Mt.default.convert(a[1]);i=[s,new Mt.default(l.x,s.y),l,new Mt.default(s.x,l.y),s]}return this.style.queryRenderedFeatures(i,r,this.transform)}querySourceFeatures(e,r){return this.style.querySourceFeatures(e,r)}setStyle(e,r){return r=k({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r),r.diff!==!1&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(e,r))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let r=this._locale[e];if(r==null)throw new Error("Missing UI string '".concat(e,"'"));return r}_updateStyle(e,r){if(r.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,r));return}let i=this.style&&r.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new Qt(this,r||{});else return delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e,r,i):this.style.loadJSON(e,r,i),this}_lazyInitEmptyStyle(){this.style||(this.style=new Qt(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,r){if(typeof e=="string"){let i=e,o=this._requestManager.transformRequest(i,"Style");Bt(o,(a,s)=>{a?this.fire(new j(a)):s&&this._updateDiff(s,r)})}else typeof e=="object"&&this._updateDiff(e,r)}_updateDiff(e,r){try{this.style.setState(e,r)&&this._update(!0)}catch(i){xe("Unable to perform style diff: ".concat(i.message||i.error||i,". Rebuilding the style from scratch.")),this._updateStyle(e,r)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():xe("There is no style added to the map.")}addSource(e,r){return this._lazyInitEmptyStyle(),this.style.addSource(e,r),this._update(!0)}isSourceLoaded(e){let r=this.style&&this.style.sourceCaches[e];if(r===void 0){this.fire(new j(new Error("There is no source with ID '".concat(e,"'"))));return}return r.loaded()}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!e)this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.updateElevation(this.terrain);else{let r=this.style.sourceCaches[e.source];if(!r)throw new Error("cannot load terrain, because there exists no source with ID: ".concat(e.source));for(let i in this.style._layers){let o=this.style._layers[i];o.type==="hillshade"&&o.source===e.source&&xe("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Es(this.painter,r,e),this.painter.renderToTexture=new Ls(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=i=>{i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId===e.source&&this.transform.updateElevation(this.terrain),this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}return this.fire(new E("terrain",{terrain:e})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){let e=this.style&&this.style.sourceCaches;for(let r in e){let o=e[r]._tiles;for(let a in o){let s=o[a];if(!(s.state==="loaded"||s.state==="errored"))return!1}}return!0}addSourceType(e,r,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(e,r,i)}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}addImage(e,r,i={}){let{pixelRatio:o=1,sdf:a=!1,stretchX:s,stretchY:l,content:c}=i;this._lazyInitEmptyStyle();let p=0;if(r instanceof HTMLImageElement||ct(r)){let{width:m,height:h,data:d}=ee.getImageData(r);this.style.addImage(e,{data:new _e({width:m,height:h},d),pixelRatio:o,stretchX:s,stretchY:l,content:c,sdf:a,version:p})}else{if(r.width===void 0||r.height===void 0)return this.fire(new j(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`")));{let{width:m,height:h,data:d}=r,g=r;return this.style.addImage(e,{data:new _e({width:m,height:h},new Uint8Array(d)),pixelRatio:o,stretchX:s,stretchY:l,content:c,sdf:a,version:p,userImage:g}),g.onAdd&&g.onAdd(this,e),this}}}updateImage(e,r){let i=this.style.getImage(e);if(!i)return this.fire(new j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let o=r instanceof HTMLImageElement||ct(r)?ee.getImageData(r):r,{width:a,height:s,data:l}=o;if(a===void 0||s===void 0)return this.fire(new j(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(a!==i.data.width||s!==i.data.height)return this.fire(new j(new Error("The width and height of the updated image must be that same as the previous version of the image")));let c=!(r instanceof HTMLImageElement||ct(r));return i.data.replace(l,c),this.style.updateImage(e,i),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new j(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e,r){He.getImage(this._requestManager.transformRequest(e,"Image"),r)}listImages(){return this.style.listImages()}addLayer(e,r){return this._lazyInitEmptyStyle(),this.style.addLayer(e,r),this._update(!0)}moveLayer(e,r){return this.style.moveLayer(e,r),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}setLayerZoomRange(e,r,i){return this.style.setLayerZoomRange(e,r,i),this._update(!0)}setFilter(e,r,i={}){return this.style.setFilter(e,r,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,r,i,o={}){return this.style.setPaintProperty(e,r,i,o),this._update(!0)}getPaintProperty(e,r){return this.style.getPaintProperty(e,r)}setLayoutProperty(e,r,i,o={}){return this.style.setLayoutProperty(e,r,i,o),this._update(!0)}getLayoutProperty(e,r){return this.style.getLayoutProperty(e,r)}setGlyphs(e,r={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,r),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,r,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,r,i,o=>{o||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,r={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,r,i=>{i||this._update(!0)}),this}setLight(e,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,r),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(e,r){return this.style.setFeatureState(e,r),this._update()}removeFeatureState(e,r){return this.style.removeFeatureState(e,r),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,r=0;return this._container&&(e=this._container.clientWidth||400,r=this._container.clientHeight||300),[e,r]}_setupContainer(){let e=this._container,r=this._containerDimensions(),i=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],i)}_setupCooperativeGestures(){let e=this._container;this._cooperativeGesturesScreen=M.create("div","maplibregl-cooperative-gesture-screen",e);let r=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(r=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map");let i=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map";this._cooperativeGesturesScreen.innerHTML='\n <div class="maplibregl-desktop-message">'.concat(r,'</div>\n <div class="maplibregl-mobile-message">').concat(i,"</div>\n "),this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){M.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(e,r,i){}_setupPainter(){let e={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},r=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{r={requestedAttributes:e},o&&(r.statusMessage=o.statusMessage,r.type=o.type)},{once:!0});let i=this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e);if(!i){let o="Failed to initialize WebGL";throw r?(r.message=o,new Error(JSON.stringify(r))):new Error(o)}this.painter=new us(i,this.transform),_i.testSupport(i)}_onCooperativeGesture(e,r,i){return!r&&i<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return!this.style||!this.style._loaded?this:(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this)}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){let r=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let i=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let a=this.transform.zoom,s=ee.now();this.style.zoomHistory.update(a,s);let l=new le(a,{now:s,fadeDuration:r,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),c=l.crossFadingFactor();(c!==1||c!==this._crossFadingFactor)&&(i=!0,this._crossFadingFactor=c),this.style.update(l)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.updateElevation(this.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,r,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:!1,zooming:!1,moving:!1,fadeDuration:r,showPadding:this.showPadding}),this.fire(new E("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,er.mark("load"),this.fire(new E("load"))),this.style&&(this.style.hasTransitions()||i)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new E("idle")),this._loaded&&!this._fullyLoaded&&!o&&(this._fullyLoaded=!0,er.mark("fullLoad")),this._fullyLoaded=!0,this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var r;this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),He.removeThrottleControl(this._imageQueueHandle),(r=this._resizeObserver)==null||r.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),M.remove(this._canvasContainer),M.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),er.clearMetrics(),this._removed=!0,this.fire(new E("remove"))}triggerRepaintSync(){this._render(performance.now())}triggerRepaint(){this.style&&!this._frame&&(this._frame=ee.frame(e=>{er.frame(e),this._frame=null,this._render(e)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return Cv}getCameraTargetElevation(){return this.transform.elevation}};u(sh,"Map");var Fs=sh;f();f();f();var lh=class lh{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){let e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){!this.isEnabled()||this._lastPoint||this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=e.length?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t)){this.reset(t);return}let i=e.length?e[0]:e;if(!(!this._moved&&i.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(r,i)}dragEnd(t){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(t)&&(this._moved&&M.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};u(lh,"DragHandler");var rr=lh;f();var Mv=0,Lv=2,kv={[Mv]:1,[Lv]:2};function Dv(n,t){let e=kv[t];return n.buttons===void 0||(n.buttons&e)!==e}u(Dv,"buttonNoLongerPressed");var uh=class uh{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){let e=M.mouseButton(t);this._eventButton=e}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!Dv(t,this._eventButton)}isValidEndEvent(t){return M.mouseButton(t)===this._eventButton}};u(uh,"MouseMoveStateManager");var vn=uh,ch=class ch{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){let e=t.targetTouches[0].identifier;this._firstTouch=e}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}};u(ch,"OneFingerTouchMoveStateManager");var wn=ch;var Gx=0,qx=2,jx=u(n=>{n.mousedown=n.dragStart,n.mousemoveWindow=n.dragMove,n.mouseup=n.dragEnd,n.contextmenu=function(t){t.preventDefault()}},"assignEvents");var Hx=u(({enable:n,clickTolerance:t,bearingDegreesPerPixelMoved:e=.8})=>{let r=new vn({checkCorrectEvent:i=>M.mouseButton(i)===Gx&&i.ctrlKey||M.mouseButton(i)===qx});return new rr({clickTolerance:t,move:(i,o)=>({bearingDelta:(o.x-i.x)*e}),moveStateManager:r,enable:n,assignEvents:jx})},"generateMouseRotationHandler"),Zx=u(({enable:n,clickTolerance:t,pitchDegreesPerPixelMoved:e=-.5})=>{let r=new vn({checkCorrectEvent:i=>M.mouseButton(i)===Gx&&i.ctrlKey||M.mouseButton(i)===qx});return new rr({clickTolerance:t,move:(i,o)=>({pitchDelta:(o.y-i.y)*e}),moveStateManager:r,enable:n,assignEvents:jx})},"generateMousePitchHandler");f();var Wx=u(n=>{n.touchstart=n.dragStart,n.touchmoveWindow=n.dragMove,n.touchend=n.dragEnd},"assignEvents"),Xx=u(({enable:n,clickTolerance:t,bearingDegreesPerPixelMoved:e=.8})=>{let r=new wn;return new rr({clickTolerance:t,move:(i,o)=>({bearingDelta:(o.x-i.x)*e}),moveStateManager:r,enable:n,assignEvents:Wx})},"generateOneFingerTouchRotationHandler"),Kx=u(({enable:n,clickTolerance:t,pitchDegreesPerPixelMoved:e=-.5})=>{let r=new wn;return new rr({clickTolerance:t,move:(i,o)=>({pitchDelta:(o.y-i.y)*e}),moveStateManager:r,enable:n,assignEvents:Wx})},"generateOneFingerTouchPitchHandler");var Fv={showCompass:!0,showZoom:!0,visualizePitch:!1},mh=class mh{constructor(t){this._updateZoomButtons=u(()=>{let t=this._map.getZoom(),e=t===this._map.getMaxZoom(),r=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())},"_updateZoomButtons");this._rotateCompassArrow=u(()=>{let t=this.options.visualizePitch?"scale(".concat(1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5),") rotateX(").concat(this._map.transform.pitch,"deg) rotateZ(").concat(this._map.transform.angle*(180/Math.PI),"deg)"):"rotate(".concat(this._map.transform.angle*(180/Math.PI),"deg)");this._compassIcon.style.transform=t},"_rotateCompassArrow");this._setButtonTitle=u((t,e)=>{let r=this._map._getUIString("NavigationControl.".concat(e));t.title=r,t.setAttribute("aria-label",r)},"_setButtonTitle");this.options=k({},Fv,t),this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),M.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),M.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=M.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ph(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){M.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){let r=M.create("button",t,this._container);return r.type="button",r.addEventListener("click",e),r}};u(mh,"NavigationControl");var zs=mh,hh=class hh{constructor(t,e,r=!1){this.mousedown=u(t=>{this.startMouse(k({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),M.mousePos(this.element,t)),M.addEventListener(window,"mousemove",this.mousemove),M.addEventListener(window,"mouseup",this.mouseup)},"mousedown");this.mousemove=u(t=>{this.moveMouse(t,M.mousePos(this.element,t))},"mousemove");this.mouseup=u(t=>{this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()},"mouseup");this.touchstart=u(t=>{t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=M.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),M.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.addEventListener(window,"touchend",this.touchend))},"touchstart");this.touchmove=u(t=>{t.targetTouches.length!==1?this.reset():(this._lastPos=M.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))},"touchmove");this.touchend=u(t=>{t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},"touchend");this.reset=u(()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},"reset");this._clickTolerance=10;let i=t.dragRotate._mouseRotate.getClickTolerance(),o=t.dragRotate._mousePitch.getClickTolerance();this.element=e,this.mouseRotate=Hx({clickTolerance:i,enable:!0}),this.touchRotate=Xx({clickTolerance:i,enable:!0}),this.map=t,r&&(this.mousePitch=Zx({clickTolerance:o,enable:!0}),this.touchPitch=Kx({clickTolerance:o,enable:!0})),M.addEventListener(e,"mousedown",this.mousedown),M.addEventListener(e,"touchstart",this.touchstart,{passive:!1}),M.addEventListener(e,"touchcancel",this.reset)}startMouse(t,e){this.mouseRotate.dragStart(t,e),this.mousePitch&&this.mousePitch.dragStart(t,e),M.disableDrag()}startTouch(t,e){this.touchRotate.dragStart(t,e),this.touchPitch&&this.touchPitch.dragStart(t,e),M.disableDrag()}moveMouse(t,e){let r=this.map,{bearingDelta:i}=this.mouseRotate.dragMove(t,e)||{};if(i&&r.setBearing(r.getBearing()+i),this.mousePitch){let{pitchDelta:o}=this.mousePitch.dragMove(t,e)||{};o&&r.setPitch(r.getPitch()+o)}}moveTouch(t,e){let r=this.map,{bearingDelta:i}=this.touchRotate.dragMove(t,e)||{};if(i&&r.setBearing(r.getBearing()+i),this.touchPitch){let{pitchDelta:o}=this.touchPitch.dragMove(t,e)||{};o&&r.setPitch(r.getPitch()+o)}}off(){let t=this.element;M.removeEventListener(t,"mousedown",this.mousedown),M.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),M.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.removeEventListener(window,"touchend",this.touchend),M.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){M.enableDrag(),M.removeEventListener(window,"mousemove",this.mousemove),M.removeEventListener(window,"mouseup",this.mouseup),M.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.removeEventListener(window,"touchend",this.touchend)}};u(hh,"MouseRotateWrapper");var ph=hh;f();f();var ir;function $x(n,t=!1){ir!==void 0&&!t?n(ir):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(e=>{ir=e.state!=="denied",n(ir)}).catch(()=>{ir=!!window.navigator.geolocation,n(ir)}):(ir=!!window.navigator.geolocation,n(ir))}u($x,"checkGeolocationSupport");f();var Os=te(be(),1);f();function Bs(n,t,e){if(n=new Q(n.lng,n.lat),t){let r=new Q(n.lng-360,n.lat),i=new Q(n.lng+360,n.lat),o=e.locationPoint(n).distSqr(t);e.locationPoint(r).distSqr(t)<o?n=r:e.locationPoint(i).distSqr(t)<o&&(n=i)}for(;Math.abs(n.lng-e.center.lng)>180;){let r=e.locationPoint(n);if(r.x>=0&&r.y>=0&&r.x<=e.width&&r.y<=e.height)break;n.lng>e.center.lng?n.lng-=360:n.lng+=360}return n}u(Bs,"smartWrap");f();var Sn={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Rs(n,t,e){let r=n.classList;for(let i in Sn)r.remove("maplibregl-".concat(e,"-anchor-").concat(i));r.add("maplibregl-".concat(e,"-anchor-").concat(t))}u(Rs,"applyAnchorClass");var fh=class fh extends se{constructor(e){super();this._onKeyPress=u(e=>{let r=e.code,i=e.charCode||e.keyCode;(r==="Space"||r==="Enter"||i===32||i===13)&&this.togglePopup()},"_onKeyPress");this._onMapClick=u(e=>{let r=e.originalEvent.target,i=this._element;this._popup&&(r===i||i.contains(r))&&this.togglePopup()},"_onMapClick");this._update=u(e=>{if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Bs(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let r="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?r="rotateZ(".concat(this._rotation,"deg)"):this._rotationAlignment==="map"&&(r="rotateZ(".concat(this._rotation-this._map.getBearing(),"deg)"));let i="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?i="rotateX(0deg)":this._pitchAlignment==="map"&&(i="rotateX(".concat(this._map.getPitch(),"deg)")),(!e||e.type==="moveend")&&(this._pos=this._pos.round()),M.setTransform(this._element,"".concat(Sn[this._anchor]," translate(").concat(this._pos.x,"px, ").concat(this._pos.y,"px) ").concat(i," ").concat(r)),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{let o=this._map.unproject(this._pos),a=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=o.distanceTo(this._lngLat)>a*20?"0.2":"1.0",this._opacityTimeout=null},100))},"_update");this._onMove=u(e=>{if(!this._isDragging){let r=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=r}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new E("dragstart"))),this.fire(new E("drag")))},"_onMove");this._onUp=u(()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new E("dragend")),this._state="inactive"},"_onUp");this._addDragHandler=u(e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},"_addDragHandler");if(this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,!e||!e.element){this._defaultMarker=!0,this._element=M.create("div"),this._element.setAttribute("aria-label","Map marker");let r=M.createNS("http://www.w3.org/2000/svg","svg"),i=41,o=27;r.setAttributeNS(null,"display","block"),r.setAttributeNS(null,"height","".concat(i,"px")),r.setAttributeNS(null,"width","".concat(o,"px")),r.setAttributeNS(null,"viewBox","0 0 ".concat(o," ").concat(i));let a=M.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");let s=M.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");let l=M.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");let c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let b of c){let w=M.createNS("http://www.w3.org/2000/svg","ellipse");w.setAttributeNS(null,"opacity","0.04"),w.setAttributeNS(null,"cx","10.5"),w.setAttributeNS(null,"cy","5.80029008"),w.setAttributeNS(null,"rx",b.rx),w.setAttributeNS(null,"ry",b.ry),l.appendChild(w)}let p=M.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"fill",this._color);let m=M.createNS("http://www.w3.org/2000/svg","path");m.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),p.appendChild(m);let h=M.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"opacity","0.25"),h.setAttributeNS(null,"fill","#000000");let d=M.createNS("http://www.w3.org/2000/svg","path");d.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),h.appendChild(d);let g=M.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(6.0, 7.0)"),g.setAttributeNS(null,"fill","#FFFFFF");let y=M.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(8.0, 8.0)");let x=M.createNS("http://www.w3.org/2000/svg","circle");x.setAttributeNS(null,"fill","#000000"),x.setAttributeNS(null,"opacity","0.25"),x.setAttributeNS(null,"cx","5.5"),x.setAttributeNS(null,"cy","5.5"),x.setAttributeNS(null,"r","5.4999962");let v=M.createNS("http://www.w3.org/2000/svg","circle");v.setAttributeNS(null,"fill","#FFFFFF"),v.setAttributeNS(null,"cx","5.5"),v.setAttributeNS(null,"cy","5.5"),v.setAttributeNS(null,"r","5.4999962"),y.appendChild(x),y.appendChild(v),s.appendChild(l),s.appendChild(p),s.appendChild(h),s.appendChild(g),s.appendChild(y),r.appendChild(s),r.setAttributeNS(null,"height","".concat(i*this._scale,"px")),r.setAttributeNS(null,"width","".concat(o*this._scale,"px")),this._element.appendChild(r),this._offset=Os.default.convert(e&&e.offset||[0,-14])}else this._element=e.element,this._offset=Os.default.convert(e&&e.offset||[0,0]);if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",r=>{r.preventDefault()}),this._element.addEventListener("mousedown",r=>{r.preventDefault()}),Rs(this._element,this._anchor,"marker"),e&&e.className)for(let r of e.className.split(" "))this._element.classList.add(r);this._popup=null}addTo(e){return this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),M.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let o=Math.sqrt(Math.pow(13.5,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,(38.1-13.5+o)*-1],"bottom-right":[-o,(38.1-13.5+o)*-1],left:[13.5,(38.1-13.5)*-1],right:[-13.5,(38.1-13.5)*-1]}:this._offset}this._popup=e,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){let e=this._popup;if(e)e.isOpen()?e.remove():e.addTo(this._map);else return this;return this}getOffset(){return this._offset}setOffset(e){return this._offset=Os.default.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}};u(fh,"Marker");var Er=fh;var zv={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Vs=0,Pn=!1,dh=class dh extends se{constructor(e){super();this._onSuccess=u(e=>{if(this._map){if(this._isOutOfMapMaxBounds(e)){this._setErrorState(),this.fire(new E("outofmaxbounds",e)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new E("geolocate",e)),this._finish()}},"_onSuccess");this._updateCamera=u(e=>{let r=new Q(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,o=this._map.getBearing(),a=k({bearing:o},this.options.fitBoundsOptions),s=We.fromLngLat(r,i);this._map.fitBounds(s,a,{geolocateSource:!0})},"_updateCamera");this._updateMarker=u(e=>{if(e){let r=new Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},"_updateMarker");this._onZoom=u(()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},"_onZoom");this._onError=u(e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&Pn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new E("error",e)),this._finish()}},"_onError");this._finish=u(()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},"_finish");this._setupUI=u(e=>{if(this._map){if(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=M.create("button","maplibregl-ctrl-geolocate",this._container),M.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",e===!1){xe("Geolocation support is not available so the GeolocateControl will be disabled.");let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r)}else{let r=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=M.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Er({element:this._dotElement}),this._circleElement=M.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Er({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=>{let i=r.originalEvent&&r.originalEvent.type==="resize";!r.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!i&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new E("trackuserlocationend")))})}},"_setupUI");this.options=k({},zv,e)}onAdd(e){return this._map=e,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),$x(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),M.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Vs=0,Pn=!1}_isOutOfMapMaxBounds(e){let r=this._map.getMaxBounds(),i=e.coords;return r&&(i.longitude<r.getWest()||i.longitude>r.getEast()||i.latitude<r.getSouth()||i.latitude>r.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}}_updateCircleRadius(){let e=this._map.getBounds(),r=e.getSouthEast(),i=e.getNorthEast(),o=r.distanceTo(i),a=this._map._container.clientHeight,s=Math.ceil(2*(this._accuracy/(o/a)));this._circleElement.style.width="".concat(s,"px"),this._circleElement.style.height="".concat(s,"px")}trigger(){if(!this._setup)return xe("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new E("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Vs--,Pn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new E("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new E("trackuserlocationstart"));break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Vs++;let e;Vs>1?(e={maximumAge:6e5,timeout:0},Pn=!0):(e=this.options.positionOptions,Pn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}};u(dh,"GeolocateControl");var Us=dh;f();var Bv={maxWidth:100,unit:"metric"},yh=class yh{constructor(t){this._onMove=u(()=>{Jx(this._map,this._container,this.options)},"_onMove");this.setUnit=u(t=>{this.options.unit=t,Jx(this._map,this._container,this.options)},"setUnit");this.options=k({},Bv,t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){M.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}};u(yh,"ScaleControl");var Ns=yh;function Jx(n,t,e){let r=e&&e.maxWidth||100,i=n._container.clientHeight/2,o=n.unproject([0,i]),a=n.unproject([r,i]),s=o.distanceTo(a);if(e&&e.unit==="imperial"){let l=3.2808*s;if(l>5280){let c=l/5280;Tn(t,r,c,n._getUIString("ScaleControl.Miles"))}else Tn(t,r,l,n._getUIString("ScaleControl.Feet"))}else if(e&&e.unit==="nautical"){let l=s/1852;Tn(t,r,l,n._getUIString("ScaleControl.NauticalMiles"))}else s>=1e3?Tn(t,r,s/1e3,n._getUIString("ScaleControl.Kilometers")):Tn(t,r,s,n._getUIString("ScaleControl.Meters"))}u(Jx,"updateScale");function Tn(n,t,e,r){let i=Ov(e),o=i/e;n.style.width="".concat(t*o,"px"),n.innerHTML="".concat(i," ").concat(r)}u(Tn,"setScale");function Rv(n){let t=Math.pow(10,Math.ceil(-Math.log(n)/Math.LN10));return Math.round(n*t)/t}u(Rv,"getDecimalRoundNum");function Ov(n){let t=Math.pow(10,"".concat(Math.floor(n)).length-1),e=n/t;return e=e>=10?10:e>=5?5:e>=3?3:e>=2?2:e>=1?1:Rv(e),t*e}u(Ov,"getRoundNum");f();var gh=class gh extends se{constructor(e={}){super();this._onFullscreenChange=u(()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},"_onFullscreenChange");this._onClickFullscreen=u(()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},"_onClickFullscreen");this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:xe("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){M.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=M.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);M.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new E("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new E("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}};u(gh,"FullscreenControl");var Gs=gh;f();var xh=class xh{constructor(t){this._toggleTerrain=u(()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},"_toggleTerrain");this._updateTerrainIcon=u(()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},"_updateTerrainIcon");this.options=t}onAdd(t){return this._map=t,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=M.create("button","maplibregl-ctrl-terrain",this._container),M.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){M.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}};u(xh,"TerrainControl");var qs=xh;f();var ke=te(be(),1);var Vv={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Uv=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),_h=class _h extends se{constructor(e){super();this.remove=u(()=>(this._content&&M.remove(this._content),this._container&&(M.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new E("close")),this),"remove");this._onMouseUp=u(e=>{this._update(e.point)},"_onMouseUp");this._onMouseMove=u(e=>{this._update(e.point)},"_onMouseMove");this._onDrag=u(e=>{this._update(e.point)},"_onDrag");this._update=u(e=>{let r=this._lngLat||this._trackPointer;if(!this._map||!r||!this._content)return;if(!this._container){if(this._container=M.create("div","maplibregl-popup",this._map.getContainer()),this._tip=M.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let l of this.options.className.split(" "))this._container.classList.add(l);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Bs(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!e)return;let i=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),o=this.options.anchor,a=Yx(this.options.offset);if(!o){let l=this._container.offsetWidth,c=this._container.offsetHeight,p;i.y+a.bottom.y<c?p=["top"]:i.y>this._map.transform.height-c?p=["bottom"]:p=[],i.x<l/2?p.push("left"):i.x>this._map.transform.width-l/2&&p.push("right"),p.length===0?o="bottom":o=p.join("-")}let s=i.add(a[o]).round();M.setTransform(this._container,"".concat(Sn[o]," translate(").concat(s.x,"px,").concat(s.y,"px)")),Rs(this._container,o,"popup")},"_update");this._onClose=u(()=>{this.remove()},"_onClose");this.options=k(Object.create(Vv),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new E("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=Q.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let r=document.createDocumentFragment(),i=document.createElement("body"),o;for(i.innerHTML=e;o=i.firstChild,!!o;)r.appendChild(o);return this.setDOMContent(r)}getMaxWidth(){var e;return(e=this._container)==null?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=M.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){this._container&&this._container.classList.add(e)}removeClassName(e){this._container&&this._container.classList.remove(e)}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}_createCloseButton(){this.options.closeButton&&(this._closeButton=M.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(Uv);e&&e.focus()}};u(_h,"Popup");var js=_h;function Yx(n){if(n)if(typeof n=="number"){let t=Math.round(Math.sqrt(.5*Math.pow(n,2)));return{center:new ke.default(0,0),top:new ke.default(0,n),"top-left":new ke.default(t,t),"top-right":new ke.default(-t,t),bottom:new ke.default(0,-n),"bottom-left":new ke.default(t,-t),"bottom-right":new ke.default(-t,-t),left:new ke.default(n,0),right:new ke.default(-n,0)}}else if(n instanceof ke.default||Array.isArray(n)){let t=ke.default.convert(n);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}else return{center:ke.default.convert(n.center||[0,0]),top:ke.default.convert(n.top||[0,0]),"top-left":ke.default.convert(n["top-left"]||[0,0]),"top-right":ke.default.convert(n["top-right"]||[0,0]),bottom:ke.default.convert(n.bottom||[0,0]),"bottom-left":ke.default.convert(n["bottom-left"]||[0,0]),"bottom-right":ke.default.convert(n["bottom-right"]||[0,0]),left:ke.default.convert(n.left||[0,0]),right:ke.default.convert(n.right||[0,0])};else return Yx(new ke.default(0,0))}u(Yx,"normalizeOffset");var e_=te(be(),1);f();var Qx={extend(n,...t){return k(n,...t)},run(n){n()},logToElement(n,t=!1,e="log"){let r=window.document.getElementById(e);r&&(t&&(r.innerHTML=""),r.innerHTML+="<br>".concat(n))}};var Nv=zn.version,de=class de{static get version(){return Nv}static get workerCount(){return Yt.workerCount}static set workerCount(t){Yt.workerCount=t}static get maxParallelImageRequests(){return Ge.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(t){Ge.MAX_PARALLEL_IMAGE_REQUESTS=t}static get workerUrl(){return Ge.WORKER_URL}static set workerUrl(t){console.log("setting worker url",t),Ge.WORKER_URL=t}static addProtocol(t,e){Ge.REGISTERED_PROTOCOLS[t]=e}static removeProtocol(t){delete Ge.REGISTERED_PROTOCOLS[t]}};u(de,"MapLibreGL"),de.Map=Fs,de.NavigationControl=zs,de.GeolocateControl=Us,de.AttributionControl=ui,de.LogoControl=ci,de.ScaleControl=Ns,de.FullscreenControl=Gs,de.TerrainControl=qs,de.Popup=js,de.Marker=Er,de.Style=Qt,de.LngLat=Q,de.LngLatBounds=We,de.Point=e_.default,de.MercatorCoordinate=Se,de.Evented=se,de.AJAXError=zt,de.config=Ge,de.CanvasSource=ri,de.GeoJSONSource=ei,de.ImageSource=at,de.RasterDEMTileSource=Qr,de.RasterTileSource=$t,de.VectorTileSource=$r,de.VideoSource=ti,de.setRTLTextPlugin=xf,de.getRTLTextPluginStatus=bi,de.prewarm=iy,de.clearPrewarmedResources=ny;var Hs=de;Qx.extend(Hs,{isSafari:ar,getPerformanceMetrics:er.getPerformanceMetrics});var DH=Hs;export{DH as default};
|
|
1
|
+
import{A as Lh,B as kh,C as yi,D as Dh,E as Fh,F as zh,G as $s,H as Js,I as G,J as ut,K as Re,L as kn,M as Bh,N as Rh,O as Dn,P as Oh,Q as Fn,R as Vh,S as Uh,T as Nh,a as be,b as l_,c as T,d as Xs,e as Ks,f as bh,g as Ft,h as vh,i as wh,j as Sh,k as me,l as fi,m as di,n as Ph,o as Th,p as Ih,q as Ah,r as Ae,s as Ch,t as Eh,u as An,v as Cn,w as En,x as Mh,y as Mn,z as Ln}from"./chunk-CW6OSHJQ.js";import{a as f}from"./chunk-PEJPQGCC.js";import{a as u,e as te}from"./chunk-J5IUISYU.js";f();var zn={name:"@packages/outdoor-context",private:!0,description:"BSD licensed community fork of mapbox-gl, a WebGL interactive maps library",version:"3.2.0",main:"dist/maplibre-gl.js",style:"dist/maplibre-gl.css",license:"BSD-3-Clause",funding:"https://github.com/maplibre/maplibre-gl-js?sponsor=1",repository:{type:"git",url:"git://github.com/maplibre/maplibre-gl-js.git"},types:"dist/maplibre-gl.d.ts",type:"module",dependencies:{"@mapbox/geojson-rewind":"^0.5.2","@mapbox/jsonlint-lines-primitives":"^2.0.2","@mapbox/point-geometry":"^0.1.0","@mapbox/tiny-sdf":"^2.0.6","@mapbox/unitbezier":"^0.0.1","@mapbox/vector-tile":"^1.3.1","@mapbox/whoots-js":"^3.1.0","@maplibre/maplibre-gl-style-spec":"^19.2.2","@types/geojson":"^7946.0.10","@types/mapbox__point-geometry":"^0.1.2","@types/mapbox__vector-tile":"^1.3.0","@types/pbf":"^3.0.2",earcut:"^2.2.4","geojson-vt":"^3.2.1","gl-matrix":"^3.4.3","global-prefix":"^3.0.0",kdbush:"^4.0.2","murmurhash-js":"^1.0.0",pbf:"^3.2.1",potpack:"^2.0.0",quickselect:"^2.0.0",supercluster:"^8.0.1",tinyqueue:"^2.0.3","vt-pbf":"^3.1.3"},devDependencies:{"@mapbox/mapbox-gl-rtl-text":"^0.2.3","@mapbox/mvt-fixtures":"^3.10.0","@rollup/plugin-commonjs":"^25.0.3","@rollup/plugin-json":"^6.0.0","@rollup/plugin-node-resolve":"^15.1.0","@rollup/plugin-replace":"^5.0.2","@rollup/plugin-strip":"^3.0.2","@rollup/plugin-terser":"^0.4.3","@rollup/plugin-typescript":"^11.1.2","@types/benchmark":"^2.1.2","@types/cssnano":"^5.0.0","@types/d3":"^7.4.0","@types/diff":"^5.0.3","@types/earcut":"^2.1.1","@types/eslint":"^8.44.0","@types/gl":"^6.0.2","@types/glob":"^8.1.0","@types/jest":"^29.5.3","@types/jsdom":"^21.1.1","@types/minimist":"^1.2.2","@types/murmurhash-js":"^1.0.4","@types/nise":"^1.4.1","@types/node":"^20.4.2","@types/offscreencanvas":"^2019.7.0","@types/pixelmatch":"^5.2.4","@types/pngjs":"^6.0.1","@types/react":"^18.2.15","@types/react-dom":"^18.2.6","@types/request":"^2.48.8","@types/shuffle-seed":"^1.1.0","@types/supercluster":"^7.1.0","@types/window-or-global":"^1.0.4","@typescript-eslint/eslint-plugin":"^5.61.0","@typescript-eslint/parser":"^5.62.0",address:"^1.2.2",benchmark:"^2.1.4",canvas:"^2.11.2",cssnano:"^6.0.1",d3:"^7.8.5","d3-queue":"^3.0.7","devtools-protocol":"^0.0.1170846",diff:"^5.1.0","dts-bundle-generator":"^8.0.1",eslint:"^8.45.0","eslint-config-mourner":"^3.0.0","eslint-plugin-html":"^7.1.0","eslint-plugin-import":"^2.27.5","eslint-plugin-jest":"^27.2.3","eslint-plugin-tsdoc":"0.2.17","eslint-plugin-react":"^7.32.2",expect:"^29.5.0",gl:"^6.0.2",glob:"^10.3.3","is-builtin-module":"^3.2.1",jest:"^29.6.1","jest-canvas-mock":"^2.5.2","jest-environment-jsdom":"^29.6.1",jsdom:"^22.1.0","json-stringify-pretty-compact":"^4.0.0",minimist:"^1.2.8","mock-geolocation":"^1.0.11",nise:"^5.1.4","node-plantuml":"^0.9.0","npm-font-open-sans":"^1.1.0","npm-run-all":"^4.1.5","pdf-merger-js":"^4.3.0",pixelmatch:"^5.3.0",pngjs:"^7.0.0",postcss:"^8.4.26","postcss-cli":"^10.1.0","postcss-inline-svg":"^6.0.0","pretty-bytes":"^6.1.1",puppeteer:"^20.8.2",react:"^18.2.0","react-dom":"^18.2.0",rollup:"^3.26.2","rollup-plugin-sourcemaps":"^0.6.3",rw:"^1.3.3",semver:"^7.5.4","shuffle-seed":"^1.1.6","source-map-explorer":"^2.5.3",st:"^3.0.0",stylelint:"^15.10.1","stylelint-config-standard":"^34.0.0","ts-jest":"^29.1.1","ts-node":"^10.9.1",tslib:"^2.6.0",typedoc:"^0.24.8","typedoc-plugin-markdown":"^3.15.3","typedoc-plugin-missing-exports":"^2.0.0",typescript:"^5.1.6"},overrides:{"postcss-inline-svg":{"css-select":"^5.1.0","dom-serializer":"^2.0.0",htmlparser2:"^8.0.1","postcss-value-parser":"^4.2.0"}},scripts:{"generate-dist-package":"npm run tsnode build/generate-dist-package.js","generate-shaders":"npm run tsnode build/generate-shaders.ts","generate-struct-arrays":"npm run tsnode build/generate-struct-arrays.ts","generate-style-code":"npm run tsnode build/generate-style-code.ts","generate-typings":"npm run tsnode build/generate-typings.ts","generate-docs":"typedoc && npm run tsnode build/generate-docs.ts","generate-images":"npm run tsnode build/generate-doc-images.ts","build-dist":"run-p --print-label generate-typings build-dev build-prod build-csp build-csp-dev build-css","build-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev","watch-dev":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:dev --watch","build-prod":"rollup --configPlugin @rollup/plugin-typescript -c --environment BUILD:production","build-csp":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts","build-csp-dev":"rollup --configPlugin @rollup/plugin-typescript -c rollup.config.csp.ts --environment BUILD:dev","build-css":"postcss -o dist/maplibre-gl.css src/css/maplibre-gl.css","build-diagrams":"cd docs/diagrams; ls *.plantuml | xargs -I {} puml generate --svg {} -o {}.svg","watch-css":"postcss --watch -o dist/maplibre-gl.css src/css/maplibre-gl.css","build-benchmarks":"npm run build-dev && rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts","watch-benchmarks":"rollup --configPlugin @rollup/plugin-typescript -c test/bench/rollup_config_benchmarks.ts --watch","start-server":"st --no-cache -H 0.0.0.0 --port 9966 .",start:"run-p watch-css watch-dev start-server","start-bench":"run-p watch-css watch-benchmarks start-server",lint:"eslint --cache --ext .ts,.tsx,.js,.html --ignore-path .gitignore .","lint-css":"stylelint src/css/maplibre-gl.css",test:"run-p lint lint-css test-render jest",jest:"jest","jest-ci":"jest --reporters=github-actions --reporters=summary","test-build":"jest --selectProjects=build","test-integration":"jest --selectProjects=integration","test-render":"npm run tsnode test/integration/render/run_render_tests.ts","test-unit":"jest --selectProjects=unit","test-watch-roots":"jest --watch",codegen:"run-p generate-dist-package generate-style-code generate-struct-arrays generate-shaders",benchmark:"npm run tsnode test/bench/run-benchmarks.ts","gl-stats":"npm run tsnode test/bench/gl-stats.ts",prepare:"npm run codegen",typecheck:"tsc --noEmit && tsc --project tsconfig.dist.json",tsnode:"node --experimental-loader=ts-node/esm --no-warnings"},files:["build/","dist/*","src/"],engines:{npm:">=8.1.0",node:">=16.14.0"}};f();f();var jh=te(be(),1),Hh=te(l_(),1);function Zh(n){if(n<=0)return 0;if(n>=1)return 1;let t=n*n,e=t*n;return 4*(n<.5?e:3*(n-t)+e-.75)}u(Zh,"easeCubicInOut");function Qs(n,t,e,r){let i=new Hh.default(n,t,e,r);return function(o){return i.solve(o)}}u(Qs,"bezier");var el=Qs(.25,.1,.25,1);function ye(n,t,e){return Math.min(e,Math.max(t,n))}u(ye,"clamp");function St(n,t,e){let r=e-t,i=((n-t)%r+r)%r+t;return i===t?e:i}u(St,"wrap");function Bn(n,t,e){if(!n.length)return e(null,[]);let r=n.length,i=new Array(n.length),o=null;n.forEach((a,s)=>{t(a,(l,c)=>{l&&(o=l),i[s]=c,--r===0&&e(o,i)})})}u(Bn,"asyncAll");function Wh(n,t){let e=[];for(let r in n)r in t||e.push(r);return e}u(Wh,"keysDifference");function k(n,...t){for(let e of t)for(let r in e)n[r]=e[r];return n}u(k,"extend");function ht(n,t){let e={};for(let r=0;r<t.length;r++){let i=t[r];i in n&&(e[i]=n[i])}return e}u(ht,"pick");var c_=1;function Rn(){return c_++}u(Rn,"uniqueId");function Xh(n){return Math.log(n)/Math.LN2%1===0}u(Xh,"isPowerOfTwo");function Kh(n){return n<=1?1:Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))}u(Kh,"nextPowerOfTwo");function gi(n,t,e){let r={};for(let i in n)r[i]=t.call(e||this,n[i],i,n);return r}u(gi,"mapObject");function On(n,t,e){let r={};for(let i in n)t.call(e||this,n[i],i,n)&&(r[i]=n[i]);return r}u(On,"filterObject");function wt(n,t){if(Array.isArray(n)){if(!Array.isArray(t)||n.length!==t.length)return!1;for(let e=0;e<n.length;e++)if(!wt(n[e],t[e]))return!1;return!0}if(typeof n=="object"&&n!==null&&t!==null){if(typeof t!="object"||Object.keys(n).length!==Object.keys(t).length)return!1;for(let r in n)if(!wt(n[r],t[r]))return!1;return!0}return n===t}u(wt,"deepEqual");function Xe(n){return Array.isArray(n)?n.map(Xe):typeof n=="object"&&n?gi(n,Xe):n}u(Xe,"clone");function $h(n,t){for(let e=0;e<n.length;e++)if(t.indexOf(n[e])>=0)return!0;return!1}u($h,"arraysIntersect");var Gh={};function xe(n){Gh[n]||(typeof console<"u"&&console.warn(n),Gh[n]=!0)}u(xe,"warnOnce");function Pt(n,t,e){return(e.y-n.y)*(t.x-n.x)>(t.y-n.y)*(e.x-n.x)}u(Pt,"isCounterClockwise");function Jh(n,t,e,r){let i=t.y-n.y,o=t.x-n.x,a=r.y-e.y,s=r.x-e.x,l=a*o-s*i;if(l===0)return null;let c=n.y-e.y,p=n.x-e.x,m=(s*c-a*p)/l;return new jh.default(n.x+m*o,n.y+m*i)}u(Jh,"findLineIntersection");function Yh(n){let t=0;for(let e=0,r=n.length,i=r-1,o,a;e<r;i=e++)o=n[e],a=n[i],t+=(a.x-o.x)*(o.y+a.y);return t}u(Yh,"calculateSignedArea");function Qh([n,t,e]){return t+=90,t*=Math.PI/180,e*=Math.PI/180,{x:n*Math.cos(t)*Math.sin(e),y:n*Math.sin(t)*Math.sin(e),z:n*Math.cos(e)}}u(Qh,"sphericalToCartesian");function Ke(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}u(Ke,"isWorker");function ef(n){let t=/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,e={};if(n.replace(t,(r,i,o,a)=>{let s=o||a;return e[i]=s?s.toLowerCase():!0,""}),e["max-age"]){let r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}u(ef,"parseCacheControl");var Ys=null;function ar(n){if(Ys==null){let t=n.navigator?n.navigator.userAgent:null;Ys=!!n.safari||!!(t&&(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Ys}u(ar,"isSafari");function ct(n){return typeof ImageBitmap<"u"&&n instanceof ImageBitmap}u(ct,"isImageBitmap");function tf(n,t){let e=new Blob([new Uint8Array(n)],{type:"image/png"});createImageBitmap(e).then(r=>{t(null,r)}).catch(r=>{t(new Error("Could not load image because of ".concat(r.message,". Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")))})}u(tf,"arrayBufferToImageBitmap");var qh="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function rf(n,t){let e=new Image;e.onload=()=>{t(null,e),URL.revokeObjectURL(e.src),e.onload=null,window.requestAnimationFrame(()=>{e.src=qh})},e.onerror=()=>t(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."));let r=new Blob([new Uint8Array(n)],{type:"image/png"});e.src=n.byteLength?URL.createObjectURL(r):qh}u(rf,"arrayBufferToImage");f();var p_=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),Vn,tl,ee={now:p_,frame(n){let t=requestAnimationFrame(n);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(n,t=0){return this.getImageCanvasContext(n).getImageData(-t,-t,n.width+2*t,n.height+2*t)},getImageCanvasContext(n){let t=window.document.createElement("canvas"),e=t.getContext("2d",{willReadFrequently:!0});if(!e)throw new Error("failed to create canvas 2d context");return t.width=n.width,t.height=n.height,e.drawImage(n,0,0,n.width,n.height),e},resolveURL(n){return Vn||(Vn=document.createElement("a")),Vn.href=n,Vn.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(tl==null&&(tl=matchMedia("(prefers-reduced-motion: reduce)")),tl.matches):!1}};f();var rl=te(be(),1);var Te=class Te{static testProp(t){if(!Te.docStyle)return t[0];for(let e=0;e<t.length;e++)if(t[e]in Te.docStyle)return t[e];return t[0]}static create(t,e,r){let i=window.document.createElement(t);return e!==void 0&&(i.className=e),r&&r.appendChild(i),i}static createNS(t,e){return window.document.createElementNS(t,e)}static disableDrag(){Te.docStyle&&Te.selectProp&&(Te.userSelect=Te.docStyle[Te.selectProp],Te.docStyle[Te.selectProp]="none")}static enableDrag(){Te.docStyle&&Te.selectProp&&(Te.docStyle[Te.selectProp]=Te.userSelect)}static setTransform(t,e){t.style[Te.transformProp]=e}static addEventListener(t,e,r,i={}){"passive"in i?t.addEventListener(e,r,i):t.addEventListener(e,r,i.capture)}static removeEventListener(t,e,r,i={}){"passive"in i?t.removeEventListener(e,r,i):t.removeEventListener(e,r,i.capture)}static suppressClickInternal(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",Te.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",Te.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",Te.suppressClickInternal,!0)},0)}static mousePos(t,e){let r=t.getBoundingClientRect();return new rl.default(e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop)}static touchPos(t,e){let r=t.getBoundingClientRect(),i=[];for(let o=0;o<e.length;o++)i.push(new rl.default(e[o].clientX-r.left-t.clientLeft,e[o].clientY-r.top-t.clientTop));return i}static mouseButton(t){return t.button}static remove(t){t&&t.parentNode&&t.parentNode.removeChild(t)}};u(Te,"DOM"),Te.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,Te.selectProp=Te.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),Te.transformProp=Te.testProp(["transform","WebkitTransform"]);var M=Te;f();f();var Ge={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};var ol=class ol extends Error{constructor(e,r,i,o){super("AJAXError: ".concat(r," (").concat(e,"): ").concat(i));this.status=e,this.statusText=r,this.url=i,this.body=o}};u(ol,"AJAXError");var zt=ol,Un=Ke()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,il=u(n=>Ge.REGISTERED_PROTOCOLS[n.substring(0,n.indexOf("://"))],"getProtocolAction"),m_=u(n=>/^file:/.test(n)||/^file:/.test(Un())&&!/^\w+:/.test(n),"isFileURL");function nf(n,t){let e=new AbortController,r=new Request(n.url,{method:n.method||"GET",body:n.body,credentials:n.credentials,headers:n.headers,referrer:Un(),signal:e.signal}),i=!1,o=!1;n.type==="json"&&r.headers.set("Accept","application/json");let a=u((l,c,p)=>{if(!o){if(l&&l.message!=="SecurityError"&&xe(l),c&&p)return s(c);fetch(r).then(m=>m.ok?s(m):m.blob().then(h=>t(new zt(m.status,m.statusText,n.url,h)))).catch(m=>{m.code!==20&&t(new Error(m.message))})}},"validateOrFetch"),s=u(l=>{(n.type==="arrayBuffer"||n.type==="image"?l.arrayBuffer():n.type==="json"?l.json():l.text()).then(c=>{o||(i=!0,t(null,c,l.headers.get("Cache-Control"),l.headers.get("Expires")))}).catch(c=>{o||t(new Error(c.message))})},"finishRequest");return a(null,null),{cancel:()=>{o=!0,i||e.abort()}}}u(nf,"makeFetchRequest");function h_(n,t){let e=new XMLHttpRequest;e.open(n.method||"GET",n.url,!0),(n.type==="arrayBuffer"||n.type==="image")&&(e.responseType="arraybuffer");for(let r in n.headers)e.setRequestHeader(r,n.headers[r]);return n.type==="json"&&(e.responseType="text",e.setRequestHeader("Accept","application/json")),e.withCredentials=n.credentials==="include",e.onerror=()=>{t(new Error(e.statusText))},e.onload=()=>{if((e.status>=200&&e.status<300||e.status===0)&&e.response!==null){let r=e.response;if(n.type==="json")try{r=JSON.parse(e.response)}catch(i){return t(i)}t(null,r,e.getResponseHeader("Cache-Control"),e.getResponseHeader("Expires"))}else{let r=new Blob([e.response],{type:e.getResponseHeader("Content-Type")});t(new zt(e.status,e.statusText,n.url,r))}},e.send(n.body),{cancel:()=>e.abort()}}u(h_,"makeXMLHttpRequest");var Mr=u(function(n,t){if(/:\/\//.test(n.url)&&!/^https?:|^file:/.test(n.url)){if(Ke()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",n,t);if(!Ke())return(il(n.url)||nf)(n,t)}if(!m_(n.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return nf(n,t);if(Ke()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",n,t,void 0,!0)}return h_(n,t)},"makeRequest"),Bt=u(function(n,t){return Mr(k(n,{type:"json"}),t)},"getJSON"),Nn=u(function(n,t){return Mr(k(n,{type:"arrayBuffer"}),t)},"getArrayBuffer");function nl(n){if(!n||n.indexOf("://")<=0||n.indexOf("data:image/")===0||n.indexOf("blob:")===0)return!0;let t=new URL(n),e=window.location;return t.protocol===e.protocol&&t.host===e.host}u(nl,"sameOrigin");var of=u(function(n,t){let e=window.document.createElement("video");e.muted=!0,e.onloadstart=function(){t(null,e)};for(let r=0;r<n.length;r++){let i=window.document.createElement("source");nl(n[r])||(e.crossOrigin="Anonymous"),i.src=n[r],e.appendChild(i)}return{cancel:()=>{}}},"getVideo");f();f();var _i={supported:!1,testSupport:f_},xi,al=!1,Lr,af=!1;typeof document<"u"&&(Lr=document.createElement("img"),Lr.onload=function(){xi&&sf(xi),xi=null,af=!0},Lr.onerror=function(){al=!0,xi=null},Lr.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");function f_(n){al||!Lr||(af?sf(n):xi=n)}u(f_,"testSupport");function sf(n){let t=n.createTexture();n.bindTexture(n.TEXTURE_2D,t);try{if(n.texImage2D(n.TEXTURE_2D,0,n.RGBA,n.RGBA,n.UNSIGNED_BYTE,Lr),n.isContextLost())return;_i.supported=!0}catch{}n.deleteTexture(t),al=!0}u(sf,"testWebpTextureUpload");var He;(g=>{let n,t,e,r;g.resetRequestQueue=u(()=>{n=[],t=0,e=0,r={}},"resetRequestQueue"),g.addThrottleControl=u(y=>{let x=e++;return r[x]=y,x},"addThrottleControl"),g.removeThrottleControl=u(y=>{delete r[y],h()},"removeThrottleControl");let s=u(()=>{let y=Object.keys(r),x=!1;if(y.length>0){for(let v of y)if(x=r[v](),x)break}return x},"isThrottled");g.getImage=u((y,x,v=!0)=>{_i.supported&&(y.headers||(y.headers={}),y.headers.accept="image/webp,*/*");let b={requestParameters:y,supportImageRefresh:v,callback:x,cancelled:!1,completed:!1,cancel:()=>{!b.completed&&!b.cancelled&&(b.cancelled=!0,b.innerRequest&&(b.innerRequest.cancel(),t--),h())}};return n.push(b),h(),b},"getImage");let c=u((y,x)=>{typeof createImageBitmap=="function"?tf(y,x):rf(y,x)},"arrayBufferToCanvasImageSource"),p=u(y=>{let{requestParameters:x,supportImageRefresh:v,callback:b}=y;return k(x,{type:"image"}),(v===!1&&!Ke()&&!il(x.url)&&(!x.headers||Object.keys(x.headers).reduce((P,I)=>P&&I==="accept",!0))?d:Mr)(x,(P,I,C,z)=>{m(y,b,P,I,C,z)})},"doImageRequest"),m=u((y,x,v,b,w,S)=>{v?x(v):b instanceof HTMLImageElement||b instanceof ImageBitmap?x(null,b):b&&c(b,u((I,C)=>{I!=null?x(I):C!=null&&x(null,C,{cacheControl:w,expires:S})},"decoratedCallback")),y.cancelled||(y.completed=!0,t--,h())},"onImageResponse"),h=u(()=>{let y=s()?Ge.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:Ge.MAX_PARALLEL_IMAGE_REQUESTS;for(let x=t;x<y&&n.length>0;x++){let v=n.shift();if(v.cancelled){x--;continue}let b=p(v);t++,v.innerRequest=b}},"processQueue"),d=u((y,x)=>{let v=new Image,b=y.url,w=!1,S=y.credentials;return S&&S==="include"?v.crossOrigin="use-credentials":(S&&S==="same-origin"||!nl(b))&&(v.crossOrigin="anonymous"),v.fetchPriority="high",v.onload=()=>{x(null,v),v.onerror=v.onload=null},v.onerror=()=>{w||x(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.")),v.onerror=v.onload=null},v.src=b,{cancel:()=>{w=!0,v.src=""}}},"getImageUsingHtmlImage")})(He||(He={}));He.resetRequestQueue();f();var sl=class sl{constructor(t){this._transformRequestFn=t}transformRequest(t,e){return this._transformRequestFn?this._transformRequestFn(t,e)||{url:t}:{url:t}}normalizeSpriteURL(t,e,r){let i=y_(t);return i.path+="".concat(e).concat(r),g_(i)}setTransformRequest(t){this._transformRequestFn=t}};u(sl,"RequestManager");var Gn=sl,d_=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function y_(n){let t=n.match(d_);if(!t)throw new Error('Unable to parse URL "'.concat(n,'"'));return{protocol:t[1],authority:t[2],path:t[3]||"/",params:t[4]?t[4].split("&"):[]}}u(y_,"parseUrl");function g_(n){let t=n.params.length?"?".concat(n.params.join("&")):"";return"".concat(n.protocol,"://").concat(n.authority).concat(n.path).concat(t)}u(g_,"formatUrl");f();f();function lf(n,t,e){e[n]&&e[n].indexOf(t)!==-1||(e[n]=e[n]||[],e[n].push(t))}u(lf,"_addEventListener");function ll(n,t,e){if(e&&e[n]){let r=e[n].indexOf(t);r!==-1&&e[n].splice(r,1)}}u(ll,"_removeEventListener");var ul=class ul{constructor(t,e={}){k(this,e),this.type=t}};u(ul,"Event");var E=ul,cl=class cl extends E{constructor(e,r={}){super("error",k({error:e},r))}};u(cl,"ErrorEvent");var j=cl,pl=class pl{on(t,e){return this._listeners=this._listeners||{},lf(t,e,this._listeners),this}off(t,e){return ll(t,e,this._listeners),ll(t,e,this._oneTimeListeners),this}once(t,e){return e?(this._oneTimeListeners=this._oneTimeListeners||{},lf(t,e,this._oneTimeListeners),this):new Promise(r=>this.once(t,r))}fire(t,e){typeof t=="string"&&(t=new E(t,e||{}));let r=t.type;if(this.listens(r)){t.target=this;let i=this._listeners&&this._listeners[r]?this._listeners[r].slice():[];for(let s of i)s.call(this,t);let o=this._oneTimeListeners&&this._oneTimeListeners[r]?this._oneTimeListeners[r].slice():[];for(let s of o)ll(r,s,this._oneTimeListeners),s.call(this,t);let a=this._eventedParent;a&&(k(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(t))}else t instanceof j&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,e){return this._eventedParent=t,this._eventedParentData=e,this}};u(pl,"Evented");var se=pl;f();f();f();f();var Me=Fh,T0=Me.source,uf=Me.light,I0=Me.terrain,A0=Me.filter,cf=Me.paintProperty,pf=Me.layoutProperty;function kr(n,t){let e=!1;if(t&&t.length)for(let r of t)n.fire(new j(new Error(r.message))),e=!0;return e}u(kr,"emitValidationErrors");f();f();f();var qn=class qn{constructor(t,e,r){let i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let a=new Int32Array(this.arrayBuffer);t=a[0],e=a[1],r=a[2],this.d=e+2*r;for(let c=0;c<this.d*this.d;c++){let p=a[3+c],m=a[3+c+1];i.push(p===m?null:a.subarray(p,m))}let s=a[3+i.length],l=a[3+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=e+2*r;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;let o=r/e*t;this.min=-o,this.max=t+o}insert(t,e,r,i,o){this._forEachCell(e,r,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,e,r,i,o,a){this.cells[o].push(a)}query(t,e,r,i,o){let a=this.min,s=this.max;if(t<=a&&e<=a&&s<=r&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let l=[],c={};return this._forEachCell(t,e,r,i,this._queryCell,l,c,o),l}}_queryCell(t,e,r,i,o,a,s,l){let c=this.cells[o];if(c!==null){let p=this.keys,m=this.bboxes;for(let h=0;h<c.length;h++){let d=c[h];if(s[d]===void 0){let g=d*4;(l?l(m[g+0],m[g+1],m[g+2],m[g+3]):t<=m[g+2]&&e<=m[g+3]&&r>=m[g+0]&&i>=m[g+1])?(s[d]=!0,a.push(p[d])):s[d]=!1}}}}_forEachCell(t,e,r,i,o,a,s,l){let c=this._convertToCellCoord(t),p=this._convertToCellCoord(e),m=this._convertToCellCoord(r),h=this._convertToCellCoord(i);for(let d=c;d<=m;d++)for(let g=p;g<=h;g++){let y=this.d*g+d;if(!(l&&!l(this._convertFromCellCoord(d),this._convertFromCellCoord(g),this._convertFromCellCoord(d+1),this._convertFromCellCoord(g+1)))&&o.call(this,t,e,r,i,y,a,s,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,e=3+this.cells.length+1+1,r=0;for(let a=0;a<this.cells.length;a++)r+=this.cells[a].length;let i=new Int32Array(e+r+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=e;for(let a=0;a<t.length;a++){let s=t[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+t.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+t.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(t,e){let r=t.toArrayBuffer();return e&&e.push(r),{buffer:r}}static deserialize(t){return new qn(t.buffer)}};u(qn,"TransferableGridIndex");var sr=qn;var Rt={};function O(n,t,e={}){if(Rt[n])throw new Error("".concat(n," is already registered."));Object.defineProperty(t,"_classRegistryKey",{value:n,writeable:!1}),Rt[n]={klass:t,omit:e.omit||[],shallow:e.shallow||[]}}u(O,"register");O("Object",Object);O("TransferableGridIndex",sr);O("Color",me);O("Error",Error);O("AJAXError",zt);O("ResolvedImage",di);O("StylePropertyFunction",Lh);O("StyleExpression",En,{omit:["_evaluator"]});O("ZoomDependentExpression",Ln);O("ZoomConstantExpression",Mn);O("CompoundExpression",Ih,{omit:["_evaluate"]});for(let n in An)An[n]._classRegistryKey||O("Expression_".concat(n),An[n]);function mf(n){return n&&typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||n.constructor&&n.constructor.name==="ArrayBuffer")}u(mf,"isArrayBuffer");function Dr(n,t){if(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp||n instanceof Blob)return n;if(mf(n)||ct(n))return t&&t.push(n),n;if(ArrayBuffer.isView(n)){let e=n;return t&&t.push(e.buffer),e}if(n instanceof ImageData)return t&&t.push(n.data.buffer),n;if(Array.isArray(n)){let e=[];for(let r of n)e.push(Dr(r,t));return e}if(typeof n=="object"){let e=n.constructor,r=e._classRegistryKey;if(!r)throw new Error("can't serialize object of unregistered class");if(!Rt[r])throw new Error("".concat(r," is not registered."));let i=e.serialize?e.serialize(n,t):{};if(e.serialize){if(t&&i===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(let o in n){if(!n.hasOwnProperty(o)||Rt[r].omit.indexOf(o)>=0)continue;let a=n[o];i[o]=Rt[r].shallow.indexOf(o)>=0?a:Dr(a,t)}n instanceof Error&&(i.message=n.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(i.$name=r),i}throw new Error("can't serialize object of type ".concat(typeof n))}u(Dr,"serialize");function Fr(n){if(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp||n instanceof Blob||mf(n)||ct(n)||ArrayBuffer.isView(n)||n instanceof ImageData)return n;if(Array.isArray(n))return n.map(Fr);if(typeof n=="object"){let t=n.$name||"Object";if(!Rt[t])throw new Error("can't deserialize unregistered class ".concat(t));let{klass:e}=Rt[t];if(!e)throw new Error("can't deserialize unregistered class ".concat(t));if(e.deserialize)return e.deserialize(n);let r=Object.create(e.prototype);for(let i of Object.keys(n)){if(i==="$name")continue;let o=n[i];r[i]=Rt[t].shallow.indexOf(i)>=0?o:Fr(o)}return r}throw new Error("can't deserialize object of type ".concat(typeof n))}u(Fr,"deserialize");f();f();var ml=class ml{constructor(){this.first=!0}update(t,e){let r=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=r,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=r,!0):(this.lastFloorZoom>r?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom<r&&(this.lastIntegerZoom=r,this.lastIntegerZoomTime=e),t!==this.lastZoom?(this.lastZoom=t,this.lastFloorZoom=r,!0):!1)}};u(ml,"ZoomHistory");var zr=ml;f();f();var ne={"Latin-1 Supplement":n=>n>=128&&n<=255,Arabic:n=>n>=1536&&n<=1791,"Arabic Supplement":n=>n>=1872&&n<=1919,"Arabic Extended-A":n=>n>=2208&&n<=2303,"Hangul Jamo":n=>n>=4352&&n<=4607,"Unified Canadian Aboriginal Syllabics":n=>n>=5120&&n<=5759,Khmer:n=>n>=6016&&n<=6143,"Unified Canadian Aboriginal Syllabics Extended":n=>n>=6320&&n<=6399,"General Punctuation":n=>n>=8192&&n<=8303,"Letterlike Symbols":n=>n>=8448&&n<=8527,"Number Forms":n=>n>=8528&&n<=8591,"Miscellaneous Technical":n=>n>=8960&&n<=9215,"Control Pictures":n=>n>=9216&&n<=9279,"Optical Character Recognition":n=>n>=9280&&n<=9311,"Enclosed Alphanumerics":n=>n>=9312&&n<=9471,"Geometric Shapes":n=>n>=9632&&n<=9727,"Miscellaneous Symbols":n=>n>=9728&&n<=9983,"Miscellaneous Symbols and Arrows":n=>n>=11008&&n<=11263,"CJK Radicals Supplement":n=>n>=11904&&n<=12031,"Kangxi Radicals":n=>n>=12032&&n<=12255,"Ideographic Description Characters":n=>n>=12272&&n<=12287,"CJK Symbols and Punctuation":n=>n>=12288&&n<=12351,Hiragana:n=>n>=12352&&n<=12447,Katakana:n=>n>=12448&&n<=12543,Bopomofo:n=>n>=12544&&n<=12591,"Hangul Compatibility Jamo":n=>n>=12592&&n<=12687,Kanbun:n=>n>=12688&&n<=12703,"Bopomofo Extended":n=>n>=12704&&n<=12735,"CJK Strokes":n=>n>=12736&&n<=12783,"Katakana Phonetic Extensions":n=>n>=12784&&n<=12799,"Enclosed CJK Letters and Months":n=>n>=12800&&n<=13055,"CJK Compatibility":n=>n>=13056&&n<=13311,"CJK Unified Ideographs Extension A":n=>n>=13312&&n<=19903,"Yijing Hexagram Symbols":n=>n>=19904&&n<=19967,"CJK Unified Ideographs":n=>n>=19968&&n<=40959,"Yi Syllables":n=>n>=40960&&n<=42127,"Yi Radicals":n=>n>=42128&&n<=42191,"Hangul Jamo Extended-A":n=>n>=43360&&n<=43391,"Hangul Syllables":n=>n>=44032&&n<=55215,"Hangul Jamo Extended-B":n=>n>=55216&&n<=55295,"Private Use Area":n=>n>=57344&&n<=63743,"CJK Compatibility Ideographs":n=>n>=63744&&n<=64255,"Arabic Presentation Forms-A":n=>n>=64336&&n<=65023,"Vertical Forms":n=>n>=65040&&n<=65055,"CJK Compatibility Forms":n=>n>=65072&&n<=65103,"Small Form Variants":n=>n>=65104&&n<=65135,"Arabic Presentation Forms-B":n=>n>=65136&&n<=65279,"Halfwidth and Fullwidth Forms":n=>n>=65280&&n<=65519};function hl(n){for(let t of n)if(hf(t.charCodeAt(0)))return!0;return!1}u(hl,"allowsVerticalWritingMode");function hf(n){return n===746||n===747?!0:n<4352?!1:!!(ne["Bopomofo Extended"](n)||ne.Bopomofo(n)||ne["CJK Compatibility Forms"](n)&&!(n>=65097&&n<=65103)||ne["CJK Compatibility Ideographs"](n)||ne["CJK Compatibility"](n)||ne["CJK Radicals Supplement"](n)||ne["CJK Strokes"](n)||ne["CJK Symbols and Punctuation"](n)&&!(n>=12296&&n<=12305)&&!(n>=12308&&n<=12319)&&n!==12336||ne["CJK Unified Ideographs Extension A"](n)||ne["CJK Unified Ideographs"](n)||ne["Enclosed CJK Letters and Months"](n)||ne["Hangul Compatibility Jamo"](n)||ne["Hangul Jamo Extended-A"](n)||ne["Hangul Jamo Extended-B"](n)||ne["Hangul Jamo"](n)||ne["Hangul Syllables"](n)||ne.Hiragana(n)||ne["Ideographic Description Characters"](n)||ne.Kanbun(n)||ne["Kangxi Radicals"](n)||ne["Katakana Phonetic Extensions"](n)||ne.Katakana(n)&&n!==12540||ne["Halfwidth and Fullwidth Forms"](n)&&n!==65288&&n!==65289&&n!==65293&&!(n>=65306&&n<=65310)&&n!==65339&&n!==65341&&n!==65343&&!(n>=65371&&n<=65503)&&n!==65507&&!(n>=65512&&n<=65519)||ne["Small Form Variants"](n)&&!(n>=65112&&n<=65118)&&!(n>=65123&&n<=65126)||ne["Unified Canadian Aboriginal Syllabics"](n)||ne["Unified Canadian Aboriginal Syllabics Extended"](n)||ne["Vertical Forms"](n)||ne["Yijing Hexagram Symbols"](n)||ne["Yi Syllables"](n)||ne["Yi Radicals"](n))}u(hf,"charHasUprightVerticalOrientation");function ff(n){return n>=1424&&n<=2303||ne["Arabic Presentation Forms-A"](n)||ne["Arabic Presentation Forms-B"](n)}u(ff,"charInRTLScript");function x_(n,t){return!(!t&&ff(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||ne.Khmer(n))}u(x_,"charInSupportedScript");function df(n){for(let t of n)if(ff(t.charCodeAt(0)))return!0;return!1}u(df,"stringContainsRTLText");function yf(n,t){for(let e of n)if(!x_(e.charCodeAt(0),t))return!1;return!0}u(yf,"isStringInSupportedScript");f();var ft={unavailable:"unavailable",deferred:"deferred",loading:"loading",loaded:"loaded",error:"error"},fl=null,$e=ft.unavailable,Ot=null,yl=u(function(n){n&&typeof n=="string"&&n.indexOf("NetworkError")>-1&&($e=ft.error),fl&&fl(n)},"triggerPluginCompletionEvent");function dl(){jn.fire(new E("pluginStateChange",{pluginStatus:$e,pluginURL:Ot}))}u(dl,"sendPluginStateToWorker");var jn=new se,bi=u(function(){return $e},"getRTLTextPluginStatus"),gf=u(function(n){return n({pluginStatus:$e,pluginURL:Ot}),jn.on("pluginStateChange",n),n},"registerForPluginStateChange");var xf=u(function(n,t,e=!1){if($e===ft.deferred||$e===ft.loading||$e===ft.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ot=ee.resolveURL(n),$e=ft.deferred,fl=t,dl(),e||_f()},"setRTLTextPlugin"),_f=u(function(){if($e!==ft.deferred||!Ot)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");$e=ft.loading,dl(),Ot&&Nn({url:Ot},n=>{n?yl(n):($e=ft.loaded,dl())})},"downloadRTLTextPlugin"),Je={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded(){return $e===ft.loaded||Je.applyArabicShaping!=null},isLoading(){return $e===ft.loading},setState(n){if(!Ke())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");$e=n.pluginStatus,Ot=n.pluginURL},isParsed(){if(!Ke())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return Je.applyArabicShaping!=null&&Je.processBidirectionalText!=null&&Je.processStyledBidirectionalText!=null},getPluginURL(){if(!Ke())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Ot}},bf=u(function(){!Je.isLoading()&&!Je.isLoaded()&&bi()==="deferred"&&_f()},"lazyLoadRTLTextPlugin");var gl=class gl{constructor(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new zr,this.transition={})}isSupportedScript(t){return yf(t,Je.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,e=t-Math.floor(t),r=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:e+(1-e)*r}:{fromScale:.5,toScale:1,t:1-(1-r)*e}}};u(gl,"EvaluationParameters");var le=gl;var xl=class xl{constructor(t,e){this.property=t,this.value=e,this.expression=kh(e===void 0?t.specification.default:e,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,e,r){return this.property.possiblyEvaluate(this,t,e,r)}};u(xl,"PropertyValue");var Br=xl,_l=class _l{constructor(t){this.property=t,this.value=new Br(t,void 0)}transitioned(t,e){return new Hn(this.property,this.value,e,k({},t.transition,this.transition),t.now)}untransitioned(){return new Hn(this.property,this.value,null,{},0)}};u(_l,"TransitionablePropertyValue");var vi=_l,bl=class bl{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Xe(this._values[t].value.value)}setValue(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new vi(this._values[t].property)),this._values[t].value=new Br(this._values[t].property,e===null?void 0:Xe(e))}getTransition(t){return Xe(this._values[t].transition)}setTransition(t,e){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new vi(this._values[t].property)),this._values[t].transition=Xe(e)||void 0}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r);let i=this.getTransition(e);i!==void 0&&(t["".concat(e,"-transition")]=i)}return t}transitioned(t,e){let r=new Zn(this._properties);for(let i of Object.keys(this._values))r._values[i]=this._values[i].transitioned(t,e._values[i]);return r}untransitioned(){let t=new Zn(this._properties);for(let e of Object.keys(this._values))t._values[e]=this._values[e].untransitioned();return t}};u(bl,"Transitionable");var Rr=bl,vl=class vl{constructor(t,e,r,i,o){this.property=t,this.value=e,this.begin=o+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=r)}possiblyEvaluate(t,e,r){let i=t.now||0,o=this.value.possiblyEvaluate(t,e,r),a=this.prior;if(a){if(i>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(i<this.begin)return a.possiblyEvaluate(t,e,r);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(t,e,r),o,Zh(s))}}else return o}};u(vl,"TransitioningPropertyValue");var Hn=vl,wl=class wl{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,e,r){let i=new Vt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(t,e,r);return i}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}};u(wl,"Transitioning");var Zn=wl,Sl=class Sl{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return Xe(this._values[t].value)}setValue(t,e){this._values[t]=new Br(this._values[t].property,e===null?void 0:Xe(e))}serialize(){let t={};for(let e of Object.keys(this._values)){let r=this.getValue(e);r!==void 0&&(t[e]=r)}return t}possiblyEvaluate(t,e,r){let i=new Vt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(t,e,r);return i}};u(Sl,"Layout");var Wn=Sl,Pl=class Pl{constructor(t,e,r){this.property=t,this.value=e,this.parameters=r}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,e,r,i){return this.property.evaluate(this.value,this.parameters,t,e,r,i)}};u(Pl,"PossiblyEvaluatedPropertyValue");var je=Pl,Tl=class Tl{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}};u(Tl,"PossiblyEvaluated");var Vt=Tl,Il=class Il{constructor(t){this.specification=t}possiblyEvaluate(t,e){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(e)}interpolate(t,e,r){let i=this.specification.type,o=Ae[i];return o?o(t,e,r):t}};u(Il,"DataConstantProperty");var q=Il,Al=class Al{constructor(t,e){this.specification=t,this.overrides=e}possiblyEvaluate(t,e,r,i){return t.expression.kind==="constant"||t.expression.kind==="camera"?new je(this,{kind:"constant",value:t.expression.evaluate(e,null,{},r,i)},e):new je(this,t.expression,e)}interpolate(t,e,r){if(t.value.kind!=="constant"||e.value.kind!=="constant")return t;if(t.value.value===void 0||e.value.value===void 0)return new je(this,{kind:"constant",value:void 0},t.parameters);let i=this.specification.type,o=Ae[i];if(o){let a=o(t.value.value,e.value.value,r);return new je(this,{kind:"constant",value:a},t.parameters)}else return t}evaluate(t,e,r,i,o,a){return t.kind==="constant"?t.value:t.evaluate(e,r,i,o,a)}};u(Al,"DataDrivenProperty");var H=Al,Cl=class Cl extends H{possiblyEvaluate(t,e,r,i){if(t.value===void 0)return new je(this,{kind:"constant",value:void 0},e);if(t.expression.kind==="constant"){let o=t.expression.evaluate(e,null,{},r,i),s=t.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,e);return new je(this,{kind:"constant",value:l},e)}else if(t.expression.kind==="camera"){let o=this._calculate(t.expression.evaluate({zoom:e.zoom-1}),t.expression.evaluate({zoom:e.zoom}),t.expression.evaluate({zoom:e.zoom+1}),e);return new je(this,{kind:"constant",value:o},e)}else return new je(this,t.expression,e)}evaluate(t,e,r,i,o,a){if(t.kind==="source"){let s=t.evaluate(e,r,i,o,a);return this._calculate(s,s,s,e)}else return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(e.zoom)-1},r,i),t.evaluate({zoom:Math.floor(e.zoom)},r,i),t.evaluate({zoom:Math.floor(e.zoom)+1},r,i),e):t.value}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}};u(Cl,"CrossFadedDataDrivenProperty");var Tt=Cl,El=class El{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,i){if(t.value!==void 0)if(t.expression.kind==="constant"){let o=t.expression.evaluate(e,null,{},r,i);return this._calculate(o,o,o,e)}else return this._calculate(t.expression.evaluate(new le(Math.floor(e.zoom-1),e)),t.expression.evaluate(new le(Math.floor(e.zoom),e)),t.expression.evaluate(new le(Math.floor(e.zoom+1),e)),e)}_calculate(t,e,r,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:e}:{from:r,to:e}}interpolate(t){return t}};u(El,"CrossFadedProperty");var lr=El,Ml=class Ml{constructor(t){this.specification=t}possiblyEvaluate(t,e,r,i){return!!t.expression.evaluate(e,null,{},r,i)}interpolate(){return!1}};u(Ml,"ColorRampProperty");var ur=Ml,Ll=class Ll{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let e in t){let r=t[e];r.specification.overridable&&this.overridableProperties.push(e);let i=this.defaultPropertyValues[e]=new Br(r,void 0),o=this.defaultTransitionablePropertyValues[e]=new vi(r);this.defaultTransitioningPropertyValues[e]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[e]=i.possiblyEvaluate({})}}};u(Ll,"Properties");var Ie=Ll;O("DataDrivenProperty",H);O("DataConstantProperty",q);O("CrossFadedDataDrivenProperty",Tt);O("CrossFadedProperty",lr);O("ColorRampProperty",ur);var Xn="-transition",kl=class kl extends se{constructor(e,r){super();if(this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(e=e,this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),r.layout&&(this._unevaluatedLayout=new Wn(r.layout)),r.paint)){this._transitionablePaint=new Rr(r.paint);for(let i in e.paint)this.setPaintProperty(i,e.paint[i],{validate:!1});for(let i in e.layout)this.setLayoutProperty(i,e.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Vt(r.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,r,i={}){if(r!=null){let o="layers.".concat(this.id,".layout.").concat(e);if(this._validate(pf,o,e,r,i))return}if(e==="visibility"){this.visibility=r;return}this._unevaluatedLayout.setValue(e,r)}getPaintProperty(e){return e.endsWith(Xn)?this._transitionablePaint.getTransition(e.slice(0,-Xn.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,r,i={}){if(r!=null){let o="layers.".concat(this.id,".paint.").concat(e);if(this._validate(cf,o,e,r,i))return!1}if(e.endsWith(Xn))return this._transitionablePaint.setTransition(e.slice(0,-Xn.length),r||void 0),!1;{let o=this._transitionablePaint._values[e],a=o.property.specification["property-type"]==="cross-faded-data-driven",s=o.value.isDataDriven(),l=o.value;this._transitionablePaint.setValue(e,r),this._handleSpecialPaintPropertyUpdate(e);let c=this._transitionablePaint._values[e].value;return c.isDataDriven()||s||a||this._handleOverridablePaintPropertyUpdate(e,l,c)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,r,i){return!1}isHidden(e){return this.minzoom&&e<this.minzoom||this.maxzoom&&e>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,r){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,r)}serialize(){let e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),On(e,(r,i)=>r!==void 0&&!(i==="layout"&&!Object.keys(r).length)&&!(i==="paint"&&!Object.keys(r).length))}_validate(e,r,i,o,a={}){return a&&a.validate===!1?!1:kr(this,e.call(Me,{key:r,layerType:this.type,objectKey:i,value:o,styleSpec:T,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let e in this.paint._values){let r=this.paint.get(e);if(!(!(r instanceof je)||!Cn(r.property.specification))&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}};u(kl,"StyleLayer");var Le=kl;f();f();f();var __={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Dl=class Dl{constructor(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}};u(Dl,"Struct");var cr=Dl,b_=128,v_=5,Fl=class Fl{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*v_),b_),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};u(Fl,"StructArray");var Ce=Fl;function fe(n,t=1){let e=0,r=0,i=n.map(a=>{let s=w_(a.type),l=e=vf(e,Math.max(t,s)),c=a.components||1;return r=Math.max(r,s),e+=s*c,{name:a.name,type:a.type,components:c,offset:l}}),o=vf(e,Math.max(r,t));return{members:i,size:o,alignment:t}}u(fe,"createLayout");function w_(n){return __[n].BYTES_PER_ELEMENT}u(w_,"sizeOf");function vf(n,t){return Math.ceil(n/t)*t}u(vf,"align");var wf=te(be(),1);var zl=class zl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,r)}emplace(e,r,i){let o=e*2;return this.int16[o+0]=r,this.int16[o+1]=i,e}};u(zl,"StructArrayLayout2i4");var pr=zl;pr.prototype.bytesPerElement=4;O("StructArrayLayout2i4",pr);var Bl=class Bl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,i)}emplace(e,r,i,o){let a=e*3;return this.int16[a+0]=r,this.int16[a+1]=i,this.int16[a+2]=o,e}};u(Bl,"StructArrayLayout3i6");var Or=Bl;Or.prototype.bytesPerElement=6;O("StructArrayLayout3i6",Or);var Rl=class Rl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,i,o)}emplace(e,r,i,o,a){let s=e*4;return this.int16[s+0]=r,this.int16[s+1]=i,this.int16[s+2]=o,this.int16[s+3]=a,e}};u(Rl,"StructArrayLayout4i8");var wi=Rl;wi.prototype.bytesPerElement=8;O("StructArrayLayout4i8",wi);var Ol=class Ol extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,r,i,o,a,s)}emplace(e,r,i,o,a,s,l){let c=e*6;return this.int16[c+0]=r,this.int16[c+1]=i,this.int16[c+2]=o,this.int16[c+3]=a,this.int16[c+4]=s,this.int16[c+5]=l,e}};u(Ol,"StructArrayLayout2i4i12");var Si=Ol;Si.prototype.bytesPerElement=12;O("StructArrayLayout2i4i12",Si);var Vl=class Vl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,r,i,o,a,s)}emplace(e,r,i,o,a,s,l){let c=e*4,p=e*8;return this.int16[c+0]=r,this.int16[c+1]=i,this.uint8[p+4]=o,this.uint8[p+5]=a,this.uint8[p+6]=s,this.uint8[p+7]=l,e}};u(Vl,"StructArrayLayout2i4ub8");var Pi=Vl;Pi.prototype.bytesPerElement=8;O("StructArrayLayout2i4ub8",Pi);var Ul=class Ul extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,r)}emplace(e,r,i){let o=e*2;return this.float32[o+0]=r,this.float32[o+1]=i,e}};u(Ul,"StructArrayLayout2f8");var Ut=Ul;Ut.prototype.bytesPerElement=8;O("StructArrayLayout2f8",Ut);var Nl=class Nl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s,l,c,p,m){let h=this.length;return this.resize(h+1),this.emplace(h,e,r,i,o,a,s,l,c,p,m)}emplace(e,r,i,o,a,s,l,c,p,m,h){let d=e*10;return this.uint16[d+0]=r,this.uint16[d+1]=i,this.uint16[d+2]=o,this.uint16[d+3]=a,this.uint16[d+4]=s,this.uint16[d+5]=l,this.uint16[d+6]=c,this.uint16[d+7]=p,this.uint16[d+8]=m,this.uint16[d+9]=h,e}};u(Nl,"StructArrayLayout10ui20");var Ti=Nl;Ti.prototype.bytesPerElement=20;O("StructArrayLayout10ui20",Ti);var Gl=class Gl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s,l,c,p,m,h,d){let g=this.length;return this.resize(g+1),this.emplace(g,e,r,i,o,a,s,l,c,p,m,h,d)}emplace(e,r,i,o,a,s,l,c,p,m,h,d,g){let y=e*12;return this.int16[y+0]=r,this.int16[y+1]=i,this.int16[y+2]=o,this.int16[y+3]=a,this.uint16[y+4]=s,this.uint16[y+5]=l,this.uint16[y+6]=c,this.uint16[y+7]=p,this.int16[y+8]=m,this.int16[y+9]=h,this.int16[y+10]=d,this.int16[y+11]=g,e}};u(Gl,"StructArrayLayout4i4ui4i24");var Ii=Gl;Ii.prototype.bytesPerElement=24;O("StructArrayLayout4i4ui4i24",Ii);var ql=class ql extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,i)}emplace(e,r,i,o){let a=e*3;return this.float32[a+0]=r,this.float32[a+1]=i,this.float32[a+2]=o,e}};u(ql,"StructArrayLayout3f12");var Ai=ql;Ai.prototype.bytesPerElement=12;O("StructArrayLayout3f12",Ai);var jl=class jl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let i=e*1;return this.uint32[i+0]=r,e}};u(jl,"StructArrayLayout1ul4");var Ci=jl;Ci.prototype.bytesPerElement=4;O("StructArrayLayout1ul4",Ci);var Hl=class Hl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s,l,c,p){let m=this.length;return this.resize(m+1),this.emplace(m,e,r,i,o,a,s,l,c,p)}emplace(e,r,i,o,a,s,l,c,p,m){let h=e*10,d=e*5;return this.int16[h+0]=r,this.int16[h+1]=i,this.int16[h+2]=o,this.int16[h+3]=a,this.int16[h+4]=s,this.int16[h+5]=l,this.uint32[d+3]=c,this.uint16[h+8]=p,this.uint16[h+9]=m,e}};u(Hl,"StructArrayLayout6i1ul2ui20");var Ei=Hl;Ei.prototype.bytesPerElement=20;O("StructArrayLayout6i1ul2ui20",Ei);var Zl=class Zl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,e,r,i,o,a,s)}emplace(e,r,i,o,a,s,l){let c=e*6;return this.int16[c+0]=r,this.int16[c+1]=i,this.int16[c+2]=o,this.int16[c+3]=a,this.int16[c+4]=s,this.int16[c+5]=l,e}};u(Zl,"StructArrayLayout2i2i2i12");var Mi=Zl;Mi.prototype.bytesPerElement=12;O("StructArrayLayout2i2i2i12",Mi);var Wl=class Wl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,e,r,i,o,a)}emplace(e,r,i,o,a,s){let l=e*4,c=e*8;return this.float32[l+0]=r,this.float32[l+1]=i,this.float32[l+2]=o,this.int16[c+6]=a,this.int16[c+7]=s,e}};u(Wl,"StructArrayLayout2f1f2i16");var Li=Wl;Li.prototype.bytesPerElement=16;O("StructArrayLayout2f1f2i16",Li);var Xl=class Xl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,i,o)}emplace(e,r,i,o,a){let s=e*12,l=e*3;return this.uint8[s+0]=r,this.uint8[s+1]=i,this.float32[l+1]=o,this.float32[l+2]=a,e}};u(Xl,"StructArrayLayout2ub2f12");var ki=Xl;ki.prototype.bytesPerElement=12;O("StructArrayLayout2ub2f12",ki);var Kl=class Kl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,i)}emplace(e,r,i,o){let a=e*3;return this.uint16[a+0]=r,this.uint16[a+1]=i,this.uint16[a+2]=o,e}};u(Kl,"StructArrayLayout3ui6");var Vr=Kl;Vr.prototype.bytesPerElement=6;O("StructArrayLayout3ui6",Vr);var $l=class $l extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b){let w=this.length;return this.resize(w+1),this.emplace(w,e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b)}emplace(e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b,w){let S=e*24,P=e*12,I=e*48;return this.int16[S+0]=r,this.int16[S+1]=i,this.uint16[S+2]=o,this.uint16[S+3]=a,this.uint32[P+2]=s,this.uint32[P+3]=l,this.uint32[P+4]=c,this.uint16[S+10]=p,this.uint16[S+11]=m,this.uint16[S+12]=h,this.float32[P+7]=d,this.float32[P+8]=g,this.uint8[I+36]=y,this.uint8[I+37]=x,this.uint8[I+38]=v,this.uint32[P+10]=b,this.int16[S+22]=w,e}};u($l,"StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48");var Di=$l;Di.prototype.bytesPerElement=48;O("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Di);var Jl=class Jl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b,w,S,P,I,C,z,D,A,R,U,L){let N=this.length;return this.resize(N+1),this.emplace(N,e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b,w,S,P,I,C,z,D,A,R,U,L)}emplace(e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b,w,S,P,I,C,z,D,A,R,U,L,N){let V=e*34,W=e*17;return this.int16[V+0]=r,this.int16[V+1]=i,this.int16[V+2]=o,this.int16[V+3]=a,this.int16[V+4]=s,this.int16[V+5]=l,this.int16[V+6]=c,this.int16[V+7]=p,this.uint16[V+8]=m,this.uint16[V+9]=h,this.uint16[V+10]=d,this.uint16[V+11]=g,this.uint16[V+12]=y,this.uint16[V+13]=x,this.uint16[V+14]=v,this.uint16[V+15]=b,this.uint16[V+16]=w,this.uint16[V+17]=S,this.uint16[V+18]=P,this.uint16[V+19]=I,this.uint16[V+20]=C,this.uint16[V+21]=z,this.uint16[V+22]=D,this.uint32[W+12]=A,this.float32[W+13]=R,this.float32[W+14]=U,this.float32[W+15]=L,this.float32[W+16]=N,e}};u(Jl,"StructArrayLayout8i15ui1ul4f68");var Fi=Jl;Fi.prototype.bytesPerElement=68;O("StructArrayLayout8i15ui1ul4f68",Fi);var Yl=class Yl extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let i=e*1;return this.float32[i+0]=r,e}};u(Yl,"StructArrayLayout1f4");var mr=Yl;mr.prototype.bytesPerElement=4;O("StructArrayLayout1f4",mr);var Ql=class Ql extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r,i){let o=this.length;return this.resize(o+1),this.emplace(o,e,r,i)}emplace(e,r,i,o){let a=e*2,s=e*4;return this.uint32[a+0]=r,this.uint16[s+2]=i,this.uint16[s+3]=o,e}};u(Ql,"StructArrayLayout1ul2ui8");var zi=Ql;zi.prototype.bytesPerElement=8;O("StructArrayLayout1ul2ui8",zi);var eu=class eu extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,r){let i=this.length;return this.resize(i+1),this.emplace(i,e,r)}emplace(e,r,i){let o=e*2;return this.uint16[o+0]=r,this.uint16[o+1]=i,e}};u(eu,"StructArrayLayout2ui4");var Bi=eu;Bi.prototype.bytesPerElement=4;O("StructArrayLayout2ui4",Bi);var tu=class tu extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){let r=this.length;return this.resize(r+1),this.emplace(r,e)}emplace(e,r){let i=e*1;return this.uint16[i+0]=r,e}};u(tu,"StructArrayLayout1ui2");var Ri=tu;Ri.prototype.bytesPerElement=2;O("StructArrayLayout1ui2",Ri);var ru=class ru extends Ce{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,r,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,e,r,i,o)}emplace(e,r,i,o,a){let s=e*4;return this.float32[s+0]=r,this.float32[s+1]=i,this.float32[s+2]=o,this.float32[s+3]=a,e}};u(ru,"StructArrayLayout4f16");var Ur=ru;Ur.prototype.bytesPerElement=16;O("StructArrayLayout4f16",Ur);var iu=class iu extends cr{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new wf.default(this.anchorPointX,this.anchorPointY)}};u(iu,"CollisionBoxStruct");var Kn=iu;Kn.prototype.size=20;var nu=class nu extends Ei{get(t){return new Kn(this,t)}};u(nu,"CollisionBoxArray");var Oi=nu;O("CollisionBoxArray",Oi);var ou=class ou extends cr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};u(ou,"PlacedSymbolStruct");var $n=ou;$n.prototype.size=48;var au=class au extends Di{get(t){return new $n(this,t)}};u(au,"PlacedSymbolArray");var Vi=au;O("PlacedSymbolArray",Vi);var su=class su extends cr{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}};u(su,"SymbolInstanceStruct");var Jn=su;Jn.prototype.size=68;var lu=class lu extends Fi{get(t){return new Jn(this,t)}};u(lu,"SymbolInstanceArray");var Ui=lu;O("SymbolInstanceArray",Ui);var uu=class uu extends mr{getoffsetX(t){return this.float32[t*1+0]}};u(uu,"GlyphOffsetArray");var Ni=uu;O("GlyphOffsetArray",Ni);var cu=class cu extends Or{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};u(cu,"SymbolLineVertexArray");var Gi=cu;O("SymbolLineVertexArray",Gi);var pu=class pu extends cr{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]}};u(pu,"FeatureIndexStruct");var Yn=pu;Yn.prototype.size=8;var mu=class mu extends zi{get(t){return new Yn(this,t)}};u(mu,"FeatureIndexArray");var qi=mu;O("FeatureIndexArray",qi);var hu=class hu extends pr{};u(hu,"PosArray");var Nt=hu,fu=class fu extends Or{};u(fu,"Pos3dArray");var Qn=fu,du=class du extends wi{};u(du,"RasterBoundsArray");var Nr=du,yu=class yu extends pr{};u(yu,"CircleLayoutArray");var eo=yu,gu=class gu extends pr{};u(gu,"FillLayoutArray");var to=gu,xu=class xu extends Si{};u(xu,"FillExtrusionLayoutArray");var ro=xu;var _u=class _u extends Pi{};u(_u,"LineLayoutArray");var io=_u,bu=class bu extends Ut{};u(bu,"LineExtLayoutArray");var no=bu,vu=class vu extends Ti{};u(vu,"PatternLayoutArray");var It=vu,wu=class wu extends Ii{};u(wu,"SymbolLayoutArray");var oo=wu,Su=class Su extends Ai{};u(Su,"SymbolDynamicLayoutArray");var ao=Su,Pu=class Pu extends Ci{};u(Pu,"SymbolOpacityArray");var so=Pu,Tu=class Tu extends Mi{};u(Tu,"CollisionBoxLayoutArray");var ji=Tu,Iu=class Iu extends Li{};u(Iu,"CollisionCircleLayoutArray");var lo=Iu,Au=class Au extends ki{};u(Au,"CollisionVertexArray");var uo=Au,Cu=class Cu extends Vr{};u(Cu,"QuadTriangleArray");var co=Cu,Eu=class Eu extends Vr{};u(Eu,"TriangleIndexArray");var qe=Eu,Mu=class Mu extends Bi{};u(Mu,"LineIndexArray");var Gt=Mu,Lu=class Lu extends Ri{};u(Lu,"LineStripIndexArray");var Hi=Lu;f();var S_=fe([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Sf,size:j1,alignment:H1}=S_;f();var hr=class hr{constructor(t=[]){this.segments=t}prepareSegment(t,e,r,i){let o=this.segments[this.segments.length-1];return t>hr.MAX_VERTEX_ARRAY_LENGTH&&xe("Max vertices per segment is ".concat(hr.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(t)),(!o||o.vertexLength+t>hr.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i)&&(o={vertexOffset:e.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0},i!==void 0&&(o.sortKey=i),this.segments.push(o)),o}get(){return this.segments}destroy(){for(let t of this.segments)for(let e in t.vaos)t.vaos[e].destroy()}static simpleSegment(t,e,r,i){return new hr([{vertexOffset:t,primitiveOffset:e,vertexLength:r,primitiveLength:i,vaos:{},sortKey:0}])}};u(hr,"SegmentVector");var ae=hr;ae.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;O("SegmentVector",ae);f();f();function ku(n,t){return n=ye(Math.floor(n),0,255),t=ye(Math.floor(t),0,255),256*n+t}u(ku,"packUint8ToFloat");f();var Zi=fe([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);f();var Tf=te(zh(),1);var mo=class mo{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,e,r,i){this.ids.push(Pf(t)),this.positions.push(e,r,i)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let e=Pf(t),r=0,i=this.ids.length-1;for(;r<i;){let a=r+i>>1;this.ids[a]>=e?i=a:r=a+1}let o=[];for(;this.ids[r]===e;){let a=this.positions[3*r],s=this.positions[3*r+1],l=this.positions[3*r+2];o.push({index:a,start:s,end:l}),r++}return o}static serialize(t,e){let r=new Float64Array(t.ids),i=new Uint32Array(t.positions);return Du(r,i,0,r.length-1),e&&e.push(r.buffer,i.buffer),{ids:r,positions:i}}static deserialize(t){let e=new mo;return e.ids=t.ids,e.positions=t.positions,e.indexed=!0,e}};u(mo,"FeaturePositionMap");var Wi=mo;function Pf(n){let t=+n;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:(0,Tf.default)(String(n))}u(Pf,"getNumericId");function Du(n,t,e,r){for(;e<r;){let i=n[e+r>>1],o=e-1,a=r+1;for(;;){do o++;while(n[o]<i);do a--;while(n[a]>i);if(o>=a)break;po(n,o,a),po(t,3*o,3*a),po(t,3*o+1,3*a+1),po(t,3*o+2,3*a+2)}a-e<r-a?(Du(n,t,e,a),e=a+1):(Du(n,t,a+1,r),r=a)}}u(Du,"sort");function po(n,t,e){let r=n[t];n[t]=n[e],n[e]=r}u(po,"swap");O("FeaturePositionMap",Wi);f();var Fu=class Fu{constructor(t,e){this.gl=t.gl,this.location=e}};u(Fu,"Uniform");var At=Fu,zu=class zu extends At{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1i(this.location,t))}};u(zu,"Uniform1i");var X=zu,Bu=class Bu extends At{constructor(t,e){super(t,e),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}};u(Bu,"Uniform1f");var B=Bu,Ru=class Ru extends At{constructor(t,e){super(t,e),this.current=[0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1])&&(this.current=t,this.gl.uniform2f(this.location,t[0],t[1]))}};u(Ru,"Uniform2f");var $=Ru,Ou=class Ou extends At{constructor(t,e){super(t,e),this.current=[0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2])&&(this.current=t,this.gl.uniform3f(this.location,t[0],t[1],t[2]))}};u(Ou,"Uniform3f");var Ze=Ou,Vu=class Vu extends At{constructor(t,e){super(t,e),this.current=[0,0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2]||t[3]!==this.current[3])&&(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}};u(Vu,"Uniform4f");var qt=Vu,Uu=class Uu extends At{constructor(t,e){super(t,e),this.current=me.transparent}set(t){(t.r!==this.current.r||t.g!==this.current.g||t.b!==this.current.b||t.a!==this.current.a)&&(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}};u(Uu,"UniformColor");var pt=Uu,P_=new Float32Array(16),Nu=class Nu extends At{constructor(t,e){super(t,e),this.current=P_}set(t){if(t[12]!==this.current[12]||t[0]!==this.current[0]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);return}for(let e=1;e<16;e++)if(t[e]!==this.current[e]){this.current=t,this.gl.uniformMatrix4fv(this.location,!1,t);break}}};u(Nu,"UniformMatrix4f");var J=Nu;function Gu(n){return[ku(255*n.r,255*n.g),ku(255*n.b,255*n.a)]}u(Gu,"packColor");var qu=class qu{constructor(t,e,r){this.value=t,this.uniformNames=e.map(i=>"u_".concat(i)),this.type=r}setUniform(t,e,r){t.set(r.constantOr(this.value))}getBinding(t,e,r){return this.type==="color"?new pt(t,e):new B(t,e)}};u(qu,"ConstantBinder");var fr=qu,ju=class ju{constructor(t,e){this.uniformNames=e.map(r=>"u_".concat(r)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,e){this.pixelRatioFrom=e.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=e.tlbr,this.patternTo=t.tlbr}setUniform(t,e,r,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&t.set(o)}getBinding(t,e,r){return r.substr(0,9)==="u_pattern"?new qt(t,e):new B(t,e)}};u(ju,"CrossFadedConstantBinder");var jt=ju,Hu=class Hu{constructor(t,e,r,i){this.expression=t,this.type=r,this.maxValue=0,this.paintVertexAttributes=e.map(o=>({name:"a_".concat(o),type:"Float32",components:r==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,e,r,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new le(0),e,{},i,[],o);this.paintVertexArray.resize(t),this._setPaintValue(a,t,s)}updatePaintArray(t,e,r,i){let o=this.expression.evaluate({zoom:0},r,i);this._setPaintValue(t,e,o)}_setPaintValue(t,e,r){if(this.type==="color"){let i=Gu(r);for(let o=t;o<e;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=t;i<e;i++)this.paintVertexArray.emplace(i,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}};u(Hu,"SourceExpressionBinder");var dt=Hu,Zu=class Zu{constructor(t,e,r,i,o,a){this.expression=t,this.uniformNames=e.map(s=>"u_".concat(s,"_t")),this.type=r,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=e.map(s=>({name:"a_".concat(s),type:"Float32",components:r==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,e,r,i,o){let a=this.expression.evaluate(new le(this.zoom),e,{},i,[],o),s=this.expression.evaluate(new le(this.zoom+1),e,{},i,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(l,t,a,s)}updatePaintArray(t,e,r,i){let o=this.expression.evaluate({zoom:this.zoom},r,i),a=this.expression.evaluate({zoom:this.zoom+1},r,i);this._setPaintValue(t,e,o,a)}_setPaintValue(t,e,r,i){if(this.type==="color"){let o=Gu(r),a=Gu(i);for(let s=t;s<e;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=t;o<e;o++)this.paintVertexArray.emplace(o,r,i);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,e){let r=this.useIntegerZoom?Math.floor(e.zoom):e.zoom,i=ye(this.expression.interpolationFactor(r,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,e,r){return new B(t,e)}};u(Zu,"CompositeExpressionBinder");var nt=Zu,Wu=class Wu{constructor(t,e,r,i,o,a){this.expression=t,this.type=e,this.useIntegerZoom=r,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(t,e,r){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(i,t,e.patterns&&e.patterns[this.layerId],r)}updatePaintArray(t,e,r,i,o){this._setPaintValues(t,e,r.patterns&&r.patterns[this.layerId],o)}_setPaintValues(t,e,r,i){if(!i||!r)return;let{min:o,mid:a,max:s}=r,l=i[o],c=i[a],p=i[s];if(!(!l||!c||!p))for(let m=t;m<e;m++)this.zoomInPaintVertexArray.emplace(m,c.tl[0],c.tl[1],c.br[0],c.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],c.pixelRatio,l.pixelRatio),this.zoomOutPaintVertexArray.emplace(m,c.tl[0],c.tl[1],c.br[0],c.br[1],p.tl[0],p.tl[1],p.br[0],p.br[1],c.pixelRatio,p.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Zi.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Zi.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}};u(Wu,"CrossFadedCompositeBinder");var gt=Wu,Xu=class Xu{constructor(t,e,r){this.binders={},this._buffers=[];let i=[];for(let o in t.paint._values){if(!r(o))continue;let a=t.paint.get(o);if(!(a instanceof je)||!Cn(a.property.specification))continue;let s=T_(o,t.type),l=a.value,c=a.property.specification.type,p=a.property.useIntegerZoom,m=a.property.specification["property-type"],h=m==="cross-faded"||m==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=h?new jt(l.value,s):new fr(l.value,s,c),i.push("/u_".concat(o));else if(l.kind==="source"||h){let d=If(o,c,"source");this.binders[o]=h?new gt(l,c,p,e,d,t.id):new dt(l,s,c,d),i.push("/a_".concat(o))}else{let d=If(o,c,"composite");this.binders[o]=new nt(l,s,c,p,e,d),i.push("/z_".concat(o))}}this.cacheKey=i.sort().join("")}getMaxValue(t){let e=this.binders[t];return e instanceof dt||e instanceof nt?e.maxValue:0}populatePaintArrays(t,e,r,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof dt||s instanceof nt||s instanceof gt)&&s.populatePaintArray(t,e,r,i,o)}}setConstantPatternPositions(t,e){for(let r in this.binders){let i=this.binders[r];i instanceof jt&&i.setConstantPatternPositions(t,e)}}updatePaintArrays(t,e,r,i,o){let a=!1;for(let s in t){let l=e.getPositions(s);for(let c of l){let p=r.feature(c.index);for(let m in this.binders){let h=this.binders[m];if((h instanceof dt||h instanceof nt||h instanceof gt)&&h.expression.isStateDependent===!0){let d=i.paint.get(m);h.expression=d.value,h.updatePaintArray(c.start,c.end,p,t[s],o),a=!0}}}}return a}defines(){let t=[];for(let e in this.binders){let r=this.binders[e];(r instanceof fr||r instanceof jt)&&t.push(...r.uniformNames.map(i=>"#define HAS_UNIFORM_".concat(i)))}return t}getBinderAttributes(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof dt||r instanceof nt)for(let i=0;i<r.paintVertexAttributes.length;i++)t.push(r.paintVertexAttributes[i].name);else if(r instanceof gt)for(let i=0;i<Zi.members.length;i++)t.push(Zi.members[i].name)}return t}getBinderUniforms(){let t=[];for(let e in this.binders){let r=this.binders[e];if(r instanceof fr||r instanceof jt||r instanceof nt)for(let i of r.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,e){let r=[];for(let i in this.binders){let o=this.binders[i];if(o instanceof fr||o instanceof jt||o instanceof nt){for(let a of o.uniformNames)if(e[a]){let s=o.getBinding(t,e[a],a);r.push({name:a,property:i,binding:s})}}}return r}setUniforms(t,e,r,i){for(let{name:o,property:a,binding:s}of e)this.binders[a].setUniform(s,i,r.get(a),o)}updatePaintBuffers(t){this._buffers=[];for(let e in this.binders){let r=this.binders[e];if(t&&r instanceof gt){let i=t.fromScale===2?r.zoomInPaintVertexBuffer:r.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(r instanceof dt||r instanceof nt)&&r.paintVertexBuffer&&this._buffers.push(r.paintVertexBuffer)}}upload(t){for(let e in this.binders){let r=this.binders[e];(r instanceof dt||r instanceof nt||r instanceof gt)&&r.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let e=this.binders[t];(e instanceof dt||e instanceof nt||e instanceof gt)&&e.destroy()}}};u(Xu,"ProgramConfiguration");var ho=Xu,Ku=class Ku{constructor(t,e,r=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new ho(i,e,r);this.needsUpload=!1,this._featureMap=new Wi,this._bufferOffset=0}populatePaintArrays(t,e,r,i,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(t,e,i,o,a);e.id!==void 0&&this._featureMap.add(e.id,r,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,e,r,i){for(let o of r)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(t,this._featureMap,e,o,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let e in this.programConfigurations)this.programConfigurations[e].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};u(Ku,"ProgramConfigurationSet");var Ye=Ku;function T_(n,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[n]||[n.replace("".concat(t,"-"),"").replace(/-/g,"_")]}u(T_,"paintAttributeNames");function I_(n){return{"line-pattern":{source:It,composite:It},"fill-pattern":{source:It,composite:It},"fill-extrusion-pattern":{source:It,composite:It}}[n]}u(I_,"getLayoutException");function If(n,t,e){let r={color:{source:Ut,composite:Ur},number:{source:mr,composite:Ut}},i=I_(n);return i&&i[e]||r[t][e]}u(If,"layoutType");O("ConstantBinder",fr);O("CrossFadedConstantBinder",jt);O("SourceExpressionBinder",dt);O("CrossFadedCompositeBinder",gt);O("CompositeExpressionBinder",nt);O("ProgramConfiguration",ho,{omit:["_buffers"]});O("ProgramConfigurationSet",Ye);f();f();f();var A_=15,$u=Math.pow(2,A_-1)-1,Af=-$u-1;function Qe(n){let t=8192/n.extent,e=n.loadGeometry();for(let r=0;r<e.length;r++){let i=e[r];for(let o=0;o<i.length;o++){let a=i[o],s=Math.round(a.x*t),l=Math.round(a.y*t);a.x=ye(s,Af,$u),a.y=ye(l,Af,$u),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&xe("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return e}u(Qe,"loadGeometry");f();function et(n,t){return{type:n.type,id:n.id,properties:n.properties,geometry:t?Qe(n):[]}}u(et,"toEvaluationFeature");function fo(n,t,e,r,i){n.emplaceBack(t*2+(r+1)/2,e*2+(i+1)/2)}u(fo,"addCircleVertex");var Ju=class Ju{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new eo,this.indexArray=new qe,this.segments=new ae,this.programConfigurations=new Ye(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){let i=this.layers[0],o=[],a=null,s=!1;i.type==="circle"&&(a=i.layout.get("circle-sort-key"),s=!a.isConstant());for(let{feature:l,id:c,index:p,sourceLayerIndex:m}of t){let h=this.layers[0]._featureFilter.needGeometry,d=et(l,h);if(!this.layers[0]._featureFilter.filter(new le(this.zoom),d,r))continue;let g=s?a.evaluate(d,{},r):void 0,y={id:c,properties:l.properties,type:l.type,sourceLayerIndex:m,index:p,geometry:h?d.geometry:Qe(l),patterns:{},sortKey:g};o.push(y)}s&&o.sort((l,c)=>l.sortKey-c.sortKey);for(let l of o){let{geometry:c,index:p,sourceLayerIndex:m}=l,h=t[p].feature;this.addFeature(l,c,p,r),e.featureIndex.insert(h,c,p,m,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Sf),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,e,r,i){for(let o of e)for(let a of o){let s=a.x,l=a.y;if(s<0||s>=8192||l<0||l>=8192)continue;let c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),p=c.vertexLength;fo(this.layoutVertexArray,s,l,-1,-1),fo(this.layoutVertexArray,s,l,1,-1),fo(this.layoutVertexArray,s,l,1,1),fo(this.layoutVertexArray,s,l,-1,1),this.indexArray.emplaceBack(p,p+1,p+2),this.indexArray.emplaceBack(p,p+3,p+2),c.vertexLength+=4,c.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,{},i)}};u(Ju,"CircleBucket");var dr=Ju;O("CircleBucket",dr,{omit:["layers"]});f();var Xi=te(be(),1);function yo(n,t){for(let e=0;e<n.length;e++)if(Gr(t,n[e]))return!0;for(let e=0;e<t.length;e++)if(Gr(n,t[e]))return!0;return!!Qu(n,t)}u(yo,"polygonIntersectsPolygon");function Ef(n,t,e){return!!(Gr(n,t)||Yu(t,n,e))}u(Ef,"polygonIntersectsBufferedPoint");function go(n,t){if(n.length===1)return Cf(t,n[0]);for(let e=0;e<t.length;e++){let r=t[e];for(let i=0;i<r.length;i++)if(Gr(n,r[i]))return!0}for(let e=0;e<n.length;e++)if(Cf(t,n[e]))return!0;for(let e=0;e<t.length;e++)if(Qu(n,t[e]))return!0;return!1}u(go,"polygonIntersectsMultiPolygon");function Mf(n,t,e){for(let r=0;r<t.length;r++){let i=t[r];if(n.length>=3){for(let o=0;o<i.length;o++)if(Gr(n,i[o]))return!0}if(C_(n,i,e))return!0}return!1}u(Mf,"polygonIntersectsBufferedMultiLine");function C_(n,t,e){if(n.length>1){if(Qu(n,t))return!0;for(let r=0;r<t.length;r++)if(Yu(t[r],n,e))return!0}for(let r=0;r<n.length;r++)if(Yu(n[r],t,e))return!0;return!1}u(C_,"lineIntersectsBufferedLine");function Qu(n,t){if(n.length===0||t.length===0)return!1;for(let e=0;e<n.length-1;e++){let r=n[e],i=n[e+1];for(let o=0;o<t.length-1;o++){let a=t[o],s=t[o+1];if(E_(r,i,a,s))return!0}}return!1}u(Qu,"lineIntersectsLine");function E_(n,t,e,r){return Pt(n,e,r)!==Pt(t,e,r)&&Pt(n,t,e)!==Pt(n,t,r)}u(E_,"lineSegmentIntersectsLineSegment");function Yu(n,t,e){let r=e*e;if(t.length===1)return n.distSqr(t[0])<r;for(let i=1;i<t.length;i++){let o=t[i-1],a=t[i];if(Lf(n,o,a)<r)return!0}return!1}u(Yu,"pointIntersectsBufferedLine");function Lf(n,t,e){let r=t.distSqr(e);if(r===0)return n.distSqr(t);let i=((n.x-t.x)*(e.x-t.x)+(n.y-t.y)*(e.y-t.y))/r;return i<0?n.distSqr(t):i>1?n.distSqr(e):n.distSqr(e.sub(t)._mult(i)._add(t))}u(Lf,"distToSegmentSquared");function Cf(n,t){let e=!1,r,i,o;for(let a=0;a<n.length;a++){r=n[a];for(let s=0,l=r.length-1;s<r.length;l=s++)i=r[s],o=r[l],i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(e=!e)}return e}u(Cf,"multiPolygonContainsPoint");function Gr(n,t){let e=!1;for(let r=0,i=n.length-1;r<n.length;i=r++){let o=n[r],a=n[i];o.y>t.y!=a.y>t.y&&t.x<(a.x-o.x)*(t.y-o.y)/(a.y-o.y)+o.x&&(e=!e)}return e}u(Gr,"polygonContainsPoint");function kf(n,t,e,r,i){for(let a of n)if(t<=a.x&&e<=a.y&&r>=a.x&&i>=a.y)return!0;let o=[new Xi.default(t,e),new Xi.default(t,i),new Xi.default(r,i),new Xi.default(r,e)];if(n.length>2){for(let a of o)if(Gr(n,a))return!0}for(let a=0;a<n.length-1;a++){let s=n[a],l=n[a+1];if(M_(s,l,o))return!0}return!1}u(kf,"polygonIntersectsBox");function M_(n,t,e){let r=e[0],i=e[2];if(n.x<r.x&&t.x<r.x||n.x>i.x&&t.x>i.x||n.y<r.y&&t.y<r.y||n.y>i.y&&t.y>i.y)return!1;let o=Pt(n,t,e[0]);return o!==Pt(n,t,e[1])||o!==Pt(n,t,e[2])||o!==Pt(n,t,e[3])}u(M_,"edgeIntersectsBox");f();var xo=te(be(),1);function yr(n,t,e){let r=t.paint.get(n).value;return r.kind==="constant"?r.value:e.programConfigurations.get(t.id).getMaxValue(n)}u(yr,"getMaximumPaintValue");function Ht(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])}u(Ht,"translateDistance");function Zt(n,t,e,r,i){if(!t[0]&&!t[1])return n;let o=xo.default.convert(t)._mult(i);e==="viewport"&&o._rotate(-r);let a=[];for(let s=0;s<n.length;s++){let l=n[s];a.push(l.sub(o))}return a}u(Zt,"translate");function Df(n,t){let e=[];for(let r=0;r<n.length;r++){let i=n[r],o=[];for(let a=0;a<i.length;a++){let s=i[a-1],l=i[a],c=i[a+1],p=a===0?new xo.default(0,0):l.sub(s)._unit()._perp(),m=a===i.length-1?new xo.default(0,0):c.sub(l)._unit()._perp(),h=p._add(m)._unit(),d=h.x*m.x+h.y*m.y;d!==0&&h._mult(1/d),o.push(h._mult(t)._add(l))}e.push(o)}return e}u(Df,"offsetLine");f();var Ff,k_=u(()=>Ff=Ff||new Ie({"circle-sort-key":new H(T.layout_circle["circle-sort-key"])}),"getLayout"),zf,D_=u(()=>zf=zf||new Ie({"circle-radius":new H(T.paint_circle["circle-radius"]),"circle-color":new H(T.paint_circle["circle-color"]),"circle-blur":new H(T.paint_circle["circle-blur"]),"circle-opacity":new H(T.paint_circle["circle-opacity"]),"circle-translate":new q(T.paint_circle["circle-translate"]),"circle-translate-anchor":new q(T.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new q(T.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new q(T.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new H(T.paint_circle["circle-stroke-width"]),"circle-stroke-color":new H(T.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new H(T.paint_circle["circle-stroke-opacity"])}),"getPaint"),Bf={get paint(){return D_()},get layout(){return k_()}};var Rf=te(be(),1);var ec=class ec extends Le{constructor(e){super(e,Bf)}createBucket(e){return new dr(e)}queryRadius(e){let r=e;return yr("circle-radius",this,r)+yr("circle-stroke-width",this,r)+Ht(this.paint.get("circle-translate"))}queryIntersectsFeature(e,r,i,o,a,s,l,c){let p=Zt(e,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,l),m=this.paint.get("circle-radius").evaluate(r,i),h=this.paint.get("circle-stroke-width").evaluate(r,i),d=m+h,g=this.paint.get("circle-pitch-alignment")==="map",y=g?p:F_(p,c),x=g?d*l:d;for(let v of o)for(let b of v){let w=g?b:Of(b,c),S=x,P=Re.transformMat4([],[b.x,b.y,0,1],c);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?S*=P[3]/s.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(S*=s.cameraToCenterDistance/P[3]),Ef(y,w,S))return!0}return!1}};u(ec,"CircleStyleLayer");var _o=ec;function Of(n,t){let e=Re.transformMat4([],[n.x,n.y,0,1],t);return new Rf.default(e[0]/e[3],e[1]/e[3])}u(Of,"projectPoint");function F_(n,t){return n.map(e=>Of(e,t))}u(F_,"projectQueryGeometry");f();f();var tc=class tc extends dr{};u(tc,"HeatmapBucket");var Ki=tc;O("HeatmapBucket",Ki,{omit:["layers"]});f();var Vf,z_=u(()=>Vf=Vf||new Ie({"heatmap-radius":new H(T.paint_heatmap["heatmap-radius"]),"heatmap-weight":new H(T.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new q(T.paint_heatmap["heatmap-intensity"]),"heatmap-color":new ur(T.paint_heatmap["heatmap-color"]),"heatmap-opacity":new q(T.paint_heatmap["heatmap-opacity"])}),"getPaint"),Uf={get paint(){return z_()}};f();f();function rc(n,{width:t,height:e},r,i){if(!i)i=new Uint8Array(t*e*r);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==t*e*r)throw new RangeError("mismatched image size. expected: ".concat(i.length," but got: ").concat(t*e*r));return n.width=t,n.height=e,n.data=i,n}u(rc,"createImage");function Nf(n,{width:t,height:e},r){if(t===n.width&&e===n.height)return;let i=rc({},{width:t,height:e},r);ic(n,i,{x:0,y:0},{x:0,y:0},{width:Math.min(n.width,t),height:Math.min(n.height,e)},r),n.width=t,n.height=e,n.data=i.data}u(Nf,"resizeImage");function ic(n,t,e,r,i,o){if(i.width===0||i.height===0)return t;if(i.width>n.width||i.height>n.height||e.x>n.width-i.width||e.y>n.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range destination coordinates for image copy");let a=n.data,s=t.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){let c=((e.y+l)*n.width+e.x)*o,p=((r.y+l)*t.width+r.x)*o;for(let m=0;m<i.width*o;m++)s[p+m]=a[c+m]}return t}u(ic,"copyImage");var bo=class bo{constructor(t,e){rc(this,t,1,e)}resize(t){Nf(this,t,1)}clone(){return new bo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,i,o){ic(t,e,r,i,o,1)}};u(bo,"AlphaImage");var gr=bo,vo=class vo{constructor(t,e){rc(this,t,4,e)}resize(t){Nf(this,t,4)}replace(t,e){e?this.data.set(t):t instanceof Uint8ClampedArray?this.data=new Uint8Array(t.buffer):this.data=t}clone(){return new vo({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,e,r,i,o){ic(t,e,r,i,o,4)}};u(vo,"RGBAImage");var _e=vo;O("AlphaImage",gr);O("RGBAImage",_e);function wo(n){let t={},e=n.resolution||256,r=n.clips?n.clips.length:1,i=n.image||new _e({width:e,height:r});if(!Xh(e))throw new Error("width is not a power of 2 - ".concat(e));let o=u((a,s,l)=>{t[n.evaluationKey]=l;let c=n.expression.evaluate(t);i.data[a+s+0]=Math.floor(c.r*255/c.a),i.data[a+s+1]=Math.floor(c.g*255/c.a),i.data[a+s+2]=Math.floor(c.b*255/c.a),i.data[a+s+3]=Math.floor(c.a*255)},"renderPixel");if(n.clips)for(let a=0,s=0;a<r;++a,s+=e*4)for(let l=0,c=0;l<e;l++,c+=4){let p=l/(e-1),{start:m,end:h}=n.clips[a],d=m*(1-p)+h*p;o(s,c,d)}else for(let a=0,s=0;a<e;a++,s+=4){let l=a/(e-1);o(0,s,l)}return i}u(wo,"renderColorRamp");var nc=class nc extends Le{constructor(e){super(e,Uf);this._updateColorRamp()}createBucket(e){return new Ki(e)}_handleSpecialPaintPropertyUpdate(e){e==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let e=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=wo({expression:e,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};u(nc,"HeatmapStyleLayer");var So=nc;f();f();var Gf,B_=u(()=>Gf=Gf||new Ie({"hillshade-illumination-direction":new q(T.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new q(T.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new q(T.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new q(T.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new q(T.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new q(T.paint_hillshade["hillshade-accent-color"])}),"getPaint"),qf={get paint(){return B_()}};var oc=class oc extends Le{constructor(e){super(e,qf)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};u(oc,"HillshadeStyleLayer");var Po=oc;f();f();f();var R_=fe([{name:"a_pos",components:2,type:"Int16"}],4);var{members:jf,size:TP,alignment:IP}=R_;var Hf=te(Bh(),1);f();function $i(n,t){let e=n.length;if(e<=1)return[n];let r=[],i,o;for(let a=0;a<e;a++){let s=Yh(n[a]);s!==0&&(n[a].area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&r.push(i),i=[n[a]]):i.push(n[a]))}if(i&&r.push(i),t>1)for(let a=0;a<r.length;a++)r[a].length<=t||(Rh(r[a],t,1,r[a].length-1,O_),r[a]=r[a].slice(0,t));return r}u($i,"classifyRings");function O_(n,t){return t.area-n.area}u(O_,"compareAreas");f();function qr(n,t,e){let r=e.patternDependencies,i=!1;for(let o of t){let a=o.paint.get("".concat(n,"-pattern"));a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,r[s.to]=!0,r[s.from]=!0)}return i}u(qr,"hasPattern");function jr(n,t,e,r,i){let o=i.patternDependencies;for(let a of t){let l=a.paint.get("".concat(n,"-pattern")).value;if(l.kind!=="constant"){let c=l.evaluate({zoom:r-1},e,{},i.availableImages),p=l.evaluate({zoom:r},e,{},i.availableImages),m=l.evaluate({zoom:r+1},e,{},i.availableImages);c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,m=m&&m.name?m.name:m,o[c]=!0,o[p]=!0,o[m]=!0,e.patterns[a.id]={min:c,mid:p,max:m}}}return e}u(jr,"addPatternDependencies");var V_=500,ac=class ac{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new to,this.indexArray=new qe,this.indexArray2=new Gt,this.programConfigurations=new Ye(t.layers,t.zoom),this.segments=new ae,this.segments2=new ae,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasPattern=qr("fill",this.layers,e);let i=this.layers[0].layout.get("fill-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:c,sourceLayerIndex:p}of t){let m=this.layers[0]._featureFilter.needGeometry,h=et(s,m);if(!this.layers[0]._featureFilter.filter(new le(this.zoom),h,r))continue;let d=o?i.evaluate(h,{},r,e.availableImages):void 0,g={id:l,properties:s.properties,type:s.type,sourceLayerIndex:p,index:c,geometry:m?h.geometry:Qe(s),patterns:{},sortKey:d};a.push(g)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:c,sourceLayerIndex:p}=s;if(this.hasPattern){let h=jr("fill",this.layers,s,this.zoom,e);this.patternFeatures.push(h)}else this.addFeature(s,l,c,r,{});let m=t[c].feature;e.featureIndex.insert(m,l,c,p,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,jf),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,e,r,i,o){for(let a of $i(e,V_)){let s=0;for(let d of a)s+=d.length;let l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),c=l.vertexLength,p=[],m=[];for(let d of a){if(d.length===0)continue;d!==a[0]&&m.push(p.length/2);let g=this.segments2.prepareSegment(d.length,this.layoutVertexArray,this.indexArray2),y=g.vertexLength;this.layoutVertexArray.emplaceBack(d[0].x,d[0].y),this.indexArray2.emplaceBack(y+d.length-1,y),p.push(d[0].x),p.push(d[0].y);for(let x=1;x<d.length;x++)this.layoutVertexArray.emplaceBack(d[x].x,d[x].y),this.indexArray2.emplaceBack(y+x-1,y+x),p.push(d[x].x),p.push(d[x].y);g.vertexLength+=d.length,g.primitiveLength+=d.length}let h=(0,Hf.default)(p,m);for(let d=0;d<h.length;d+=3)this.indexArray.emplaceBack(c+h[d],c+h[d+1],c+h[d+2]);l.vertexLength+=s,l.primitiveLength+=h.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,o,i)}};u(ac,"FillBucket");var Ji=ac;O("FillBucket",Ji,{omit:["layers","patternFeatures"]});f();var Zf,U_=u(()=>Zf=Zf||new Ie({"fill-sort-key":new H(T.layout_fill["fill-sort-key"])}),"getLayout"),Wf,N_=u(()=>Wf=Wf||new Ie({"fill-antialias":new q(T.paint_fill["fill-antialias"]),"fill-opacity":new H(T.paint_fill["fill-opacity"]),"fill-color":new H(T.paint_fill["fill-color"]),"fill-outline-color":new H(T.paint_fill["fill-outline-color"]),"fill-translate":new q(T.paint_fill["fill-translate"]),"fill-translate-anchor":new q(T.paint_fill["fill-translate-anchor"]),"fill-pattern":new Tt(T.paint_fill["fill-pattern"])}),"getPaint"),Xf={get paint(){return N_()},get layout(){return U_()}};var sc=class sc extends Le{constructor(e){super(e,Xf)}recalculate(e,r){super.recalculate(e,r);let 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(e){return new Ji(e)}queryRadius(){return Ht(this.paint.get("fill-translate"))}queryIntersectsFeature(e,r,i,o,a,s,l){let c=Zt(e,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,l);return go(c,o)}isTileClipped(){return!0}};u(sc,"FillStyleLayer");var To=sc;f();f();f();var G_=fe([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Kf=fe([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:$f,size:gT,alignment:xT}=G_;var Jf=te(Bh(),1),Yf=te(Dn(),1);var q_=Yf.default.VectorTileFeature.types,j_=500,lc=Math.pow(2,13);function Yi(n,t,e,r,i,o,a,s){n.emplaceBack(t,e,Math.floor(r*lc)*2+a,i*lc*2,o*lc*2,Math.round(s))}u(Yi,"addVertex");var uc=class uc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ro,this.centroidVertexArray=new Nt,this.indexArray=new qe,this.programConfigurations=new Ye(t.layers,t.zoom),this.segments=new ae,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.features=[],this.hasPattern=qr("fill-extrusion",this.layers,e);for(let{feature:i,id:o,index:a,sourceLayerIndex:s}of t){let l=this.layers[0]._featureFilter.needGeometry,c=et(i,l);if(!this.layers[0]._featureFilter.filter(new le(this.zoom),c,r))continue;let p={id:o,sourceLayerIndex:s,index:a,geometry:l?c.geometry:Qe(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(jr("fill-extrusion",this.layers,p,this.zoom,e)):this.addFeature(p,p.geometry,a,r,{}),e.featureIndex.insert(i,p.geometry,a,s,this.index,!0)}}addFeatures(t,e,r){for(let i of this.features){let{geometry:o}=i;this.addFeature(i,o,i.index,e,r)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$f),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Kf.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,e,r,i,o){let a={x:0,y:0,vertexCount:0};for(let s of $i(e,j_)){let l=0;for(let g of s)l+=g.length;let c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let g of s){if(g.length===0||Z_(g))continue;let y=0;for(let x=0;x<g.length;x++){let v=g[x];if(x>=1){let b=g[x-1];if(!H_(v,b)){c.vertexLength+4>ae.MAX_VERTEX_ARRAY_LENGTH&&(c=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let w=v.sub(b)._perp()._unit(),S=b.dist(v);y+S>32768&&(y=0),Yi(this.layoutVertexArray,v.x,v.y,w.x,w.y,0,0,y),Yi(this.layoutVertexArray,v.x,v.y,w.x,w.y,0,1,y),a.x+=2*v.x,a.y+=2*v.y,a.vertexCount+=2,y+=S,Yi(this.layoutVertexArray,b.x,b.y,w.x,w.y,0,0,y),Yi(this.layoutVertexArray,b.x,b.y,w.x,w.y,0,1,y),a.x+=2*b.x,a.y+=2*b.y,a.vertexCount+=2;let P=c.vertexLength;this.indexArray.emplaceBack(P,P+2,P+1),this.indexArray.emplaceBack(P+1,P+2,P+3),c.vertexLength+=4,c.primitiveLength+=2}}}}if(c.vertexLength+l>ae.MAX_VERTEX_ARRAY_LENGTH&&(c=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),q_[t.type]!=="Polygon")continue;let p=[],m=[],h=c.vertexLength;for(let g of s)if(g.length!==0){g!==s[0]&&m.push(p.length/2);for(let y=0;y<g.length;y++){let x=g[y];Yi(this.layoutVertexArray,x.x,x.y,0,0,1,1,0),a.x+=x.x,a.y+=x.y,a.vertexCount+=1,p.push(x.x),p.push(x.y)}}let d=(0,Jf.default)(p,m);for(let g=0;g<d.length;g+=3)this.indexArray.emplaceBack(h+d[g],h+d[g+2],h+d[g+1]);c.primitiveLength+=d.length/3,c.vertexLength+=l}for(let s=0;s<a.vertexCount;s++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,o,i)}};u(uc,"FillExtrusionBucket");var Qi=uc;O("FillExtrusionBucket",Qi,{omit:["layers","features"]});function H_(n,t){return n.x===t.x&&(n.x<0||n.x>8192)||n.y===t.y&&(n.y<0||n.y>8192)}u(H_,"isBoundaryEdge");function Z_(n){return n.every(t=>t.x<0)||n.every(t=>t.x>8192)||n.every(t=>t.y<0)||n.every(t=>t.y>8192)}u(Z_,"isEntirelyOutside");f();var Qf,W_=u(()=>Qf=Qf||new Ie({"fill-extrusion-opacity":new q(T["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new H(T["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new q(T["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new q(T["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Tt(T["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new H(T["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new H(T["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new q(T["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),"getPaint"),ed={get paint(){return W_()}};var Io=te(be(),1);var cc=class cc extends Le{constructor(e){super(e,ed)}createBucket(e){return new Qi(e)}queryRadius(){return Ht(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(e,r,i,o,a,s,l,c){let p=Zt(e,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,l),m=this.paint.get("fill-extrusion-height").evaluate(r,i),h=this.paint.get("fill-extrusion-base").evaluate(r,i),d=$_(p,c,s,0),g=K_(o,h,m,c),y=g[0],x=g[1];return X_(y,x,d)}};u(cc,"FillExtrusionStyleLayer");var Ao=cc;function en(n,t){return n.x*t.x+n.y*t.y}u(en,"dot");function td(n,t){if(n.length===1){let e=0,r=t[e++],i;for(;!i||r.equals(i);)if(i=t[e++],!i)return 1/0;for(;e<t.length;e++){let o=t[e],a=n[0],s=i.sub(r),l=o.sub(r),c=a.sub(r),p=en(s,s),m=en(s,l),h=en(l,l),d=en(c,s),g=en(c,l),y=p*h-m*m,x=(h*d-m*g)/y,v=(p*g-m*d)/y,b=1-x-v,w=r.z*b+i.z*x+o.z*v;if(isFinite(w))return w}return 1/0}else{let e=1/0;for(let r of t)e=Math.min(e,r.z);return e}}u(td,"getIntersectionDistance");function X_(n,t,e){let r=1/0;go(e,t)&&(r=td(e,t[0]));for(let i=0;i<t.length;i++){let o=t[i],a=n[i];for(let s=0;s<o.length-1;s++){let l=o[s],c=o[s+1],p=a[s],m=a[s+1],h=[l,c,m,p,l];yo(e,h)&&(r=Math.min(r,td(e,h)))}}return r===1/0?!1:r}u(X_,"checkIntersection");function K_(n,t,e,r){let i=[],o=[],a=r[8]*t,s=r[9]*t,l=r[10]*t,c=r[11]*t,p=r[8]*e,m=r[9]*e,h=r[10]*e,d=r[11]*e;for(let g of n){let y=[],x=[];for(let v of g){let b=v.x,w=v.y,S=r[0]*b+r[4]*w+r[12],P=r[1]*b+r[5]*w+r[13],I=r[2]*b+r[6]*w+r[14],C=r[3]*b+r[7]*w+r[15],z=S+a,D=P+s,A=I+l,R=C+c,U=S+p,L=P+m,N=I+h,V=C+d,W=new Io.default(z/R,D/R);W.z=A/R,y.push(W);let Z=new Io.default(U/V,L/V);Z.z=N/V,x.push(Z)}i.push(y),o.push(x)}return[i,o]}u(K_,"projectExtrusion");function $_(n,t,e,r){let i=[];for(let o of n){let a=[o.x,o.y,r,1];Re.transformMat4(a,a,t),i.push(new Io.default(a[0]/a[3],a[1]/a[3]))}return i}u($_,"projectQueryGeometry");f();f();f();var J_=fe([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:rd,size:i2,alignment:n2}=J_;f();var Y_=fe([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:id,size:l2,alignment:u2}=Y_;var ad=te(Dn(),1);var Q_=ad.default.VectorTileFeature.types,nd=63,eb=Math.cos(75/2*(Math.PI/180)),tb=15,rb=20,ib=15,sd=1/2,od=Math.pow(2,ib-1)/sd,pc=class pc{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(e=>e.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new io,this.layoutVertexArray2=new no,this.indexArray=new qe,this.programConfigurations=new Ye(t.layers,t.zoom),this.segments=new ae,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id)}populate(t,e,r){this.hasPattern=qr("line",this.layers,e);let i=this.layers[0].layout.get("line-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:c,sourceLayerIndex:p}of t){let m=this.layers[0]._featureFilter.needGeometry,h=et(s,m);if(!this.layers[0]._featureFilter.filter(new le(this.zoom),h,r))continue;let d=o?i.evaluate(h,{},r):void 0,g={id:l,properties:s.properties,type:s.type,sourceLayerIndex:p,index:c,geometry:m?h.geometry:Qe(s),patterns:{},sortKey:d};a.push(g)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:c,sourceLayerIndex:p}=s;if(this.hasPattern){let h=jr("line",this.layers,s,this.zoom,e);this.patternFeatures.push(h)}else this.addFeature(s,l,c,r,{});let m=t[c].feature;e.featureIndex.insert(m,l,c,p,this.index)}}update(t,e,r){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,e,this.stateDependentLayers,r)}addFeatures(t,e,r){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,e,r)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,id)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,rd),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end")){let e=+t.properties.mapbox_clip_start,r=+t.properties.mapbox_clip_end;return{start:e,end:r}}}addFeature(t,e,r,i,o){let a=this.layers[0].layout,s=a.get("line-join").evaluate(t,{}),l=a.get("line-cap"),c=a.get("line-miter-limit"),p=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let m of e)this.addLine(m,t,s,l,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,r,o,i)}addLine(t,e,r,i,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let v=0;v<t.length-1;v++)this.totalDistance+=t[v].dist(t[v+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s=Q_[e.type]==="Polygon",l=t.length;for(;l>=2&&t[l-1].equals(t[l-2]);)l--;let c=0;for(;c<l-1&&t[c].equals(t[c+1]);)c++;if(l<(s?3:2))return;r==="bevel"&&(o=1.05);let p=this.overscaling<=16?tb*8192/(512*this.overscaling):0,m=this.segments.prepareSegment(l*10,this.layoutVertexArray,this.indexArray),h,d,g,y,x;this.e1=this.e2=-1,s&&(h=t[l-2],x=t[c].sub(h)._unit()._perp());for(let v=c;v<l;v++){if(g=v===l-1?s?t[c+1]:void 0:t[v+1],g&&t[v].equals(g))continue;x&&(y=x),h&&(d=h),h=t[v],x=g?g.sub(h)._unit()._perp():y,y=y||x;let b=y.add(x);(b.x!==0||b.y!==0)&&b._unit();let w=y.x*x.x+y.y*x.y,S=b.x*x.x+b.y*x.y,P=S!==0?1/S:1/0,I=2*Math.sqrt(2-2*S),C=S<eb&&d&&g,z=y.x*x.y-y.y*x.x>0;if(C&&v>c){let R=h.dist(d);if(R>2*p){let U=h.sub(h.sub(d)._mult(p/R)._round());this.updateDistance(d,U),this.addCurrentVertex(U,y,0,0,m),d=U}}let D=d&&g,A=D?r:s?"butt":i;if(D&&A==="round"&&(P<a?A="miter":P<=2&&(A="fakeround")),A==="miter"&&P>o&&(A="bevel"),A==="bevel"&&(P>2&&(A="flipbevel"),P<o&&(A="miter")),d&&this.updateDistance(d,h),A==="miter")b._mult(P),this.addCurrentVertex(h,b,0,0,m);else if(A==="flipbevel"){if(P>100)b=x.mult(-1);else{let R=P*y.add(x).mag()/y.sub(x).mag();b._perp()._mult(R*(z?-1:1))}this.addCurrentVertex(h,b,0,0,m),this.addCurrentVertex(h,b.mult(-1),0,0,m)}else if(A==="bevel"||A==="fakeround"){let R=-Math.sqrt(P*P-1),U=z?R:0,L=z?0:R;if(d&&this.addCurrentVertex(h,y,U,L,m),A==="fakeround"){let N=Math.round(I*180/Math.PI/rb);for(let V=1;V<N;V++){let W=V/N;if(W!==.5){let ue=W-.5,Y=1.0904+w*(-3.2452+w*(3.55645-w*1.43519)),Oe=.848013+w*(-1.06021+w*.215638);W=W+W*ue*(W-1)*(Y*ue*ue+Oe)}let Z=x.sub(y)._mult(W)._add(y)._unit()._mult(z?-1:1);this.addHalfVertex(h,Z.x,Z.y,!1,z,0,m)}}g&&this.addCurrentVertex(h,x,-U,-L,m)}else if(A==="butt")this.addCurrentVertex(h,b,0,0,m);else if(A==="square"){let R=d?1:-1;this.addCurrentVertex(h,b,R,R,m)}else A==="round"&&(d&&(this.addCurrentVertex(h,y,0,0,m),this.addCurrentVertex(h,y,1,1,m,!0)),g&&(this.addCurrentVertex(h,x,-1,-1,m,!0),this.addCurrentVertex(h,x,0,0,m)));if(C&&v<l-1){let R=h.dist(g);if(R>2*p){let U=h.add(g.sub(h)._mult(p/R)._round());this.updateDistance(h,U),this.addCurrentVertex(U,x,0,0,m),h=U}}}}addCurrentVertex(t,e,r,i,o,a=!1){let s=e.x+e.y*r,l=e.y-e.x*r,c=-e.x+e.y*i,p=-e.y-e.x*i;this.addHalfVertex(t,s,l,a,!1,r,o),this.addHalfVertex(t,c,p,a,!0,-i,o),this.distance>od/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,e,r,i,o,a))}addHalfVertex({x:t,y:e},r,i,o,a,s,l){let p=(this.lineClips?this.scaledDistance*(od-1):this.scaledDistance)*sd;if(this.layoutVertexArray.emplaceBack((t<<1)+(o?1:0),(e<<1)+(a?1:0),Math.round(nd*r)+128,Math.round(nd*i)+128,(s===0?0:s<0?-1:1)+1|(p&63)<<2,p>>6),this.lineClips){let h=this.scaledDistance-this.lineClips.start,d=this.lineClips.end-this.lineClips.start,g=h/d;this.layoutVertexArray2.emplaceBack(g,this.lineClipsArray.length)}let m=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,m),l.primitiveLength++),a?this.e2=m:this.e1=m}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,e){this.distance+=t.dist(e),this.updateScaledDistance()}};u(pc,"LineBucket");var tn=pc;O("LineBucket",tn,{omit:["layers","patternFeatures"]});f();var ld,nb=u(()=>ld=ld||new Ie({"line-cap":new q(T.layout_line["line-cap"]),"line-join":new H(T.layout_line["line-join"]),"line-miter-limit":new q(T.layout_line["line-miter-limit"]),"line-round-limit":new q(T.layout_line["line-round-limit"]),"line-sort-key":new H(T.layout_line["line-sort-key"])}),"getLayout"),ud,ob=u(()=>ud=ud||new Ie({"line-opacity":new H(T.paint_line["line-opacity"]),"line-color":new H(T.paint_line["line-color"]),"line-translate":new q(T.paint_line["line-translate"]),"line-translate-anchor":new q(T.paint_line["line-translate-anchor"]),"line-width":new H(T.paint_line["line-width"]),"line-gap-width":new H(T.paint_line["line-gap-width"]),"line-offset":new H(T.paint_line["line-offset"]),"line-blur":new H(T.paint_line["line-blur"]),"line-dasharray":new lr(T.paint_line["line-dasharray"]),"line-pattern":new Tt(T.paint_line["line-pattern"]),"line-gradient":new ur(T.paint_line["line-gradient"])}),"getPaint"),mc={get paint(){return ob()},get layout(){return nb()}};var fc=class fc extends H{possiblyEvaluate(e,r){return r=new le(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(e,r)}evaluate(e,r,i,o){return r=k({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(e,r,i,o)}};u(fc,"LineFloorwidthProperty");var hc=fc,Co,dc=class dc extends Le{constructor(e){super(e,mc);this.gradientVersion=0,Co||(Co=new hc(mc.paint.properties["line-width"].specification),Co.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(e){if(e==="line-gradient"){let r=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=r._styleExpression.expression instanceof Ah,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(e,r){super.recalculate(e,r),this.paint._values["line-floorwidth"]=Co.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new tn(e)}queryRadius(e){let r=e,i=cd(yr("line-width",this,r),yr("line-gap-width",this,r)),o=yr("line-offset",this,r);return i/2+Math.abs(o)+Ht(this.paint.get("line-translate"))}queryIntersectsFeature(e,r,i,o,a,s,l){let c=Zt(e,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,l),p=l/2*cd(this.paint.get("line-width").evaluate(r,i),this.paint.get("line-gap-width").evaluate(r,i)),m=this.paint.get("line-offset").evaluate(r,i);return m&&(o=Df(o,m*l)),Mf(c,o,p)}isTileClipped(){return!0}};u(dc,"LineStyleLayer");var Eo=dc;function cd(n,t){return t>0?t+2*n:n}u(cd,"getLineWidth");f();f();f();var pd=fe([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),md=fe([{name:"a_projected_pos",components:3,type:"Float32"}],4),Q2=fe([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),hd=fe([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),eI=fe([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),yc=fe([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),fd=fe([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),tI=fe([{name:"triangle",components:3,type:"Uint16"}]),rI=fe([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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"}]),iI=fe([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),nI=fe([{type:"Float32",name:"offsetX"}]),oI=fe([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var nn=te(be(),1);f();function ab(n,t,e){let r=t.layout.get("text-transform").evaluate(e,{});return r==="uppercase"?n=n.toLocaleUpperCase():r==="lowercase"&&(n=n.toLocaleLowerCase()),Je.applyArabicShaping&&(n=Je.applyArabicShaping(n)),n}u(ab,"transformTextInternal");function dd(n,t,e){return n.sections.forEach(r=>{r.text=ab(r.text,t,e)}),n}u(dd,"transformText");f();function yd(n){let t={},e={},r=[],i=0;function o(c){r.push(n[c]),i++}u(o,"add");function a(c,p,m){let h=e[c];return delete e[c],e[p]=h,r[h].geometry[0].pop(),r[h].geometry[0]=r[h].geometry[0].concat(m[0]),h}u(a,"mergeFromRight");function s(c,p,m){let h=t[p];return delete t[p],t[c]=h,r[h].geometry[0].shift(),r[h].geometry[0]=m[0].concat(r[h].geometry[0]),h}u(s,"mergeFromLeft");function l(c,p,m){let h=m?p[0][p[0].length-1]:p[0][0];return"".concat(c,":").concat(h.x,":").concat(h.y)}u(l,"getKey");for(let c=0;c<n.length;c++){let p=n[c],m=p.geometry,h=p.text?p.text.toString():null;if(!h){o(c);continue}let d=l(h,m),g=l(h,m,!0);if(d in e&&g in t&&e[d]!==t[g]){let y=s(d,g,m),x=a(d,g,r[y].geometry);delete t[d],delete e[g],e[l(h,r[x].geometry,!0)]=x,r[y].geometry=null}else d in e?a(d,g,m):g in t?s(d,g,m):(o(c),t[d]=i-1,e[g]=i-1)}return r.filter(c=>c.geometry)}u(yd,"mergeLines");f();f();var gd={"!":"\uFE15","#":"\uFF03",$:"\uFF04","%":"\uFF05","&":"\uFF06","(":"\uFE35",")":"\uFE36","*":"\uFF0A","+":"\uFF0B",",":"\uFE10","-":"\uFE32",".":"\u30FB","/":"\uFF0F",":":"\uFE13",";":"\uFE14","<":"\uFE3F","=":"\uFF1D",">":"\uFE40","?":"\uFE16","@":"\uFF20","[":"\uFE47","\\":"\uFF3C","]":"\uFE48","^":"\uFF3E",_:"\uFE33","`":"\uFF40","{":"\uFE37","|":"\u2015","}":"\uFE38","~":"\uFF5E","\xA2":"\uFFE0","\xA3":"\uFFE1","\xA5":"\uFFE5","\xA6":"\uFFE4","\xAC":"\uFFE2","\xAF":"\uFFE3","\u2013":"\uFE32","\u2014":"\uFE31","\u2018":"\uFE43","\u2019":"\uFE44","\u201C":"\uFE41","\u201D":"\uFE42","\u2026":"\uFE19","\u2027":"\u30FB","\u20A9":"\uFFE6","\u3001":"\uFE11","\u3002":"\uFE12","\u3008":"\uFE3F","\u3009":"\uFE40","\u300A":"\uFE3D","\u300B":"\uFE3E","\u300C":"\uFE41","\u300D":"\uFE42","\u300E":"\uFE43","\u300F":"\uFE44","\u3010":"\uFE3B","\u3011":"\uFE3C","\u3014":"\uFE39","\u3015":"\uFE3A","\u3016":"\uFE17","\u3017":"\uFE18","\uFF01":"\uFE15","\uFF08":"\uFE35","\uFF09":"\uFE36","\uFF0C":"\uFE10","\uFF0D":"\uFE32","\uFF0E":"\u30FB","\uFF1A":"\uFE13","\uFF1B":"\uFE14","\uFF1C":"\uFE3F","\uFF1E":"\uFE40","\uFF1F":"\uFE16","\uFF3B":"\uFE47","\uFF3D":"\uFE48","\uFF3F":"\uFE33","\uFF5B":"\uFE37","\uFF5C":"\u2015","\uFF5D":"\uFE38","\uFF5F":"\uFE35","\uFF60":"\uFE36","\uFF61":"\uFE12","\uFF62":"\uFE41","\uFF63":"\uFE42"};f();var xr=24;f();var _d=te(Oh(),1);var xd=3;function sb(n,t,e){n===1&&e.readMessage(lb,t)}u(sb,"readFontstacks");function lb(n,t,e){if(n===3){let{id:r,bitmap:i,width:o,height:a,left:s,top:l,advance:c}=e.readMessage(ub,{});t.push({id:r,bitmap:new gr({width:o+2*xd,height:a+2*xd},i),metrics:{width:o,height:a,left:s,top:l,advance:c}})}}u(lb,"readFontstack");function ub(n,t,e){n===1?t.id=e.readVarint():n===2?t.bitmap=e.readBytes():n===3?t.width=e.readVarint():n===4?t.height=e.readVarint():n===5?t.left=e.readSVarint():n===6?t.top=e.readSVarint():n===7&&(t.advance=e.readVarint())}u(ub,"readGlyph");function bd(n){return new _d.default(n).readFields(sb,[])}u(bd,"parseGlyphPbf");f();var tt=1;var xc=class xc{constructor(t,{pixelRatio:e,version:r,stretchX:i,stretchY:o,content:a}){this.paddedRect=t,this.pixelRatio=e,this.stretchX=i,this.stretchY=o,this.content=a,this.version=r}get tl(){return[this.paddedRect.x+tt,this.paddedRect.y+tt]}get br(){return[this.paddedRect.x+this.paddedRect.w-tt,this.paddedRect.y+this.paddedRect.h-tt]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-tt*2)/this.pixelRatio,(this.paddedRect.h-tt*2)/this.pixelRatio]}};u(xc,"ImagePosition");var Hr=xc,_c=class _c{constructor(t,e){let r={},i={};this.haveRenderCallbacks=[];let o=[];this.addImages(t,r,o),this.addImages(e,i,o);let{w:a,h:s}=Fn(o),l=new _e({width:a||1,height:s||1});for(let c in t){let p=t[c],m=r[c].paddedRect;_e.copy(p.data,l,{x:0,y:0},{x:m.x+tt,y:m.y+tt},p.data)}for(let c in e){let p=e[c],m=i[c].paddedRect,h=m.x+tt,d=m.y+tt,g=p.data.width,y=p.data.height;_e.copy(p.data,l,{x:0,y:0},{x:h,y:d},p.data),_e.copy(p.data,l,{x:0,y:y-1},{x:h,y:d-1},{width:g,height:1}),_e.copy(p.data,l,{x:0,y:0},{x:h,y:d+y},{width:g,height:1}),_e.copy(p.data,l,{x:g-1,y:0},{x:h-1,y:d},{width:1,height:y}),_e.copy(p.data,l,{x:0,y:0},{x:h+g,y:d},{width:1,height:y})}this.image=l,this.iconPositions=r,this.patternPositions=i}addImages(t,e,r){for(let i in t){let o=t[i],a={x:0,y:0,w:o.data.width+2*tt,h:o.data.height+2*tt};r.push(a),e[i]=new Hr(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,e){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let r in t.updatedImages)this.patchUpdatedImage(this.iconPositions[r],t.getImage(r),e),this.patchUpdatedImage(this.patternPositions[r],t.getImage(r),e)}patchUpdatedImage(t,e,r){if(!t||!e||t.version===e.version)return;t.version=e.version;let[i,o]=t.tl;r.update(e.data,void 0,{x:i,y:o})}};u(_c,"ImageAtlas");var gc=_c;O("ImagePosition",Hr);O("ImageAtlas",gc);var _r=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(_r||{});function Mo(n){let t=.5,e=.5;switch(n){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0;break}switch(n){case"bottom":case"bottom-right":case"bottom-left":e=1;break;case"top":case"top-right":case"top-left":e=0;break}return{horizontalAlign:t,verticalAlign:e}}u(Mo,"getAnchorAlignment");var Sd=te(Dn(),1);f();var vd=255,rn=128,Lo=vd*rn;function bc(n,t){let{expression:e}=t;if(e.kind==="constant")return{kind:"constant",layoutSize:e.evaluate(new le(n+1))};if(e.kind==="source")return{kind:"source"};{let{zoomStops:r,interpolationType:i}=e,o=0;for(;o<r.length&&r[o]<=n;)o++;o=Math.max(0,o-1);let a=o;for(;a<r.length&&r[a]<n+1;)a++;a=Math.min(r.length-1,a);let s=r[o],l=r[a];if(e.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i};let c=e.evaluate(new le(s)),p=e.evaluate(new le(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:c,maxSize:p,interpolationType:i}}}u(bc,"getSizeData");function Zr(n,{uSize:t,uSizeT:e},{lowerSize:r,upperSize:i}){return n.kind==="source"?r/rn:n.kind==="composite"?Ae.number(r/rn,i/rn,e):t}u(Zr,"evaluateSizeForFeature");function br(n,t){let e=0,r=0;if(n.kind==="constant")r=n.layoutSize;else if(n.kind!=="source"){let{interpolationType:i,minZoom:o,maxZoom:a}=n,s=i?ye(Ch.interpolationFactor(i,t,o,a),0,1):0;n.kind==="camera"?r=Ae.number(n.minSize,n.maxSize,s):e=s}return{uSizeT:e,uSize:r}}u(br,"evaluateSizeForZoom");f();function Wr(n,t,e){let r="never",i=n.get(t);return i?r=i:n.get(e)&&(r="always"),r}u(Wr,"getOverlapMode");var pb=Sd.default.VectorTileFeature.types,mb=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function ko(n,t,e,r,i,o,a,s,l,c,p,m,h){let d=s?Math.min(Lo,Math.round(s[0])):0,g=s?Math.min(Lo,Math.round(s[1])):0;n.emplaceBack(t,e,Math.round(r*32),Math.round(i*32),o,a,(d<<1)+(l?1:0),g,c*16,p*16,m*256,h*256)}u(ko,"addVertex");function vr(n,t,e){n.emplaceBack(t.x,t.y,e),n.emplaceBack(t.x,t.y,e),n.emplaceBack(t.x,t.y,e),n.emplaceBack(t.x,t.y,e)}u(vr,"addDynamicAttributes");function hb(n){for(let t of n.sections)if(df(t.text))return!0;return!1}u(hb,"containsRTLText");var vc=class vc{constructor(t){this.layoutVertexArray=new oo,this.indexArray=new qe,this.programConfigurations=t,this.segments=new ae,this.dynamicLayoutVertexArray=new ao,this.opacityVertexArray=new so,this.hasVisibleVertices=!1,this.placedSymbolArray=new Vi}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,e,r,i){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,pd.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,md.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,mb,!0),this.opacityVertexBuffer.itemSize=1),(r||i)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};u(vc,"SymbolBuffers");var on=vc;O("SymbolBuffers",on);var wc=class wc{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new ae,this.collisionVertexArray=new uo}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,hd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};u(wc,"CollisionBuffers");var an=wc;O("CollisionBuffers",an);var Sc=class Sc{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(l=>l.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=G.identity([]),this.placementViewportMatrix=G.identity([]);let r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=bc(this.zoom,r["text-size"]),this.iconSizeData=bc(this.zoom,r["icon-size"]);let i=this.layers[0].layout,o=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=Wr(i,"text-overlap","text-allow-overlap")!=="never"||Wr(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!o.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(l=>_r[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=t.sourceID}createArrays(){this.text=new on(new Ye(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new on(new Ye(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new Ni,this.lineVertexArray=new Gi,this.symbolInstances=new Ui}calculateGlyphDependencies(t,e,r,i,o){for(let a=0;a<t.length;a++)if(e[t.charCodeAt(a)]=!0,(r||i)&&o){let s=gd[t.charAt(a)];s&&(e[s.charCodeAt(0)]=!0)}}populate(t,e,r){let i=this.layers[0],o=i.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),c=(s.value.kind!=="constant"||s.value.value instanceof fi&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),p=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,m=o.get("symbol-sort-key");if(this.features=[],!c&&!p)return;let h=e.iconDependencies,d=e.glyphDependencies,g=e.availableImages,y=new le(this.zoom);for(let{feature:x,id:v,index:b,sourceLayerIndex:w}of t){let S=i._featureFilter.needGeometry,P=et(x,S);if(!i._featureFilter.filter(y,P,r))continue;S||(P.geometry=Qe(x));let I;if(c){let A=i.getValueAndResolveTokens("text-field",P,r,g),R=fi.factory(A);hb(R)&&(this.hasRTLText=!0),(!this.hasRTLText||bi()==="unavailable"||this.hasRTLText&&Je.isParsed())&&(I=dd(R,i,P))}let C;if(p){let A=i.getValueAndResolveTokens("icon-image",P,r,g);A instanceof di?C=A:C=di.fromString(A)}if(!I&&!C)continue;let z=this.sortFeaturesByKey?m.evaluate(P,{},r):void 0,D={id:v,text:I,icon:C,index:b,sourceLayerIndex:w,geometry:P.geometry,properties:x.properties,type:pb[x.type],sortKey:z};if(this.features.push(D),C&&(h[C.name]=!0),I){let A=a.evaluate(P,{},r).join(","),R=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let U of I.sections)if(U.image)h[U.image.name]=!0;else{let L=hl(I.toString()),N=U.fontStack||A,V=d[N]=d[N]||{};this.calculateGlyphDependencies(U.text,V,R,this.allowVerticalPlacement,L)}}}o.get("symbol-placement")==="line"&&(this.features=yd(this.features)),this.sortFeaturesByKey&&this.features.sort((x,v)=>x.sortKey-v.sortKey)}update(t,e,r){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,e){let r=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(e[t.segment+1]),o=t.dist(e[t.segment]),a={};for(let s=t.segment+1;s<e.length;s++)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s<e.length-1&&(i+=e[s+1].dist(e[s]));for(let s=t.segment||0;s>=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=e[s-1].dist(e[s]));for(let s=0;s<e.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,i,o,a,s,l,c,p,m,h){let d=t.indexArray,g=t.layoutVertexArray,y=t.segments.prepareSegment(4*e.length,g,d,this.canOverlap?a.sortKey:void 0),x=this.glyphOffsetArray.length,v=y.vertexLength,b=this.allowVerticalPlacement&&s===2?Math.PI/2:0,w=a.text&&a.text.sections;for(let S=0;S<e.length;S++){let{tl:P,tr:I,bl:C,br:z,tex:D,pixelOffsetTL:A,pixelOffsetBR:R,minFontScaleX:U,minFontScaleY:L,glyphOffset:N,isSDF:V,sectionIndex:W}=e[S],Z=y.vertexLength,ue=N[1];ko(g,l.x,l.y,P.x,ue+P.y,D.x,D.y,r,V,A.x,A.y,U,L),ko(g,l.x,l.y,I.x,ue+I.y,D.x+D.w,D.y,r,V,R.x,A.y,U,L),ko(g,l.x,l.y,C.x,ue+C.y,D.x,D.y+D.h,r,V,A.x,R.y,U,L),ko(g,l.x,l.y,z.x,ue+z.y,D.x+D.w,D.y+D.h,r,V,R.x,R.y,U,L),vr(t.dynamicLayoutVertexArray,l,b),d.emplaceBack(Z,Z+1,Z+2),d.emplaceBack(Z+1,Z+2,Z+3),y.vertexLength+=4,y.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(N[0]),(S===e.length-1||W!==e[S+1].sectionIndex)&&t.programConfigurations.populatePaintArrays(g.length,a,a.index,{},h,w&&w[W])}t.placedSymbolArray.emplaceBack(l.x,l.y,x,this.glyphOffsetArray.length-x,v,c,p,l.segment,r?r[0]:0,r?r[1]:0,i[0],i[1],s,0,!1,0,m)}_addCollisionDebugVertex(t,e,r,i,o,a){return e.emplaceBack(0,0),t.emplaceBack(r.x,r.y,i,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(t,e,r,i,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),c=l.vertexLength,p=o.layoutVertexArray,m=o.collisionVertexArray,h=s.anchorX,d=s.anchorY;this._addCollisionDebugVertex(p,m,a,h,d,new nn.default(t,e)),this._addCollisionDebugVertex(p,m,a,h,d,new nn.default(r,e)),this._addCollisionDebugVertex(p,m,a,h,d,new nn.default(r,i)),this._addCollisionDebugVertex(p,m,a,h,d,new nn.default(t,i)),l.vertexLength+=4;let g=o.indexArray;g.emplaceBack(c,c+1),g.emplaceBack(c+1,c+2),g.emplaceBack(c+2,c+3),g.emplaceBack(c+3,c),l.primitiveLength+=4}addDebugCollisionBoxes(t,e,r,i){for(let o=t;o<e;o++){let a=this.collisionBoxArray.get(o),s=a.x1,l=a.y1,c=a.x2,p=a.y2;this.addCollisionDebugVertices(s,l,c,p,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,r)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new an(ji,yc.members,Gt),this.iconCollisionBox=new an(ji,yc.members,Gt);for(let t=0;t<this.symbolInstances.length;t++){let e=this.symbolInstances.get(t);this.addDebugCollisionBoxes(e.textBoxStartIndex,e.textBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.verticalTextBoxStartIndex,e.verticalTextBoxEndIndex,e,!0),this.addDebugCollisionBoxes(e.iconBoxStartIndex,e.iconBoxEndIndex,e,!1),this.addDebugCollisionBoxes(e.verticalIconBoxStartIndex,e.verticalIconBoxEndIndex,e,!1)}}_deserializeCollisionBoxesForSymbol(t,e,r,i,o,a,s,l,c){let p={};for(let m=e;m<r;m++){let h=t.get(m);p.textBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},p.textFeatureIndex=h.featureIndex;break}for(let m=i;m<o;m++){let h=t.get(m);p.verticalTextBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},p.verticalTextFeatureIndex=h.featureIndex;break}for(let m=a;m<s;m++){let h=t.get(m);p.iconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},p.iconFeatureIndex=h.featureIndex;break}for(let m=l;m<c;m++){let h=t.get(m);p.verticalIconBox={x1:h.x1,y1:h.y1,x2:h.x2,y2:h.y2,anchorPointX:h.anchorPointX,anchorPointY:h.anchorPointY},p.verticalIconFeatureIndex=h.featureIndex;break}return p}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let e=0;e<this.symbolInstances.length;e++){let r=this.symbolInstances.get(e);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){let r=t.placedSymbolArray.get(e),i=r.vertexStartIndex+r.numGlyphs*4;for(let o=r.vertexStartIndex;o<i;o+=4)t.indexArray.emplaceBack(o,o+1,o+2),t.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let e=Math.sin(t),r=Math.cos(t),i=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);i.push(Math.round(e*l.anchorX+r*l.anchorY)|0),o.push(l.featureIndex)}return a.sort((s,l)=>i[s]-i[l]||o[l]-o[s]),a}addToSortKeyRanges(t,e){let r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let e of this.symbolInstanceIndexes){let r=this.symbolInstances.get(e);this.featureSortOrder.push(r.featureIndex),[r.rightJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.leftJustifiedTextSymbolIndex].forEach((i,o,a)=>{i>=0&&a.indexOf(i)===o&&this.addIndicesForPlacedSymbol(this.text,i)}),r.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,r.verticalPlacedTextSymbolIndex),r.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.placedIconSymbolIndex),r.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,r.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};u(Sc,"SymbolBucket");var yt=Sc;O("SymbolBucket",yt,{omit:["layers","collisionBoxArray","features","compareText"]});yt.MAX_GLYPHS=65535;yt.addDynamicAttributes=vr;f();function Pd(n,t){return t.replace(/{([^{}]+)}/g,(e,r)=>r in n?String(n[r]):"")}u(Pd,"resolveTokens");f();var Td,fb=u(()=>Td=Td||new Ie({"symbol-placement":new q(T.layout_symbol["symbol-placement"]),"symbol-spacing":new q(T.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new q(T.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new H(T.layout_symbol["symbol-sort-key"]),"symbol-z-order":new q(T.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new q(T.layout_symbol["icon-allow-overlap"]),"icon-overlap":new q(T.layout_symbol["icon-overlap"]),"icon-ignore-placement":new q(T.layout_symbol["icon-ignore-placement"]),"icon-optional":new q(T.layout_symbol["icon-optional"]),"icon-rotation-alignment":new q(T.layout_symbol["icon-rotation-alignment"]),"icon-size":new H(T.layout_symbol["icon-size"]),"icon-text-fit":new q(T.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new q(T.layout_symbol["icon-text-fit-padding"]),"icon-image":new H(T.layout_symbol["icon-image"]),"icon-rotate":new H(T.layout_symbol["icon-rotate"]),"icon-padding":new H(T.layout_symbol["icon-padding"]),"icon-keep-upright":new q(T.layout_symbol["icon-keep-upright"]),"icon-offset":new H(T.layout_symbol["icon-offset"]),"icon-anchor":new H(T.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new q(T.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new q(T.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new q(T.layout_symbol["text-rotation-alignment"]),"text-field":new H(T.layout_symbol["text-field"]),"text-font":new H(T.layout_symbol["text-font"]),"text-size":new H(T.layout_symbol["text-size"]),"text-max-width":new H(T.layout_symbol["text-max-width"]),"text-line-height":new q(T.layout_symbol["text-line-height"]),"text-letter-spacing":new H(T.layout_symbol["text-letter-spacing"]),"text-justify":new H(T.layout_symbol["text-justify"]),"text-radial-offset":new H(T.layout_symbol["text-radial-offset"]),"text-variable-anchor":new q(T.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new H(T.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new H(T.layout_symbol["text-anchor"]),"text-max-angle":new q(T.layout_symbol["text-max-angle"]),"text-writing-mode":new q(T.layout_symbol["text-writing-mode"]),"text-rotate":new H(T.layout_symbol["text-rotate"]),"text-padding":new q(T.layout_symbol["text-padding"]),"text-keep-upright":new q(T.layout_symbol["text-keep-upright"]),"text-transform":new H(T.layout_symbol["text-transform"]),"text-offset":new H(T.layout_symbol["text-offset"]),"text-allow-overlap":new q(T.layout_symbol["text-allow-overlap"]),"text-overlap":new q(T.layout_symbol["text-overlap"]),"text-ignore-placement":new q(T.layout_symbol["text-ignore-placement"]),"text-optional":new q(T.layout_symbol["text-optional"])}),"getLayout"),Id,db=u(()=>Id=Id||new Ie({"icon-opacity":new H(T.paint_symbol["icon-opacity"]),"icon-color":new H(T.paint_symbol["icon-color"]),"icon-halo-color":new H(T.paint_symbol["icon-halo-color"]),"icon-halo-width":new H(T.paint_symbol["icon-halo-width"]),"icon-halo-blur":new H(T.paint_symbol["icon-halo-blur"]),"icon-translate":new q(T.paint_symbol["icon-translate"]),"icon-translate-anchor":new q(T.paint_symbol["icon-translate-anchor"]),"text-opacity":new H(T.paint_symbol["text-opacity"]),"text-color":new H(T.paint_symbol["text-color"],{runtimeType:wh,getOverride:n=>n.textColor,hasOverride:n=>!!n.textColor}),"text-halo-color":new H(T.paint_symbol["text-halo-color"]),"text-halo-width":new H(T.paint_symbol["text-halo-width"]),"text-halo-blur":new H(T.paint_symbol["text-halo-blur"]),"text-translate":new q(T.paint_symbol["text-translate"]),"text-translate-anchor":new q(T.paint_symbol["text-translate-anchor"])}),"getPaint"),Do={get paint(){return db()},get layout(){return fb()}};f();var Pc=class Pc{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:vh,this.defaultValue=t}evaluate(t){if(t.formattedSection){let e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let e=this.defaultValue.value;t(e._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};u(Pc,"FormatSectionOverride");var sn=Pc;O("FormatSectionOverride",sn,{omit:["defaultValue"]});var ln=class ln extends Le{constructor(e){super(e,Do)}recalculate(e,r){if(super.recalculate(e,r),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let i=this.layout.get("text-writing-mode");if(i){let o=[];for(let a of i)o.indexOf(a)<0&&o.push(a);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,r,i,o){let a=this.layout.get(e).evaluate(r,{},i,o),s=this._unevaluatedLayout._values[e];return!s.isDataDriven()&&!Mh(s.value)&&a?Pd(r.properties,a):a}createBucket(e){return new yt(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let e of Do.paint.overridableProperties){if(!ln.hasPaintOverride(this.layout,e))continue;let r=this.paint.get(e),i=new sn(r),o=new En(i,r.property.specification),a=null;r.value.kind==="constant"||r.value.kind==="source"?a=new Mn("source",o):a=new Ln("composite",o,r.value.zoomStops),this.paint._values[e]=new je(r.property,a,r.parameters)}}_handleOverridablePaintPropertyUpdate(e,r,i){return!this.layout||r.isDataDriven()||i.isDataDriven()?!1:ln.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,r){let i=e.get("text-field"),o=Do.paint.properties[r],a=!1,s=u(l=>{for(let c of l)if(o.overrides&&o.overrides.hasOverride(c)){a=!0;return}},"checkSections");if(i.value.kind==="constant"&&i.value.value instanceof fi)s(i.value.value.sections);else if(i.value.kind==="source"){let l=u(p=>{if(!a)if(p instanceof Th&&Ph(p.value)===Sh){let m=p.value;s(m.sections)}else p instanceof Eh?s(p.sections):p.eachChild(l)},"checkExpression"),c=i.value;c._styleExpression&&l(c._styleExpression.expression)}return a}};u(ln,"SymbolStyleLayer");var Fo=ln;f();f();var Ad,yb=u(()=>Ad=Ad||new Ie({"background-color":new q(T.paint_background["background-color"]),"background-pattern":new lr(T.paint_background["background-pattern"]),"background-opacity":new q(T.paint_background["background-opacity"])}),"getPaint"),Cd={get paint(){return yb()}};var Tc=class Tc extends Le{constructor(e){super(e,Cd)}};u(Tc,"BackgroundStyleLayer");var zo=Tc;f();f();var Ed,gb=u(()=>Ed=Ed||new Ie({"raster-opacity":new q(T.paint_raster["raster-opacity"]),"raster-hue-rotate":new q(T.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new q(T.paint_raster["raster-brightness-min"]),"raster-brightness-max":new q(T.paint_raster["raster-brightness-max"]),"raster-saturation":new q(T.paint_raster["raster-saturation"]),"raster-contrast":new q(T.paint_raster["raster-contrast"]),"raster-resampling":new q(T.paint_raster["raster-resampling"]),"raster-fade-duration":new q(T.paint_raster["raster-fade-duration"])}),"getPaint"),Md={get paint(){return gb()}};var Ic=class Ic extends Le{constructor(e){super(e,Md)}};u(Ic,"RasterStyleLayer");var Bo=Ic;f();function Ld(n){let t=[],e=n.id;return e===void 0&&t.push({message:"layers.".concat(e,': missing required property "id"')}),n.render===void 0&&t.push({message:"layers.".concat(e,': missing required method "render"')}),n.renderingMode&&n.renderingMode!=="2d"&&n.renderingMode!=="3d"&&t.push({message:"layers.".concat(e,': property "renderingMode" must be either "2d" or "3d"')}),t}u(Ld,"validateCustomStyleLayer");var Ac=class Ac extends Le{constructor(e){super(e,{});this.onAdd=u(e=>{this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)},"onAdd");this.onRemove=u(e=>{this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)},"onRemove");this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};u(Ac,"CustomStyleLayer");var Ro=Ac;function Oo(n){if(n.type==="custom")return new Ro(n);switch(n.type){case"background":return new zo(n);case"circle":return new _o(n);case"fill":return new To(n);case"fill-extrusion":return new Ao(n);case"heatmap":return new So(n);case"hillshade":return new Po(n);case"line":return new Eo(n);case"raster":return new Bo(n);case"symbol":return new Fo(n)}}u(Oo,"createStyleLayer");f();f();function Xr(n){let t=[];if(typeof n=="string")t.push({id:"default",url:n});else if(n&&n.length>0){let e=[];for(let{id:r,url:i}of n){let o="".concat(r).concat(i);e.indexOf(o)===-1&&(e.push(o),t.push({id:r,url:i}))}}return t}u(Xr,"coerceSpriteToArray");function Dd(n,t,e,r){let i=Xr(n),o=i.length,a=e>1?"@2x":"",s={},l={},c={};for(let{id:p,url:m}of i){let h=t.transformRequest(t.normalizeSpriteURL(m,a,".json"),"SpriteJSON"),d="".concat(p,"_").concat(h.url);s[d]=Bt(h,(x,v)=>{delete s[d],l[p]=v,kd(r,l,c,x,o)});let g=t.transformRequest(t.normalizeSpriteURL(m,a,".png"),"SpriteImage"),y="".concat(p,"_").concat(g.url);s[y]=He.getImage(g,(x,v)=>{delete s[y],c[p]=v,kd(r,l,c,x,o)})}return{cancel(){for(let p of Object.values(s))p.cancel()}}}u(Dd,"loadSprite");function kd(n,t,e,r,i){if(r){n(r);return}if(i!==Object.values(t).length||i!==Object.values(e).length)return;let o={};for(let a in t){o[a]={};let s=ee.getImageCanvasContext(e[a]),l=t[a];for(let c in l){let{width:p,height:m,x:h,y:d,sdf:g,pixelRatio:y,stretchX:x,stretchY:v,content:b}=l[c],w={width:p,height:m,x:h,y:d,context:s};o[a][c]={data:null,pixelRatio:y,sdf:g,stretchX:x,stretchY:v,content:b,spriteData:w}}}n(null,o)}u(kd,"doOnceCompleted");f();f();var Cc=class Cc{constructor(t,e,r,i){this.context=t,this.format=r,this.texture=t.gl.createTexture(),this.update(e,i)}update(t,e,r){let{width:i,height:o}=t,a=(!this.size||this.size[0]!==i||this.size[1]!==o)&&!r,{context:s}=this,{gl:l}=s;if(this.useMipmap=!!(e&&e.useMipmap),l.bindTexture(l.TEXTURE_2D,this.texture),s.pixelStoreUnpackFlipY.set(!1),s.pixelStoreUnpack.set(1),s.pixelStoreUnpackPremultiplyAlpha.set(this.format===l.RGBA&&(!e||e.premultiply!==!1)),a)this.size=[i,o],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||ct(t)?l.texImage2D(l.TEXTURE_2D,0,this.format,this.format,l.UNSIGNED_BYTE,t):l.texImage2D(l.TEXTURE_2D,0,this.format,i,o,0,this.format,l.UNSIGNED_BYTE,t.data);else{let{x:c,y:p}=r||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||ct(t)?l.texSubImage2D(l.TEXTURE_2D,0,c,p,l.RGBA,l.UNSIGNED_BYTE,t):l.texSubImage2D(l.TEXTURE_2D,0,c,p,i,o,l.RGBA,l.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&l.generateMipmap(l.TEXTURE_2D)}bind(t,e,r){let{context:i}=this,{gl:o}=i;o.bindTexture(o.TEXTURE_2D,this.texture),r===o.LINEAR_MIPMAP_NEAREST&&!this.isSizePowerOfTwo()&&(r=o.LINEAR),t!==this.filter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,t),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,r||t),this.filter=t),e!==this.wrap&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,e),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,e),this.wrap=e)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1===0}destroy(){let{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}};u(Cc,"Texture");var he=Cc;f();function Fd(n){let{userImage:t}=n;return t&&t.render&&t.render()?(n.data.replace(new Uint8Array(t.data.buffer)),!0):!1}u(Fd,"renderStyleImage");var Vo=1,Ec=class Ec extends se{constructor(){super();this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new _e({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(let{ids:r,callback:i}of this.requestors)this._notify(r,i);this.requestors=[]}}getImage(e){let r=this.images[e];if(r&&!r.data&&r.spriteData){let i=r.spriteData;r.data=new _e({width:i.width,height:i.height},i.context.getImageData(i.x,i.y,i.width,i.height).data),r.spriteData=null}return r}addImage(e,r){if(this.images[e])throw new Error("Image id ".concat(e," already exist, use updateImage instead"));this._validate(e,r)&&(this.images[e]=r)}_validate(e,r){let i=!0,o=r.data||r.spriteData;return this._validateStretch(r.stretchX,o&&o.width)||(this.fire(new j(new Error('Image "'.concat(e,'" has invalid "stretchX" value')))),i=!1),this._validateStretch(r.stretchY,o&&o.height)||(this.fire(new j(new Error('Image "'.concat(e,'" has invalid "stretchY" value')))),i=!1),this._validateContent(r.content,r)||(this.fire(new j(new Error('Image "'.concat(e,'" has invalid "content" value')))),i=!1),i}_validateStretch(e,r){if(!e)return!0;let i=0;for(let o of e){if(o[0]<i||o[1]<o[0]||r<o[1])return!1;i=o[1]}return!0}_validateContent(e,r){if(!e)return!0;if(e.length!==4)return!1;let i=r.spriteData,o=i&&i.width||r.data.width,a=i&&i.height||r.data.height;return!(e[0]<0||o<e[0]||e[1]<0||a<e[1]||e[2]<0||o<e[2]||e[3]<0||a<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,r,i=!0){let o=this.getImage(e);if(i&&(o.data.width!==r.data.width||o.data.height!==r.data.height))throw new Error("size mismatch between old image (".concat(o.data.width,"x").concat(o.data.height,") and new image (").concat(r.data.width,"x").concat(r.data.height,")."));r.version=o.version+1,this.images[e]=r,this.updatedImages[e]=!0}removeImage(e){let r=this.images[e];delete this.images[e],delete this.patterns[e],r.userImage&&r.userImage.onRemove&&r.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e,r){let i=!0;if(!this.isLoaded())for(let o of e)this.images[o]||(i=!1);this.isLoaded()||i?this._notify(e,r):this.requestors.push({ids:e,callback:r})}_notify(e,r){let i={};for(let o of e){let a=this.getImage(o);a||(this.fire(new E("styleimagemissing",{id:o})),a=this.getImage(o)),a?i[o]={data:a.data.clone(),pixelRatio:a.pixelRatio,sdf:a.sdf,version:a.version,stretchX:a.stretchX,stretchY:a.stretchY,content:a.content,hasRenderCallback:!!(a.userImage&&a.userImage.render)}:xe('Image "'.concat(o,'" 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.'))}r(null,i)}getPixelSize(){let{width:e,height:r}=this.atlasImage;return{width:e,height:r}}getPattern(e){let r=this.patterns[e],i=this.getImage(e);if(!i)return null;if(r&&r.position.version===i.version)return r.position;if(r)r.position.version=i.version;else{let o=i.data.width+Vo*2,a=i.data.height+Vo*2,s={w:o,h:a,x:0,y:0},l=new Hr(s,i);this.patterns[e]={bin:s,position:l}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){let r=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new he(e,this.atlasImage,r.RGBA),this.atlasTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}_updatePatternAtlas(){let e=[];for(let a in this.patterns)e.push(this.patterns[a].bin);let{w:r,h:i}=Fn(e),o=this.atlasImage;o.resize({width:r||1,height:i||1});for(let a in this.patterns){let{bin:s}=this.patterns[a],l=s.x+Vo,c=s.y+Vo,p=this.getImage(a).data,m=p.width,h=p.height;_e.copy(p,o,{x:0,y:0},{x:l,y:c},{width:m,height:h}),_e.copy(p,o,{x:0,y:h-1},{x:l,y:c-1},{width:m,height:1}),_e.copy(p,o,{x:0,y:0},{x:l,y:c+h},{width:m,height:1}),_e.copy(p,o,{x:m-1,y:0},{x:l-1,y:c},{width:1,height:h}),_e.copy(p,o,{x:0,y:0},{x:l+m,y:c},{width:1,height:h})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(let r of e){if(this.callbackDispatchedThisFrame[r])continue;this.callbackDispatchedThisFrame[r]=!0;let i=this.getImage(r);i||xe('Image with ID: "'.concat(r,'" was not found')),Fd(i)&&this.updateImage(r,i)}}};u(Ec,"ImageManager");var Uo=Ec;f();f();function zd(n,t,e,r,i){let o=t*256,a=o+255,s=r.transformRequest(e.replace("{fontstack}",n).replace("{range}","".concat(o,"-").concat(a)),"Glyphs");Nn(s,(l,c)=>{if(l)i(l);else if(c){let p={};for(let m of bd(c))p[m.id]=m;i(null,p)}})}u(zd,"loadGlyphRange");var wr=class wr{constructor(t,e){this.requestManager=t,this.localIdeographFontFamily=e,this.entries={}}setURL(t){this.url=t}getGlyphs(t,e){let r=[];for(let i in t)for(let o of t[i])r.push({stack:i,id:o});Bn(r,({stack:i,id:o},a)=>{let s=this.entries[i];s||(s=this.entries[i]={glyphs:{},requests:{},ranges:{}});let l=s.glyphs[o];if(l!==void 0){a(null,{stack:i,id:o,glyph:l});return}if(l=this._tinySDF(s,i,o),l){s.glyphs[o]=l,a(null,{stack:i,id:o,glyph:l});return}let c=Math.floor(o/256);if(c*256>65535){a(new Error("glyphs > 65535 not supported"));return}if(s.ranges[c]){a(null,{stack:i,id:o,glyph:l});return}if(!this.url){a(new Error("glyphsUrl is not set"));return}let p=s.requests[c];p||(p=s.requests[c]=[],wr.loadGlyphRange(i,c,this.url,this.requestManager,(m,h)=>{if(h){for(let d in h)this._doesCharSupportLocalGlyph(+d)||(s.glyphs[+d]=h[+d]);s.ranges[c]=!0}for(let d of p)d(m,h);delete s.requests[c]})),p.push((m,h)=>{m?a(m):h&&a(null,{stack:i,id:o,glyph:h[o]||null})})},(i,o)=>{if(i)e(i);else if(o){let a={};for(let{stack:s,id:l,glyph:c}of o)(a[s]||(a[s]={}))[l]=c&&{id:c.id,bitmap:c.bitmap.clone(),metrics:c.metrics};e(null,a)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(ne["CJK Unified Ideographs"](t)||ne["Hangul Syllables"](t)||ne.Hiragana(t)||ne.Katakana(t))}_tinySDF(t,e,r){let i=this.localIdeographFontFamily;if(!i||!this._doesCharSupportLocalGlyph(r))return;let o=t.tinySDF;if(!o){let l="400";/bold/i.test(e)?l="900":/medium/i.test(e)?l="500":/light/i.test(e)&&(l="200"),o=t.tinySDF=new wr.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:i,fontWeight:l})}let a=o.draw(String.fromCharCode(r)),s=27;return{id:r,bitmap:new gr({width:a.width||30,height:a.height||30},a.data),metrics:{width:a.glyphWidth||24,height:a.glyphHeight||24,left:a.glyphLeft||0,top:a.glyphTop-s||-8,advance:a.glyphAdvance||24}}}};u(wr,"GlyphManager"),wr.loadGlyphRange=zd,wr.TinySDF=Vh;var No=wr;f();var kc=class kc{constructor(){this.specification=T.light.position}possiblyEvaluate(t,e){return Qh(t.expression.evaluate(e))}interpolate(t,e,r){return{x:Ae.number(t.x,e.x,r),y:Ae.number(t.y,e.y,r),z:Ae.number(t.z,e.z,r)}}};u(kc,"LightPositionProperty");var Lc=kc,Bd="-transition",Mc,Dc=class Dc extends se{constructor(e){super();Mc=Mc||new Ie({anchor:new q(T.light.anchor),position:new Lc,color:new q(T.light.color),intensity:new q(T.light.intensity)}),this._transitionable=new Rr(Mc),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,r={}){if(!this._validate(uf,e,r))for(let i in e){let o=e[i];i.endsWith(Bd)?this._transitionable.setTransition(i.slice(0,-Bd.length),o):this._transitionable.setValue(i,o)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,r,i){return i&&i.validate===!1?!1:kr(this,e.call(Me,k({value:r,style:{glyphs:!0,sprite:!0},styleSpec:T})))}};u(Dc,"Light");var Go=Dc;f();var Fc=class Fc{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(t,e){let r=t.join(",")+String(e);return this.dashEntry[r]||(this.dashEntry[r]=this.addDash(t,e)),this.dashEntry[r]}getDashRanges(t,e,r){let i=t.length%2===1,o=[],a=i?-t[t.length-1]*r:0,s=t[0]*r,l=!0;o.push({left:a,right:s,isDash:l,zeroLength:t[0]===0});let c=t[0];for(let p=1;p<t.length;p++){l=!l;let m=t[p];a=c*r,c+=m,s=c*r,o.push({left:a,right:s,isDash:l,zeroLength:m===0})}return o}addRoundDash(t,e,r){let i=e/2;for(let o=-r;o<=r;o++){let a=this.nextRow+r+o,s=this.width*a,l=0,c=t[l];for(let p=0;p<this.width;p++){p/c.right>1&&(c=t[++l]);let m=Math.abs(p-c.left),h=Math.abs(p-c.right),d=Math.min(m,h),g,y=o/r*(i+1);if(c.isDash){let x=i-Math.abs(y);g=Math.sqrt(d*d+x*x)}else g=i-Math.sqrt(d*d+y*y);this.data[s+p]=Math.max(0,Math.min(255,g+128))}}}addRegularDash(t){for(let s=t.length-1;s>=0;--s){let l=t[s],c=t[s+1];l.zeroLength?t.splice(s,1):c&&c.isDash===l.isDash&&(c.left=l.left,t.splice(s,1))}let e=t[0],r=t[t.length-1];e.isDash===r.isDash&&(e.left=r.left-this.width,r.right=e.right+this.width);let i=this.width*this.nextRow,o=0,a=t[o];for(let s=0;s<this.width;s++){s/a.right>1&&(a=t[++o]);let l=Math.abs(s-a.left),c=Math.abs(s-a.right),p=Math.min(l,c),m=a.isDash?p:-p;this.data[i+s]=Math.max(0,Math.min(255,m+128))}}addDash(t,e){let r=e?7:0,i=2*r+1;if(this.nextRow+i>this.height)return xe("LineAtlas out of space"),null;let o=0;for(let s=0;s<t.length;s++)o+=t[s];if(o!==0){let s=this.width/o,l=this.getDashRanges(t,this.width,s);e?this.addRoundDash(l,s,r):this.addRegularDash(l)}let a={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:o};return this.nextRow+=i,this.dirty=!0,a}bind(t){let e=t.gl;this.texture?(e.bindTexture(e.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,e.texSubImage2D(e.TEXTURE_2D,0,0,0,this.width,this.height,e.ALPHA,e.UNSIGNED_BYTE,this.data))):(this.texture=e.createTexture(),e.bindTexture(e.TEXTURE_2D,this.texture),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.REPEAT),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texImage2D(e.TEXTURE_2D,0,e.ALPHA,this.width,this.height,0,e.ALPHA,e.UNSIGNED_BYTE,this.data))}};u(Fc,"LineAtlas");var qo=Fc;f();f();f();var zc=class zc{constructor(t){this._callback=t,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(){delete this._channel,this._callback=()=>{}}};u(zc,"ThrottledInvoker");var jo=zc;var Bc=class Bc{constructor(t,e,r){this.receive=u(t=>{let e=t.data,r=e.id;if(r&&!(e.targetMapId&&this.mapId!==e.targetMapId))if(e.type==="<cancel>"){delete this.tasks[r];let i=this.cancelCallbacks[r];delete this.cancelCallbacks[r],i&&i()}else Ke()||e.mustQueue?(this.tasks[r]=e,this.taskQueue.push(r),this.invoker.trigger()):this.processTask(r,e)},"receive");this.process=u(()=>{if(!this.taskQueue.length)return;let t=this.taskQueue.shift(),e=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(t,e)},"process");this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new jo(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Ke()?t:window}send(t,e,r,i,o=!1){let a=Math.round(Math.random()*1e18).toString(36).substring(0,10);r&&(this.callbacks[a]=r);let s=ar(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!r,targetMapId:i,mustQueue:o,sourceMapId:this.mapId,data:Dr(e,s)},s),{cancel:()=>{r&&delete this.callbacks[a],this.target.postMessage({id:a,type:"<cancel>",targetMapId:i,sourceMapId:this.mapId})}}}processTask(t,e){if(e.type==="<response>"){let r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(Fr(e.error)):r(null,Fr(e.data)))}else{let r=!1,i=ar(this.globalScope)?void 0:[],o=e.hasCallback?(l,c)=>{r=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:l?Dr(l):null,data:Dr(c,i)},i)}:l=>{r=!0},a=null,s=Fr(e.data);if(this.parent[e.type])a=this.parent[e.type](e.sourceMapId,s,o);else if(this.parent.getWorkerSource){let l=e.type.split(".");a=this.parent.getWorkerSource(e.sourceMapId,l[0],s.source)[l[1]](s,o)}else o(new Error("Could not find function ".concat(e.type)));!r&&a&&a.cancel&&(this.cancelCallbacks[t]=a.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}};u(Bc,"Actor");var Ho=Bc;var Zo=class Zo{constructor(t,e,r){this.workerPool=t,this.actors=[],this.currentActor=0,this.id=r;let i=this.workerPool.acquire(r);for(let o=0;o<i.length;o++){let a=i[o],s=new Zo.Actor(a,e,r);s.name="Worker ".concat(o),this.actors.push(s)}if(!this.actors.length)throw new Error("No actors found")}broadcast(t,e,r){r=r||function(){},Bn(this.actors,(i,o)=>{i.send(t,e,o)},r)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(t=!0){this.actors.forEach(e=>{e.remove()}),this.actors=[],t&&this.workerPool.release(this.id)}};u(Zo,"Dispatcher");var un=Zo;un.Actor=Ho;f();f();f();function Wo(n,t,e){let r=u(function(i,o){if(i)return e(i);if(o){let a=ht(k(o,n),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);o.vector_layers&&(a.vectorLayers=o.vector_layers,a.vectorLayerIds=a.vectorLayers.map(s=>s.id)),e(null,a)}},"loaded");return n.url?Bt(t.transformRequest(n.url,"Source"),r):ee.frame(()=>r(null,n))}u(Wo,"loadTileJson");f();f();f();var Pr=63710088e-1,Sr=class Sr{constructor(t,e){if(isNaN(t)||isNaN(e))throw new Error("Invalid LngLat object: (".concat(t,", ").concat(e,")"));if(this.lng=+t,this.lat=+e,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Sr(St(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(t){let e=Math.PI/180,r=this.lat*e,i=t.lat*e,o=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((t.lng-this.lng)*e);return Pr*Math.acos(Math.min(o,1))}static convert(t){if(t instanceof Sr)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Sr(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Sr(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};u(Sr,"LngLat");var Q=Sr;var Wt=class Wt{constructor(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):Array.isArray(t)&&(t.length===4?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1])))}setNorthEast(t){return this._ne=t instanceof Q?new Q(t.lng,t.lat):Q.convert(t),this}setSouthWest(t){return this._sw=t instanceof Q?new Q(t.lng,t.lat):Q.convert(t),this}extend(t){let e=this._sw,r=this._ne,i,o;if(t instanceof Q)i=t,o=t;else if(t instanceof Wt){if(i=t._sw,o=t._ne,!i||!o)return this}else{if(Array.isArray(t))if(t.length===4||t.every(Array.isArray)){let a=t;return this.extend(Wt.convert(a))}else{let a=t;return this.extend(Q.convert(a))}else if(t&&("lng"in t||"lon"in t)&&"lat"in t)return this.extend(Q.convert(t));return this}return!e&&!r?(this._sw=new Q(i.lng,i.lat),this._ne=new Q(o.lng,o.lat)):(e.lng=Math.min(i.lng,e.lng),e.lat=Math.min(i.lat,e.lat),r.lng=Math.max(o.lng,r.lng),r.lat=Math.max(o.lat,r.lat)),this}getCenter(){return new Q((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 Q(this.getWest(),this.getNorth())}getSouthEast(){return new Q(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(".concat(this._sw.toString(),", ").concat(this._ne.toString(),")")}isEmpty(){return!(this._sw&&this._ne)}contains(t){let{lng:e,lat:r}=Q.convert(t),i=this._sw.lat<=r&&r<=this._ne.lat,o=this._sw.lng<=e&&e<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=e&&e>=this._ne.lng),i&&o}static convert(t){return t instanceof Wt||!t?t:new Wt(t)}static fromLngLat(t,e=0){let i=360*e/40075017,o=i/Math.cos(Math.PI/180*t.lat);return new Wt(new Q(t.lng-o,t.lat-i),new Q(t.lng+o,t.lat+i))}};u(Wt,"LngLatBounds");var We=Wt;f();var Rd=2*Math.PI*Pr;function Od(n){return Rd*Math.cos(n*Math.PI/180)}u(Od,"circumferenceAtLatitude");function Xt(n){return(180+n)/360}u(Xt,"mercatorXfromLng");function Kt(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}u(Kt,"mercatorYfromLat");function Oc(n,t){return n/Od(t)}u(Oc,"mercatorZfromAltitude");function xb(n){return n*360-180}u(xb,"lngFromMercatorX");function Rc(n){let t=180-n*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}u(Rc,"latFromMercatorY");function _b(n,t){return n*Od(Rc(t))}u(_b,"altitudeFromMercatorZ");function bb(n){return 1/Math.cos(n*Math.PI/180)}u(bb,"mercatorScale");var Xo=class Xo{constructor(t,e,r=0){this.x=+t,this.y=+e,this.z=+r}static fromLngLat(t,e=0){let r=Q.convert(t);return new Xo(Xt(r.lng),Kt(r.lat),Oc(e,r.lat))}toLngLat(){return new Q(xb(this.x),Rc(this.y))}toAltitude(){return _b(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Rd*bb(Rc(this.y))}};u(Xo,"MercatorCoordinate");var Se=Xo;var Vc=class Vc{constructor(t,e,r){this.bounds=We.convert(this.validateBounds(t)),this.minzoom=e||0,this.maxzoom=r||24}validateBounds(t){return!Array.isArray(t)||t.length!==4?[-180,-90,180,90]:[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]}contains(t){let e=Math.pow(2,t.z),r={minX:Math.floor(Xt(this.bounds.getWest())*e),minY:Math.floor(Kt(this.bounds.getNorth())*e),maxX:Math.ceil(Xt(this.bounds.getEast())*e),maxY:Math.ceil(Kt(this.bounds.getSouth())*e)};return t.x>=r.minX&&t.x<r.maxX&&t.y>=r.minY&&t.y<r.maxY}};u(Vc,"TileBounds");var Kr=Vc;var Uc=class Uc extends se{constructor(e,r,i,o){super();this.load=u(()=>{this._loaded=!1,this.fire(new E("dataloading",{dataType:"source"})),this._tileJSONRequest=Wo(this._options,this.map._requestManager,(e,r)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e?this.fire(new j(e)):r&&(k(this,r),r.bounds&&(this.tileBounds=new Kr(r.bounds,this.minzoom,this.maxzoom)),this.fire(new E("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new E("data",{dataType:"source",sourceDataType:"content"})))})},"load");this.serialize=u(()=>k({},this._options),"serialize");if(this.id=e,this.dispatcher=i,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,k(this,ht(r,["url","scheme","tileSize","promoteId"])),this._options=k({type:"vector"},r),this._collectResourceTiming=r.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(o)}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.cancel(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(e,r){let i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),o={request:this.map._requestManager.transformRequest(i,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};o.request.collectResourceTiming=this._collectResourceTiming,!e.actor||e.state==="expired"?(e.actor=this.dispatcher.getActor(),e.request=e.actor.send("loadTile",o,a.bind(this))):e.state==="loading"?e.reloadCallback=r:e.request=e.actor.send("reloadTile",o,a.bind(this));function a(s,l){if(delete e.request,e.aborted)return r(null);if(s&&s.status!==404)return r(s);l&&l.resourceTiming&&(e.resourceTiming=l.resourceTiming),this.map._refreshExpiredTiles&&l&&e.setExpiryData(l),e.loadVectorData(l,this.map.painter),r(null),e.reloadCallback&&(this.loadTile(e,e.reloadCallback),e.reloadCallback=null)}u(a,"done")}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.actor&&e.actor.send("abortTile",{uid:e.uid,type:this.type,source:this.id},void 0)}unloadTile(e){e.unloadVectorData(),e.actor&&e.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}};u(Uc,"VectorTileSource");var $r=Uc;f();var Nc=class Nc extends se{constructor(e,r,i,o){super();this.id=e,this.dispatcher=i,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=k({type:"raster"},r),k(this,ht(r,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new E("dataloading",{dataType:"source"})),this._tileJSONRequest=Wo(this._options,this.map._requestManager,(e,r)=>{this._tileJSONRequest=null,this._loaded=!0,e?this.fire(new j(e)):r&&(k(this,r),r.bounds&&(this.tileBounds=new Kr(r.bounds,this.minzoom,this.maxzoom)),this.fire(new E("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new E("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return k({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e,r){let i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=He.getImage(this.map._requestManager.transformRequest(i,"Tile"),(o,a,s)=>{if(delete e.request,e.aborted)e.state="unloaded",r(null);else if(o)e.state="errored",r(o);else if(a){this.map._refreshExpiredTiles&&s&&e.setExpiryData(s);let l=this.map.painter.context,c=l.gl;e.texture=this.map.painter.getTileTexture(a.width),e.texture?e.texture.update(a,{useMipmap:!0}):(e.texture=new he(l,a,c.RGBA,{useMipmap:!0}),e.texture.bind(c.LINEAR,c.CLAMP_TO_EDGE,c.LINEAR_MIPMAP_NEAREST),l.extTextureFilterAnisotropic&&c.texParameterf(c.TEXTURE_2D,l.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,l.extTextureFilterAnisotropicMax)),e.state="loaded",r(null)}},this.map._refreshExpiredTiles)}abortTile(e,r){e.request&&(e.request.cancel(),delete e.request),r()}unloadTile(e,r){e.texture&&this.map.painter.saveTileTexture(e.texture),r()}hasTransition(){return!1}};u(Nc,"RasterTileSource");var $t=Nc;f();f();var Gc;function Vd(){return Gc==null&&(Gc=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),Gc}u(Vd,"offscreenCanvasSupported");f();var Ud=te(be(),1);var qc=class qc{constructor(t,e,r){if(t<0||t>25||r<0||r>=Math.pow(2,t)||e<0||e>=Math.pow(2,t))throw new Error("x=".concat(e,", y=").concat(r,", z=").concat(t," outside of bounds. 0<=x<").concat(Math.pow(2,t),", 0<=y<").concat(Math.pow(2,t)," 0<=z<=25 "));this.z=t,this.x=e,this.y=r,this.key=cn(0,t,t,e,r)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,e,r){let i=Uh(this.x,this.y,this.z),o=vb(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(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(r==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,e>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let e=this.z-t.z;return e>0&&t.x===this.x>>e&&t.y===this.y>>e}getTilePoint(t){let e=Math.pow(2,this.z);return new Ud.default((t.x*e-this.x)*8192,(t.y*e-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}};u(qc,"CanonicalTileID");var Jr=qc,jc=class jc{constructor(t,e){this.wrap=t,this.canonical=e,this.key=cn(t,e.z,e.z,e.x,e.y)}};u(jc,"UnwrappedTileID");var Yr=jc,ot=class ot{constructor(t,e,r,i,o){if(t<r)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(t,"; z = ").concat(r));this.overscaledZ=t,this.wrap=e,this.canonical=new Jr(r,+i,+o),this.key=cn(e,t,r,i,o)}clone(){return new ot(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let e=this.canonical.z-t;return t>this.canonical.z?new ot(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ot(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)}calculateScaledKey(t,e){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-t;return t>this.canonical.z?cn(this.wrap*+e,t,this.canonical.z,this.canonical.x,this.canonical.y):cn(this.wrap*+e,t,t,this.canonical.x>>r,this.canonical.y>>r)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let e=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>e&&t.canonical.y===this.canonical.y>>e}children(t){if(this.overscaledZ>=t)return[new ot(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let e=this.canonical.z+1,r=this.canonical.x*2,i=this.canonical.y*2;return[new ot(e,this.wrap,e,r,i),new ot(e,this.wrap,e,r+1,i),new ot(e,this.wrap,e,r,i+1),new ot(e,this.wrap,e,r+1,i+1)]}isLessThan(t){return this.wrap<t.wrap?!0:this.wrap>t.wrap?!1:this.overscaledZ<t.overscaledZ?!0:this.overscaledZ>t.overscaledZ?!1:this.canonical.x<t.canonical.x?!0:this.canonical.x>t.canonical.x?!1:this.canonical.y<t.canonical.y}wrapped(){return new ot(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new ot(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Yr(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(t){return this.canonical.getTilePoint(new Se(t.x-this.wrap,t.y))}};u(ot,"OverscaledTileID");var Ne=ot;function cn(n,t,e,r,i){n*=2,n<0&&(n=n*-1-1);let o=1<<e;return(o*o*n+o*i+r).toString(36)+e.toString(36)+t.toString(36)}u(cn,"calculateKey");function vb(n,t,e){let r="",i;for(let o=n;o>0;o--)i=1<<o-1,r+=(t&i?1:0)+(e&i?2:0);return r}u(vb,"getQuadkey");O("CanonicalTileID",Jr);O("OverscaledTileID",Ne,{omit:["posMatrix"]});f();var Zc=class Zc{constructor(t,e,r){if(this.uid=t,e.height!==e.width)throw new RangeError("DEM tiles must be square");if(r&&r!=="mapbox"&&r!=="terrarium"){xe('"'.concat(r,'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".'));return}this.stride=e.height;let i=this.dim=e.height-2;this.data=new Uint32Array(e.data.buffer),this.encoding=r||"mapbox";for(let o=0;o<i;o++)this.data[this._idx(-1,o)]=this.data[this._idx(0,o)],this.data[this._idx(i,o)]=this.data[this._idx(i-1,o)],this.data[this._idx(o,-1)]=this.data[this._idx(o,0)],this.data[this._idx(o,i)]=this.data[this._idx(o,i-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(i,-1)]=this.data[this._idx(i-1,0)],this.data[this._idx(-1,i)]=this.data[this._idx(0,i-1)],this.data[this._idx(i,i)]=this.data[this._idx(i-1,i-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let o=0;o<i;o++)for(let a=0;a<i;a++){let s=this.get(o,a);s>this.max&&(this.max=s),s<this.min&&(this.min=s)}}get(t,e){let r=new Uint8Array(this.data.buffer),i=this._idx(t,e)*4;return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(r[i],r[i+1],r[i+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,e){if(t<-1||t>=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(e+1)*this.stride+(t+1)}_unpackMapbox(t,e,r){return(t*256*256+e*256+r)/10-1e4}_unpackTerrarium(t,e,r){return t*256+e+r/256-32768}getPixels(){return new _e({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let i=e*this.dim,o=e*this.dim+this.dim,a=r*this.dim,s=r*this.dim+this.dim;switch(e){case-1:i=o-1;break;case 1:o=i+1;break}switch(r){case-1:a=s-1;break;case 1:s=a+1;break}let l=-e*this.dim,c=-r*this.dim;for(let p=a;p<s;p++)for(let m=i;m<o;m++)this.data[this._idx(m,p)]=t.data[this._idx(m+l,p+c)]}};u(Zc,"DEMData");var Hc=Zc;O("DEMData",Hc);var Wc=class Wc extends $t{constructor(e,r,i,o){super(e,r,i,o);this.type="raster-dem",this.maxzoom=22,this._options=k({type:"raster-dem"},r),this.encoding=r.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(e,r){let i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.request=He.getImage(this.map._requestManager.transformRequest(i,"Tile"),o.bind(this),this.map._refreshExpiredTiles),e.neighboringTiles=this._getNeighboringTiles(e.tileID);function o(s,l){if(delete e.request,e.aborted)e.state="unloaded",r(null);else if(s)e.state="errored",r(s);else if(l){this.map._refreshExpiredTiles&&e.setExpiryData(l),delete l.cacheControl,delete l.expires;let p=ct(l)&&Vd()?l:ee.getImageData(l,1),m={uid:e.uid,coord:e.tileID,source:this.id,rawImageData:p,encoding:this.encoding};(!e.actor||e.state==="expired")&&(e.actor=this.dispatcher.getActor(),e.actor.send("loadDEMTile",m,a.bind(this)))}}u(o,"imageLoaded");function a(s,l){s&&(e.state="errored",r(s)),l&&(e.dem=l,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded",r(null))}u(a,"done")}_getNeighboringTiles(e){let r=e.canonical,i=Math.pow(2,r.z),o=(r.x-1+i)%i,a=r.x===0?e.wrap-1:e.wrap,s=(r.x+1+i)%i,l=r.x+1===i?e.wrap+1:e.wrap,c={};return c[new Ne(e.overscaledZ,a,r.z,o,r.y).key]={backfilled:!1},c[new Ne(e.overscaledZ,l,r.z,s,r.y).key]={backfilled:!1},r.y>0&&(c[new Ne(e.overscaledZ,a,r.z,o,r.y-1).key]={backfilled:!1},c[new Ne(e.overscaledZ,e.wrap,r.z,r.x,r.y-1).key]={backfilled:!1},c[new Ne(e.overscaledZ,l,r.z,s,r.y-1).key]={backfilled:!1}),r.y+1<i&&(c[new Ne(e.overscaledZ,a,r.z,o,r.y+1).key]={backfilled:!1},c[new Ne(e.overscaledZ,e.wrap,r.z,r.x,r.y+1).key]={backfilled:!1},c[new Ne(e.overscaledZ,l,r.z,s,r.y+1).key]={backfilled:!1}),c}unloadTile(e){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&e.actor.send("removeDEMTile",{uid:e.uid,source:this.id})}};u(Wc,"RasterDEMTileSource");var Qr=Wc;f();var Xc=class Xc extends se{constructor(e,r,i,o){super();this.load=u(()=>{this._updateWorkerData()},"load");this.serialize=u(()=>k({},this._options,{type:this.type,data:this._data}),"serialize");this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=i.getActor(),this.setEventedParent(o),this._data=r.data,this._options=k({},r),this._collectResourceTiming=r.collectResourceTiming,r.maxzoom!==void 0&&(this.maxzoom=r.maxzoom),r.type&&(this.type=r.type),r.attribution&&(this.attribution=r.attribution),this.promoteId=r.promoteId;let a=8192/this.tileSize;this.workerOptions=k({source:this.id,cluster:r.cluster||!1,geojsonVtOptions:{buffer:(r.buffer!==void 0?r.buffer:128)*a,tolerance:(r.tolerance!==void 0?r.tolerance:.375)*a,extent:8192,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:8192,radius:(r.clusterRadius||50)*a,log:!1,generateId:r.generateId||!1},clusterProperties:r.clusterProperties,filter:r.filter},r.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=e.clusterRadius),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e,r){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:e,source:this.id},r),this}getClusterChildren(e,r){return this.actor.send("geojson.getClusterChildren",{clusterId:e,source:this.id},r),this}getClusterLeaves(e,r,i,o){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:e,limit:r,offset:i},o),this}_updateWorkerData(e){let r=k({},this.workerOptions);e?r.dataDiff=e:typeof this._data=="string"?(r.request=this.map._requestManager.transformRequest(ee.resolveURL(this._data),"Source"),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new E("dataloading",{dataType:"source"})),this.actor.send("".concat(this.type,".loadData"),r,(i,o)=>{if(this._pendingLoads--,this._removed||o&&o.abandoned){this.fire(new E("dataabort",{dataType:"source"}));return}let a=null;if(o&&o.resourceTiming&&o.resourceTiming[this.id]&&(a=o.resourceTiming[this.id].slice(0)),i){this.fire(new j(i));return}let s={dataType:"source"};this._collectResourceTiming&&a&&a.length>0&&k(s,{resourceTiming:a}),this.fire(new E("data",{...s,sourceDataType:"metadata"})),this.fire(new E("data",{...s,sourceDataType:"content"}))})}loaded(){return this._pendingLoads===0}loadTile(e,r){let i=e.actor?"reloadTile":"loadTile";e.actor=this.actor;let o={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};e.request=this.actor.send(i,o,(a,s)=>(delete e.request,e.unloadVectorData(),e.aborted?r(null):a?r(a):(e.loadVectorData(s,this.map.painter,i==="reloadTile"),r(null))))}abortTile(e){e.request&&(e.request.cancel(),delete e.request),e.aborted=!0}unloadTile(e){e.unloadVectorData(),this.actor.send("removeTile",{uid:e.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}};u(Xc,"GeoJSONSource");var ei=Xc;f();f();f();var Jt=fe([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);var Kc=class Kc extends se{constructor(e,r,i,o){super();this.load=u((e,r)=>{this._loaded=!1,this.fire(new E("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=He.getImage(this.map._requestManager.transformRequest(this.url,"Image"),(i,o)=>{this._request=null,this._loaded=!0,i?this.fire(new j(i)):o&&(this.image=o,e&&(this.coordinates=e),r&&r(),this._finishLoading())})},"load");this.prepare=u(()=>{if(Object.keys(this.tiles).length===0||!this.image)return;let e=this.map.painter.context,r=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Jt.members)),this.boundsSegments||(this.boundsSegments=ae.simpleSegment(0,0,4,2)),this.texture||(this.texture=new he(e,this.image,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(let o in this.tiles){let a=this.tiles[o];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new E("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},"prepare");this.serialize=u(()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),"serialize");this.id=e,this.dispatcher=i,this.coordinates=r.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(o),this.options=r}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=e.url,this.load(e.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new E("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(e){this.coordinates=e;let r=e.map(Se.fromLngLat);this.tileID=wb(r),this.minzoom=this.maxzoom=this.tileID.z;let i=r.map(o=>this.tileID.getTilePoint(o)._round());return this._boundsArray=new Nr,this._boundsArray.emplaceBack(i[0].x,i[0].y,0,0),this._boundsArray.emplaceBack(i[1].x,i[1].y,8192,0),this._boundsArray.emplaceBack(i[3].x,i[3].y,0,8192),this._boundsArray.emplaceBack(i[2].x,i[2].y,8192,8192),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new E("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(e,r){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},r(null)):(e.state="errored",r(null))}hasTransition(){return!1}};u(Kc,"ImageSource");var at=Kc;function wb(n){let t=1/0,e=1/0,r=-1/0,i=-1/0;for(let p of n)t=Math.min(t,p.x),e=Math.min(e,p.y),r=Math.max(r,p.x),i=Math.max(i,p.y);let o=r-t,a=i-e,s=Math.max(o,a),l=Math.max(0,Math.floor(-Math.log(s)/Math.LN2)),c=Math.pow(2,l);return new Jr(l,Math.floor((t+r)/2*c),Math.floor((e+i)/2*c))}u(wb,"getCoordinatesCenterTileID");var $c=class $c extends at{constructor(e,r,i,o){super(e,r,i,o);this.load=u(()=>{this._loaded=!1;let e=this.options;this.urls=[];for(let r of e.urls)this.urls.push(this.map._requestManager.transformRequest(r,"Source").url);of(this.urls,(r,i)=>{this._loaded=!0,r?this.fire(new j(r)):i&&(this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},"load");this.prepare=u(()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;let e=this.map.painter.context,r=e.gl;this.boundsBuffer||(this.boundsBuffer=e.createVertexBuffer(this._boundsArray,Jt.members)),this.boundsSegments||(this.boundsSegments=ae.simpleSegment(0,0,4,2)),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 he(e,this.video,r.RGBA),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE));let i=!1;for(let o in this.tiles){let a=this.tiles[o];a.state!=="loaded"&&(a.state="loaded",a.texture=this.texture,i=!0)}i&&this.fire(new E("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},"prepare");this.serialize=u(()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),"serialize");this.roundZoom=!0,this.type="video",this.options=r}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){let r=this.video.seekable;e<r.start(0)||e>r.end(0)?this.fire(new j(new Ft("sources.".concat(this.id),null,"Playback for this video can be set only between the ".concat(r.start(0)," and ").concat(r.end(0),"-second mark.")))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}};u($c,"VideoSource");var ti=$c;f();var Jc=class Jc extends at{constructor(e,r,i,o){super(e,r,i,o);this.load=u(()=>{if(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 j(new Error("Canvas dimensions cannot be less than or equal to zero.")));return}this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading()},"load");this.prepare=u(()=>{let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;let r=this.map.painter.context,i=r.gl;this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,Jt.members)),this.boundsSegments||(this.boundsSegments=ae.simpleSegment(0,0,4,2)),this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new he(r,this.canvas,i.RGBA,{premultiply:!0});let o=!1;for(let a in this.tiles){let s=this.tiles[a];s.state!=="loaded"&&(s.state="loaded",s.texture=this.texture,o=!0)}o&&this.fire(new E("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},"prepare");this.serialize=u(()=>({type:"canvas",coordinates:this.coordinates}),"serialize");r.coordinates?(!Array.isArray(r.coordinates)||r.coordinates.length!==4||r.coordinates.some(a=>!Array.isArray(a)||a.length!==2||a.some(s=>typeof s!="number")))&&this.fire(new j(new Ft("sources.".concat(e),null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new j(new Ft("sources.".concat(e),null,'missing required property "coordinates"'))),r.animate&&typeof r.animate!="boolean"&&this.fire(new j(new Ft("sources.".concat(e),null,'optional "animate" property must be a boolean value'))),r.canvas?typeof r.canvas!="string"&&!(r.canvas instanceof HTMLCanvasElement)&&this.fire(new j(new Ft("sources.".concat(e),null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new j(new Ft("sources.".concat(e),null,'missing required property "canvas"'))),this.options=r,this.animate=r.animate!==void 0?r.animate:!0}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(let e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}};u(Jc,"CanvasSource");var ri=Jc;var Nd={},Gd=u((n,t,e,r)=>{let i=Yc(t.type),o=new i(n,t,e,r);if(o.id!==n)throw new Error("Expected Source id to be ".concat(n," instead of ").concat(o.id));return o},"create"),Yc=u(n=>{switch(n){case"geojson":return ei;case"image":return at;case"raster":return $t;case"raster-dem":return Qr;case"vector":return $r;case"video":return ti;case"canvas":return ri}return Nd[n]},"getSourceType"),qd=u((n,t)=>{Nd[n]=t},"setSourceType");f();function Sb(n,t){let e=G.create();return G.translate(e,e,[1,1,0]),G.scale(e,e,[n.width*.5,n.height*.5,1]),G.multiply(e,e,n.calculatePosMatrix(t.toUnwrapped()))}u(Sb,"getPixelPosMatrix");function Pb(n,t,e){if(n)for(let r of n){let i=t[r];if(i&&i.source===e&&i.type==="fill-extrusion")return!0}else for(let r in t){let i=t[r];if(i.source===e&&i.type==="fill-extrusion")return!0}return!1}u(Pb,"queryIncludes3DLayer");function jd(n,t,e,r,i,o){let a=Pb(i&&i.layers,t,n.id),s=o.maxPitchScaleFactor(),l=n.tilesIn(r,s,a);l.sort(Wd);let c=[];for(let m of l)c.push({wrappedTileID:m.tileID.wrapped().key,queryResults:m.tile.queryRenderedFeatures(t,e,n._state,m.queryGeometry,m.cameraQueryGeometry,m.scale,i,o,s,Sb(n.transform,m.tileID))});let p=Tb(c);for(let m in p)p[m].forEach(h=>{let d=h.feature,g=n.getFeatureState(d.layer["source-layer"],d.id);d.source=d.layer.source,d.layer["source-layer"]&&(d.sourceLayer=d.layer["source-layer"]),d.state=g});return p}u(jd,"queryRenderedFeatures");function Hd(n,t,e,r,i,o,a){let s={},l=o.queryRenderedSymbols(r),c=[];for(let p of Object.keys(l).map(Number))c.push(a[p]);c.sort(Wd);for(let p of c){let m=p.featureIndex.lookupSymbolFeatures(l[p.bucketInstanceId],t,p.bucketIndex,p.sourceLayerIndex,i.filter,i.layers,i.availableImages,n);for(let h in m){let d=s[h]=s[h]||[],g=m[h];g.sort((y,x)=>{let v=p.featureSortOrder;if(v){let b=v.indexOf(y.featureIndex);return v.indexOf(x.featureIndex)-b}else return x.featureIndex-y.featureIndex});for(let y of g)d.push(y)}}for(let p in s)s[p].forEach(m=>{let h=m.feature,d=n[p],y=e[d.source].getFeatureState(h.layer["source-layer"],h.id);h.source=h.layer.source,h.layer["source-layer"]&&(h.sourceLayer=h.layer["source-layer"]),h.state=y});return s}u(Hd,"queryRenderedSymbols");function Zd(n,t){let e=n.getRenderableIds().map(o=>n.getTileByID(o)),r=[],i={};for(let o=0;o<e.length;o++){let a=e[o],s=a.tileID.canonical.key;i[s]||(i[s]=!0,a.querySourceFeatures(r,t))}return r}u(Zd,"querySourceFeatures");function Wd(n,t){let e=n.tileID,r=t.tileID;return e.overscaledZ-r.overscaledZ||e.canonical.y-r.canonical.y||e.wrap-r.wrap||e.canonical.x-r.canonical.x}u(Wd,"sortTilesIn");function Tb(n){let t={},e={};for(let r of n){let i=r.queryResults,o=r.wrappedTileID,a=e[o]=e[o]||{};for(let s in i){let l=i[s],c=a[s]=a[s]||{},p=t[s]=t[s]||[];for(let m of l)c[m.featureIndex]||(c[m.featureIndex]=!0,p.push(m))}}return t}u(Tb,"mergeRenderedFeatureLayers");f();f();f();function Xd(n,t){let e={};if(!t)return e;for(let r of n){let i=r.layerIds.map(o=>t.getLayer(o)).filter(Boolean);if(i.length!==0){r.layers=i,r.stateDependentLayerIds&&(r.stateDependentLayers=r.stateDependentLayerIds.map(o=>i.filter(a=>a.id===o)[0]));for(let o of i)e[o.id]=r}}return e}u(Xd,"deserialize");f();f();var Qc=class Qc{constructor(t){this._stringToNumber={},this._numberToString=[];for(let e=0;e<t.length;e++){let r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(t," can't be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[t]}};u(Qc,"DictionaryCoder");var Ko=Qc;var Jd=te(Dn(),1),Yd=te(Oh(),1);f();var ep=class ep{constructor(t,e,r,i,o){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=i,this.properties=t.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let e in this)e==="_geometry"||e==="_vectorTileFeature"||(t[e]=this[e]);return t}};u(ep,"GeoJSONFeature");var ii=ep;var rp=class rp{constructor(t,e){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new sr(8192,16,0),this.grid3D=new sr(8192,16,0),this.featureIndexArray=new qi,this.promoteId=e}insert(t,e,r,i,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,i,o);let l=a?this.grid3D:this.grid;for(let c=0;c<e.length;c++){let p=e[c],m=[1/0,1/0,-1/0,-1/0];for(let h=0;h<p.length;h++){let d=p[h];m[0]=Math.min(m[0],d.x),m[1]=Math.min(m[1],d.y),m[2]=Math.max(m[2],d.x),m[3]=Math.max(m[3],d.y)}m[0]<8192&&m[1]<8192&&m[2]>=0&&m[3]>=0&&l.insert(s,m[0],m[1],m[2],m[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Jd.default.VectorTile(new Yd.default(this.rawTileData)).layers,this.sourceLayerCoder=new Ko(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,e,r,i){this.loadVTLayers();let o=t.params||{},a=8192/t.tileSize/t.scale,s=yi(o.filter),l=t.queryGeometry,c=t.queryPadding*a,p=$d(l),m=this.grid.query(p.minX-c,p.minY-c,p.maxX+c,p.maxY+c),h=$d(t.cameraQueryGeometry),d=this.grid3D.query(h.minX-c,h.minY-c,h.maxX+c,h.maxY+c,(x,v,b,w)=>kf(t.cameraQueryGeometry,x-c,v-c,b+c,w+c));for(let x of d)m.push(x);m.sort(Ib);let g={},y;for(let x=0;x<m.length;x++){let v=m[x];if(v===y)continue;y=v;let b=this.featureIndexArray.get(v),w=null;this.loadMatchingFeature(g,b.bucketIndex,b.sourceLayerIndex,b.featureIndex,s,o.layers,o.availableImages,e,r,i,(S,P,I)=>(w||(w=Qe(S)),P.queryIntersectsFeature(l,S,I,w,this.z,t.transform,a,t.pixelPosMatrix)))}return g}loadMatchingFeature(t,e,r,i,o,a,s,l,c,p,m){let h=this.bucketLayerIDs[e];if(a&&!$h(a,h))return;let d=this.sourceLayerCoder.decode(r),y=this.vtLayers[d].feature(i);if(o.needGeometry){let v=et(y,!0);if(!o.filter(new le(this.tileID.overscaledZ),v,this.tileID.canonical))return}else if(!o.filter(new le(this.tileID.overscaledZ),y))return;let x=this.getId(y,d);for(let v=0;v<h.length;v++){let b=h[v];if(a&&a.indexOf(b)<0)continue;let w=l[b];if(!w)continue;let S={};x&&p&&(S=p.getState(w.sourceLayer||"_geojsonTileLayer",x));let P=k({},c[b]);P.paint=Kd(P.paint,w.paint,y,S,s),P.layout=Kd(P.layout,w.layout,y,S,s);let I=!m||m(y,w,S);if(!I)continue;let C=new ii(y,this.z,this.x,this.y,x);C.layer=P;let z=t[b];z===void 0&&(z=t[b]=[]),z.push({featureIndex:i,feature:C,intersectionZ:I})}}lookupSymbolFeatures(t,e,r,i,o,a,s,l){let c={};this.loadVTLayers();let p=yi(o);for(let m of t)this.loadMatchingFeature(c,r,i,m,p,a,s,l,e);return c}hasLayer(t){for(let e of this.bucketLayerIDs)for(let r of e)if(t===r)return!0;return!1}getId(t,e){let r=t.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[e];r=t.properties[i],typeof r=="boolean"&&(r=Number(r))}return r}};u(rp,"FeatureIndex");var tp=rp;O("FeatureIndex",tp,{omit:["rawTileData","sourceLayerCoder"]});function Kd(n,t,e,r,i){return gi(n,(o,a)=>{let s=t instanceof Vt?t.get(a):null;return s&&s.evaluate?s.evaluate(e,r,i):s})}u(Kd,"evaluateProperties");function $d(n){let t=1/0,e=1/0,r=-1/0,i=-1/0;for(let o of n)t=Math.min(t,o.x),e=Math.min(e,o.y),r=Math.max(r,o.x),i=Math.max(i,o.y);return{minX:t,minY:e,maxX:r,maxY:i}}u($d,"getBounds");function Ib(n,t){return t-n}u(Ib,"topDownFeatureComparator");var Ab=3e4,ip=class ip{constructor(t,e){this.timeAdded=0;this.fadeEndTime=0;this.tileID=t,this.uid=Rn(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){let e=t+this.timeAdded;e<this.fadeEndTime||(this.fadeEndTime=e)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(t){this.demTexture&&t.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(t,e,r){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",!t){this.collisionBoxArray=new Oi;return}t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=Xd(t.buckets,e.style),this.hasSymbolBuckets=!1;for(let i in this.buckets){let o=this.buckets[i];if(o instanceof yt)if(this.hasSymbolBuckets=!0,r)o.justReloaded=!0;else break}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(let i in this.buckets){let o=this.buckets[i];if(o instanceof yt&&o.hasRTLText){this.hasRTLText=!0,bf();break}}this.queryPadding=0;for(let i in this.buckets){let o=this.buckets[i];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(i).queryRadius(o))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}unloadVectorData(){for(let t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(let r in this.buckets){let i=this.buckets[r];i.uploadPending()&&i.upload(t)}let e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new he(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new he(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,e,r,i,o,a,s,l,c,p){return!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData?{}:this.latestFeatureIndex.query({queryGeometry:i,cameraQueryGeometry:o,scale:a,tileSize:this.tileSize,pixelPosMatrix:p,transform:l,params:s,queryPadding:this.queryPadding*c},t,e,r)}querySourceFeatures(t,e){let r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;let i=r.loadVTLayers(),o=e&&e.sourceLayer?e.sourceLayer:"",a=i._geojsonTileLayer||i[o];if(!a)return;let s=yi(e&&e.filter),{z:l,x:c,y:p}=this.tileID.canonical,m={z:l,x:c,y:p};for(let h=0;h<a.length;h++){let d=a.feature(h);if(s.needGeometry){let x=et(d,!0);if(!s.filter(new le(this.tileID.overscaledZ),x,this.tileID.canonical))continue}else if(!s.filter(new le(this.tileID.overscaledZ),d))continue;let g=r.getId(d,o),y=new ii(d,l,c,p,g);y.tile=m,t.push(y)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(t){let e=this.expirationTime;if(t.cacheControl){let r=ef(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+r["max-age"]*1e3)}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){let r=Date.now(),i=!1;if(this.expirationTime>r)i=!1;else if(!e)i=!0;else if(this.expirationTime<e)i=!0;else{let o=this.expirationTime-e;o?this.expirationTime=r+Math.max(o,Ab):i=!0}i?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(t,e){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(t).length===0)return;let r=this.latestFeatureIndex.loadVTLayers();for(let i in this.buckets){if(!e.style.hasLayer(i))continue;let o=this.buckets[i],a=o.layers[0].sourceLayer||"_geojsonTileLayer",s=r[a],l=t[a];if(!s||!l||Object.keys(l).length===0)continue;o.update(l,s,this.imageAtlas&&this.imageAtlas.patternPositions||{});let c=e&&e.style&&e.style.getLayer(i);c&&(this.queryPadding=Math.max(this.queryPadding,c.queryRadius(o)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ee.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(t){this.symbolFadeHoldUntil=ee.now()+t}setDependencies(t,e){let r={};for(let i of e)r[i]=!0;this.dependencies[t]=r}hasDependency(t,e){for(let r of t){let i=this.dependencies[r];if(i){for(let o of e)if(i[o])return!0}}return!1}};u(ip,"Tile");var ni=ip;f();var np=class np{constructor(t,e){this.max=t,this.onRemove=e,this.reset()}reset(){for(let t in this.data)for(let e of this.data[t])e.timeout&&clearTimeout(e.timeout),this.onRemove(e.value);return this.data={},this.order=[],this}add(t,e,r){let i=t.wrapped().key;this.data[i]===void 0&&(this.data[i]=[]);let o={value:e,timeout:void 0};if(r!==void 0&&(o.timeout=setTimeout(()=>{this.remove(t,o)},r)),this.data[i].push(o),this.order.push(i),this.order.length>this.max){let a=this._getAndRemoveByKey(this.order[0]);a&&this.onRemove(a)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){let e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){let e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;let r=t.wrapped().key,i=e===void 0?0:this.data[r].indexOf(e),o=this.data[r][i];return this.data[r].splice(i,1),o.timeout&&clearTimeout(o.timeout),this.data[r].length===0&&delete this.data[r],this.onRemove(o.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){let e=this._getAndRemoveByKey(this.order[0]);e&&this.onRemove(e)}return this}filter(t){let e=[];for(let r in this.data)for(let i of this.data[r])t(i.value)||e.push(i);for(let r of e)this.remove(r.value.tileID,r)}};u(np,"TileCache");var $o=np;var ap=te(be(),1);f();var op=class op{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,e,r){let i=String(e);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][i]=this.stateChanges[t][i]||{},k(this.stateChanges[t][i],r),this.deletedStates[t]===null){this.deletedStates[t]={};for(let o in this.state[t])o!==i&&(this.deletedStates[t][o]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][i]===null){this.deletedStates[t][i]={};for(let a in this.state[t][i])r[a]||(this.deletedStates[t][i][a]=null)}else for(let a in r)this.deletedStates[t]&&this.deletedStates[t][i]&&this.deletedStates[t][i][a]===null&&delete this.deletedStates[t][i][a]}removeFeatureState(t,e,r){if(this.deletedStates[t]===null)return;let o=String(e);if(this.deletedStates[t]=this.deletedStates[t]||{},r&&e!==void 0)this.deletedStates[t][o]!==null&&(this.deletedStates[t][o]=this.deletedStates[t][o]||{},this.deletedStates[t][o][r]=null);else if(e!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][o]){this.deletedStates[t][o]={};for(r in this.stateChanges[t][o])this.deletedStates[t][o][r]=null}else this.deletedStates[t][o]=null;else this.deletedStates[t]=null}getState(t,e){let r=String(e),i=this.state[t]||{},o=this.stateChanges[t]||{},a=k({},i[r],o[r]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){let s=this.deletedStates[t][e];if(s===null)return{};for(let l in s)delete a[l]}return a}initializeTileState(t,e){t.setFeatureState(this.state,e)}coalesceChanges(t,e){let r={};for(let i in this.stateChanges){this.state[i]=this.state[i]||{};let o={};for(let a in this.stateChanges[i])this.state[i][a]||(this.state[i][a]={}),k(this.state[i][a],this.stateChanges[i][a]),o[a]=this.state[i][a];r[i]=o}for(let i in this.deletedStates){this.state[i]=this.state[i]||{};let o={};if(this.deletedStates[i]===null)for(let a in this.state[i])o[a]={},this.state[i][a]={};else for(let a in this.deletedStates[i]){if(this.deletedStates[i][a]===null)this.state[i][a]={};else for(let l of Object.keys(this.deletedStates[i][a]))delete this.state[i][a][l];o[a]=this.state[i][a]}r[i]=r[i]||{},k(r[i],o)}if(this.stateChanges={},this.deletedStates={},Object.keys(r).length!==0)for(let i in t)t[i].setFeatureState(r,e)}};u(op,"SourceFeatureState");var Jo=op;var Tr=class Tr extends se{constructor(e,r,i){super();this.id=e,this.dispatcher=i,this.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,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=Gd(e,r,i,this),this._tiles={},this._cache=new $o(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Jo,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if((this.used!==void 0||this.usedForTerrain!==void 0)&&!this.used&&!this.usedForTerrain)return!0;if(!this._updated)return!1;for(let e in this._tiles){let r=this._tiles[e];if(r.state!=="loaded"&&r.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;let e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,r){return this._source.loadTile(e,r)}_unloadTile(e){if(this._source.unloadTile)return this._source.unloadTile(e,()=>{})}_abortTile(e){this._source.abortTile&&this._source.abortTile(e,()=>{}),this._source.fire(new E("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}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(let r in this._tiles){let i=this._tiles[r];i.upload(e),i.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(Qd).map(e=>e.key)}getRenderableIds(e){let r=[];for(let i in this._tiles)this._isIdRenderable(i,e)&&r.push(this._tiles[i]);return e?r.sort((i,o)=>{let a=i.tileID,s=o.tileID,l=new ap.default(a.canonical.x,a.canonical.y)._rotate(this.transform.angle),c=new ap.default(s.canonical.x,s.canonical.y)._rotate(this.transform.angle);return a.overscaledZ-s.overscaledZ||c.y-l.y||c.x-l.x}).map(i=>i.tileID.key):r.map(i=>i.tileID).sort(Qd).map(i=>i.key)}hasRenderableParent(e){let r=this.findLoadedParent(e,0);return r?this._isIdRenderable(r.tileID.key):!1}_isIdRenderable(e,r){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(r||!this._tiles[e].holdingForFade())}reload(){if(this._paused){this._shouldReloadOnResume=!0;return}this._cache.reset();for(let e in this._tiles)this._tiles[e].state!=="errored"&&this._reloadTile(e,"reloading")}_reloadTile(e,r){let i=this._tiles[e];i&&(i.state!=="loading"&&(i.state=r),this._loadTile(i,this._tileLoaded.bind(this,i,e,r)))}_tileLoaded(e,r,i,o){if(o){e.state="errored",o.status!==404?this._source.fire(new j(o,{tile:e})):this.update(this.transform,this.terrain);return}e.timeAdded=ee.now(),i==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(r,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new E("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){let r=this.getRenderableIds();for(let o=0;o<r.length;o++){let a=r[o];if(e.neighboringTiles&&e.neighboringTiles[a]){let s=this.getTileByID(a);i(e,s),i(s,e)}}function i(o,a){o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0;let s=a.tileID.canonical.x-o.tileID.canonical.x,l=a.tileID.canonical.y-o.tileID.canonical.y,c=Math.pow(2,o.tileID.canonical.z),p=a.tileID.key;s===0&&l===0||Math.abs(l)>1||(Math.abs(s)>1&&(Math.abs(s+c)===1?s+=c:Math.abs(s-c)===1&&(s-=c)),!(!a.dem||!o.dem)&&(o.dem.backfillBorder(a.dem,s,l),o.neighboringTiles&&o.neighboringTiles[p]&&(o.neighboringTiles[p].backfilled=!0)))}u(i,"fillBorder")}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,r,i,o){for(let a in this._tiles){let s=this._tiles[a];if(o[a]||!s.hasData()||s.tileID.overscaledZ<=r||s.tileID.overscaledZ>i)continue;let l=s.tileID;for(;s&&s.tileID.overscaledZ>r+1;){let p=s.tileID.scaledTo(s.tileID.overscaledZ-1);s=this._tiles[p.key],s&&s.hasData()&&(l=p)}let c=l;for(;c.overscaledZ>r;)if(c=c.scaledTo(c.overscaledZ-1),e[c.key]){o[l.key]=l;break}}}findLoadedParent(e,r){if(e.key in this._loadedParentTiles){let i=this._loadedParentTiles[e.key];return i&&i.tileID.overscaledZ>=r?i:null}for(let i=e.overscaledZ-1;i>=r;i--){let o=e.scaledTo(i),a=this._getLoadedTile(o);if(a)return a}}_getLoadedTile(e){let r=this._tiles[e.key];return r&&r.hasData()?r:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){let r=Math.ceil(e.width/this._source.tileSize)+1,i=Math.ceil(e.height/this._source.tileSize)+1,o=r*i,a=this._maxTileCacheZoomLevels===null?Ge.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels,s=Math.floor(o*a),l=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,s):s;this._cache.setMaxSize(l)}handleWrapJump(e){let r=this._prevLng===void 0?e:this._prevLng,o=(e-r)/360,a=Math.round(o);if(this._prevLng=e,a){let s={};for(let l in this._tiles){let c=this._tiles[l];c.tileID=c.tileID.unwrapTo(c.tileID.wrap+a),s[c.tileID.key]=c}this._tiles=s;for(let l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(let l in this._tiles){let c=this._tiles[l];this._setTileReloadTimer(l,c)}}}update(e,r){if(this.transform=e,this.terrain=r,!this._sourceLoaded||this._paused)return;this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={};let i;!this.used&&!this.usedForTerrain?i=[]:this._source.tileID?i=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(m=>new Ne(m.canonical.z,m.wrap,m.canonical.z,m.canonical.x,m.canonical.y)):(i=e.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this.usedForTerrain?!1:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:r}),this._source.hasTile&&(i=i.filter(m=>this._source.hasTile(m))));let o=e.coveringZoomLevel(this._source),a=Math.max(o-Tr.maxOverzooming,this._source.minzoom),s=Math.max(o+Tr.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){let m={};for(let h of i)if(h.canonical.z>this._source.minzoom){let d=h.scaledTo(h.canonical.z-1);m[d.key]=d;let g=h.scaledTo(Math.max(this._source.minzoom,Math.min(h.canonical.z,5)));m[g.key]=g}i=i.concat(Object.values(m))}let l=i.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,l&&this.fire(new E("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));let c=this._updateRetainedTiles(i,o);if(ey(this._source.type)){let m={},h={},d=Object.keys(c),g=ee.now();for(let y of d){let x=c[y],v=this._tiles[y];if(!v||v.fadeEndTime!==0&&v.fadeEndTime<=g)continue;let b=this.findLoadedParent(x,a);b&&(this._addTile(b.tileID),m[b.tileID.key]=b.tileID),h[y]=x}this._retainLoadedChildren(h,o,s,c);for(let y in m)c[y]||(this._coveredTiles[y]=!0,c[y]=m[y]);if(r){let y={},x={};for(let v of i)this._tiles[v.key].hasData()?y[v.key]=v:x[v.key]=v;for(let v in x){let b=x[v].children(this._source.maxzoom);this._tiles[b[0].key]&&this._tiles[b[1].key]&&this._tiles[b[2].key]&&this._tiles[b[3].key]&&(y[b[0].key]=c[b[0].key]=b[0],y[b[1].key]=c[b[1].key]=b[1],y[b[2].key]=c[b[2].key]=b[2],y[b[3].key]=c[b[3].key]=b[3],delete x[v])}for(let v in x){let b=this.findLoadedParent(x[v],this._source.minzoom);if(b){y[b.tileID.key]=c[b.tileID.key]=b.tileID;for(let w in y)y[w].isChildOf(b.tileID)&&delete y[w]}}for(let v in this._tiles)y[v]||(this._coveredTiles[v]=!0)}}for(let m in c)this._tiles[m].clearFadeHold();let p=Wh(this._tiles,c);for(let m of p){let h=this._tiles[m];h.hasSymbolBuckets&&!h.holdingForFade()?h.setHoldDuration(this.map._fadeDuration):(!h.hasSymbolBuckets||h.symbolFadeFinished())&&this._removeTile(m)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(let e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,r){let i={},o={},a=Math.max(r-Tr.maxOverzooming,this._source.minzoom),s=Math.max(r+Tr.maxUnderzooming,this._source.minzoom),l={};for(let c of e){let p=this._addTile(c);i[c.key]=c,!p.hasData()&&r<this._source.maxzoom&&(l[c.key]=c)}this._retainLoadedChildren(l,r,s,i);for(let c of e){let p=this._tiles[c.key];if(p.hasData())continue;if(r+1>this._source.maxzoom){let h=c.children(this._source.maxzoom)[0],d=this.getTile(h);if(d&&d.hasData()){i[h.key]=h;continue}}else{let h=c.children(this._source.maxzoom);if(i[h[0].key]&&i[h[1].key]&&i[h[2].key]&&i[h[3].key])continue}let m=p.wasRequested();for(let h=c.overscaledZ-1;h>=a;--h){let d=c.scaledTo(h);if(o[d.key])break;if(o[d.key]=!0,p=this.getTile(d),!p&&m&&(p=this._addTile(d)),p){let g=p.hasData();if((m||g)&&(i[d.key]=d),m=p.wasRequested(),g)break}}}return i}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(let e in this._tiles){let r=[],i,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){i=this._loadedParentTiles[o.key];break}r.push(o.key);let a=o.scaledTo(o.overscaledZ-1);if(i=this._getLoadedTile(a),i)break;o=a}for(let a of r)this._loadedParentTiles[a]=i}}_addTile(e){let r=this._tiles[e.key];if(r)return r;r=this._cache.getAndRemove(e),r&&(this._setTileReloadTimer(e.key,r),r.tileID=e,this._state.initializeTileState(r,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,r)));let i=r;return r||(r=new ni(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(r,this._tileLoaded.bind(this,r,e.key,r.state))),r.uses++,this._tiles[e.key]=r,i||this._source.fire(new E("dataloading",{tile:r,coord:r.tileID,dataType:"source"})),r}_setTileReloadTimer(e,r){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);let i=r.getExpiryTimeout();i&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},i))}_removeTile(e){let r=this._tiles[e];r&&(r.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),!(r.uses>0)&&(r.hasData()&&r.state!=="reloading"?this._cache.add(r.tileID,r,r.getExpiryTimeout()):(r.aborted=!0,this._abortTile(r),this._unloadTile(r))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(let e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,r,i){let o=[],a=this.transform;if(!a)return o;let s=i?a.getCameraQueryGeometry(e):e,l=e.map(y=>a.pointCoordinate(y,this.terrain)),c=s.map(y=>a.pointCoordinate(y,this.terrain)),p=this.getIds(),m=1/0,h=1/0,d=-1/0,g=-1/0;for(let y of c)m=Math.min(m,y.x),h=Math.min(h,y.y),d=Math.max(d,y.x),g=Math.max(g,y.y);for(let y=0;y<p.length;y++){let x=this._tiles[p[y]];if(x.holdingForFade())continue;let v=x.tileID,b=Math.pow(2,a.zoom-x.tileID.overscaledZ),w=r*x.queryPadding*8192/x.tileSize/b,S=[v.getTilePoint(new Se(m,h)),v.getTilePoint(new Se(d,g))];if(S[0].x-w<8192&&S[0].y-w<8192&&S[1].x+w>=0&&S[1].y+w>=0){let P=l.map(C=>v.getTilePoint(C)),I=c.map(C=>v.getTilePoint(C));o.push({tile:x,tileID:v,queryGeometry:P,cameraQueryGeometry:I,scale:b})}}return o}getVisibleCoordinates(e){let r=this.getRenderableIds(e).map(i=>this._tiles[i].tileID);for(let i of r)i.posMatrix=this.transform.calculatePosMatrix(i.toUnwrapped());return r}hasTransition(){if(this._source.hasTransition())return!0;if(ey(this._source.type)){let e=ee.now();for(let r in this._tiles)if(this._tiles[r].fadeEndTime>=e)return!0}return!1}setFeatureState(e,r,i){e=e||"_geojsonTileLayer",this._state.updateState(e,r,i)}removeFeatureState(e,r,i){e=e||"_geojsonTileLayer",this._state.removeFeatureState(e,r,i)}getFeatureState(e,r){return e=e||"_geojsonTileLayer",this._state.getState(e,r)}setDependencies(e,r,i){let o=this._tiles[e];o&&o.setDependencies(r,i)}reloadTilesForDependencies(e,r){for(let i in this._tiles)this._tiles[i].hasDependency(e,r)&&this._reloadTile(i,"reloading");this._cache.filter(i=>!i.hasDependency(e,r))}};u(Tr,"SourceCache");var Ct=Tr;Ct.maxOverzooming=10;Ct.maxUnderzooming=3;function Qd(n,t){let e=Math.abs(n.wrap*2)-+(n.wrap<0),r=Math.abs(t.wrap*2)-+(t.wrap<0);return n.overscaledZ-t.overscaledZ||r-e||t.canonical.y-n.canonical.y||t.canonical.x-n.canonical.x}u(Qd,"compareTileId");function ey(n){return n==="raster"||n==="image"||n==="video"}u(ey,"isRasterType");f();f();f();f();var ty='(()=>{var Tf=Object.create;var da=Object.defineProperty;var Ef=Object.getOwnPropertyDescriptor;var Ff=Object.getOwnPropertyNames;var Mf=Object.getPrototypeOf,Lf=Object.prototype.hasOwnProperty;var we=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),sl=(e,t)=>{for(var r in t)da(e,r,{get:t[r],enumerable:!0})},Df=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ff(t))!Lf.call(e,i)&&i!==r&&da(e,i,{get:()=>t[i],enumerable:!(n=Ef(t,i))||n.enumerable});return e};var Z=(e,t,r)=>(r=e!=null?Tf(Mf(e)):{},Df(t||!e||!e.__esModule?da(r,"default",{value:e,enumerable:!0}):r,e));var he=we((Kx,ll)=>{"use strict";ll.exports=rr;function rr(e,t){this.x=e,this.y=t}rr.prototype={clone:function(){return new rr(this.x,this.y)},add:function(e){return this.clone()._add(e)},sub:function(e){return this.clone()._sub(e)},multByPoint:function(e){return this.clone()._multByPoint(e)},divByPoint:function(e){return this.clone()._divByPoint(e)},mult:function(e){return this.clone()._mult(e)},div:function(e){return this.clone()._div(e)},rotate:function(e){return this.clone()._rotate(e)},rotateAround:function(e,t){return this.clone()._rotateAround(e,t)},matMult:function(e){return this.clone()._matMult(e)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(e){return this.x===e.x&&this.y===e.y},dist:function(e){return Math.sqrt(this.distSqr(e))},distSqr:function(e){var t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith:function(e){return this.angleWithSep(e.x,e.y)},angleWithSep:function(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult:function(e){var t=e[0]*this.x+e[1]*this.y,r=e[2]*this.x+e[3]*this.y;return this.x=t,this.y=r,this},_add:function(e){return this.x+=e.x,this.y+=e.y,this},_sub:function(e){return this.x-=e.x,this.y-=e.y,this},_mult:function(e){return this.x*=e,this.y*=e,this},_div:function(e){return this.x/=e,this.y/=e,this},_multByPoint:function(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint:function(e){return this.x/=e.x,this.y/=e.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var e=this.y;return this.y=this.x,this.x=-e,this},_rotate:function(e){var t=Math.cos(e),r=Math.sin(e),n=t*this.x-r*this.y,i=r*this.x+t*this.y;return this.x=n,this.y=i,this},_rotateAround:function(e,t){var r=Math.cos(e),n=Math.sin(e),i=t.x+r*(this.x-t.x)-n*(this.y-t.y),o=t.y+n*(this.x-t.x)+r*(this.y-t.y);return this.x=i,this.y=o,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}};rr.convert=function(e){return e instanceof rr?e:Array.isArray(e)?new rr(e[0],e[1]):e}});var ga=we((Yx,cl)=>{"use strict";cl.exports=ul;function ul(e,t,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=n}ul.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(t===void 0&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,n=0;n<8;n++){var i=this.sampleCurveX(r)-e;if(Math.abs(i)<t)return r;var o=this.sampleCurveDerivativeX(r);if(Math.abs(o)<1e-6)break;r=r-i/o}var a=0,s=1;for(r=e,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-e)<t));n++)e>i?a=r:s=r,r=(s-a)*.5+a;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}}});var Du=we((w0,es)=>{function Jm(e,t){var r,n,i,o,a,s,l,u,c,p;for(r=e.length&3,n=e.length-r,i=t,a=3432918353,l=461845907,p=0;p<n;)c=e.charCodeAt(p)&255|(e.charCodeAt(++p)&255)<<8|(e.charCodeAt(++p)&255)<<16|(e.charCodeAt(++p)&255)<<24,++p,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c,i=i<<13|i>>>19,o=(i&65535)*5+(((i>>>16)*5&65535)<<16)&4294967295,i=(o&65535)+27492+(((o>>>16)+58964&65535)<<16);switch(c=0,r){case 3:c^=(e.charCodeAt(p+2)&255)<<16;case 2:c^=(e.charCodeAt(p+1)&255)<<8;case 1:c^=e.charCodeAt(p)&255,c=(c&65535)*a+(((c>>>16)*a&65535)<<16)&4294967295,c=c<<15|c>>>17,c=(c&65535)*l+(((c>>>16)*l&65535)<<16)&4294967295,i^=c}return i^=e.length,i^=i>>>16,i=(i&65535)*2246822507+(((i>>>16)*2246822507&65535)<<16)&4294967295,i^=i>>>13,i=(i&65535)*3266489909+(((i>>>16)*3266489909&65535)<<16)&4294967295,i^=i>>>16,i>>>0}typeof es<"u"&&(es.exports=Jm)});var Vu=we((A0,ts)=>{function Wm(e,t){for(var r=e.length,n=t^r,i=0,o;r>=4;)o=e.charCodeAt(i)&255|(e.charCodeAt(++i)&255)<<8|(e.charCodeAt(++i)&255)<<16|(e.charCodeAt(++i)&255)<<24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),o^=o>>>24,o=(o&65535)*1540483477+(((o>>>16)*1540483477&65535)<<16),n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)^o,r-=4,++i;switch(r){case 3:n^=(e.charCodeAt(i+2)&255)<<16;case 2:n^=(e.charCodeAt(i+1)&255)<<8;case 1:n^=e.charCodeAt(i)&255,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16)}return n^=n>>>13,n=(n&65535)*1540483477+(((n>>>16)*1540483477&65535)<<16),n^=n>>>15,n>>>0}typeof ts!==void 0&&(ts.exports=Wm)});var rs=we((_0,fo)=>{var Bu=Du(),Hm=Vu();fo.exports=Bu;fo.exports.murmur3=Bu;fo.exports.murmur2=Hm});var hs=we((g1,ms)=>{"use strict";ms.exports=Io;ms.exports.default=Io;function Io(e,t,r){r=r||2;var n=t&&t.length,i=n?t[0]*r:e.length,o=Sc(e,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;var s,l,u,c,p,f,y;if(n&&(o=Vd(e,t,o,r)),e.length>80*r){s=u=e[0],l=c=e[1];for(var m=r;m<i;m+=r)p=e[m],f=e[m+1],p<s&&(s=p),f<l&&(l=f),p>u&&(u=p),f>c&&(c=f);y=Math.max(u-s,c-l),y=y!==0?32767/y:0}return Bn(o,a,r,s,l,y,0),a}function Sc(e,t,r,n,i){var o,a;if(i===ys(e,t,r,n)>0)for(o=t;o<r;o+=n)a=Pc(o,e[o],e[o+1],a);else for(o=r-n;o>=t;o-=n)a=Pc(o,e[o],e[o+1],a);return a&&Co(a,a.next)&&(Rn(a),a=a.next),a}function Ht(e,t){if(!e)return e;t||(t=e);var r=e,n;do if(n=!1,!r.steiner&&(Co(r,r.next)||se(r.prev,r,r.next)===0)){if(Rn(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function Bn(e,t,r,n,i,o,a){if(e){!a&&o&&Nd(e,n,i,o);for(var s=e,l,u;e.prev!==e.next;){if(l=e.prev,u=e.next,o?Md(e,n,i,o):Fd(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(u.i/r|0),Rn(e),e=u.next,s=u.next;continue}if(e=u,e===s){a?a===1?(e=Ld(Ht(e),t,r),Bn(e,t,r,n,i,o,2)):a===2&&Dd(e,t,r,n,i,o):Bn(Ht(e),t,r,n,i,o,1);break}}}}function Fd(e){var t=e.prev,r=e,n=e.next;if(se(t,r,n)>=0)return!1;for(var i=t.x,o=r.x,a=n.x,s=t.y,l=r.y,u=n.y,c=i<o?i<a?i:a:o<a?o:a,p=s<l?s<u?s:u:l<u?l:u,f=i>o?i>a?i:a:o>a?o:a,y=s>l?s>u?s:u:l>u?l:u,m=n.next;m!==t;){if(m.x>=c&&m.x<=f&&m.y>=p&&m.y<=y&&Pr(i,s,o,l,a,u,m.x,m.y)&&se(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Md(e,t,r,n){var i=e.prev,o=e,a=e.next;if(se(i,o,a)>=0)return!1;for(var s=i.x,l=o.x,u=a.x,c=i.y,p=o.y,f=a.y,y=s<l?s<u?s:u:l<u?l:u,m=c<p?c<f?c:f:p<f?p:f,h=s>l?s>u?s:u:l>u?l:u,d=c>p?c>f?c:f:p>f?p:f,g=ps(y,m,t,r,n),v=ps(h,d,t,r,n),b=e.prevZ,x=e.nextZ;b&&b.z>=g&&x&&x.z<=v;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=d&&b!==i&&b!==a&&Pr(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0||(b=b.prevZ,x.x>=y&&x.x<=h&&x.y>=m&&x.y<=d&&x!==i&&x!==a&&Pr(s,c,l,p,u,f,x.x,x.y)&&se(x.prev,x,x.next)>=0))return!1;x=x.nextZ}for(;b&&b.z>=g;){if(b.x>=y&&b.x<=h&&b.y>=m&&b.y<=d&&b!==i&&b!==a&&Pr(s,c,l,p,u,f,b.x,b.y)&&se(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;x&&x.z<=v;){if(x.x>=y&&x.x<=h&&x.y>=m&&x.y<=d&&x!==i&&x!==a&&Pr(s,c,l,p,u,f,x.x,x.y)&&se(x.prev,x,x.next)>=0)return!1;x=x.nextZ}return!0}function Ld(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!Co(i,o)&&wc(i,n,n.next,o)&&zn(i,o)&&zn(o,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),Rn(n),Rn(n.next),n=e=o),n=n.next}while(n!==e);return Ht(n)}function Dd(e,t,r,n,i,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&Gd(a,s)){var l=Ac(a,s);a=Ht(a,a.next),l=Ht(l,l.next),Bn(a,t,r,n,i,o,0),Bn(l,t,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==e)}function Vd(e,t,r,n){var i=[],o,a,s,l,u;for(o=0,a=t.length;o<a;o++)s=t[o]*n,l=o<a-1?t[o+1]*n:e.length,u=Sc(e,s,l,n,!1),u===u.next&&(u.steiner=!0),i.push($d(u));for(i.sort(Bd),o=0;o<i.length;o++)r=zd(i[o],r);return r}function Bd(e,t){return e.x-t.x}function zd(e,t){var r=Rd(e,t);if(!r)return t;var n=Ac(r,e);return Ht(n,n.next),Ht(r,r.next)}function Rd(e,t){var r=t,n=e.x,i=e.y,o=-1/0,a;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,a=r.x<r.next.x?r:r.next,s===n))return a}r=r.next}while(r!==t);if(!a)return null;var l=a,u=a.x,c=a.y,p=1/0,f;r=a;do n>=r.x&&r.x>=u&&n!==r.x&&Pr(i<c?n:o,i,u,c,i<c?o:n,i,r.x,r.y)&&(f=Math.abs(i-r.y)/(n-r.x),zn(r,e)&&(f<p||f===p&&(r.x>a.x||r.x===a.x&&Od(a,r)))&&(a=r,p=f)),r=r.next;while(r!==l);return a}function Od(e,t){return se(e.prev,e,t.prev)<0&&se(t.next,e,e.next)<0}function Nd(e,t,r,n){var i=e;do i.z===0&&(i.z=ps(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,Ud(i)}function Ud(e){var t,r,n,i,o,a,s,l,u=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,n=r,s=0,t=0;t<u&&(s++,n=n.nextZ,!!n);t++);for(l=u;s>0||l>0&&n;)s!==0&&(l===0||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n}o.nextZ=null,u*=2}while(a>1);return e}function ps(e,t,r,n,i){return e=(e-r)*i|0,t=(t-n)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function $d(e){var t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function Pr(e,t,r,n,i,o,a,s){return(i-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(n-s)>=(r-a)*(t-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function Gd(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!qd(e,t)&&(zn(e,t)&&zn(t,e)&&jd(e,t)&&(se(e.prev,e,t.prev)||se(e,t.prev,t))||Co(e,t)&&se(e.prev,e,e.next)>0&&se(t.prev,t,t.next)>0)}function se(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Co(e,t){return e.x===t.x&&e.y===t.y}function wc(e,t,r,n){var i=_o(se(e,t,r)),o=_o(se(e,t,n)),a=_o(se(r,n,e)),s=_o(se(r,n,t));return!!(i!==o&&a!==s||i===0&&Ao(e,r,t)||o===0&&Ao(e,n,t)||a===0&&Ao(r,e,n)||s===0&&Ao(r,t,n))}function Ao(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function _o(e){return e>0?1:e<0?-1:0}function qd(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&wc(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function zn(e,t){return se(e.prev,e,e.next)<0?se(e,t,e.next)>=0&&se(e,e.prev,t)>=0:se(e,t,e.prev)<0||se(e,e.next,t)<0}function jd(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function Ac(e,t){var r=new fs(e.i,e.x,e.y),n=new fs(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Pc(e,t,r,n){var i=new fs(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Rn(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function fs(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Io.deviation=function(e,t,r,n){var i=t&&t.length,o=i?t[0]*r:e.length,a=Math.abs(ys(e,0,o,r));if(i)for(var s=0,l=t.length;s<l;s++){var u=t[s]*r,c=s<l-1?t[s+1]*r:e.length;a-=Math.abs(ys(e,u,c,r))}var p=0;for(s=0;s<n.length;s+=3){var f=n[s]*r,y=n[s+1]*r,m=n[s+2]*r;p+=Math.abs((e[f]-e[m])*(e[y+1]-e[f+1])-(e[f]-e[y])*(e[m+1]-e[f+1]))}return a===0&&p===0?0:Math.abs((p-a)/a)};function ys(e,t,r,n){for(var i=0,o=t,a=r-n;o<r;o+=n)i+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return i}Io.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var a=0;a<t;a++)r.vertices.push(e[i][o][a]);i>0&&(n+=e[i-1].length,r.holes.push(n))}return r}});var gs=we((eP,Mc)=>{"use strict";var Xd=he();Mc.exports=_r;function _r(e,t,r,n,i){this.properties={},this.extent=r,this.type=0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=i,e.readFields(Qd,this,t)}function Qd(e,t,r){e==1?t.id=r.readVarint():e==2?eg(r,t):e==3?t.type=r.readVarint():e==4&&(t._geometry=r.pos)}function eg(e,t){for(var r=e.readVarint()+e.pos;e.pos<r;){var n=t._keys[e.readVarint()],i=t._values[e.readVarint()];t.properties[n]=i}}_r.types=["Unknown","Point","LineString","Polygon"];_r.prototype.loadGeometry=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,n=0,i=0,o=0,a=[],s;e.pos<t;){if(n<=0){var l=e.readVarint();r=l&7,n=l>>3}if(n--,r===1||r===2)i+=e.readSVarint(),o+=e.readSVarint(),r===1&&(s&&a.push(s),s=[]),s.push(new Xd(i,o));else if(r===7)s&&s.push(s[0].clone());else throw new Error("unknown command "+r)}return s&&a.push(s),a};_r.prototype.bbox=function(){var e=this._pbf;e.pos=this._geometry;for(var t=e.readVarint()+e.pos,r=1,n=0,i=0,o=0,a=1/0,s=-1/0,l=1/0,u=-1/0;e.pos<t;){if(n<=0){var c=e.readVarint();r=c&7,n=c>>3}if(n--,r===1||r===2)i+=e.readSVarint(),o+=e.readSVarint(),i<a&&(a=i),i>s&&(s=i),o<l&&(l=o),o>u&&(u=o);else if(r!==7)throw new Error("unknown command "+r)}return[a,l,s,u]};_r.prototype.toGeoJSON=function(e,t,r){var n=this.extent*Math.pow(2,r),i=this.extent*e,o=this.extent*t,a=this.loadGeometry(),s=_r.types[this.type],l,u;function c(y){for(var m=0;m<y.length;m++){var h=y[m],d=180-(h.y+o)*360/n;y[m]=[(h.x+i)*360/n-180,360/Math.PI*Math.atan(Math.exp(d*Math.PI/180))-90]}}switch(this.type){case 1:var p=[];for(l=0;l<a.length;l++)p[l]=a[l][0];a=p,c(a);break;case 2:for(l=0;l<a.length;l++)c(a[l]);break;case 3:for(a=tg(a),l=0;l<a.length;l++)for(u=0;u<a[l].length;u++)c(a[l][u]);break}a.length===1?a=a[0]:s="Multi"+s;var f={type:"Feature",geometry:{type:s,coordinates:a},properties:this.properties};return"id"in this&&(f.id=this.id),f};function tg(e){var t=e.length;if(t<=1)return[e];for(var r=[],n,i,o=0;o<t;o++){var a=rg(e[o]);a!==0&&(i===void 0&&(i=a<0),i===a<0?(n&&r.push(n),n=[e[o]]):n.push(e[o]))}return n&&r.push(n),r}function rg(e){for(var t=0,r=0,n=e.length,i=n-1,o,a;r<n;i=r++)o=e[r],a=e[i],t+=(a.x-o.x)*(o.y+a.y);return t}});var xs=we((tP,Dc)=>{"use strict";var ng=gs();Dc.exports=Lc;function Lc(e,t){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(ig,this,t),this.length=this._features.length}function ig(e,t,r){e===15?t.version=r.readVarint():e===1?t.name=r.readString():e===5?t.extent=r.readVarint():e===2?t._features.push(r.pos):e===3?t._keys.push(r.readString()):e===4&&t._values.push(og(r))}function og(e){for(var t=null,r=e.readVarint()+e.pos;e.pos<r;){var n=e.readVarint()>>3;t=n===1?e.readString():n===2?e.readFloat():n===3?e.readDouble():n===4?e.readVarint64():n===5?e.readVarint():n===6?e.readSVarint():n===7?e.readBoolean():null}return t}Lc.prototype.feature=function(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];var t=this._pbf.readVarint()+this._pbf.pos;return new ng(this._pbf,t,this.extent,this._keys,this._values)}});var Bc=we((rP,Vc)=>{"use strict";var ag=xs();Vc.exports=sg;function sg(e,t){this.layers=e.readFields(lg,{},t)}function lg(e,t,r){if(e===3){var n=new ag(r,r.readVarint()+r.pos);n.length&&(t[n.name]=n)}}});var It=we((nP,To)=>{To.exports.VectorTile=Bc();To.exports.VectorTileFeature=gs();To.exports.VectorTileLayer=xs()});var np=we(ws=>{ws.read=function(e,t,r,n,i){var o,a,s=i*8-n-1,l=(1<<s)-1,u=l>>1,c=-7,p=r?i-1:0,f=r?-1:1,y=e[t+p];for(p+=f,o=y&(1<<-c)-1,y>>=-c,c+=s;c>0;o=o*256+e[t+p],p+=f,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=a*256+e[t+p],p+=f,c-=8);if(o===0)o=1-u;else{if(o===l)return a?NaN:(y?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-u}return(y?-1:1)*a*Math.pow(2,o-n)};ws.write=function(e,t,r,n,i,o){var a,s,l,u=o*8-i-1,c=(1<<u)-1,p=c>>1,f=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:o-1,m=n?1:-1,h=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+p>=1?t+=f/l:t+=f*Math.pow(2,1-p),t*l>=2&&(a++,l/=2),a+p>=c?(s=0,a=c):a+p>=1?(s=(t*l-1)*Math.pow(2,i),a=a+p):(s=t*Math.pow(2,p-1)*Math.pow(2,i),a=0));i>=8;e[r+y]=s&255,y+=m,s/=256,i-=8);for(a=a<<i|s,u+=i;u>0;e[r+y]=a&255,y+=m,a/=256,u-=8);e[r+y-m]|=h*128}});var $n=we((RS,lp)=>{"use strict";lp.exports=J;var Do=np();function J(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}J.Varint=0;J.Fixed64=1;J.Bytes=2;J.Fixed32=5;var As=65536*65536,ip=1/As,Cg=12,sp=typeof TextDecoder>"u"?null:new TextDecoder("utf8");J.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,e(i,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=Vo(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=ap(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=Vo(this.buf,this.pos)+Vo(this.buf,this.pos+4)*As;return this.pos+=8,e},readSFixed64:function(){var e=Vo(this.buf,this.pos)+ap(this.buf,this.pos+4)*As;return this.pos+=8,e},readFloat:function(){var e=Do.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=Do.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,kg(r,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=Cg&&sp?$g(this.buf,t,e):Ug(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==J.Bytes)return e.push(this.readVarint(t));var r=ut(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==J.Bytes)return e.push(this.readSVarint());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==J.Bytes)return e.push(this.readBoolean());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==J.Bytes)return e.push(this.readFloat());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==J.Bytes)return e.push(this.readDouble());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==J.Bytes)return e.push(this.readFixed32());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==J.Bytes)return e.push(this.readSFixed32());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==J.Bytes)return e.push(this.readFixed64());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==J.Bytes)return e.push(this.readSFixed64());var t=ut(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===J.Varint)for(;this.buf[this.pos++]>127;);else if(t===J.Bytes)this.pos=this.readVarint()+this.pos;else if(t===J.Fixed32)this.pos+=4;else if(t===J.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),kr(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),kr(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),kr(this.buf,e&-1,this.pos),kr(this.buf,Math.floor(e*ip),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),kr(this.buf,e&-1,this.pos),kr(this.buf,Math.floor(e*ip),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){Tg(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=Gg(this.buf,e,this.pos);var r=this.pos-t;r>=128&&op(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),Do.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),Do.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&op(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,J.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,Mg,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,Lg,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,Bg,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,Dg,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,Vg,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,zg,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,Rg,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,Og,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,Ng,t)},writeBytesField:function(e,t){this.writeTag(e,J.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,J.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,J.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,J.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,J.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,J.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,J.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,J.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,J.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,J.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,!!t)}};function kg(e,t,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return Cr(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function ut(e){return e.type===J.Bytes?e.readVarint()+e.pos:e.pos+1}function Cr(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function Tg(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn\'t fit into 10 bytes");t.realloc(10),Eg(r,n,t),Fg(n,t)}function Eg(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function Fg(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function op(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function Mg(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function Lg(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function Dg(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function Vg(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function Bg(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function zg(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function Rg(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function Og(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function Ng(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function Vo(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function kr(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function ap(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function Ug(e,t,r){for(var n="",i=t;i<r;){var o=e[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var l,u,c;s===1?o<128&&(a=o):s===2?(l=e[i+1],(l&192)===128&&(a=(o&31)<<6|l&63,a<=127&&(a=null))):s===3?(l=e[i+1],u=e[i+2],(l&192)===128&&(u&192)===128&&(a=(o&15)<<12|(l&63)<<6|u&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(l=e[i+1],u=e[i+2],c=e[i+3],(l&192)===128&&(u&192)===128&&(c&192)===128&&(a=(o&15)<<18|(l&63)<<12|(u&63)<<6|c&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}function $g(e,t,r){return sp.decode(e.subarray(t,r))}function Gg(e,t,r){for(var n=0,i,o;n<t.length;n++){if(i=t.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=i;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=i&63|128)}return r}});var nf=we((k_,rf)=>{rf.exports=na;function na(e,t){var r=e&&e.type,n;if(r==="FeatureCollection")for(n=0;n<e.features.length;n++)na(e.features[n],t);else if(r==="GeometryCollection")for(n=0;n<e.geometries.length;n++)na(e.geometries[n],t);else if(r==="Feature")na(e.geometry,t);else if(r==="Polygon")ef(e.coordinates,t);else if(r==="MultiPolygon")for(n=0;n<e.coordinates.length;n++)ef(e.coordinates[n],t);return e}function ef(e,t){if(e.length!==0){tf(e[0],t);for(var r=1;r<e.length;r++)tf(e[r],!t)}}function tf(e,t){for(var r=0,n=0,i=0,o=e.length,a=o-1;i<o;a=i++){var s=(e[i][0]-e[a][0])*(e[a][1]+e[i][1]),l=r+s;n+=Math.abs(r)>=Math.abs(s)?r-l+s:s-l+r,r=l}r+n>=0!=!!t&&e.reverse()}});var lf=we((F_,sf)=>{"use strict";var Ix=he(),Cx=It().VectorTileFeature;sf.exports=af;function af(e,t){this.options=t||{},this.features=e,this.length=e.length}af.prototype.feature=function(e){return new oa(this.features[e],this.options.extent)};function oa(e,t){this.id=typeof e.id=="number"?e.id:void 0,this.type=e.type,this.rawGeometry=e.type===1?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096}oa.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t<e.length;t++){for(var r=e[t],n=[],i=0;i<r.length;i++)n.push(new Ix(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry};oa.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var e=this.geometry,t=1/0,r=-1/0,n=1/0,i=-1/0,o=0;o<e.length;o++)for(var a=e[o],s=0;s<a.length;s++){var l=a[s];t=Math.min(t,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[t,n,r,i]};oa.prototype.toGeoJSON=Cx.prototype.toGeoJSON});var pf=we((M_,oi)=>{var kx=$n(),cf=lf();oi.exports=Us;oi.exports.fromVectorTileJs=Us;oi.exports.fromGeojsonVt=Tx;oi.exports.GeoJSONWrapper=cf;function Us(e){var t=new kx;return Ex(e,t),t.finish()}function Tx(e,t){t=t||{};var r={};for(var n in e)r[n]=new cf(e[n].features,t),r[n].name=n,r[n].version=t.version,r[n].extent=t.extent;return Us({layers:r})}function Ex(e,t){for(var r in e.layers)t.writeMessage(3,Fx,e.layers[r])}function Fx(e,t){t.writeVarintField(15,e.version||1),t.writeStringField(1,e.name||""),t.writeVarintField(5,e.extent||4096);var r,n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r<e.length;r++)n.feature=e.feature(r),t.writeMessage(2,Mx,n);var i=n.keys;for(r=0;r<i.length;r++)t.writeStringField(3,i[r]);var o=n.values;for(r=0;r<o.length;r++)t.writeMessage(4,Vx,o[r])}function Mx(e,t){var r=e.feature;r.id!==void 0&&t.writeVarintField(1,r.id),t.writeMessage(2,Lx,e),t.writeVarintField(3,r.type),t.writeMessage(4,Dx,r)}function Lx(e,t){var r=e.feature,n=e.keys,i=e.values,o=e.keycache,a=e.valuecache;for(var s in r.properties){var l=r.properties[s],u=o[s];if(l!==null){typeof u>"u"&&(n.push(s),u=n.length-1,o[s]=u),t.writeVarint(u);var c=typeof l;c!=="string"&&c!=="boolean"&&c!=="number"&&(l=JSON.stringify(l));var p=c+":"+l,f=a[p];typeof f>"u"&&(i.push(l),f=i.length-1,a[p]=f),t.writeVarint(f)}}}function Ns(e,t){return(t<<3)+(e&7)}function uf(e){return e<<1^e>>31}function Dx(e,t){for(var r=e.loadGeometry(),n=e.type,i=0,o=0,a=r.length,s=0;s<a;s++){var l=r[s],u=1;n===1&&(u=l.length),t.writeVarint(Ns(1,u));for(var c=n===3?l.length-1:l.length,p=0;p<c;p++){p===1&&n!==1&&t.writeVarint(Ns(2,c-1));var f=l[p].x-i,y=l[p].y-o;t.writeVarint(uf(f)),t.writeVarint(uf(y)),i+=f,o+=y}n===3&&t.writeVarint(Ns(7,1))}}function Vx(e,t){var r=typeof e;r==="string"?t.writeStringField(1,e):r==="boolean"?t.writeBooleanField(7,e):r==="number"&&(e%1!==0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}});var Vf=Z(he(),1),fl=Z(ga(),1);function yl(e){if(e<=0)return 0;if(e>=1)return 1;let t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}function Bf(e,t,r,n){let i=new fl.default(e,t,r,n);return function(o){return i.solve(o)}}var Xx=Bf(.25,.1,.25,1);function rt(e,t,r){return Math.min(r,Math.max(t,e))}function ml(e,t,r){let n=r-t,i=((e-t)%n+n)%n+t;return i===t?r:i}function Ae(e,...t){for(let r of t)for(let n in r)e[n]=r[n];return e}function hl(e){return Math.log(e)/Math.LN2%1===0}function Rr(e,t,r){let n={};for(let i in e)n[i]=t.call(r||this,e[i],i,e);return n}function dl(e,t,r){let n={};for(let i in e)t.call(r||this,e[i],i,e)&&(n[i]=e[i]);return n}function tt(e){return Array.isArray(e)?e.map(tt):typeof e=="object"&&e?Rr(e,tt):e}function gl(e,t){for(let r=0;r<e.length;r++)if(t.indexOf(e[r])>=0)return!0;return!1}var pl={};function ce(e){pl[e]||(typeof console<"u"&&console.warn(e),pl[e]=!0)}function nt(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function xl(e){let t=0;for(let r=0,n=e.length,i=n-1,o,a;r<n;i=r++)o=e[r],a=e[i],t+=(a.x-o.x)*(o.y+a.y);return t}function Ie(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}var xa=null;function ba(e){if(xa==null){let t=e.navigator?e.navigator.userAgent:null;xa=!!e.safari||!!(t&&(/\\b(iPad|iPhone|iPod)\\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return xa}function Or(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap}var Ft=class e{constructor(t,r,n){let i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;let a=new Int32Array(this.arrayBuffer);t=a[0],r=a[1],n=a[2],this.d=r+2*n;for(let u=0;u<this.d*this.d;u++){let c=a[3+u],p=a[3+u+1];i.push(c===p?null:a.subarray(c,p))}let s=a[3+i.length],l=a[3+i.length+1];this.keys=a.subarray(s,l),this.bboxes=a.subarray(l),this.insert=this._insertReadonly}else{this.d=r+2*n;for(let a=0;a<this.d*this.d;a++)i.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=n,this.scale=r/t,this.uid=0;let o=n/r*t;this.min=-o,this.max=t+o}insert(t,r,n,i,o){this._forEachCell(r,n,i,o,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i),this.bboxes.push(o)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,r,n,i,o,a){this.cells[o].push(a)}query(t,r,n,i,o){let a=this.min,s=this.max;if(t<=a&&r<=a&&s<=n&&s<=i&&!o)return Array.prototype.slice.call(this.keys);{let l=[],u={};return this._forEachCell(t,r,n,i,this._queryCell,l,u,o),l}}_queryCell(t,r,n,i,o,a,s,l){let u=this.cells[o];if(u!==null){let c=this.keys,p=this.bboxes;for(let f=0;f<u.length;f++){let y=u[f];if(s[y]===void 0){let m=y*4;(l?l(p[m+0],p[m+1],p[m+2],p[m+3]):t<=p[m+2]&&r<=p[m+3]&&n>=p[m+0]&&i>=p[m+1])?(s[y]=!0,a.push(c[y])):s[y]=!1}}}}_forEachCell(t,r,n,i,o,a,s,l){let u=this._convertToCellCoord(t),c=this._convertToCellCoord(r),p=this._convertToCellCoord(n),f=this._convertToCellCoord(i);for(let y=u;y<=p;y++)for(let m=c;m<=f;m++){let h=this.d*m+y;if(!(l&&!l(this._convertFromCellCoord(y),this._convertFromCellCoord(m),this._convertFromCellCoord(y+1),this._convertFromCellCoord(m+1)))&&o.call(this,t,r,n,i,h,a,s,l))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;let t=this.cells,r=3+this.cells.length+1+1,n=0;for(let a=0;a<this.cells.length;a++)n+=this.cells[a].length;let i=new Int32Array(r+n+this.keys.length+this.bboxes.length);i[0]=this.extent,i[1]=this.n,i[2]=this.padding;let o=r;for(let a=0;a<t.length;a++){let s=t[a];i[3+a]=o,i.set(s,o),o+=s.length}return i[3+t.length]=o,i.set(this.keys,o),o+=this.keys.length,i[3+t.length+1]=o,i.set(this.bboxes,o),o+=this.bboxes.length,i.buffer}static serialize(t,r){let n=t.toArrayBuffer();return r&&r.push(n),{buffer:n}}static deserialize(t){return new e(t.buffer)}};var Ll=Z(ga(),1),zf=8,Rf={version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},Of={"*":{type:"source"}},Nf=["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],Uf={type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},$f={type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},Gf={type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},qf={type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},jf={type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},Zf={type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},Jf={id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},Wf=["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],Hf={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Kf={"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Yf={"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Xf={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},Qf={"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ey={"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ty={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ry={visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},ny={type:"array",value:"*"},iy={type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},oy={type:"enum",values:{Point:{},LineString:{},Polygon:{}}},ay={type:"array",minimum:0,maximum:24,value:["number","color"],length:2},sy={type:"array",value:"*",minimum:1},ly={anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},uy={source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},cy=["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],py={"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},fy={"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},yy={"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},my={"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},hy={"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},dy={"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},gy={"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},xy={"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},by={duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},vy={"*":{type:"string"}},S={$version:zf,$root:Rf,sources:Of,source:Nf,source_vector:Uf,source_raster:$f,source_raster_dem:Gf,source_geojson:qf,source_video:jf,source_image:Zf,layer:Jf,layout:Wf,layout_background:Hf,layout_fill:Kf,layout_circle:Yf,layout_heatmap:Xf,"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:Qf,layout_symbol:ey,layout_raster:ty,layout_hillshade:ry,filter:ny,filter_operator:iy,geometry_type:oy,function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:ay,expression:sy,light:ly,terrain:uy,paint:cy,paint_fill:py,"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:fy,paint_circle:yy,paint_heatmap:my,paint_symbol:hy,paint_raster:dy,paint_hillshade:gy,paint_background:xy,transition:by,"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:vy},Py=["type","source","source-layer","minzoom","maxzoom","filter","layout"];var D=class{constructor(t,r,n,i){this.message=(t?"".concat(t,": "):"")+n,i&&(this.identifier=i),r!=null&&r.__line__&&(this.line=r.__line__)}};function sr(e,...t){for(let r of t)for(let n in r)e[n]=r[n];return e}var Ve=class extends Error{constructor(t,r){super(r),this.message=r,this.key=t}},Ca=class e{constructor(t,r=[]){this.parent=t,this.bindings={};for(let[n,i]of r)this.bindings[n]=i}concat(t){return new e(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error("".concat(t," not found in scope."))}has(t){return this.bindings[t]?!0:this.parent?this.parent.has(t):!1}},cr={kind:"null"},L={kind:"number"},G={kind:"string"},U={kind:"boolean"},ze={kind:"color"},or={kind:"object"},$={kind:"value"},Sy={kind:"error"},Fi={kind:"collator"},pr={kind:"formatted"},Mi={kind:"padding"},Xr={kind:"resolvedImage"},Li={kind:"variableAnchorOffsetCollection"};function Fe(e,t){return{kind:"array",itemType:e,N:t}}function ne(e){if(e.kind==="array"){let t=ne(e.itemType);return typeof e.N=="number"?"array<".concat(t,", ").concat(e.N,">"):e.itemType.kind==="value"?"array":"array<".concat(t,">")}else return e.kind}var wy=[cr,L,G,U,ze,pr,or,Fe($),Mi,Xr,Li];function Gr(e,t){if(t.kind==="error")return null;if(e.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Gr(e.itemType,t.itemType))&&(typeof e.N!="number"||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if(e.kind==="value"){for(let r of wy)if(!Gr(r,t))return null}}return"Expected ".concat(ne(e)," but found ").concat(ne(t)," instead.")}function Oa(e,t){return t.some(r=>r.kind===e.kind)}function qr(e,t){return t.some(r=>r==="null"?e===null:r==="array"?Array.isArray(e):r==="object"?e&&!Array.isArray(e)&&typeof e=="object":r===typeof e)}function Nr(e,t){return e.kind==="array"&&t.kind==="array"?e.itemType.kind===t.itemType.kind&&typeof e.N=="number":e.kind===t.kind}var Dl=.96422,Vl=1,Bl=.82521,zl=4/29,ar=6/29,Rl=3*ar*ar,Ay=ar*ar*ar,_y=Math.PI/180,Iy=180/Math.PI;function Ol(e){return e=e%360,e<0&&(e+=360),e}function Nl([e,t,r,n]){e=va(e),t=va(t),r=va(r);let i,o,a=Pa((.2225045*e+.7168786*t+.0606169*r)/Vl);e===t&&t===r?i=o=a:(i=Pa((.4360747*e+.3850649*t+.1430804*r)/Dl),o=Pa((.0139322*e+.0971045*t+.7141733*r)/Bl));let s=116*a-16;return[s<0?0:s,500*(i-a),200*(a-o),n]}function va(e){return e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function Pa(e){return e>Ay?Math.pow(e,1/3):e/Rl+zl}function Ul([e,t,r,n]){let i=(e+16)/116,o=isNaN(t)?i:i+t/500,a=isNaN(r)?i:i-r/200;return i=Vl*wa(i),o=Dl*wa(o),a=Bl*wa(a),[Sa(3.1338561*o-1.6168667*i-.4906146*a),Sa(-.9787684*o+1.9161415*i+.033454*a),Sa(.0719453*o-.2289914*i+1.4052427*a),n]}function Sa(e){return e=e<=.00304?12.92*e:1.055*Math.pow(e,1/2.4)-.055,e<0?0:e>1?1:e}function wa(e){return e>ar?e*e*e:Rl*(e-zl)}function Cy(e){let[t,r,n,i]=Nl(e),o=Math.sqrt(r*r+n*n);return[Math.round(o*1e4)?Ol(Math.atan2(n,r)*Iy):NaN,o,t,i]}function ky([e,t,r,n]){return e=isNaN(e)?0:e*_y,Ul([r,Math.cos(e)*t,Math.sin(e)*t,n])}function Ty([e,t,r,n]){e=Ol(e),t/=100,r/=100;function i(o){let a=(o+e/30)%12,s=t*Math.min(r,1-r);return r-s*Math.max(-1,Math.min(a-3,9-a,1))}return[i(0),i(8),i(4),n]}function Ey(e){if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t=Fy[e];if(t){let[i,o,a]=t;return[i/255,o/255,a/255,1]}if(e.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(e)){let o=e.length<6?1:2,a=1;return[di(e.slice(a,a+=o)),di(e.slice(a,a+=o)),di(e.slice(a,a+=o)),di(e.slice(a,a+o)||"ff")]}if(e.startsWith("rgb")){let i=/^rgba?\\(\\s*([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)(%)?(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,o=e.match(i);if(o){let[a,s,l,u,c,p,f,y,m,h,d,g]=o,v=[u||" ",f||" ",h].join("");if(v===" "||v===" /"||v===",,"||v===",,,"){let b=[l,p,m].join(""),x=b==="%%%"?100:b===""?255:0;if(x){let P=[nr(+s/x,0,1),nr(+c/x,0,1),nr(+y/x,0,1),d?bl(+d,g):1];if(vl(P))return P}}return}}let r=/^hsla?\\(\\s*([\\de.+-]+)(?:deg)?(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s+|\\s*(,)\\s*)([\\de.+-]+)%(?:\\s*([,\\/])\\s*([\\de.+-]+)(%)?)?\\s*\\)$/,n=e.match(r);if(n){let[i,o,a,s,l,u,c,p,f]=n,y=[a||" ",l||" ",c].join("");if(y===" "||y===" /"||y===",,"||y===",,,"){let m=[+o,nr(+s,0,100),nr(+u,0,100),p?bl(+p,f):1];if(vl(m))return Ty(m)}}}function di(e){return parseInt(e.padEnd(2,e),16)/255}function bl(e,t){return nr(t?e/100:e,0,1)}function nr(e,t,r){return Math.min(Math.max(t,e),r)}function vl(e){return!e.some(Number.isNaN)}var Fy={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},W=class e{constructor(t,r,n,i=1,o=!0){this.r=t,this.g=r,this.b=n,this.a=i,o||(this.r*=i,this.g*=i,this.b*=i,i||this.overwriteGetter("rgb",[t,r,n,i]))}static parse(t){if(t instanceof e)return t;if(typeof t!="string")return;let r=Ey(t);if(r)return new e(...r,!1)}get rgb(){let{r:t,g:r,b:n,a:i}=this,o=i||1/0;return this.overwriteGetter("rgb",[t/o,r/o,n/o,i])}get hcl(){return this.overwriteGetter("hcl",Cy(this.rgb))}get lab(){return this.overwriteGetter("lab",Nl(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){let[t,r,n,i]=this.rgb;return"rgba(".concat([t,r,n].map(o=>Math.round(o*255)).join(","),",").concat(i,")")}};W.black=new W(0,0,0,1);W.white=new W(1,1,1,1);W.transparent=new W(0,0,0,0);W.red=new W(1,0,0,1);var jr=class{constructor(t,r,n){t?this.sensitivity=r?"variant":"case":this.sensitivity=r?"accent":"base",this.locale=n,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}},Zr=class{constructor(t,r,n,i,o){this.text=t,this.image=r,this.scale=n,this.fontStack=i,this.textColor=o}},Me=class e{constructor(t){this.sections=t}static fromString(t){return new e([new Zr(t,null,null,null,null)])}isEmpty(){return this.sections.length===0?!0:!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof e?t:e.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}},je=class e{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof e)return t;if(typeof t=="number")return new e([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(let r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]];break}return new e(t)}}toString(){return JSON.stringify(this.values)}},My=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]),it=class e{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof e)return t;if(!(!Array.isArray(t)||t.length<1||t.length%2!==0)){for(let r=0;r<t.length;r+=2){let n=t[r],i=t[r+1];if(typeof n!="string"||!My.has(n)||!Array.isArray(i)||i.length!==2||typeof i[0]!="number"||typeof i[1]!="number")return}return new e(t)}}toString(){return JSON.stringify(this.values)}},Ce=class e{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new e({name:t,available:!1}):null}};function $l(e,t,r,n){if(!(typeof e=="number"&&e>=0&&e<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255)){let i=typeof n=="number"?[e,t,r,n]:[e,t,r];return"Invalid rgba value [".concat(i.join(", "),"]: \'r\', \'g\', and \'b\' must be between 0 and 255.")}return typeof n>"u"||typeof n=="number"&&n>=0&&n<=1?null:"Invalid rgba value [".concat([e,t,r,n].join(", "),"]: \'a\' must be between 0 and 1.")}function vi(e){if(e===null||typeof e=="string"||typeof e=="boolean"||typeof e=="number"||e instanceof W||e instanceof jr||e instanceof Me||e instanceof je||e instanceof it||e instanceof Ce)return!0;if(Array.isArray(e)){for(let t of e)if(!vi(t))return!1;return!0}else if(typeof e=="object"){for(let t in e)if(!vi(e[t]))return!1;return!0}else return!1}function fe(e){if(e===null)return cr;if(typeof e=="string")return G;if(typeof e=="boolean")return U;if(typeof e=="number")return L;if(e instanceof W)return ze;if(e instanceof jr)return Fi;if(e instanceof Me)return pr;if(e instanceof je)return Mi;if(e instanceof it)return Li;if(e instanceof Ce)return Xr;if(Array.isArray(e)){let t=e.length,r;for(let n of e){let i=fe(n);if(!r)r=i;else{if(r===i)continue;r=$;break}}return Fe(r||$,t)}else return or}function Ur(e){let t=typeof e;return e===null?"":t==="string"||t==="number"||t==="boolean"?String(e):e instanceof W||e instanceof Me||e instanceof je||e instanceof it||e instanceof Ce?e.toString():JSON.stringify(e)}var mt=class e{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error("\'literal\' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(!vi(t[1]))return r.error("invalid value");let n=t[1],i=fe(n),o=r.expectedType;return i.kind==="array"&&i.N===0&&o&&o.kind==="array"&&(typeof o.N!="number"||o.N===0)&&(i=o),new e(i,n)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}},oe=class{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}},gi={string:G,number:L,boolean:U,object:or},Ge=class e{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n=1,i,o=t[0];if(o==="array"){let s;if(t.length>2){let u=t[1];if(typeof u!="string"||!(u in gi)||u==="object")return r.error(\'The item type argument of "array" must be one of string, number, boolean\',1);s=gi[u],n++}else s=$;let l;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error(\'The length argument to "array" must be a positive integer literal\',2);l=t[2],n++}i=Fe(s,l)}else{if(!gi[o])throw new Error("Types doesn\'t contain name = ".concat(o));i=gi[o]}let a=[];for(;n<t.length;n++){let s=r.parse(t[n],n,$);if(!s)return null;a.push(s)}return new e(i,a)}evaluate(t){for(let r=0;r<this.args.length;r++){let n=this.args[r].evaluate(t);if(Gr(this.type,fe(n))){if(r===this.args.length-1)throw new oe("Expected value to be of type ".concat(ne(this.type),", but found ").concat(ne(fe(n))," instead."))}else return n}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},Pl={"to-boolean":U,"to-color":ze,"to-number":L,"to-string":G},ft=class e{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n=t[0];if(!Pl[n])throw new Error("Can\'t parse ".concat(n," as it is not part of the known types"));if((n==="to-boolean"||n==="to-string")&&t.length!==2)return r.error("Expected one argument.");let i=Pl[n],o=[];for(let a=1;a<t.length;a++){let s=r.parse(t[a],a,$);if(!s)return null;o.push(s)}return new e(i,o)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,n;for(let i of this.args){if(r=i.evaluate(t),n=null,r instanceof W)return r;if(typeof r=="string"){let o=t.parseColor(r);if(o)return o}else if(Array.isArray(r)&&(r.length<3||r.length>4?n="Invalid rbga value ".concat(JSON.stringify(r),": expected an array containing either three or four numeric values."):n=$l(r[0],r[1],r[2],r[3]),!n))return new W(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new oe(n||"Could not parse color from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"padding":{let r;for(let n of this.args){r=n.evaluate(t);let i=je.parse(r);if(i)return i}throw new oe("Could not parse padding from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"variableAnchorOffsetCollection":{let r;for(let n of this.args){r=n.evaluate(t);let i=it.parse(r);if(i)return i}throw new oe("Could not parse variableAnchorOffsetCollection from value \'".concat(typeof r=="string"?r:JSON.stringify(r),"\'"))}case"number":{let r=null;for(let n of this.args){if(r=n.evaluate(t),r===null)return 0;let i=Number(r);if(!isNaN(i))return i}throw new oe("Could not convert ".concat(JSON.stringify(r)," to number."))}case"formatted":return Me.fromString(Ur(this.args[0].evaluate(t)));case"resolvedImage":return Ce.fromString(Ur(this.args[0].evaluate(t)));default:return Ur(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},Ly=["Unknown","Point","LineString","Polygon"],Pi=class{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Ly[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache[t];return r||(r=this._parseColorCache[t]=W.parse(t)),r}},Si=class e{constructor(t,r,n=[],i,o=new Ca,a=[]){this.registry=t,this.path=n,this.key=n.map(s=>"[".concat(s,"]")).join(""),this.scope=o,this.errors=a,this.expectedType=i,this._isConstant=r}parse(t,r,n,i,o={}){return r?this.concat(r,n,i)._parse(t,o):this._parse(t,o)}_parse(t,r){(t===null||typeof t=="string"||typeof t=="boolean"||typeof t=="number")&&(t=["literal",t]);function n(i,o,a){return a==="assert"?new Ge(o,[i]):a==="coerce"?new ft(o,[i]):i}if(Array.isArray(t)){if(t.length===0)return this.error(\'Expected an array with at least one element. If you wanted a literal array, use ["literal", []].\');let i=t[0];if(typeof i!="string")return this.error("Expression name must be a string, but found ".concat(typeof i,\' instead. If you wanted a literal array, use ["literal", [...]].\'),0),null;let o=this.registry[i];if(o){let a=o.parse(t,this);if(!a)return null;if(this.expectedType){let s=this.expectedType,l=a.type;if((s.kind==="string"||s.kind==="number"||s.kind==="boolean"||s.kind==="object"||s.kind==="array")&&l.kind==="value")a=n(a,s,r.typeAnnotation||"assert");else if((s.kind==="color"||s.kind==="formatted"||s.kind==="resolvedImage")&&(l.kind==="value"||l.kind==="string"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="padding"&&(l.kind==="value"||l.kind==="number"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(s.kind==="variableAnchorOffsetCollection"&&(l.kind==="value"||l.kind==="array"))a=n(a,s,r.typeAnnotation||"coerce");else if(this.checkSubtype(s,l))return null}if(!(a instanceof mt)&&a.type.kind!=="resolvedImage"&&this._isConstant(a)){let s=new Pi;try{a=new mt(a.type,a.evaluate(s))}catch(l){return this.error(l.message),null}}return a}return this.error(\'Unknown expression "\'.concat(i,\'". If you wanted a literal array, use ["literal", [...]].\'),0)}else return typeof t>"u"?this.error("\'undefined\' value invalid. Use null instead."):typeof t=="object"?this.error(\'Bare objects invalid. Use ["literal", {...}] instead.\'):this.error("Expected an array, but found ".concat(typeof t," instead."))}concat(t,r,n){let i=typeof t=="number"?this.path.concat(t):this.path,o=n?this.scope.concat(n):this.scope;return new e(this.registry,this._isConstant,i,r||null,o,this.errors)}error(t,...r){let n="".concat(this.key).concat(r.map(i=>"[".concat(i,"]")).join(""));this.errors.push(new Ve(n,t))}checkSubtype(t,r){let n=Gr(t,r);return n&&this.error(n),n}},wi=class e{constructor(t,r,n){this.type=Fi,this.locale=n,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");let n=t[1];if(typeof n!="object"||Array.isArray(n))return r.error("Collator options argument must be an object.");let i=r.parse(n["case-sensitive"]===void 0?!1:n["case-sensitive"],1,U);if(!i)return null;let o=r.parse(n["diacritic-sensitive"]===void 0?!1:n["diacritic-sensitive"],1,U);if(!o)return null;let a=null;return n.locale&&(a=r.parse(n.locale,1,G),!a)?null:new e(i,o,a)}evaluate(t){return new jr(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}},yt=8192;function Na(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Dy(e){return(180+e)/360}function Vy(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Ai(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function By(e,t){let r=Dy(e[0]),n=Vy(e[1]),i=Math.pow(2,t.z);return[Math.round(r*i*yt),Math.round(n*i*yt)]}function zy(e,t,r){let n=e[0]-t[0],i=e[1]-t[1],o=e[0]-r[0],a=e[1]-r[1];return n*a-o*i===0&&n*o<=0&&i*a<=0}function Ry(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function Ua(e,t){let r=!1;for(let n=0,i=t.length;n<i;n++){let o=t[n];for(let a=0,s=o.length;a<s-1;a++){if(zy(e,o[a],o[a+1]))return!1;Ry(e,o[a],o[a+1])&&(r=!r)}}return r}function Oy(e,t){for(let r=0;r<t.length;r++)if(Ua(e,t[r]))return!0;return!1}function Ny(e,t){return e[0]*t[1]-e[1]*t[0]}function Sl(e,t,r,n){let i=e[0]-r[0],o=e[1]-r[1],a=t[0]-r[0],s=t[1]-r[1],l=n[0]-r[0],u=n[1]-r[1],c=i*u-l*o,p=a*u-l*s;return c>0&&p<0||c<0&&p>0}function Uy(e,t,r,n){let i=[t[0]-e[0],t[1]-e[1]],o=[n[0]-r[0],n[1]-r[1]];return Ny(o,i)===0?!1:!!(Sl(e,t,r,n)&&Sl(r,n,e,t))}function $y(e,t,r){for(let n of r)for(let i=0;i<n.length-1;++i)if(Uy(e,t,n[i],n[i+1]))return!0;return!1}function Gl(e,t){for(let r=0;r<e.length;++r)if(!Ua(e[r],t))return!1;for(let r=0;r<e.length-1;++r)if($y(e[r],e[r+1],t))return!1;return!0}function Gy(e,t){for(let r=0;r<t.length;r++)if(Gl(e,t[r]))return!0;return!1}function $a(e,t,r){let n=[];for(let i=0;i<e.length;i++){let o=[];for(let a=0;a<e[i].length;a++){let s=By(e[i][a],r);Na(t,s),o.push(s)}n.push(o)}return n}function ql(e,t,r){let n=[];for(let i=0;i<e.length;i++){let o=$a(e[i],t,r);n.push(o)}return n}function jl(e,t,r,n){if(e[0]<r[0]||e[0]>r[2]){let i=n*.5,o=e[0]-r[0]>i?-n:r[0]-e[0]>i?n:0;o===0&&(o=e[0]-r[2]>i?-n:r[2]-e[0]>i?n:0),e[0]+=o}Na(t,e)}function qy(e){e[0]=e[1]=1/0,e[2]=e[3]=-1/0}function wl(e,t,r,n){let i=Math.pow(2,n.z)*yt,o=[n.x*yt,n.y*yt],a=[];for(let s of e)for(let l of s){let u=[l.x+o[0],l.y+o[1]];jl(u,t,r,i),a.push(u)}return a}function Al(e,t,r,n){let i=Math.pow(2,n.z)*yt,o=[n.x*yt,n.y*yt],a=[];for(let s of e){let l=[];for(let u of s){let c=[u.x+o[0],u.y+o[1]];Na(t,c),l.push(c)}a.push(l)}if(t[2]-t[0]<=i/2){qy(t);for(let s of a)for(let l of s)jl(l,t,r,i)}return a}function jy(e,t){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type==="Polygon"){let o=$a(t.coordinates,n,i),a=wl(e.geometry(),r,n,i);if(!Ai(r,n))return!1;for(let s of a)if(!Ua(s,o))return!1}if(t.type==="MultiPolygon"){let o=ql(t.coordinates,n,i),a=wl(e.geometry(),r,n,i);if(!Ai(r,n))return!1;for(let s of a)if(!Oy(s,o))return!1}return!0}function Zy(e,t){let r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(t.type==="Polygon"){let o=$a(t.coordinates,n,i),a=Al(e.geometry(),r,n,i);if(!Ai(r,n))return!1;for(let s of a)if(!Gl(s,o))return!1}if(t.type==="MultiPolygon"){let o=ql(t.coordinates,n,i),a=Al(e.geometry(),r,n,i);if(!Ai(r,n))return!1;for(let s of a)if(!Gy(s,o))return!1}return!0}var Jr=class e{constructor(t,r){this.type=U,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error("\'within\' expression requires exactly one argument, but found ".concat(t.length-1," instead."));if(vi(t[1])){let n=t[1];if(n.type==="FeatureCollection")for(let i=0;i<n.features.length;++i){let o=n.features[i].geometry.type;if(o==="Polygon"||o==="MultiPolygon")return new e(n,n.features[i].geometry)}else if(n.type==="Feature"){let i=n.geometry.type;if(i==="Polygon"||i==="MultiPolygon")return new e(n,n.geometry)}else if(n.type==="Polygon"||n.type==="MultiPolygon")return new e(n,n)}return r.error("\'within\' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return jy(t,this.geometries);if(t.geometryType()==="LineString")return Zy(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}},_i=class e{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("\'var\' expression requires exactly one string literal argument.");let n=t[1];return r.scope.has(n)?new e(n,r.scope.get(n)):r.error(\'Unknown variable "\'.concat(n,\'". Make sure "\').concat(n,\'" has been bound in an enclosing "let" expression before using it.\'),1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}},Ye=class e{constructor(t,r,n,i){this.name=t,this.type=r,this._evaluate=n,this.args=i}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){let n=t[0],i=e.definitions[n];if(!i)return r.error(\'Unknown expression "\'.concat(n,\'". If you wanted a literal array, use ["literal", [...]].\'),0);let o=Array.isArray(i)?i[0]:i.type,a=Array.isArray(i)?[[i[1],i[2]]]:i.overloads,s=a.filter(([u])=>!Array.isArray(u)||u.length===t.length-1),l=null;for(let[u,c]of s){l=new Si(r.registry,Ii,r.path,null,r.scope);let p=[],f=!1;for(let y=1;y<t.length;y++){let m=t[y],h=Array.isArray(u)?u[y-1]:u.type,d=l.parse(m,1+p.length,h);if(!d){f=!0;break}p.push(d)}if(!f){if(Array.isArray(u)&&u.length!==p.length){l.error("Expected ".concat(u.length," arguments, but found ").concat(p.length," instead."));continue}for(let y=0;y<p.length;y++){let m=Array.isArray(u)?u[y]:u.type,h=p[y];l.concat(y+1).checkSubtype(m,h.type)}if(l.errors.length===0)return new e(n,o,c,p)}}if(s.length===1)r.errors.push(...l.errors);else{let c=(s.length?s:a).map(([f])=>Jy(f)).join(" | "),p=[];for(let f=1;f<t.length;f++){let y=r.parse(t[f],1+p.length);if(!y)return null;p.push(ne(y.type))}r.error("Expected arguments of type ".concat(c,", but found (").concat(p.join(", "),") instead."))}return null}static register(t,r){e.definitions=r;for(let n in r)t[n]=e}};function Jy(e){return Array.isArray(e)?"(".concat(e.map(ne).join(", "),")"):"(".concat(ne(e.type),"...)")}function Ii(e){if(e instanceof _i)return Ii(e.boundExpression);if(e instanceof Ye&&e.name==="error")return!1;if(e instanceof wi)return!1;if(e instanceof Jr)return!1;let t=e instanceof ft||e instanceof Ge,r=!0;return e.eachChild(n=>{t?r=r&&Ii(n):r=r&&n instanceof mt}),r?Di(e)&&Vi(e,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"]):!1}function Di(e){if(e instanceof Ye){if(e.name==="get"&&e.args.length===1)return!1;if(e.name==="feature-state")return!1;if(e.name==="has"&&e.args.length===1)return!1;if(e.name==="properties"||e.name==="geometry-type"||e.name==="id")return!1;if(/^filter-/.test(e.name))return!1}if(e instanceof Jr)return!1;let t=!0;return e.eachChild(r=>{t&&!Di(r)&&(t=!1)}),t}function Wr(e){if(e instanceof Ye&&e.name==="feature-state")return!1;let t=!0;return e.eachChild(r=>{t&&!Wr(r)&&(t=!1)}),t}function Vi(e,t){if(e instanceof Ye&&t.indexOf(e.name)>=0)return!1;let r=!0;return e.eachChild(n=>{r&&!Vi(n,t)&&(r=!1)}),r}function Bi(e,t){let r=e.length-1,n=0,i=r,o=0,a,s;for(;n<=i;)if(o=Math.floor((n+i)/2),a=e[o],s=e[o+1],a<=t){if(o===r||t<s)return o;n=o+1}else if(a>t)i=o-1;else throw new oe("Input is not a number.");return 0}var lr=class e{constructor(t,r,n){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(let[i,o]of n)this.labels.push(i),this.outputs.push(o)}static parse(t,r){if(t.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!==0)return r.error("Expected an even number of arguments.");let n=r.parse(t[1],1,L);if(!n)return null;let i=[],o=null;r.expectedType&&r.expectedType.kind!=="value"&&(o=r.expectedType);for(let a=1;a<t.length;a+=2){let s=a===1?-1/0:t[a],l=t[a+1],u=a,c=a+1;if(typeof s!="number")return r.error(\'Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',u);if(i.length&&i[i.length-1][0]>=s)return r.error(\'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.\',u);let p=r.parse(l,c,o);if(!p)return null;o=o||p.type,i.push([s,p])}return new e(o,n,i)}evaluate(t){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(t);let i=this.input.evaluate(t);if(i<=r[0])return n[0].evaluate(t);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(t);let a=Bi(r,i);return n[a].evaluate(t)}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function Wy(e){return e==="rgb"||e==="hcl"||e==="lab"}function Lt(e,t,r){return e+r*(t-e)}function Hy(e,t,r,n="rgb"){switch(n){case"rgb":{let[i,o,a,s]=Ci(e.rgb,t.rgb,r);return new W(i,o,a,s,!1)}case"hcl":{let[i,o,a,s]=e.hcl,[l,u,c,p]=t.hcl,f,y;if(!isNaN(i)&&!isNaN(l)){let v=l-i;l>i&&v>180?v-=360:l<i&&i-l>180&&(v+=360),f=i+r*v}else isNaN(i)?isNaN(l)?f=NaN:(f=l,(a===1||a===0)&&(y=u)):(f=i,(c===1||c===0)&&(y=o));let[m,h,d,g]=ky([f,y!=null?y:Lt(o,u,r),Lt(a,c,r),Lt(s,p,r)]);return new W(m,h,d,g,!1)}case"lab":{let[i,o,a,s]=Ul(Ci(e.lab,t.lab,r));return new W(i,o,a,s,!1)}}}function Ci(e,t,r){return e.map((n,i)=>Lt(n,t[i],r))}function Ky(e,t,r){return new je(Ci(e.values,t.values,r))}function Yy(e,t,r){let n=e.values,i=t.values;if(n.length!==i.length)throw new oe("Cannot interpolate values of different length. from: ".concat(e.toString(),", to: ").concat(t.toString()));let o=[];for(let a=0;a<n.length;a+=2){if(n[a]!==i[a])throw new oe("Cannot interpolate values containing mismatched anchors. from[".concat(a,"]: ").concat(n[a],", to[").concat(a,"]: ").concat(i[a]));o.push(n[a]);let[s,l]=n[a+1],[u,c]=i[a+1];o.push([Lt(s,u,r),Lt(l,c,r)])}return new it(o)}var Re={number:Lt,color:Hy,array:Ci,padding:Ky,variableAnchorOffsetCollection:Yy},qe=class e{constructor(t,r,n,i,o){this.type=t,this.operator=r,this.interpolation=n,this.input=i,this.labels=[],this.outputs=[];for(let[a,s]of o)this.labels.push(a),this.outputs.push(s)}static interpolationFactor(t,r,n,i){let o=0;if(t.name==="exponential")o=Aa(r,t.base,n,i);else if(t.name==="linear")o=Aa(r,1,n,i);else if(t.name==="cubic-bezier"){let a=t.controlPoints;o=new Ll.default(a[0],a[1],a[2],a[3]).solve(Aa(r,1,n,i))}return o}static parse(t,r){let[n,i,o,...a]=t;if(!Array.isArray(i)||i.length===0)return r.error("Expected an interpolation type expression.",1);if(i[0]==="linear")i={name:"linear"};else if(i[0]==="exponential"){let u=i[1];if(typeof u!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);i={name:"exponential",base:u}}else if(i[0]==="cubic-bezier"){let u=i.slice(1);if(u.length!==4||u.some(c=>typeof c!="number"||c<0||c>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);i={name:"cubic-bezier",controlPoints:u}}else return r.error("Unknown interpolation type ".concat(String(i[0])),1,0);if(t.length-1<4)return r.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if((t.length-1)%2!==0)return r.error("Expected an even number of arguments.");if(o=r.parse(o,2,L),!o)return null;let s=[],l=null;n==="interpolate-hcl"||n==="interpolate-lab"?l=ze:r.expectedType&&r.expectedType.kind!=="value"&&(l=r.expectedType);for(let u=0;u<a.length;u+=2){let c=a[u],p=a[u+1],f=u+3,y=u+4;if(typeof c!="number")return r.error(\'Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.\',f);if(s.length&&s[s.length-1][0]>=c)return r.error(\'Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.\',f);let m=r.parse(p,y,l);if(!m)return null;l=l||m.type,s.push([c,m])}return!Nr(l,L)&&!Nr(l,ze)&&!Nr(l,Mi)&&!Nr(l,Li)&&!Nr(l,Fe(L))?r.error("Type ".concat(ne(l)," is not interpolatable.")):new e(l,n,i,o,s)}evaluate(t){let r=this.labels,n=this.outputs;if(r.length===1)return n[0].evaluate(t);let i=this.input.evaluate(t);if(i<=r[0])return n[0].evaluate(t);let o=r.length;if(i>=r[o-1])return n[o-1].evaluate(t);let a=Bi(r,i),s=r[a],l=r[a+1],u=e.interpolationFactor(this.interpolation,i,s,l),c=n[a].evaluate(t),p=n[a+1].evaluate(t);switch(this.operator){case"interpolate":return Re[this.type.kind](c,p,u);case"interpolate-hcl":return Re.color(c,p,u,"hcl");case"interpolate-lab":return Re.color(c,p,u,"lab")}}eachChild(t){t(this.input);for(let r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}};function Aa(e,t,r,n){let i=n-r,o=e-r;return i===0?0:t===1?o/i:(Math.pow(t,o)-1)/(Math.pow(t,i)-1)}var ki=class e{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expectected at least one argument.");let n=null,i=r.expectedType;i&&i.kind!=="value"&&(n=i);let o=[];for(let s of t.slice(1)){let l=r.parse(s,1+o.length,n,void 0,{typeAnnotation:"omit"});if(!l)return null;n=n||l.type,o.push(l)}if(!n)throw new Error("No output type");return i&&o.some(s=>Gr(i,s.type))?new e($,o):new e(n,o)}evaluate(t){let r=null,n=0,i;for(let o of this.args)if(n++,r=o.evaluate(t),r&&r instanceof Ce&&!r.available&&(i||(i=r.name),r=null,n===this.args.length&&(r=i)),r!==null)break;return r}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}},Ti=class e{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(let r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error("Expected at least 3 arguments, but found ".concat(t.length-1," instead."));let n=[];for(let o=1;o<t.length-1;o+=2){let a=t[o];if(typeof a!="string")return r.error("Expected string, but found ".concat(typeof a," instead."),o);if(/[^a-zA-Z0-9_]/.test(a))return r.error("Variable names must contain only alphanumeric characters or \'_\'.",o);let s=r.parse(t[o+1],o+1);if(!s)return null;n.push([a,s])}let i=r.parse(t[t.length-1],t.length-1,r.expectedType,n);return i?new e(n,i):null}outputDefined(){return this.result.outputDefined()}},ka=class e{constructor(t,r,n){this.type=t,this.index=r,this.input=n}static parse(t,r){if(t.length!==3)return r.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1,L),i=r.parse(t[2],2,Fe(r.expectedType||$));if(!n||!i)return null;let o=i.type;return new e(o.itemType,n,i)}evaluate(t){let r=this.index.evaluate(t),n=this.input.evaluate(t);if(r<0)throw new oe("Array index out of bounds: ".concat(r," < 0."));if(r>=n.length)throw new oe("Array index out of bounds: ".concat(r," > ").concat(n.length-1,"."));if(r!==Math.floor(r))throw new oe("Array index must be an integer, but found ".concat(r," instead."));return n[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}},Ta=class e{constructor(t,r){this.type=U,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error("Expected 2 arguments, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1,$),i=r.parse(t[2],2,$);return!n||!i?null:Oa(n.type,[U,G,L,cr,$])?new e(n,i):r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(ne(n.type)," instead"))}evaluate(t){let r=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!n)return!1;if(!qr(r,["boolean","string","number","null"]))throw new oe("Expected first argument to be of type boolean, string, number or null, but found ".concat(ne(fe(r))," instead."));if(!qr(n,["string","array"]))throw new oe("Expected second argument to be of type array or string, but found ".concat(ne(fe(n))," instead."));return n.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}},Ea=class e{constructor(t,r,n){this.type=L,this.needle=t,this.haystack=r,this.fromIndex=n}static parse(t,r){if(t.length<=2||t.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1,$),i=r.parse(t[2],2,$);if(!n||!i)return null;if(!Oa(n.type,[U,G,L,cr,$]))return r.error("Expected first argument to be of type boolean, string, number or null, but found ".concat(ne(n.type)," instead"));if(t.length===4){let o=r.parse(t[3],3,L);return o?new e(n,i,o):null}else return new e(n,i)}evaluate(t){let r=this.needle.evaluate(t),n=this.haystack.evaluate(t);if(!qr(r,["boolean","string","number","null"]))throw new oe("Expected first argument to be of type boolean, string, number or null, but found ".concat(ne(fe(r))," instead."));if(!qr(n,["string","array"]))throw new oe("Expected second argument to be of type array or string, but found ".concat(ne(fe(n))," instead."));if(this.fromIndex){let i=this.fromIndex.evaluate(t);return n.indexOf(r,i)}return n.indexOf(r)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}},Fa=class e{constructor(t,r,n,i,o,a){this.inputType=t,this.type=r,this.input=n,this.cases=i,this.outputs=o,this.otherwise=a}static parse(t,r){if(t.length<5)return r.error("Expected at least 4 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!==1)return r.error("Expected an even number of arguments.");let n,i;r.expectedType&&r.expectedType.kind!=="value"&&(i=r.expectedType);let o={},a=[];for(let u=2;u<t.length-1;u+=2){let c=t[u],p=t[u+1];Array.isArray(c)||(c=[c]);let f=r.concat(u);if(c.length===0)return f.error("Expected at least one branch label.");for(let m of c){if(typeof m!="number"&&typeof m!="string")return f.error("Branch labels must be numbers or strings.");if(typeof m=="number"&&Math.abs(m)>Number.MAX_SAFE_INTEGER)return f.error("Branch labels must be integers no larger than ".concat(Number.MAX_SAFE_INTEGER,"."));if(typeof m=="number"&&Math.floor(m)!==m)return f.error("Numeric branch labels must be integer values.");if(!n)n=fe(m);else if(f.checkSubtype(n,fe(m)))return null;if(typeof o[String(m)]<"u")return f.error("Branch labels must be unique.");o[String(m)]=a.length}let y=r.parse(p,u,i);if(!y)return null;i=i||y.type,a.push(y)}let s=r.parse(t[1],1,$);if(!s)return null;let l=r.parse(t[t.length-1],t.length-1,i);return!l||s.type.kind!=="value"&&r.concat(1).checkSubtype(n,s.type)?null:new e(n,i,s,o,a,l)}evaluate(t){let r=this.input.evaluate(t);return(fe(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}},Ma=class e{constructor(t,r,n){this.type=t,this.branches=r,this.otherwise=n}static parse(t,r){if(t.length<4)return r.error("Expected at least 3 arguments, but found only ".concat(t.length-1,"."));if(t.length%2!==0)return r.error("Expected an odd number of arguments.");let n;r.expectedType&&r.expectedType.kind!=="value"&&(n=r.expectedType);let i=[];for(let a=1;a<t.length-1;a+=2){let s=r.parse(t[a],a,U);if(!s)return null;let l=r.parse(t[a+1],a+1,n);if(!l)return null;i.push([s,l]),n=n||l.type}let o=r.parse(t[t.length-1],t.length-1,n);if(!o)return null;if(!n)throw new Error("Can\'t infer output type");return new e(n,i,o)}evaluate(t){for(let[r,n]of this.branches)if(r.evaluate(t))return n.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(let[r,n]of this.branches)t(r),t(n);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}},La=class e{constructor(t,r,n,i){this.type=t,this.input=r,this.beginIndex=n,this.endIndex=i}static parse(t,r){if(t.length<=2||t.length>=5)return r.error("Expected 3 or 4 arguments, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1,$),i=r.parse(t[2],2,L);if(!n||!i)return null;if(!Oa(n.type,[Fe($),G,$]))return r.error("Expected first argument to be of type array or string, but found ".concat(ne(n.type)," instead"));if(t.length===4){let o=r.parse(t[3],3,L);return o?new e(n.type,n,i,o):null}else return new e(n.type,n,i)}evaluate(t){let r=this.input.evaluate(t),n=this.beginIndex.evaluate(t);if(!qr(r,["string","array"]))throw new oe("Expected first argument to be of type array or string, but found ".concat(ne(fe(r))," instead."));if(this.endIndex){let i=this.endIndex.evaluate(t);return r.slice(n,i)}return r.slice(n)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}};function _l(e,t){return e==="=="||e==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function Xy(e,t,r){return t===r}function Qy(e,t,r){return t!==r}function em(e,t,r){return t<r}function tm(e,t,r){return t>r}function rm(e,t,r){return t<=r}function nm(e,t,r){return t>=r}function Zl(e,t,r,n){return n.compare(t,r)===0}function im(e,t,r,n){return!Zl(e,t,r,n)}function om(e,t,r,n){return n.compare(t,r)<0}function am(e,t,r,n){return n.compare(t,r)>0}function sm(e,t,r,n){return n.compare(t,r)<=0}function lm(e,t,r,n){return n.compare(t,r)>=0}function fr(e,t,r){let n=e!=="=="&&e!=="!=";return class Jl{constructor(o,a,s){this.type=U,this.lhs=o,this.rhs=a,this.collator=s,this.hasUntypedArgument=o.type.kind==="value"||a.type.kind==="value"}static parse(o,a){if(o.length!==3&&o.length!==4)return a.error("Expected two or three arguments.");let s=o[0],l=a.parse(o[1],1,$);if(!l)return null;if(!_l(s,l.type))return a.concat(1).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(ne(l.type),"\'."));let u=a.parse(o[2],2,$);if(!u)return null;if(!_l(s,u.type))return a.concat(2).error(\'"\'.concat(s,"\\" comparisons are not supported for type \'").concat(ne(u.type),"\'."));if(l.type.kind!==u.type.kind&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot compare types \'".concat(ne(l.type),"\' and \'").concat(ne(u.type),"\'."));n&&(l.type.kind==="value"&&u.type.kind!=="value"?l=new Ge(u.type,[l]):l.type.kind!=="value"&&u.type.kind==="value"&&(u=new Ge(l.type,[u])));let c=null;if(o.length===4){if(l.type.kind!=="string"&&u.type.kind!=="string"&&l.type.kind!=="value"&&u.type.kind!=="value")return a.error("Cannot use collator to compare non-string types.");if(c=a.parse(o[3],3,Fi),!c)return null}return new Jl(l,u,c)}evaluate(o){let a=this.lhs.evaluate(o),s=this.rhs.evaluate(o);if(n&&this.hasUntypedArgument){let l=fe(a),u=fe(s);if(l.kind!==u.kind||!(l.kind==="string"||l.kind==="number"))throw new oe(\'Expected arguments for "\'.concat(e,\'" to be (string, string) or (number, number), but found (\').concat(l.kind,", ").concat(u.kind,") instead."))}if(this.collator&&!n&&this.hasUntypedArgument){let l=fe(a),u=fe(s);if(l.kind!=="string"||u.kind!=="string")return t(o,a,s)}return this.collator?r(o,a,s,this.collator.evaluate(o)):t(o,a,s)}eachChild(o){o(this.lhs),o(this.rhs),this.collator&&o(this.collator)}outputDefined(){return!0}}}var um=fr("==",Xy,Zl),cm=fr("!=",Qy,im),pm=fr("<",em,om),fm=fr(">",tm,am),ym=fr("<=",rm,sm),mm=fr(">=",nm,lm),Da=class e{constructor(t,r,n,i,o){this.type=G,this.number=t,this.locale=r,this.currency=n,this.minFractionDigits=i,this.maxFractionDigits=o}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");let n=r.parse(t[1],1,L);if(!n)return null;let i=t[2];if(typeof i!="object"||Array.isArray(i))return r.error("NumberFormat options argument must be an object.");let o=null;if(i.locale&&(o=r.parse(i.locale,1,G),!o))return null;let a=null;if(i.currency&&(a=r.parse(i.currency,1,G),!a))return null;let s=null;if(i["min-fraction-digits"]&&(s=r.parse(i["min-fraction-digits"],1,L),!s))return null;let l=null;return i["max-fraction-digits"]&&(l=r.parse(i["max-fraction-digits"],1,L),!l)?null:new e(n,o,a,s,l)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}},Hr=class e{constructor(t){this.type=pr,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let n=t[1];if(!Array.isArray(n)&&typeof n=="object")return r.error("First argument must be an image or text section.");let i=[],o=!1;for(let a=1;a<=t.length-1;++a){let s=t[a];if(o&&typeof s=="object"&&!Array.isArray(s)){o=!1;let l=null;if(s["font-scale"]&&(l=r.parse(s["font-scale"],1,L),!l))return null;let u=null;if(s["text-font"]&&(u=r.parse(s["text-font"],1,Fe(G)),!u))return null;let c=null;if(s["text-color"]&&(c=r.parse(s["text-color"],1,ze),!c))return null;let p=i[i.length-1];p.scale=l,p.font=u,p.textColor=c}else{let l=r.parse(t[a],1,$);if(!l)return null;let u=l.type.kind;if(u!=="string"&&u!=="value"&&u!=="null"&&u!=="resolvedImage")return r.error("Formatted text type must be \'string\', \'value\', \'image\' or \'null\'.");o=!0,i.push({content:l,scale:null,font:null,textColor:null})}}return new e(i)}evaluate(t){let r=n=>{let i=n.content.evaluate(t);return fe(i)===Xr?new Zr("",i,null,null,null):new Zr(Ur(i),null,n.scale?n.scale.evaluate(t):null,n.font?n.font.evaluate(t).join(","):null,n.textColor?n.textColor.evaluate(t):null)};return new Me(this.sections.map(r))}eachChild(t){for(let r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor)}outputDefined(){return!1}},Va=class e{constructor(t){this.type=Xr,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");let n=r.parse(t[1],1,G);return n?new e(n):r.error("No image name provided.")}evaluate(t){let r=this.input.evaluate(t),n=Ce.fromString(r);return n&&t.availableImages&&(n.available=t.availableImages.indexOf(r)>-1),n}eachChild(t){t(this.input)}outputDefined(){return!1}},Ba=class e{constructor(t){this.type=L,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected 1 argument, but found ".concat(t.length-1," instead."));let n=r.parse(t[1],1);return n?n.type.kind!=="array"&&n.type.kind!=="string"&&n.type.kind!=="value"?r.error("Expected argument of type string or array, but found ".concat(ne(n.type)," instead.")):new e(n):null}evaluate(t){let r=this.input.evaluate(t);if(typeof r=="string")return r.length;if(Array.isArray(r))return r.length;throw new oe("Expected value to be of type string or array, but found ".concat(ne(fe(r))," instead."))}eachChild(t){t(this.input)}outputDefined(){return!1}},zt={"==":um,"!=":cm,">":fm,"<":pm,">=":mm,"<=":ym,array:Ge,at:ka,boolean:Ge,case:Ma,coalesce:ki,collator:wi,format:Hr,image:Va,in:Ta,"index-of":Ea,interpolate:qe,"interpolate-hcl":qe,"interpolate-lab":qe,length:Ba,let:Ti,literal:mt,match:Fa,number:Ge,"number-format":Da,object:Ge,slice:La,step:lr,string:Ge,"to-boolean":ft,"to-color":ft,"to-number":ft,"to-string":ft,var:_i,within:Jr};function Il(e,[t,r,n,i]){t=t.evaluate(e),r=r.evaluate(e),n=n.evaluate(e);let o=i?i.evaluate(e):1,a=$l(t,r,n,o);if(a)throw new oe(a);return new W(t/255,r/255,n/255,o,!1)}function Cl(e,t){return e in t}function _a(e,t){let r=t[e];return typeof r>"u"?null:r}function hm(e,t,r,n){for(;r<=n;){let i=r+n>>1;if(t[i]===e)return!0;t[i]>e?n=i-1:r=i+1}return!1}function Mt(e){return{type:e}}Ye.register(zt,{error:[Sy,[G],(e,[t])=>{throw new oe(t.evaluate(e))}],typeof:[G,[$],(e,[t])=>ne(fe(t.evaluate(e)))],"to-rgba":[Fe(L,4),[ze],(e,[t])=>{let[r,n,i,o]=t.evaluate(e).rgb;return[r*255,n*255,i*255,o]}],rgb:[ze,[L,L,L],Il],rgba:[ze,[L,L,L,L],Il],has:{type:U,overloads:[[[G],(e,[t])=>Cl(t.evaluate(e),e.properties())],[[G,or],(e,[t,r])=>Cl(t.evaluate(e),r.evaluate(e))]]},get:{type:$,overloads:[[[G],(e,[t])=>_a(t.evaluate(e),e.properties())],[[G,or],(e,[t,r])=>_a(t.evaluate(e),r.evaluate(e))]]},"feature-state":[$,[G],(e,[t])=>_a(t.evaluate(e),e.featureState||{})],properties:[or,[],e=>e.properties()],"geometry-type":[G,[],e=>e.geometryType()],id:[$,[],e=>e.id()],zoom:[L,[],e=>e.globals.zoom],"heatmap-density":[L,[],e=>e.globals.heatmapDensity||0],"line-progress":[L,[],e=>e.globals.lineProgress||0],accumulated:[$,[],e=>e.globals.accumulated===void 0?null:e.globals.accumulated],"+":[L,Mt(L),(e,t)=>{let r=0;for(let n of t)r+=n.evaluate(e);return r}],"*":[L,Mt(L),(e,t)=>{let r=1;for(let n of t)r*=n.evaluate(e);return r}],"-":{type:L,overloads:[[[L,L],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[L],(e,[t])=>-t.evaluate(e)]]},"/":[L,[L,L],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[L,[L,L],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[L,[],()=>Math.LN2],pi:[L,[],()=>Math.PI],e:[L,[],()=>Math.E],"^":[L,[L,L],(e,[t,r])=>Math.pow(t.evaluate(e),r.evaluate(e))],sqrt:[L,[L],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[L,[L],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[L,[L],(e,[t])=>Math.log(t.evaluate(e))],log2:[L,[L],(e,[t])=>Math.log(t.evaluate(e))/Math.LN2],sin:[L,[L],(e,[t])=>Math.sin(t.evaluate(e))],cos:[L,[L],(e,[t])=>Math.cos(t.evaluate(e))],tan:[L,[L],(e,[t])=>Math.tan(t.evaluate(e))],asin:[L,[L],(e,[t])=>Math.asin(t.evaluate(e))],acos:[L,[L],(e,[t])=>Math.acos(t.evaluate(e))],atan:[L,[L],(e,[t])=>Math.atan(t.evaluate(e))],min:[L,Mt(L),(e,t)=>Math.min(...t.map(r=>r.evaluate(e)))],max:[L,Mt(L),(e,t)=>Math.max(...t.map(r=>r.evaluate(e)))],abs:[L,[L],(e,[t])=>Math.abs(t.evaluate(e))],round:[L,[L],(e,[t])=>{let r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[L,[L],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[L,[L],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[U,[G,$],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[U,[$],(e,[t])=>e.id()===t.value],"filter-type-==":[U,[G],(e,[t])=>e.geometryType()===t.value],"filter-<":[U,[G,$],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[U,[$],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r<n}],"filter->":[U,[G,$],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[U,[$],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r>n}],"filter-<=":[U,[G,$],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[U,[$],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r<=n}],"filter->=":[U,[G,$],(e,[t,r])=>{let n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[U,[$],(e,[t])=>{let r=e.id(),n=t.value;return typeof r==typeof n&&r>=n}],"filter-has":[U,[$],(e,[t])=>t.value in e.properties()],"filter-has-id":[U,[],e=>e.id()!==null&&e.id()!==void 0],"filter-type-in":[U,[Fe(G)],(e,[t])=>t.value.indexOf(e.geometryType())>=0],"filter-id-in":[U,[Fe($)],(e,[t])=>t.value.indexOf(e.id())>=0],"filter-in-small":[U,[G,Fe($)],(e,[t,r])=>r.value.indexOf(e.properties()[t.value])>=0],"filter-in-large":[U,[G,Fe($)],(e,[t,r])=>hm(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:U,overloads:[[[U,U],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Mt(U),(e,t)=>{for(let r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:U,overloads:[[[U,U],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Mt(U),(e,t)=>{for(let r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[U,[U],(e,[t])=>!t.evaluate(e)],"is-supported-script":[U,[G],(e,[t])=>{let r=e.globals&&e.globals.isSupportedScript;return r?r(t.evaluate(e)):!0}],upcase:[G,[G],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[G,[G],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[G,Mt($),(e,t)=>t.map(r=>Ur(r.evaluate(e))).join("")],"resolved-locale":[G,[Fi],(e,[t])=>t.evaluate(e).resolvedLocale()]});function za(e){return{result:"success",value:e}}function ir(e){return{result:"error",value:e}}function ht(e){return e["property-type"]==="data-driven"||e["property-type"]==="cross-faded-data-driven"}function Wl(e){return!!e.expression&&e.expression.parameters.indexOf("zoom")>-1}function Ga(e){return!!e.expression&&e.expression.interpolated}function j(e){return e instanceof Number?"number":e instanceof String?"string":e instanceof Boolean?"boolean":Array.isArray(e)?"array":e===null?"null":typeof e}function zi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function dm(e){return e}function Hl(e,t){let r=t.type==="color",n=e.stops&&typeof e.stops[0][0]=="object",i=n||e.property!==void 0,o=n||!i,a=e.type||(Ga(t)?"exponential":"interval");if(r||t.type==="padding"){let c=r?W.parse:je.parse;e=sr({},e),e.stops&&(e.stops=e.stops.map(p=>[p[0],c(p[1])])),e.default?e.default=c(e.default):e.default=c(t.default)}if(e.colorSpace&&!Wy(e.colorSpace))throw new Error(\'Unknown color space: "\'.concat(e.colorSpace,\'"\'));let s,l,u;if(a==="exponential")s=kl;else if(a==="interval")s=xm;else if(a==="categorical"){s=gm,l=Object.create(null);for(let c of e.stops)l[c[0]]=c[1];u=typeof e.stops[0][0]}else if(a==="identity")s=bm;else throw new Error(\'Unknown function type "\'.concat(a,\'"\'));if(n){let c={},p=[];for(let m=0;m<e.stops.length;m++){let h=e.stops[m],d=h[0].zoom;c[d]===void 0&&(c[d]={zoom:d,type:e.type,property:e.property,default:e.default,stops:[]},p.push(d)),c[d].stops.push([h[0].value,h[1]])}let f=[];for(let m of p)f.push([c[m].zoom,Hl(c[m],t)]);let y={name:"linear"};return{kind:"composite",interpolationType:y,interpolationFactor:qe.interpolationFactor.bind(void 0,y),zoomStops:f.map(m=>m[0]),evaluate({zoom:m},h){return kl({stops:f,base:e.base},t,m).evaluate(m,h)}}}else if(o){let c=a==="exponential"?{name:"exponential",base:e.base!==void 0?e.base:1}:null;return{kind:"camera",interpolationType:c,interpolationFactor:qe.interpolationFactor.bind(void 0,c),zoomStops:e.stops.map(p=>p[0]),evaluate:({zoom:p})=>s(e,t,p,l,u)}}else return{kind:"source",evaluate(c,p){let f=p&&p.properties?p.properties[e.property]:void 0;return f===void 0?Qr(e.default,t.default):s(e,t,f,l,u)}}}function Qr(e,t,r){if(e!==void 0)return e;if(t!==void 0)return t;if(r!==void 0)return r}function gm(e,t,r,n,i){let o=typeof r===i?n[r]:void 0;return Qr(o,e.default,t.default)}function xm(e,t,r){if(j(r)!=="number")return Qr(e.default,t.default);let n=e.stops.length;if(n===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];let i=Bi(e.stops.map(o=>o[0]),r);return e.stops[i][1]}function kl(e,t,r){let n=e.base!==void 0?e.base:1;if(j(r)!=="number")return Qr(e.default,t.default);let i=e.stops.length;if(i===1||r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];let o=Bi(e.stops.map(c=>c[0]),r),a=vm(r,n,e.stops[o][0],e.stops[o+1][0]),s=e.stops[o][1],l=e.stops[o+1][1],u=Re[t.type]||dm;return typeof s.evaluate=="function"?{evaluate(...c){let p=s.evaluate.apply(void 0,c),f=l.evaluate.apply(void 0,c);if(!(p===void 0||f===void 0))return u(p,f,a,e.colorSpace)}}:u(s,l,a,e.colorSpace)}function bm(e,t,r){switch(t.type){case"color":r=W.parse(r);break;case"formatted":r=Me.fromString(r.toString());break;case"resolvedImage":r=Ce.fromString(r.toString());break;case"padding":r=je.parse(r);break;default:j(r)!==t.type&&(t.type!=="enum"||!t.values[r])&&(r=void 0)}return Qr(r,e.default,t.default)}function vm(e,t,r,n){let i=n-r,o=e-r;return i===0?0:t===1?o/i:(Math.pow(t,o)-1)/(Math.pow(t,i)-1)}var Dt=class{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new Pi,this._defaultValue=r?Sm(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,n,i,o,a){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=n,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a,this.expression.evaluate(this._evaluator)}evaluate(t,r,n,i,o,a){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=n||null,this._evaluator.canonical=i,this._evaluator.availableImages=o||null,this._evaluator.formattedSection=a||null;try{let s=this.expression.evaluate(this._evaluator);if(s==null||typeof s=="number"&&s!==s)return this._defaultValue;if(this._enumValues&&!(s in this._enumValues))throw new oe("Expected value to be one of ".concat(Object.keys(this._enumValues).map(l=>JSON.stringify(l)).join(", "),", but found ").concat(JSON.stringify(s)," instead."));return s}catch(s){return this._warningHistory[s.message]||(this._warningHistory[s.message]=!0,typeof console<"u"&&console.warn(s.message)),this._defaultValue}}};function en(e){return Array.isArray(e)&&e.length>0&&typeof e[0]=="string"&&e[0]in zt}function Rt(e,t){let r=new Si(zt,Ii,[],t?Pm(t):void 0),n=r.parse(e,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return n?za(new Dt(n,t)):ir(r.errors)}var dt=class{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Wr(r.expression)}evaluateWithoutErrorHandling(t,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(t,r,n,i,o,a)}evaluate(t,r,n,i,o,a){return this._styleExpression.evaluate(t,r,n,i,o,a)}},gt=class{constructor(t,r,n,i){this.kind=t,this.zoomStops=n,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Wr(r.expression),this.interpolationType=i}evaluateWithoutErrorHandling(t,r,n,i,o,a){return this._styleExpression.evaluateWithoutErrorHandling(t,r,n,i,o,a)}evaluate(t,r,n,i,o,a){return this._styleExpression.evaluate(t,r,n,i,o,a)}interpolationFactor(t,r,n){return this.interpolationType?qe.interpolationFactor(this.interpolationType,t,r,n):0}};function Kl(e,t){let r=Rt(e,t);if(r.result==="error")return r;let n=r.value.expression,i=Di(n);if(!i&&!ht(t))return ir([new Ve("","data expressions not supported")]);let o=Vi(n,["zoom"]);if(!o&&!Wl(t))return ir([new Ve("","zoom expressions not supported")]);let a=bi(n);if(!a&&!o)return ir([new Ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\')]);if(a instanceof Ve)return ir([a]);if(a instanceof qe&&!Ga(t))return ir([new Ve("",\'"interpolate" expressions cannot be used with this property\')]);if(!a)return za(i?new dt("constant",r.value):new dt("source",r.value));let s=a instanceof qe?a.interpolation:void 0;return za(i?new gt("camera",r.value,a.labels,s):new gt("composite",r.value,a.labels,s))}var Kr=class e{constructor(t,r){this._parameters=t,this._specification=r,sr(this,Hl(this._parameters,this._specification))}static deserialize(t){return new e(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}};function Yl(e,t){if(zi(e))return new Kr(e,t);if(en(e)){let r=Kl(e,t);if(r.result==="error")throw new Error(r.value.map(n=>"".concat(n.key,": ").concat(n.message)).join(", "));return r.value}else{let r=e;return t.type==="color"&&typeof e=="string"?r=W.parse(e):t.type==="padding"&&(typeof e=="number"||Array.isArray(e))?r=je.parse(e):t.type==="variableAnchorOffsetCollection"&&Array.isArray(e)&&(r=it.parse(e)),{kind:"constant",evaluate:()=>r}}}function bi(e){let t=null;if(e instanceof Ti)t=bi(e.result);else if(e instanceof ki){for(let r of e.args)if(t=bi(r),t)break}else(e instanceof lr||e instanceof qe)&&e.input instanceof Ye&&e.input.name==="zoom"&&(t=e);return t instanceof Ve||e.eachChild(r=>{let n=bi(r);n instanceof Ve?t=n:!t&&n?t=new Ve("",\'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.\'):t&&n&&t!==n&&(t=new Ve("",\'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.\'))}),t}function Pm(e){let t={color:ze,string:G,number:L,enum:G,boolean:U,formatted:pr,padding:Mi,resolvedImage:Xr,variableAnchorOffsetCollection:Li};return e.type==="array"?Fe(t[e.value]||$,e.length):t[e.type]}function Sm(e){return e.type==="color"&&zi(e.default)?new W(0,0,0,0):e.type==="color"?W.parse(e.default)||null:e.type==="padding"?je.parse(e.default)||null:e.type==="variableAnchorOffsetCollection"?it.parse(e.default)||null:e.default===void 0?null:e.default}function qa(e){if(e===!0||e===!1)return!0;if(!Array.isArray(e)||e.length===0)return!1;switch(e[0]){case"has":return e.length>=2&&e[1]!=="$id"&&e[1]!=="$type";case"in":return e.length>=3&&(typeof e[1]!="string"||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return e.length!==3||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(let t of e.slice(1))if(!qa(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}var wm={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function tn(e){if(e==null)return{filter:()=>!0,needGeometry:!1};qa(e)||(e=Ei(e));let t=Rt(e,wm);if(t.result==="error")throw new Error(t.value.map(r=>"".concat(r.key,": ").concat(r.message)).join(", "));{let r=Xl(e);return{filter:(n,i,o)=>t.value.evaluate(n,i,{},o),needGeometry:r}}}function Am(e,t){return e<t?-1:e>t?1:0}function Xl(e){if(!Array.isArray(e))return!1;if(e[0]==="within")return!0;for(let t=1;t<e.length;t++)if(Xl(e[t]))return!0;return!1}function Ei(e){if(!e)return!0;let t=e[0];return e.length<=1?t!=="any":t==="=="?Ia(e[1],e[2],"=="):t==="!="?xi(Ia(e[1],e[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Ia(e[1],e[2],t):t==="any"?_m(e.slice(1)):t==="all"?["all"].concat(e.slice(1).map(Ei)):t==="none"?["all"].concat(e.slice(1).map(Ei).map(xi)):t==="in"?Tl(e[1],e.slice(2)):t==="!in"?xi(Tl(e[1],e.slice(2))):t==="has"?El(e[1]):t==="!has"?xi(El(e[1])):t==="within"?e:!0}function Ia(e,t,r){switch(e){case"$type":return["filter-type-".concat(r),t];case"$id":return["filter-id-".concat(r),t];default:return["filter-".concat(r),e,t]}}function _m(e){return["any"].concat(e.map(Ei))}function Tl(e,t){if(t.length===0)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",e,["literal",t.sort(Am)]]:["filter-in-small",e,["literal",t]]}}function El(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function xi(e){return["!",e]}function Ra(e){let t=typeof e;if(t==="number"||t==="boolean"||t==="string"||e===void 0||e===null)return JSON.stringify(e);if(Array.isArray(e)){let i="[";for(let o of e)i+="".concat(Ra(o),",");return"".concat(i,"]")}let r=Object.keys(e).sort(),n="{";for(let i=0;i<r.length;i++)n+="".concat(JSON.stringify(r[i]),":").concat(Ra(e[r[i]]),",");return"".concat(n,"}")}function Im(e){let t="";for(let r of Py)t+="/".concat(Ra(e[r]));return t}function Ql(e,t){let r={};for(let i=0;i<e.length;i++){let o=t&&t[e[i].id]||Im(e[i]);t&&(t[e[i].id]=o);let a=r[o];a||(a=r[o]=[]),a.push(e[i])}let n=[];for(let i in r)n.push(r[i]);return n}function eu(e){let t=e.key,r=e.value;return r?[new D(t,r,"constants have been deprecated as of v8")]:[]}function pe(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}function Vt(e){if(Array.isArray(e))return e.map(Vt);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){let t={};for(let r in e)t[r]=Vt(e[r]);return t}return pe(e)}function Be(e){let t=e.key,r=e.value,n=e.valueSpec||{},i=e.objectElementValidators||{},o=e.style,a=e.styleSpec,s=e.validateSpec,l=[],u=j(r);if(u!=="object")return[new D(t,r,"object expected, ".concat(u," found"))];for(let c in r){let p=c.split(".")[0],f=n[p]||n["*"],y;if(i[p])y=i[p];else if(n[p])y=s;else if(i["*"])y=i["*"];else if(n["*"])y=s;else{l.push(new D(t,r[c],\'unknown property "\'.concat(c,\'"\')));continue}l=l.concat(y({key:(t&&"".concat(t,"."))+c,value:r[c],valueSpec:f,style:o,styleSpec:a,object:r,objectKey:c,validateSpec:s},r))}for(let c in n)i[c]||n[c].required&&n[c].default===void 0&&r[c]===void 0&&l.push(new D(t,r,\'missing required property "\'.concat(c,\'"\')));return l}function ja(e){let t=e.value,r=e.valueSpec,n=e.validateSpec,i=e.style,o=e.styleSpec,a=e.key,s=e.arrayElementValidator||n;if(j(t)!=="array")return[new D(a,t,"array expected, ".concat(j(t)," found"))];if(r.length&&t.length!==r.length)return[new D(a,t,"array length ".concat(r.length," expected, length ").concat(t.length," found"))];if(r["min-length"]&&t.length<r["min-length"])return[new D(a,t,"array length at least ".concat(r["min-length"]," expected, length ").concat(t.length," found"))];let l={type:r.value,values:r.values};o.$version<7&&(l.function=r.function),j(r.value)==="object"&&(l=r.value);let u=[];for(let c=0;c<t.length;c++)u=u.concat(s({array:t,arrayIndex:c,value:t[c],valueSpec:l,validateSpec:e.validateSpec,style:i,styleSpec:o,key:"".concat(a,"[").concat(c,"]")}));return u}function Za(e){let t=e.key,r=e.value,n=e.valueSpec,i=j(r);return i==="number"&&r!==r&&(i="NaN"),i!=="number"?[new D(t,r,"number expected, ".concat(i," found"))]:"minimum"in n&&r<n.minimum?[new D(t,r,"".concat(r," is less than the minimum value ").concat(n.minimum))]:"maximum"in n&&r>n.maximum?[new D(t,r,"".concat(r," is greater than the maximum value ").concat(n.maximum))]:[]}function tu(e){let t=e.valueSpec,r=pe(e.value.type),n,i={},o,a,s=r!=="categorical"&&e.value.property===void 0,l=!s,u=j(e.value.stops)==="array"&&j(e.value.stops[0])==="array"&&j(e.value.stops[0][0])==="object",c=Be({key:e.key,value:e.value,valueSpec:e.styleSpec.function,validateSpec:e.validateSpec,style:e.style,styleSpec:e.styleSpec,objectElementValidators:{stops:p,default:m}});return r==="identity"&&s&&c.push(new D(e.key,e.value,\'missing required property "property"\')),r!=="identity"&&!e.value.stops&&c.push(new D(e.key,e.value,\'missing required property "stops"\')),r==="exponential"&&e.valueSpec.expression&&!Ga(e.valueSpec)&&c.push(new D(e.key,e.value,"exponential functions not supported")),e.styleSpec.$version>=8&&(l&&!ht(e.valueSpec)?c.push(new D(e.key,e.value,"property functions not supported")):s&&!Wl(e.valueSpec)&&c.push(new D(e.key,e.value,"zoom functions not supported"))),(r==="categorical"||u)&&e.value.property===void 0&&c.push(new D(e.key,e.value,\'"property" property is required\')),c;function p(h){if(r==="identity")return[new D(h.key,h.value,\'identity function may not have a "stops" property\')];let d=[],g=h.value;return d=d.concat(ja({key:h.key,value:g,valueSpec:h.valueSpec,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,arrayElementValidator:f})),j(g)==="array"&&g.length===0&&d.push(new D(h.key,g,"array must have at least one stop")),d}function f(h){let d=[],g=h.value,v=h.key;if(j(g)!=="array")return[new D(v,g,"array expected, ".concat(j(g)," found"))];if(g.length!==2)return[new D(v,g,"array length 2 expected, length ".concat(g.length," found"))];if(u){if(j(g[0])!=="object")return[new D(v,g,"object expected, ".concat(j(g[0])," found"))];if(g[0].zoom===void 0)return[new D(v,g,"object stop key must have zoom")];if(g[0].value===void 0)return[new D(v,g,"object stop key must have value")];if(a&&a>pe(g[0].zoom))return[new D(v,g[0].zoom,"stop zoom values must appear in ascending order")];pe(g[0].zoom)!==a&&(a=pe(g[0].zoom),o=void 0,i={}),d=d.concat(Be({key:"".concat(v,"[0]"),value:g[0],valueSpec:{zoom:{}},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec,objectElementValidators:{zoom:Za,value:y}}))}else d=d.concat(y({key:"".concat(v,"[0]"),value:g[0],valueSpec:{},validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec},g));return en(Vt(g[1]))?d.concat([new D("".concat(v,"[1]"),g[1],"expressions are not allowed in function stops.")]):d.concat(h.validateSpec({key:"".concat(v,"[1]"),value:g[1],valueSpec:t,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec}))}function y(h,d){let g=j(h.value),v=pe(h.value),b=h.value!==null?h.value:d;if(!n)n=g;else if(g!==n)return[new D(h.key,b,"".concat(g," stop domain type must match previous stop domain type ").concat(n))];if(g!=="number"&&g!=="string"&&g!=="boolean")return[new D(h.key,b,"stop domain value must be a number, string, or boolean")];if(g!=="number"&&r!=="categorical"){let x="number expected, ".concat(g," found");return ht(t)&&r===void 0&&(x+=\'\\nIf you intended to use a categorical function, specify `"type": "categorical"`.\'),[new D(h.key,b,x)]}return r==="categorical"&&g==="number"&&(!isFinite(v)||Math.floor(v)!==v)?[new D(h.key,b,"integer expected, found ".concat(v))]:r!=="categorical"&&g==="number"&&o!==void 0&&v<o?[new D(h.key,b,"stop domain values must appear in ascending order")]:(o=v,r==="categorical"&&v in i?[new D(h.key,b,"stop domain values must be unique")]:(i[v]=!0,[]))}function m(h){return h.validateSpec({key:h.key,value:h.value,valueSpec:t,validateSpec:h.validateSpec,style:h.style,styleSpec:h.styleSpec})}}function ur(e){let t=(e.expressionContext==="property"?Kl:Rt)(Vt(e.value),e.valueSpec);if(t.result==="error")return t.value.map(n=>new D("".concat(e.key).concat(n.key),e.value,n.message));let r=t.value.expression||t.value._styleExpression.expression;if(e.expressionContext==="property"&&e.propertyKey==="text-font"&&!r.outputDefined())return[new D(e.key,e.value,\'Invalid data expression for "\'.concat(e.propertyKey,\'". Output values must be contained as literals within the expression.\'))];if(e.expressionContext==="property"&&e.propertyType==="layout"&&!Wr(r))return[new D(e.key,e.value,\'"feature-state" data expressions are not supported with layout properties.\')];if(e.expressionContext==="filter"&&!Wr(r))return[new D(e.key,e.value,\'"feature-state" data expressions are not supported with filters.\')];if(e.expressionContext&&e.expressionContext.indexOf("cluster")===0){if(!Vi(r,["zoom","feature-state"]))return[new D(e.key,e.value,\'"zoom" and "feature-state" expressions are not supported with cluster properties.\')];if(e.expressionContext==="cluster-initial"&&!Di(r))return[new D(e.key,e.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Cm(e){let t=e.value,r=e.key,n=j(t);return n!=="boolean"?[new D(r,t,"boolean expected, ".concat(n," found"))]:[]}function km(e){let t=e.key,r=e.value,n=j(r);return n!=="string"?[new D(t,r,"color expected, ".concat(n," found"))]:W.parse(String(r))?[]:[new D(t,r,\'color expected, "\'.concat(r,\'" found\'))]}function Yr(e){let t=e.key,r=e.value,n=e.valueSpec,i=[];return Array.isArray(n.values)?n.values.indexOf(pe(r))===-1&&i.push(new D(t,r,"expected one of [".concat(n.values.join(", "),"], ").concat(JSON.stringify(r)," found"))):Object.keys(n.values).indexOf(pe(r))===-1&&i.push(new D(t,r,"expected one of [".concat(Object.keys(n.values).join(", "),"], ").concat(JSON.stringify(r)," found"))),i}function Ja(e){return qa(Vt(e.value))?ur(sr({},e,{expressionContext:"filter",valueSpec:{value:"boolean"}})):ru(e)}function ru(e){let t=e.value,r=e.key;if(j(t)!=="array")return[new D(r,t,"array expected, ".concat(j(t)," found"))];let n=e.styleSpec,i,o=[];if(t.length<1)return[new D(r,t,"filter array must have at least 1 element")];switch(o=o.concat(Yr({key:"".concat(r,"[0]"),value:t[0],valueSpec:n.filter_operator,style:e.style,styleSpec:e.styleSpec})),pe(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&pe(t[1])==="$type"&&o.push(new D(r,t,\'"$type" cannot be use with operator "\'.concat(t[0],\'"\')));case"==":case"!=":t.length!==3&&o.push(new D(r,t,\'filter array for operator "\'.concat(t[0],\'" must have 3 elements\')));case"in":case"!in":t.length>=2&&(i=j(t[1]),i!=="string"&&o.push(new D("".concat(r,"[1]"),t[1],"string expected, ".concat(i," found"))));for(let a=2;a<t.length;a++)i=j(t[a]),pe(t[1])==="$type"?o=o.concat(Yr({key:"".concat(r,"[").concat(a,"]"),value:t[a],valueSpec:n.geometry_type,style:e.style,styleSpec:e.styleSpec})):i!=="string"&&i!=="number"&&i!=="boolean"&&o.push(new D("".concat(r,"[").concat(a,"]"),t[a],"string, number, or boolean expected, ".concat(i," found")));break;case"any":case"all":case"none":for(let a=1;a<t.length;a++)o=o.concat(ru({key:"".concat(r,"[").concat(a,"]"),value:t[a],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":i=j(t[1]),t.length!==2?o.push(new D(r,t,\'filter array for "\'.concat(t[0],\'" operator must have 2 elements\'))):i!=="string"&&o.push(new D("".concat(r,"[1]"),t[1],"string expected, ".concat(i," found")));break;case"within":i=j(t[1]),t.length!==2?o.push(new D(r,t,\'filter array for "\'.concat(t[0],\'" operator must have 2 elements\'))):i!=="object"&&o.push(new D("".concat(r,"[1]"),t[1],"object expected, ".concat(i," found")));break}return o}function nu(e,t){let r=e.key,n=e.validateSpec,i=e.style,o=e.styleSpec,a=e.value,s=e.objectKey,l=o["".concat(t,"_").concat(e.layerType)];if(!l)return[];let u=s.match(/^(.*)-transition$/);if(t==="paint"&&u&&l[u[1]]&&l[u[1]].transition)return n({key:r,value:a,valueSpec:o.transition,style:i,styleSpec:o});let c=e.valueSpec||l[s];if(!c)return[new D(r,a,\'unknown property "\'.concat(s,\'"\'))];let p;if(j(a)==="string"&&ht(c)&&!c.tokens&&(p=/^{([^}]+)}$/.exec(a)))return[new D(r,a,\'"\'.concat(s,\'" does not support interpolation syntax\\n\')+\'Use an identity property function instead: `{ "type": "identity", "property": \'.concat(JSON.stringify(p[1])," }`."))];let f=[];return e.layerType==="symbol"&&(s==="text-field"&&i&&!i.glyphs&&f.push(new D(r,a,\'use of "text-field" requires a style "glyphs" property\')),s==="text-font"&&zi(Vt(a))&&pe(a.type)==="identity"&&f.push(new D(r,a,\'"text-font" does not support identity functions\'))),f.concat(n({key:e.key,value:a,valueSpec:c,style:i,styleSpec:o,expressionContext:"property",propertyType:t,propertyKey:s}))}function iu(e){return nu(e,"paint")}function ou(e){return nu(e,"layout")}function au(e){let t=[],r=e.value,n=e.key,i=e.style,o=e.styleSpec;!r.type&&!r.ref&&t.push(new D(n,r,\'either "type" or "ref" is required\'));let a=pe(r.type),s=pe(r.ref);if(r.id){let l=pe(r.id);for(let u=0;u<e.arrayIndex;u++){let c=i.layers[u];pe(c.id)===l&&t.push(new D(n,r.id,\'duplicate layer id "\'.concat(r.id,\'", previously used at line \').concat(c.id.__line__)))}}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(u=>{u in r&&t.push(new D(n,r[u],\'"\'.concat(u,\'" is prohibited for ref layers\')))});let l;i.layers.forEach(u=>{pe(u.id)===s&&(l=u)}),l?l.ref?t.push(new D(n,r.ref,"ref cannot reference another ref layer")):a=pe(l.type):t.push(new D(n,r.ref,\'ref layer "\'.concat(s,\'" not found\')))}else if(a!=="background")if(!r.source)t.push(new D(n,r,\'missing required property "source"\'));else{let l=i.sources&&i.sources[r.source],u=l&&pe(l.type);l?u==="vector"&&a==="raster"?t.push(new D(n,r.source,\'layer "\'.concat(r.id,\'" requires a raster source\'))):u==="raster"&&a!=="raster"?t.push(new D(n,r.source,\'layer "\'.concat(r.id,\'" requires a vector source\'))):u==="vector"&&!r["source-layer"]?t.push(new D(n,r,\'layer "\'.concat(r.id,\'" must specify a "source-layer"\'))):u==="raster-dem"&&a!=="hillshade"?t.push(new D(n,r.source,"raster-dem source can only be used with layer type \'hillshade\'.")):a==="line"&&r.paint&&r.paint["line-gradient"]&&(u!=="geojson"||!l.lineMetrics)&&t.push(new D(n,r,\'layer "\'.concat(r.id,\'" specifies a line-gradient, which requires a GeoJSON source with `lineMetrics` enabled.\'))):t.push(new D(n,r.source,\'source "\'.concat(r.source,\'" not found\')))}return t=t.concat(Be({key:n,value:r,valueSpec:o.layer,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,objectElementValidators:{"*"(){return[]},type(){return e.validateSpec({key:"".concat(n,".type"),value:r.type,valueSpec:o.layer.type,style:e.style,styleSpec:e.styleSpec,validateSpec:e.validateSpec,object:r,objectKey:"type"})},filter:Ja,layout(l){return Be({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return ou(sr({layerType:a},u))}}})},paint(l){return Be({layer:r,key:l.key,value:l.value,style:l.style,styleSpec:l.styleSpec,validateSpec:l.validateSpec,objectElementValidators:{"*"(u){return iu(sr({layerType:a},u))}}})}}})),t}function Bt(e){let t=e.value,r=e.key,n=j(t);return n!=="string"?[new D(r,t,"string expected, ".concat(n," found"))]:[]}var Fl={promoteId:Tm};function su(e){let t=e.value,r=e.key,n=e.styleSpec,i=e.style,o=e.validateSpec;if(!t.type)return[new D(r,t,\'"type" is required\')];let a=pe(t.type),s;switch(a){case"vector":case"raster":case"raster-dem":return s=Be({key:r,value:t,valueSpec:n["source_".concat(a.replace("-","_"))],style:e.style,styleSpec:n,objectElementValidators:Fl,validateSpec:o}),s;case"geojson":if(s=Be({key:r,value:t,valueSpec:n.source_geojson,style:i,styleSpec:n,validateSpec:o,objectElementValidators:Fl}),t.cluster)for(let l in t.clusterProperties){let[u,c]=t.clusterProperties[l],p=typeof u=="string"?[u,["accumulated"],["get",l]]:u;s.push(...ur({key:"".concat(r,".").concat(l,".map"),value:c,validateSpec:o,expressionContext:"cluster-map"})),s.push(...ur({key:"".concat(r,".").concat(l,".reduce"),value:p,validateSpec:o,expressionContext:"cluster-reduce"}))}return s;case"video":return Be({key:r,value:t,valueSpec:n.source_video,style:i,validateSpec:o,styleSpec:n});case"image":return Be({key:r,value:t,valueSpec:n.source_image,style:i,validateSpec:o,styleSpec:n});case"canvas":return[new D(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Yr({key:"".concat(r,".type"),value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:i,validateSpec:o,styleSpec:n})}}function Tm({key:e,value:t}){if(j(t)==="string")return Bt({key:e,value:t});{let r=[];for(let n in t)r.push(...Bt({key:"".concat(e,".").concat(n),value:t[n]}));return r}}function lu(e){let t=e.value,r=e.styleSpec,n=r.light,i=e.style,o=[],a=j(t);if(t===void 0)return o;if(a!=="object")return o=o.concat([new D("light",t,"object expected, ".concat(a," found"))]),o;for(let s in t){let l=s.match(/^(.*)-transition$/);l&&n[l[1]]&&n[l[1]].transition?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:r.transition,validateSpec:e.validateSpec,style:i,styleSpec:r})):n[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:n[s],validateSpec:e.validateSpec,style:i,styleSpec:r})):o=o.concat([new D(s,t[s],\'unknown property "\'.concat(s,\'"\'))])}return o}function uu(e){let t=e.value,r=e.styleSpec,n=r.terrain,i=e.style,o=[],a=j(t);if(t===void 0)return o;if(a!=="object")return o=o.concat([new D("terrain",t,"object expected, ".concat(a," found"))]),o;for(let s in t)n[s]?o=o.concat(e.validateSpec({key:s,value:t[s],valueSpec:n[s],validateSpec:e.validateSpec,style:i,styleSpec:r})):o=o.concat([new D(s,t[s],\'unknown property "\'.concat(s,\'"\'))]);return o}function Em(e){return Bt(e).length===0?[]:ur(e)}function Fm(e){return Bt(e).length===0?[]:ur(e)}function Mm(e){let t=e.key,r=e.value;if(j(r)==="array"){if(r.length<1||r.length>4)return[new D(t,r,"padding requires 1 to 4 values; ".concat(r.length," values found"))];let i={type:"number"},o=[];for(let a=0;a<r.length;a++)o=o.concat(e.validateSpec({key:"".concat(t,"[").concat(a,"]"),value:r[a],validateSpec:e.validateSpec,valueSpec:i}));return o}else return Za({key:t,value:r,valueSpec:{}})}function Lm(e){let t=e.key,r=e.value,n=j(r),i=e.styleSpec;if(n!=="array"||r.length<1||r.length%2!==0)return[new D(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let o=[];for(let a=0;a<r.length;a+=2)o=o.concat(Yr({key:"".concat(t,"[").concat(a,"]"),value:r[a],valueSpec:i.layout_symbol["text-anchor"]})),o=o.concat(ja({key:"".concat(t,"[").concat(a+1,"]"),value:r[a+1],valueSpec:{length:2,value:"number"},validateSpec:e.validateSpec,style:e.style,styleSpec:i}));return o}function cu(e){let t=[],r=e.value,n=e.key;if(Array.isArray(r)){let i=[],o=[];for(let a in r){r[a].id&&i.includes(r[a].id)&&t.push(new D(n,r,"all the sprites\' ids must be unique, but ".concat(r[a].id," is duplicated"))),i.push(r[a].id),r[a].url&&o.includes(r[a].url)&&t.push(new D(n,r,"all the sprites\' URLs must be unique, but ".concat(r[a].url," is duplicated"))),o.push(r[a].url);let s={id:{type:"string",required:!0},url:{type:"string",required:!0}};t=t.concat(Be({key:"".concat(n,"[").concat(a,"]"),value:r[a],valueSpec:s,validateSpec:e.validateSpec}))}return t}else return Bt({key:n,value:r})}var Ml={"*"(){return[]},array:ja,boolean:Cm,number:Za,color:km,constants:eu,enum:Yr,filter:Ja,function:tu,layer:au,object:Be,source:su,light:lu,terrain:uu,string:Bt,formatted:Em,resolvedImage:Fm,padding:Mm,variableAnchorOffsetCollection:Lm,sprite:cu};function $r(e){let t=e.value,r=e.valueSpec,n=e.styleSpec;return e.validateSpec=$r,r.expression&&zi(pe(t))?tu(e):r.expression&&en(Vt(t))?ur(e):r.type&&Ml[r.type]?Ml[r.type](e):Be(sr({},e,{valueSpec:r.type?n[r.type]:r}))}function pu(e){let t=e.value,r=e.key,n=Bt(e);return n.length||(t.indexOf("{fontstack}")===-1&&n.push(new D(r,t,\'"glyphs" url must include a "{fontstack}" token\')),t.indexOf("{range}")===-1&&n.push(new D(r,t,\'"glyphs" url must include a "{range}" token\'))),n}function Ze(e,t=S){let r=[];return r=r.concat($r({key:"",value:e,valueSpec:t.$root,styleSpec:t,style:e,validateSpec:$r,objectElementValidators:{glyphs:pu,"*"(){return[]}}})),e.constants&&(r=r.concat(eu({key:"constants",value:e.constants,style:e,styleSpec:t,validateSpec:$r}))),fu(r)}Ze.source=at(ot(su));Ze.sprite=at(ot(cu));Ze.glyphs=at(ot(pu));Ze.light=at(ot(lu));Ze.terrain=at(ot(uu));Ze.layer=at(ot(au));Ze.filter=at(ot(Ja));Ze.paintProperty=at(ot(iu));Ze.layoutProperty=at(ot(ou));function ot(e){return function(t){return e({...t,validateSpec:$r})}}function fu(e){return[].concat(e).sort((t,r)=>t.line-r.line)}function at(e){return function(...t){return fu(e.apply(this,t))}}var yu={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};var yr=class extends Error{constructor(r,n,i,o){super("AJAXError: ".concat(n," (").concat(r,"): ").concat(i));this.status=r,this.statusText=n,this.url=i,this.body=o}},hu=Ie()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Dm=e=>yu.REGISTERED_PROTOCOLS[e.substring(0,e.indexOf("://"))],Vm=e=>/^file:/.test(e)||/^file:/.test(hu())&&!/^\\w+:/.test(e);function mu(e,t){let r=new AbortController,n=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:hu(),signal:r.signal}),i=!1,o=!1;e.type==="json"&&n.headers.set("Accept","application/json");let a=(l,u,c)=>{if(!o){if(l&&l.message!=="SecurityError"&&ce(l),u&&c)return s(u);fetch(n).then(p=>p.ok?s(p):p.blob().then(f=>t(new yr(p.status,p.statusText,e.url,f)))).catch(p=>{p.code!==20&&t(new Error(p.message))})}},s=l=>{(e.type==="arrayBuffer"||e.type==="image"?l.arrayBuffer():e.type==="json"?l.json():l.text()).then(u=>{o||(i=!0,t(null,u,l.headers.get("Cache-Control"),l.headers.get("Expires")))}).catch(u=>{o||t(new Error(u.message))})};return a(null,null),{cancel:()=>{o=!0,i||r.abort()}}}function Bm(e,t){let r=new XMLHttpRequest;r.open(e.method||"GET",e.url,!0),(e.type==="arrayBuffer"||e.type==="image")&&(r.responseType="arraybuffer");for(let n in e.headers)r.setRequestHeader(n,e.headers[n]);return e.type==="json"&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials=e.credentials==="include",r.onerror=()=>{t(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||r.status===0)&&r.response!==null){let n=r.response;if(e.type==="json")try{n=JSON.parse(r.response)}catch(i){return t(i)}t(null,n,r.getResponseHeader("Cache-Control"),r.getResponseHeader("Expires"))}else{let n=new Blob([r.response],{type:r.getResponseHeader("Content-Type")});t(new yr(r.status,r.statusText,e.url,n))}},r.send(e.body),{cancel:()=>r.abort()}}var du=function(e,t){if(/:\\/\\//.test(e.url)&&!/^https?:|^file:/.test(e.url)){if(Ie()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t);if(!Ie())return(Dm(e.url)||mu)(e,t)}if(!Vm(e.url)){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return mu(e,t);if(Ie()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",e,t,void 0,!0)}return Bm(e,t)},gu=function(e,t){return du(Ae(e,{type:"json"}),t)},Wa=function(e,t){return du(Ae(e,{type:"arrayBuffer"}),t)};var xt={};function k(e,t,r={}){if(xt[e])throw new Error("".concat(e," is already registered."));Object.defineProperty(t,"_classRegistryKey",{value:e,writeable:!1}),xt[e]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}k("Object",Object);k("TransferableGridIndex",Ft);k("Color",W);k("Error",Error);k("AJAXError",yr);k("ResolvedImage",Ce);k("StylePropertyFunction",Kr);k("StyleExpression",Dt,{omit:["_evaluator"]});k("ZoomDependentExpression",gt);k("ZoomConstantExpression",dt);k("CompoundExpression",Ye,{omit:["_evaluate"]});for(let e in zt)zt[e]._classRegistryKey||k("Expression_".concat(e),zt[e]);function xu(e){return e&&typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||e.constructor&&e.constructor.name==="ArrayBuffer")}function mr(e,t){if(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob)return e;if(xu(e)||Or(e))return t&&t.push(e),e;if(ArrayBuffer.isView(e)){let r=e;return t&&t.push(r.buffer),r}if(e instanceof ImageData)return t&&t.push(e.data.buffer),e;if(Array.isArray(e)){let r=[];for(let n of e)r.push(mr(n,t));return r}if(typeof e=="object"){let r=e.constructor,n=r._classRegistryKey;if(!n)throw new Error("can\'t serialize object of unregistered class");if(!xt[n])throw new Error("".concat(n," is not registered."));let i=r.serialize?r.serialize(e,t):{};if(r.serialize){if(t&&i===t[t.length-1])throw new Error("statically serialized object won\'t survive transfer of $name property")}else{for(let o in e){if(!e.hasOwnProperty(o)||xt[n].omit.indexOf(o)>=0)continue;let a=e[o];i[o]=xt[n].shallow.indexOf(o)>=0?a:mr(a,t)}e instanceof Error&&(i.message=e.message)}if(i.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(i.$name=n),i}throw new Error("can\'t serialize object of type ".concat(typeof e))}function hr(e){if(e==null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof Blob||xu(e)||Or(e)||ArrayBuffer.isView(e)||e instanceof ImageData)return e;if(Array.isArray(e))return e.map(hr);if(typeof e=="object"){let t=e.$name||"Object";if(!xt[t])throw new Error("can\'t deserialize unregistered class ".concat(t));let{klass:r}=xt[t];if(!r)throw new Error("can\'t deserialize unregistered class ".concat(t));if(r.deserialize)return r.deserialize(e);let n=Object.create(r.prototype);for(let i of Object.keys(e)){if(i==="$name")continue;let o=e[i];n[i]=xt[t].shallow.indexOf(i)>=0?o:hr(o)}return n}throw new Error("can\'t deserialize object of type ".concat(typeof e))}var Ri=class{constructor(t){this._callback=t,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(){delete this._channel,this._callback=()=>{}}};var Oi=class{constructor(t,r,n){this.receive=t=>{let r=t.data,n=r.id;if(n&&!(r.targetMapId&&this.mapId!==r.targetMapId))if(r.type==="<cancel>"){delete this.tasks[n];let i=this.cancelCallbacks[n];delete this.cancelCallbacks[n],i&&i()}else Ie()||r.mustQueue?(this.tasks[n]=r,this.taskQueue.push(n),this.invoker.trigger()):this.processTask(n,r)};this.process=()=>{if(!this.taskQueue.length)return;let t=this.taskQueue.shift(),r=this.tasks[t];delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),r&&this.processTask(t,r)};this.target=t,this.parent=r,this.mapId=n,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new Ri(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=Ie()?t:window}send(t,r,n,i,o=!1){let a=Math.round(Math.random()*1e18).toString(36).substring(0,10);n&&(this.callbacks[a]=n);let s=ba(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!n,targetMapId:i,mustQueue:o,sourceMapId:this.mapId,data:mr(r,s)},s),{cancel:()=>{n&&delete this.callbacks[a],this.target.postMessage({id:a,type:"<cancel>",targetMapId:i,sourceMapId:this.mapId})}}}processTask(t,r){if(r.type==="<response>"){let n=this.callbacks[t];delete this.callbacks[t],n&&(r.error?n(hr(r.error)):n(null,hr(r.data)))}else{let n=!1,i=ba(this.globalScope)?void 0:[],o=r.hasCallback?(l,u)=>{n=!0,delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:"<response>",sourceMapId:this.mapId,error:l?mr(l):null,data:mr(u,i)},i)}:l=>{n=!0},a=null,s=hr(r.data);if(this.parent[r.type])a=this.parent[r.type](r.sourceMapId,s,o);else if(this.parent.getWorkerSource){let l=r.type.split(".");a=this.parent.getWorkerSource(r.sourceMapId,l[0],s.source)[l[1]](s,o)}else o(new Error("Could not find function ".concat(r.type)));!n&&a&&a.cancel&&(this.cancelCallbacks[t]=a.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}};function bu(e,t,r){r[e]&&r[e].indexOf(t)!==-1||(r[e]=r[e]||[],r[e].push(t))}function Ha(e,t,r){if(r&&r[e]){let n=r[e].indexOf(t);n!==-1&&r[e].splice(n,1)}}var rn=class{constructor(t,r={}){Ae(this,r),this.type=t}},nn=class extends rn{constructor(r,n={}){super("error",Ae({error:r},n))}},dr=class{on(t,r){return this._listeners=this._listeners||{},bu(t,r,this._listeners),this}off(t,r){return Ha(t,r,this._listeners),Ha(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},bu(t,r,this._oneTimeListeners),this):new Promise(n=>this.once(t,n))}fire(t,r){typeof t=="string"&&(t=new rn(t,r||{}));let n=t.type;if(this.listens(n)){t.target=this;let i=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(let s of i)s.call(this,t);let o=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(let s of o)Ha(n,s,this._oneTimeListeners),s.call(this,t);let a=this._eventedParent;a&&(Ae(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),a.fire(t))}else t instanceof nn&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}};var bt=Ze,vb=bt.source,Pb=bt.light,Sb=bt.terrain,wb=bt.filter,vu=bt.paintProperty,Pu=bt.layoutProperty;function Su(e,t){let r=!1;if(t&&t.length)for(let n of t)e.fire(new nn(new Error(n.message))),r=!0;return r}var Ni=class{constructor(){this.first=!0}update(t,r){let n=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=n,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=n,!0):(this.lastFloorZoom>n?(this.lastIntegerZoom=n+1,this.lastIntegerZoomTime=r):this.lastFloorZoom<n&&(this.lastIntegerZoom=n,this.lastIntegerZoomTime=r),t!==this.lastZoom?(this.lastZoom=t,this.lastFloorZoom=n,!0):!1)}};var V={"Latin-1 Supplement":e=>e>=128&&e<=255,Arabic:e=>e>=1536&&e<=1791,"Arabic Supplement":e=>e>=1872&&e<=1919,"Arabic Extended-A":e=>e>=2208&&e<=2303,"Hangul Jamo":e=>e>=4352&&e<=4607,"Unified Canadian Aboriginal Syllabics":e=>e>=5120&&e<=5759,Khmer:e=>e>=6016&&e<=6143,"Unified Canadian Aboriginal Syllabics Extended":e=>e>=6320&&e<=6399,"General Punctuation":e=>e>=8192&&e<=8303,"Letterlike Symbols":e=>e>=8448&&e<=8527,"Number Forms":e=>e>=8528&&e<=8591,"Miscellaneous Technical":e=>e>=8960&&e<=9215,"Control Pictures":e=>e>=9216&&e<=9279,"Optical Character Recognition":e=>e>=9280&&e<=9311,"Enclosed Alphanumerics":e=>e>=9312&&e<=9471,"Geometric Shapes":e=>e>=9632&&e<=9727,"Miscellaneous Symbols":e=>e>=9728&&e<=9983,"Miscellaneous Symbols and Arrows":e=>e>=11008&&e<=11263,"CJK Radicals Supplement":e=>e>=11904&&e<=12031,"Kangxi Radicals":e=>e>=12032&&e<=12255,"Ideographic Description Characters":e=>e>=12272&&e<=12287,"CJK Symbols and Punctuation":e=>e>=12288&&e<=12351,Hiragana:e=>e>=12352&&e<=12447,Katakana:e=>e>=12448&&e<=12543,Bopomofo:e=>e>=12544&&e<=12591,"Hangul Compatibility Jamo":e=>e>=12592&&e<=12687,Kanbun:e=>e>=12688&&e<=12703,"Bopomofo Extended":e=>e>=12704&&e<=12735,"CJK Strokes":e=>e>=12736&&e<=12783,"Katakana Phonetic Extensions":e=>e>=12784&&e<=12799,"Enclosed CJK Letters and Months":e=>e>=12800&&e<=13055,"CJK Compatibility":e=>e>=13056&&e<=13311,"CJK Unified Ideographs Extension A":e=>e>=13312&&e<=19903,"Yijing Hexagram Symbols":e=>e>=19904&&e<=19967,"CJK Unified Ideographs":e=>e>=19968&&e<=40959,"Yi Syllables":e=>e>=40960&&e<=42127,"Yi Radicals":e=>e>=42128&&e<=42191,"Hangul Jamo Extended-A":e=>e>=43360&&e<=43391,"Hangul Syllables":e=>e>=44032&&e<=55215,"Hangul Jamo Extended-B":e=>e>=55216&&e<=55295,"Private Use Area":e=>e>=57344&&e<=63743,"CJK Compatibility Ideographs":e=>e>=63744&&e<=64255,"Arabic Presentation Forms-A":e=>e>=64336&&e<=65023,"Vertical Forms":e=>e>=65040&&e<=65055,"CJK Compatibility Forms":e=>e>=65072&&e<=65103,"Small Form Variants":e=>e>=65104&&e<=65135,"Arabic Presentation Forms-B":e=>e>=65136&&e<=65279,"Halfwidth and Fullwidth Forms":e=>e>=65280&&e<=65519};function on(e){for(let t of e)if(Ui(t.charCodeAt(0)))return!0;return!1}function wu(e){for(let t of e)if(!zm(t.charCodeAt(0)))return!1;return!0}function zm(e){return!(V.Arabic(e)||V["Arabic Supplement"](e)||V["Arabic Extended-A"](e)||V["Arabic Presentation Forms-A"](e)||V["Arabic Presentation Forms-B"](e))}function Au(e){return e<11904?!1:!!(V["Bopomofo Extended"](e)||V.Bopomofo(e)||V["CJK Compatibility Forms"](e)||V["CJK Compatibility Ideographs"](e)||V["CJK Compatibility"](e)||V["CJK Radicals Supplement"](e)||V["CJK Strokes"](e)||V["CJK Symbols and Punctuation"](e)||V["CJK Unified Ideographs Extension A"](e)||V["CJK Unified Ideographs"](e)||V["Enclosed CJK Letters and Months"](e)||V["Halfwidth and Fullwidth Forms"](e)||V.Hiragana(e)||V["Ideographic Description Characters"](e)||V["Kangxi Radicals"](e)||V["Katakana Phonetic Extensions"](e)||V.Katakana(e)||V["Vertical Forms"](e)||V["Yi Radicals"](e)||V["Yi Syllables"](e))}function Ui(e){return e===746||e===747?!0:e<4352?!1:!!(V["Bopomofo Extended"](e)||V.Bopomofo(e)||V["CJK Compatibility Forms"](e)&&!(e>=65097&&e<=65103)||V["CJK Compatibility Ideographs"](e)||V["CJK Compatibility"](e)||V["CJK Radicals Supplement"](e)||V["CJK Strokes"](e)||V["CJK Symbols and Punctuation"](e)&&!(e>=12296&&e<=12305)&&!(e>=12308&&e<=12319)&&e!==12336||V["CJK Unified Ideographs Extension A"](e)||V["CJK Unified Ideographs"](e)||V["Enclosed CJK Letters and Months"](e)||V["Hangul Compatibility Jamo"](e)||V["Hangul Jamo Extended-A"](e)||V["Hangul Jamo Extended-B"](e)||V["Hangul Jamo"](e)||V["Hangul Syllables"](e)||V.Hiragana(e)||V["Ideographic Description Characters"](e)||V.Kanbun(e)||V["Kangxi Radicals"](e)||V["Katakana Phonetic Extensions"](e)||V.Katakana(e)&&e!==12540||V["Halfwidth and Fullwidth Forms"](e)&&e!==65288&&e!==65289&&e!==65293&&!(e>=65306&&e<=65310)&&e!==65339&&e!==65341&&e!==65343&&!(e>=65371&&e<=65503)&&e!==65507&&!(e>=65512&&e<=65519)||V["Small Form Variants"](e)&&!(e>=65112&&e<=65118)&&!(e>=65123&&e<=65126)||V["Unified Canadian Aboriginal Syllabics"](e)||V["Unified Canadian Aboriginal Syllabics Extended"](e)||V["Vertical Forms"](e)||V["Yijing Hexagram Symbols"](e)||V["Yi Syllables"](e)||V["Yi Radicals"](e))}function Rm(e){return!!(V["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||V["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)||V["Letterlike Symbols"](e)||V["Number Forms"](e)||V["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)||V["Control Pictures"](e)&&e!==9251||V["Optical Character Recognition"](e)||V["Enclosed Alphanumerics"](e)||V["Geometric Shapes"](e)||V["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||V["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||V["CJK Symbols and Punctuation"](e)||V.Katakana(e)||V["Private Use Area"](e)||V["CJK Compatibility Forms"](e)||V["Small Form Variants"](e)||V["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}function Ka(e){return!(Ui(e)||Rm(e))}function _u(e){return V.Arabic(e)||V["Arabic Supplement"](e)||V["Arabic Extended-A"](e)||V["Arabic Presentation Forms-A"](e)||V["Arabic Presentation Forms-B"](e)}function Iu(e){return e>=1424&&e<=2303||V["Arabic Presentation Forms-A"](e)||V["Arabic Presentation Forms-B"](e)}function Om(e,t){return!(!t&&Iu(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||V.Khmer(e))}function Cu(e){for(let t of e)if(Iu(t.charCodeAt(0)))return!0;return!1}function ku(e,t){for(let r of e)if(!Om(r.charCodeAt(0),t))return!1;return!0}var Nm=typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),$i,Ya,Um={now:Nm,frame(e){let t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){return this.getImageCanvasContext(e).getImageData(-t,-t,e.width+2*t,e.height+2*t)},getImageCanvasContext(e){let t=window.document.createElement("canvas"),r=t.getContext("2d",{willReadFrequently:!0});if(!r)throw new Error("failed to create canvas 2d context");return t.width=e.width,t.height=e.height,r.drawImage(e,0,0,e.width,e.height),r},resolveURL(e){return $i||($i=document.createElement("a")),$i.href=e,$i.href},hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return matchMedia?(Ya==null&&(Ya=matchMedia("(prefers-reduced-motion: reduce)")),Ya.matches):!1}};var Xa={unavailable:"unavailable",deferred:"deferred",loading:"loading",loaded:"loaded",error:"error"};var Gi=Xa.unavailable,Tu=null;var Db=new dr,Eu=function(){return Gi};var ae={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded(){return Gi===Xa.loaded||ae.applyArabicShaping!=null},isLoading(){return Gi===Xa.loading},setState(e){if(!Ie())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Gi=e.pluginStatus,Tu=e.pluginURL},isParsed(){if(!Ie())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return ae.applyArabicShaping!=null&&ae.processBidirectionalText!=null&&ae.processStyledBidirectionalText!=null},getPluginURL(){if(!Ie())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Tu}};var q=class{constructor(t,r){this.zoom=t,r?(this.now=r.now,this.fadeDuration=r.fadeDuration,this.zoomHistory=r.zoomHistory,this.transition=r.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Ni,this.transition={})}isSupportedScript(t){return ku(t,ae.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){let t=this.zoom,r=t-Math.floor(t),n=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*n}:{fromScale:.5,toScale:1,t:1-(1-n)*r}}};var gr=class{constructor(t,r){this.property=t,this.value=r,this.expression=Yl(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,r,n){return this.property.possiblyEvaluate(this,t,r,n)}},an=class{constructor(t){this.property=t,this.value=new gr(t,void 0)}transitioned(t,r){return new ji(this.property,this.value,r,Ae({},t.transition,this.transition),t.now)}untransitioned(){return new ji(this.property,this.value,null,{},0)}},qi=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return tt(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new an(this._values[t].property)),this._values[t].value=new gr(this._values[t].property,r===null?void 0:tt(r))}getTransition(t){return tt(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new an(this._values[t].property)),this._values[t].transition=tt(r)||void 0}serialize(){let t={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(t[r]=n);let i=this.getTransition(r);i!==void 0&&(t["".concat(r,"-transition")]=i)}return t}transitioned(t,r){let n=new Zi(this._properties);for(let i of Object.keys(this._values))n._values[i]=this._values[i].transitioned(t,r._values[i]);return n}untransitioned(){let t=new Zi(this._properties);for(let r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}},ji=class{constructor(t,r,n,i,o){this.property=t,this.value=r,this.begin=o+i.delay||0,this.end=this.begin+i.duration||0,t.specification.transition&&(i.delay||i.duration)&&(this.prior=n)}possiblyEvaluate(t,r,n){let i=t.now||0,o=this.value.possiblyEvaluate(t,r,n),a=this.prior;if(a){if(i>this.end)return this.prior=null,o;if(this.value.isDataDriven())return this.prior=null,o;if(i<this.begin)return a.possiblyEvaluate(t,r,n);{let s=(i-this.begin)/(this.end-this.begin);return this.property.interpolate(a.possiblyEvaluate(t,r,n),o,yl(s))}}else return o}},Zi=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,n){let i=new vt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(t,r,n);return i}hasTransition(){for(let t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}},Ji=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}getValue(t){return tt(this._values[t].value)}setValue(t,r){this._values[t]=new gr(this._values[t].property,r===null?void 0:tt(r))}serialize(){let t={};for(let r of Object.keys(this._values)){let n=this.getValue(r);n!==void 0&&(t[r]=n)}return t}possiblyEvaluate(t,r,n){let i=new vt(this._properties);for(let o of Object.keys(this._values))i._values[o]=this._values[o].possiblyEvaluate(t,r,n);return i}},be=class{constructor(t,r,n){this.property=t,this.value=r,this.parameters=n}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,n,i){return this.property.evaluate(this.value,this.parameters,t,r,n,i)}},vt=class{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}},z=class{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,n){let i=this.specification.type,o=Re[i];return o?o(t,r,n):t}},R=class{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,n,i){return t.expression.kind==="constant"||t.expression.kind==="camera"?new be(this,{kind:"constant",value:t.expression.evaluate(r,null,{},n,i)},r):new be(this,t.expression,r)}interpolate(t,r,n){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new be(this,{kind:"constant",value:void 0},t.parameters);let i=this.specification.type,o=Re[i];if(o){let a=o(t.value.value,r.value.value,n);return new be(this,{kind:"constant",value:a},t.parameters)}else return t}evaluate(t,r,n,i,o,a){return t.kind==="constant"?t.value:t.evaluate(r,n,i,o,a)}},st=class extends R{possiblyEvaluate(t,r,n,i){if(t.value===void 0)return new be(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){let o=t.expression.evaluate(r,null,{},n,i),s=t.property.specification.type==="resolvedImage"&&typeof o!="string"?o.name:o,l=this._calculate(s,s,s,r);return new be(this,{kind:"constant",value:l},r)}else if(t.expression.kind==="camera"){let o=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new be(this,{kind:"constant",value:o},r)}else return new be(this,t.expression,r)}evaluate(t,r,n,i,o,a){if(t.kind==="source"){let s=t.evaluate(r,n,i,o,a);return this._calculate(s,s,s,r)}else return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},n,i),t.evaluate({zoom:Math.floor(r.zoom)},n,i),t.evaluate({zoom:Math.floor(r.zoom)+1},n,i),r):t.value}_calculate(t,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:n,to:r}}interpolate(t){return t}},Ot=class{constructor(t){this.specification=t}possiblyEvaluate(t,r,n,i){if(t.value!==void 0)if(t.expression.kind==="constant"){let o=t.expression.evaluate(r,null,{},n,i);return this._calculate(o,o,o,r)}else return this._calculate(t.expression.evaluate(new q(Math.floor(r.zoom-1),r)),t.expression.evaluate(new q(Math.floor(r.zoom),r)),t.expression.evaluate(new q(Math.floor(r.zoom+1),r)),r)}_calculate(t,r,n,i){return i.zoom>i.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:n,to:r}}interpolate(t){return t}},Nt=class{constructor(t){this.specification=t}possiblyEvaluate(t,r,n,i){return!!t.expression.evaluate(r,null,{},n,i)}interpolate(){return!1}},ie=class{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(let r in t){let n=t[r];n.specification.overridable&&this.overridableProperties.push(r);let i=this.defaultPropertyValues[r]=new gr(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new an(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}};k("DataDrivenProperty",R);k("DataConstantProperty",z);k("CrossFadedDataDrivenProperty",st);k("CrossFadedProperty",Ot);k("ColorRampProperty",Nt);var Wi="-transition",le=class extends dr{constructor(r,n){super();if(this.id=r.id,this.type=r.type,this._featureFilter={filter:()=>!0,needGeometry:!1},r.type!=="custom"&&(r=r,this.metadata=r.metadata,this.minzoom=r.minzoom,this.maxzoom=r.maxzoom,r.type!=="background"&&(this.source=r.source,this.sourceLayer=r["source-layer"],this.filter=r.filter),n.layout&&(this._unevaluatedLayout=new Ji(n.layout)),n.paint)){this._transitionablePaint=new qi(n.paint);for(let i in r.paint)this.setPaintProperty(i,r.paint[i],{validate:!1});for(let i in r.layout)this.setLayoutProperty(i,r.layout[i],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new vt(n.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(r){return r==="visibility"?this.visibility:this._unevaluatedLayout.getValue(r)}setLayoutProperty(r,n,i={}){if(n!=null){let o="layers.".concat(this.id,".layout.").concat(r);if(this._validate(Pu,o,r,n,i))return}if(r==="visibility"){this.visibility=n;return}this._unevaluatedLayout.setValue(r,n)}getPaintProperty(r){return r.endsWith(Wi)?this._transitionablePaint.getTransition(r.slice(0,-Wi.length)):this._transitionablePaint.getValue(r)}setPaintProperty(r,n,i={}){if(n!=null){let o="layers.".concat(this.id,".paint.").concat(r);if(this._validate(vu,o,r,n,i))return!1}if(r.endsWith(Wi))return this._transitionablePaint.setTransition(r.slice(0,-Wi.length),n||void 0),!1;{let o=this._transitionablePaint._values[r],a=o.property.specification["property-type"]==="cross-faded-data-driven",s=o.value.isDataDriven(),l=o.value;this._transitionablePaint.setValue(r,n),this._handleSpecialPaintPropertyUpdate(r);let u=this._transitionablePaint._values[r].value;return u.isDataDriven()||s||a||this._handleOverridablePaintPropertyUpdate(r,l,u)}}_handleSpecialPaintPropertyUpdate(r){}_handleOverridablePaintPropertyUpdate(r,n,i){return!1}isHidden(r){return this.minzoom&&r<this.minzoom||this.maxzoom&&r>=this.maxzoom?!0:this.visibility==="none"}updateTransitions(r){this._transitioningPaint=this._transitionablePaint.transitioned(r,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(r,n){r.getCrossfadeParameters&&(this._crossfadeParameters=r.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(r,void 0,n)),this.paint=this._transitioningPaint.possiblyEvaluate(r,void 0,n)}serialize(){let r={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(r.layout=r.layout||{},r.layout.visibility=this.visibility),dl(r,(n,i)=>n!==void 0&&!(i==="layout"&&!Object.keys(n).length)&&!(i==="paint"&&!Object.keys(n).length))}_validate(r,n,i,o,a={}){return a&&a.validate===!1?!1:Su(this,r.call(bt,{key:n,layerType:this.type,objectKey:i,value:o,styleSpec:S,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(let r in this.paint._values){let n=this.paint.get(r);if(!(!(n instanceof be)||!ht(n.property.specification))&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}};var $m={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},Ut=class{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}},Gm=128,qm=5,te=class{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){let r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*qm),Gm),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);let r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}};function ee(e,t=1){let r=0,n=0,i=e.map(a=>{let s=jm(a.type),l=r=Fu(r,Math.max(t,s)),u=a.components||1;return n=Math.max(n,s),r+=s*u,{name:a.name,type:a.type,components:u,offset:l}}),o=Fu(r,Math.max(n,t));return{members:i,size:o,alignment:t}}function jm(e){return $m[e].BYTES_PER_ELEMENT}function Fu(e,t){return Math.ceil(e/t)*t}var Mu=Z(he(),1),$t=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n){let i=this.length;return this.resize(i+1),this.emplace(i,r,n)}emplace(r,n,i){let o=r*2;return this.int16[o+0]=n,this.int16[o+1]=i,r}};$t.prototype.bytesPerElement=4;k("StructArrayLayout2i4",$t);var sn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,r,n,i)}emplace(r,n,i,o){let a=r*3;return this.int16[a+0]=n,this.int16[a+1]=i,this.int16[a+2]=o,r}};sn.prototype.bytesPerElement=6;k("StructArrayLayout3i6",sn);var Hi=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,r,n,i,o)}emplace(r,n,i,o,a){let s=r*4;return this.int16[s+0]=n,this.int16[s+1]=i,this.int16[s+2]=o,this.int16[s+3]=a,r}};Hi.prototype.bytesPerElement=8;k("StructArrayLayout4i8",Hi);var ln=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,r,n,i,o,a,s)}emplace(r,n,i,o,a,s,l){let u=r*6;return this.int16[u+0]=n,this.int16[u+1]=i,this.int16[u+2]=o,this.int16[u+3]=a,this.int16[u+4]=s,this.int16[u+5]=l,r}};ln.prototype.bytesPerElement=12;k("StructArrayLayout2i4i12",ln);var un=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,r,n,i,o,a,s)}emplace(r,n,i,o,a,s,l){let u=r*4,c=r*8;return this.int16[u+0]=n,this.int16[u+1]=i,this.uint8[c+4]=o,this.uint8[c+5]=a,this.uint8[c+6]=s,this.uint8[c+7]=l,r}};un.prototype.bytesPerElement=8;k("StructArrayLayout2i4ub8",un);var Pt=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n){let i=this.length;return this.resize(i+1),this.emplace(i,r,n)}emplace(r,n,i){let o=r*2;return this.float32[o+0]=n,this.float32[o+1]=i,r}};Pt.prototype.bytesPerElement=8;k("StructArrayLayout2f8",Pt);var cn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c,p){let f=this.length;return this.resize(f+1),this.emplace(f,r,n,i,o,a,s,l,u,c,p)}emplace(r,n,i,o,a,s,l,u,c,p,f){let y=r*10;return this.uint16[y+0]=n,this.uint16[y+1]=i,this.uint16[y+2]=o,this.uint16[y+3]=a,this.uint16[y+4]=s,this.uint16[y+5]=l,this.uint16[y+6]=u,this.uint16[y+7]=c,this.uint16[y+8]=p,this.uint16[y+9]=f,r}};cn.prototype.bytesPerElement=20;k("StructArrayLayout10ui20",cn);var pn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c,p,f,y){let m=this.length;return this.resize(m+1),this.emplace(m,r,n,i,o,a,s,l,u,c,p,f,y)}emplace(r,n,i,o,a,s,l,u,c,p,f,y,m){let h=r*12;return this.int16[h+0]=n,this.int16[h+1]=i,this.int16[h+2]=o,this.int16[h+3]=a,this.uint16[h+4]=s,this.uint16[h+5]=l,this.uint16[h+6]=u,this.uint16[h+7]=c,this.int16[h+8]=p,this.int16[h+9]=f,this.int16[h+10]=y,this.int16[h+11]=m,r}};pn.prototype.bytesPerElement=24;k("StructArrayLayout4i4ui4i24",pn);var fn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,r,n,i)}emplace(r,n,i,o){let a=r*3;return this.float32[a+0]=n,this.float32[a+1]=i,this.float32[a+2]=o,r}};fn.prototype.bytesPerElement=12;k("StructArrayLayout3f12",fn);var yn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(r){let n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){let i=r*1;return this.uint32[i+0]=n,r}};yn.prototype.bytesPerElement=4;k("StructArrayLayout1ul4",yn);var mn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c){let p=this.length;return this.resize(p+1),this.emplace(p,r,n,i,o,a,s,l,u,c)}emplace(r,n,i,o,a,s,l,u,c,p){let f=r*10,y=r*5;return this.int16[f+0]=n,this.int16[f+1]=i,this.int16[f+2]=o,this.int16[f+3]=a,this.int16[f+4]=s,this.int16[f+5]=l,this.uint32[y+3]=u,this.uint16[f+8]=c,this.uint16[f+9]=p,r}};mn.prototype.bytesPerElement=20;k("StructArrayLayout6i1ul2ui20",mn);var hn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s){let l=this.length;return this.resize(l+1),this.emplace(l,r,n,i,o,a,s)}emplace(r,n,i,o,a,s,l){let u=r*6;return this.int16[u+0]=n,this.int16[u+1]=i,this.int16[u+2]=o,this.int16[u+3]=a,this.int16[u+4]=s,this.int16[u+5]=l,r}};hn.prototype.bytesPerElement=12;k("StructArrayLayout2i2i2i12",hn);var Ki=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a){let s=this.length;return this.resize(s+1),this.emplace(s,r,n,i,o,a)}emplace(r,n,i,o,a,s){let l=r*4,u=r*8;return this.float32[l+0]=n,this.float32[l+1]=i,this.float32[l+2]=o,this.int16[u+6]=a,this.int16[u+7]=s,r}};Ki.prototype.bytesPerElement=16;k("StructArrayLayout2f1f2i16",Ki);var dn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,r,n,i,o)}emplace(r,n,i,o,a){let s=r*12,l=r*3;return this.uint8[s+0]=n,this.uint8[s+1]=i,this.float32[l+1]=o,this.float32[l+2]=a,r}};dn.prototype.bytesPerElement=12;k("StructArrayLayout2ub2f12",dn);var gn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,r,n,i)}emplace(r,n,i,o){let a=r*3;return this.uint16[a+0]=n,this.uint16[a+1]=i,this.uint16[a+2]=o,r}};gn.prototype.bytesPerElement=6;k("StructArrayLayout3ui6",gn);var xn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v){let b=this.length;return this.resize(b+1),this.emplace(b,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v)}emplace(r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,b){let x=r*24,P=r*12,w=r*48;return this.int16[x+0]=n,this.int16[x+1]=i,this.uint16[x+2]=o,this.uint16[x+3]=a,this.uint32[P+2]=s,this.uint32[P+3]=l,this.uint32[P+4]=u,this.uint16[x+10]=c,this.uint16[x+11]=p,this.uint16[x+12]=f,this.float32[P+7]=y,this.float32[P+8]=m,this.uint8[w+36]=h,this.uint8[w+37]=d,this.uint8[w+38]=g,this.uint32[P+10]=v,this.int16[x+22]=b,r}};xn.prototype.bytesPerElement=48;k("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",xn);var bn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,b,x,P,w,A,T,I,E,_,F,M){let B=this.length;return this.resize(B+1),this.emplace(B,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,b,x,P,w,A,T,I,E,_,F,M)}emplace(r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,b,x,P,w,A,T,I,E,_,F,M,B){let C=r*34,O=r*17;return this.int16[C+0]=n,this.int16[C+1]=i,this.int16[C+2]=o,this.int16[C+3]=a,this.int16[C+4]=s,this.int16[C+5]=l,this.int16[C+6]=u,this.int16[C+7]=c,this.uint16[C+8]=p,this.uint16[C+9]=f,this.uint16[C+10]=y,this.uint16[C+11]=m,this.uint16[C+12]=h,this.uint16[C+13]=d,this.uint16[C+14]=g,this.uint16[C+15]=v,this.uint16[C+16]=b,this.uint16[C+17]=x,this.uint16[C+18]=P,this.uint16[C+19]=w,this.uint16[C+20]=A,this.uint16[C+21]=T,this.uint16[C+22]=I,this.uint32[O+12]=E,this.float32[O+13]=_,this.float32[O+14]=F,this.float32[O+15]=M,this.float32[O+16]=B,r}};bn.prototype.bytesPerElement=68;k("StructArrayLayout8i15ui1ul4f68",bn);var Gt=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r){let n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){let i=r*1;return this.float32[i+0]=n,r}};Gt.prototype.bytesPerElement=4;k("StructArrayLayout1f4",Gt);var vn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n,i){let o=this.length;return this.resize(o+1),this.emplace(o,r,n,i)}emplace(r,n,i,o){let a=r*2,s=r*4;return this.uint32[a+0]=n,this.uint16[s+2]=i,this.uint16[s+3]=o,r}};vn.prototype.bytesPerElement=8;k("StructArrayLayout1ul2ui8",vn);var Pn=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r,n){let i=this.length;return this.resize(i+1),this.emplace(i,r,n)}emplace(r,n,i){let o=r*2;return this.uint16[o+0]=n,this.uint16[o+1]=i,r}};Pn.prototype.bytesPerElement=4;k("StructArrayLayout2ui4",Pn);var Yi=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(r){let n=this.length;return this.resize(n+1),this.emplace(n,r)}emplace(r,n){let i=r*1;return this.uint16[i+0]=n,r}};Yi.prototype.bytesPerElement=2;k("StructArrayLayout1ui2",Yi);var xr=class extends te{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(r,n,i,o){let a=this.length;return this.resize(a+1),this.emplace(a,r,n,i,o)}emplace(r,n,i,o,a){let s=r*4;return this.float32[s+0]=n,this.float32[s+1]=i,this.float32[s+2]=o,this.float32[s+3]=a,r}};xr.prototype.bytesPerElement=16;k("StructArrayLayout4f16",xr);var Xi=class extends Ut{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new Mu.default(this.anchorPointX,this.anchorPointY)}};Xi.prototype.size=20;var Sn=class extends mn{get(t){return new Xi(this,t)}};k("CollisionBoxArray",Sn);var Qi=class extends Ut{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(r){this._structArray.uint8[this._pos1+37]=r}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(r){this._structArray.uint8[this._pos1+38]=r}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(r){this._structArray.uint32[this._pos4+10]=r}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}};Qi.prototype.size=48;var wn=class extends xn{get(t){return new Qi(this,t)}};k("PlacedSymbolArray",wn);var eo=class extends Ut{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(r){this._structArray.uint32[this._pos4+12]=r}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}};eo.prototype.size=68;var An=class extends bn{get(t){return new eo(this,t)}};k("SymbolInstanceArray",An);var _n=class extends Gt{getoffsetX(t){return this.float32[t*1+0]}};k("GlyphOffsetArray",_n);var In=class extends sn{getx(t){return this.int16[t*3+0]}gety(t){return this.int16[t*3+1]}gettileUnitDistanceFromAnchor(t){return this.int16[t*3+2]}};k("SymbolLineVertexArray",In);var to=class extends Ut{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]}};to.prototype.size=8;var Cn=class extends vn{get(t){return new to(this,t)}};k("FeatureIndexArray",Cn);var ro=class extends $t{};var no=class extends $t{},io=class extends $t{},oo=class extends ln{};var ao=class extends un{},so=class extends Pt{},lt=class extends cn{},lo=class extends pn{},uo=class extends fn{},co=class extends yn{},kn=class extends hn{};var po=class extends dn{};var Le=class extends gn{},St=class extends Pn{};var Zm=ee([{name:"a_pos",components:2,type:"Int16"}],4);var{members:Lu,size:y0,alignment:m0}=Zm;var me=class e{constructor(t=[]){this.segments=t}prepareSegment(t,r,n,i){let o=this.segments[this.segments.length-1];return t>e.MAX_VERTEX_ARRAY_LENGTH&&ce("Max vertices per segment is ".concat(e.MAX_VERTEX_ARRAY_LENGTH,": bucket requested ").concat(t)),(!o||o.vertexLength+t>e.MAX_VERTEX_ARRAY_LENGTH||o.sortKey!==i)&&(o={vertexOffset:r.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0},i!==void 0&&(o.sortKey=i),this.segments.push(o)),o}get(){return this.segments}destroy(){for(let t of this.segments)for(let r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,n,i){return new e([{vertexOffset:t,primitiveOffset:r,vertexLength:n,primitiveLength:i,vaos:{},sortKey:0}])}};me.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1;k("SegmentVector",me);function Qa(e,t){return e=rt(Math.floor(e),0,255),t=rt(Math.floor(t),0,255),256*e+t}var Tn=ee([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Ru=Z(rs(),1);var En=class e{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,n,i){this.ids.push(zu(t)),this.positions.push(r,n,i)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");let r=zu(t),n=0,i=this.ids.length-1;for(;n<i;){let a=n+i>>1;this.ids[a]>=r?i=a:n=a+1}let o=[];for(;this.ids[n]===r;){let a=this.positions[3*n],s=this.positions[3*n+1],l=this.positions[3*n+2];o.push({index:a,start:s,end:l}),n++}return o}static serialize(t,r){let n=new Float64Array(t.ids),i=new Uint32Array(t.positions);return ns(n,i,0,n.length-1),r&&r.push(n.buffer,i.buffer),{ids:n,positions:i}}static deserialize(t){let r=new e;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}};function zu(e){let t=+e;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:(0,Ru.default)(String(e))}function ns(e,t,r,n){for(;r<n;){let i=e[r+n>>1],o=r-1,a=n+1;for(;;){do o++;while(e[o]<i);do a--;while(e[a]>i);if(o>=a)break;yo(e,o,a),yo(t,3*o,3*a),yo(t,3*o+1,3*a+1),yo(t,3*o+2,3*a+2)}a-r<n-a?(ns(e,t,r,a),r=a+1):(ns(e,t,a+1,n),n=a)}}function yo(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}k("FeaturePositionMap",En);var Fn=class{constructor(t,r){this.gl=t.gl,this.location=r}};var br=class extends Fn{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}};var mo=class extends Fn{constructor(t,r){super(t,r),this.current=[0,0,0,0]}set(t){(t[0]!==this.current[0]||t[1]!==this.current[1]||t[2]!==this.current[2]||t[3]!==this.current[3])&&(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}},ho=class extends Fn{constructor(t,r){super(t,r),this.current=W.transparent}set(t){(t.r!==this.current.r||t.g!==this.current.g||t.b!==this.current.b||t.a!==this.current.a)&&(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}},T0=new Float32Array(16);function is(e){return[Qa(255*e.r,255*e.g),Qa(255*e.b,255*e.a)]}var qt=class{constructor(t,r,n){this.value=t,this.uniformNames=r.map(i=>"u_".concat(i)),this.type=n}setUniform(t,r,n){t.set(n.constantOr(this.value))}getBinding(t,r,n){return this.type==="color"?new ho(t,r):new br(t,r)}},wt=class{constructor(t,r){this.uniformNames=r.map(n=>"u_".concat(n)),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,n,i){let o=i==="u_pattern_to"?this.patternTo:i==="u_pattern_from"?this.patternFrom:i==="u_pixel_ratio_to"?this.pixelRatioTo:i==="u_pixel_ratio_from"?this.pixelRatioFrom:null;o&&t.set(o)}getBinding(t,r,n){return n.substr(0,9)==="u_pattern"?new mo(t,r):new br(t,r)}},Je=class{constructor(t,r,n,i){this.expression=t,this.type=n,this.maxValue=0,this.paintVertexAttributes=r.map(o=>({name:"a_".concat(o),type:"Float32",components:n==="color"?2:1,offset:0})),this.paintVertexArray=new i}populatePaintArray(t,r,n,i,o){let a=this.paintVertexArray.length,s=this.expression.evaluate(new q(0),r,{},i,[],o);this.paintVertexArray.resize(t),this._setPaintValue(a,t,s)}updatePaintArray(t,r,n,i){let o=this.expression.evaluate({zoom:0},n,i);this._setPaintValue(t,r,o)}_setPaintValue(t,r,n){if(this.type==="color"){let i=is(n);for(let o=t;o<r;o++)this.paintVertexArray.emplace(o,i[0],i[1])}else{for(let i=t;i<r;i++)this.paintVertexArray.emplace(i,n);this.maxValue=Math.max(this.maxValue,Math.abs(n))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}},De=class{constructor(t,r,n,i,o,a){this.expression=t,this.uniformNames=r.map(s=>"u_".concat(s,"_t")),this.type=n,this.useIntegerZoom=i,this.zoom=o,this.maxValue=0,this.paintVertexAttributes=r.map(s=>({name:"a_".concat(s),type:"Float32",components:n==="color"?4:2,offset:0})),this.paintVertexArray=new a}populatePaintArray(t,r,n,i,o){let a=this.expression.evaluate(new q(this.zoom),r,{},i,[],o),s=this.expression.evaluate(new q(this.zoom+1),r,{},i,[],o),l=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(l,t,a,s)}updatePaintArray(t,r,n,i){let o=this.expression.evaluate({zoom:this.zoom},n,i),a=this.expression.evaluate({zoom:this.zoom+1},n,i);this._setPaintValue(t,r,o,a)}_setPaintValue(t,r,n,i){if(this.type==="color"){let o=is(n),a=is(i);for(let s=t;s<r;s++)this.paintVertexArray.emplace(s,o[0],o[1],a[0],a[1])}else{for(let o=t;o<r;o++)this.paintVertexArray.emplace(o,n,i);this.maxValue=Math.max(this.maxValue,Math.abs(n),Math.abs(i))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,r){let n=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,i=rt(this.expression.interpolationFactor(n,this.zoom,this.zoom+1),0,1);t.set(i)}getBinding(t,r,n){return new br(t,r)}},Xe=class{constructor(t,r,n,i,o,a){this.expression=t,this.type=r,this.useIntegerZoom=n,this.zoom=i,this.layerId=a,this.zoomInPaintVertexArray=new o,this.zoomOutPaintVertexArray=new o}populatePaintArray(t,r,n){let i=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(i,t,r.patterns&&r.patterns[this.layerId],n)}updatePaintArray(t,r,n,i,o){this._setPaintValues(t,r,n.patterns&&n.patterns[this.layerId],o)}_setPaintValues(t,r,n,i){if(!i||!n)return;let{min:o,mid:a,max:s}=n,l=i[o],u=i[a],c=i[s];if(!(!l||!u||!c))for(let p=t;p<r;p++)this.zoomInPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],l.tl[0],l.tl[1],l.br[0],l.br[1],u.pixelRatio,l.pixelRatio),this.zoomOutPaintVertexArray.emplace(p,u.tl[0],u.tl[1],u.br[0],u.br[1],c.tl[0],c.tl[1],c.br[0],c.br[1],u.pixelRatio,c.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Tn.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Tn.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}},go=class{constructor(t,r,n){this.binders={},this._buffers=[];let i=[];for(let o in t.paint._values){if(!n(o))continue;let a=t.paint.get(o);if(!(a instanceof be)||!ht(a.property.specification))continue;let s=Km(o,t.type),l=a.value,u=a.property.specification.type,c=a.property.useIntegerZoom,p=a.property.specification["property-type"],f=p==="cross-faded"||p==="cross-faded-data-driven";if(l.kind==="constant")this.binders[o]=f?new wt(l.value,s):new qt(l.value,s,u),i.push("/u_".concat(o));else if(l.kind==="source"||f){let y=Ou(o,u,"source");this.binders[o]=f?new Xe(l,u,c,r,y,t.id):new Je(l,s,u,y),i.push("/a_".concat(o))}else{let y=Ou(o,u,"composite");this.binders[o]=new De(l,s,u,c,r,y),i.push("/z_".concat(o))}}this.cacheKey=i.sort().join("")}getMaxValue(t){let r=this.binders[t];return r instanceof Je||r instanceof De?r.maxValue:0}populatePaintArrays(t,r,n,i,o){for(let a in this.binders){let s=this.binders[a];(s instanceof Je||s instanceof De||s instanceof Xe)&&s.populatePaintArray(t,r,n,i,o)}}setConstantPatternPositions(t,r){for(let n in this.binders){let i=this.binders[n];i instanceof wt&&i.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,n,i,o){let a=!1;for(let s in t){let l=r.getPositions(s);for(let u of l){let c=n.feature(u.index);for(let p in this.binders){let f=this.binders[p];if((f instanceof Je||f instanceof De||f instanceof Xe)&&f.expression.isStateDependent===!0){let y=i.paint.get(p);f.expression=y.value,f.updatePaintArray(u.start,u.end,c,t[s],o),a=!0}}}}return a}defines(){let t=[];for(let r in this.binders){let n=this.binders[r];(n instanceof qt||n instanceof wt)&&t.push(...n.uniformNames.map(i=>"#define HAS_UNIFORM_".concat(i)))}return t}getBinderAttributes(){let t=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof Je||n instanceof De)for(let i=0;i<n.paintVertexAttributes.length;i++)t.push(n.paintVertexAttributes[i].name);else if(n instanceof Xe)for(let i=0;i<Tn.members.length;i++)t.push(Tn.members[i].name)}return t}getBinderUniforms(){let t=[];for(let r in this.binders){let n=this.binders[r];if(n instanceof qt||n instanceof wt||n instanceof De)for(let i of n.uniformNames)t.push(i)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){let n=[];for(let i in this.binders){let o=this.binders[i];if(o instanceof qt||o instanceof wt||o instanceof De){for(let a of o.uniformNames)if(r[a]){let s=o.getBinding(t,r[a],a);n.push({name:a,property:i,binding:s})}}}return n}setUniforms(t,r,n,i){for(let{name:o,property:a,binding:s}of r)this.binders[a].setUniform(s,i,n.get(a),o)}updatePaintBuffers(t){this._buffers=[];for(let r in this.binders){let n=this.binders[r];if(t&&n instanceof Xe){let i=t.fromScale===2?n.zoomInPaintVertexBuffer:n.zoomOutPaintVertexBuffer;i&&this._buffers.push(i)}else(n instanceof Je||n instanceof De)&&n.paintVertexBuffer&&this._buffers.push(n.paintVertexBuffer)}}upload(t){for(let r in this.binders){let n=this.binders[r];(n instanceof Je||n instanceof De||n instanceof Xe)&&n.upload(t)}this.updatePaintBuffers()}destroy(){for(let t in this.binders){let r=this.binders[t];(r instanceof Je||r instanceof De||r instanceof Xe)&&r.destroy()}}},ke=class{constructor(t,r,n=()=>!0){this.programConfigurations={};for(let i of t)this.programConfigurations[i.id]=new go(i,r,n);this.needsUpload=!1,this._featureMap=new En,this._bufferOffset=0}populatePaintArrays(t,r,n,i,o,a){for(let s in this.programConfigurations)this.programConfigurations[s].populatePaintArrays(t,r,i,o,a);r.id!==void 0&&this._featureMap.add(r.id,n,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,n,i){for(let o of n)this.needsUpload=this.programConfigurations[o.id].updatePaintArrays(t,this._featureMap,r,o,i)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(let r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(let t in this.programConfigurations)this.programConfigurations[t].destroy()}};function Km(e,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[e]||[e.replace("".concat(t,"-"),"").replace(/-/g,"_")]}function Ym(e){return{"line-pattern":{source:lt,composite:lt},"fill-pattern":{source:lt,composite:lt},"fill-extrusion-pattern":{source:lt,composite:lt}}[e]}function Ou(e,t,r){let n={color:{source:Pt,composite:xr},number:{source:Gt,composite:Pt}},i=Ym(e);return i&&i[r]||n[t][r]}k("ConstantBinder",qt);k("CrossFadedConstantBinder",wt);k("SourceExpressionBinder",Je);k("CrossFadedCompositeBinder",Xe);k("CompositeExpressionBinder",De);k("ProgramConfiguration",go,{omit:["_buffers"]});k("ProgramConfigurationSet",ke);var Xm=15,os=Math.pow(2,Xm-1)-1,Nu=-os-1;function Te(e){let t=8192/e.extent,r=e.loadGeometry();for(let n=0;n<r.length;n++){let i=r[n];for(let o=0;o<i.length;o++){let a=i[o],s=Math.round(a.x*t),l=Math.round(a.y*t);a.x=rt(s,Nu,os),a.y=rt(l,Nu,os),(s<a.x||s>a.x+1||l<a.y||l>a.y+1)&&ce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function Oe(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Te(e):[]}}function xo(e,t,r,n,i){e.emplaceBack(t*2+(n+1)/2,r*2+(i+1)/2)}var jt=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new no,this.indexArray=new Le,this.segments=new me,this.programConfigurations=new ke(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){let i=this.layers[0],o=[],a=null,s=!1;i.type==="circle"&&(a=i.layout.get("circle-sort-key"),s=!a.isConstant());for(let{feature:l,id:u,index:c,sourceLayerIndex:p}of t){let f=this.layers[0]._featureFilter.needGeometry,y=Oe(l,f);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),y,n))continue;let m=s?a.evaluate(y,{},n):void 0,h={id:u,properties:l.properties,type:l.type,sourceLayerIndex:p,index:c,geometry:f?y.geometry:Te(l),patterns:{},sortKey:m};o.push(h)}s&&o.sort((l,u)=>l.sortKey-u.sortKey);for(let l of o){let{geometry:u,index:c,sourceLayerIndex:p}=l,f=t[c].feature;this.addFeature(l,u,c,n),r.featureIndex.insert(f,u,c,p,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Lu),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,r,n,i){for(let o of r)for(let a of o){let s=a.x,l=a.y;if(s<0||s>=8192||l<0||l>=8192)continue;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),c=u.vertexLength;xo(this.layoutVertexArray,s,l,-1,-1),xo(this.layoutVertexArray,s,l,1,-1),xo(this.layoutVertexArray,s,l,1,1),xo(this.layoutVertexArray,s,l,-1,1),this.indexArray.emplaceBack(c,c+1,c+2),this.indexArray.emplaceBack(c,c+3,c+2),u.vertexLength+=4,u.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,{},i)}};k("CircleBucket",jt,{omit:["layers"]});var Mn=Z(he(),1);function $u(e,t){for(let r=0;r<e.length;r++)if(vr(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(vr(e,t[r]))return!0;return!!ss(e,t)}function Gu(e,t,r){return!!(vr(e,t)||as(t,e,r))}function bo(e,t){if(e.length===1)return Uu(t,e[0]);for(let r=0;r<t.length;r++){let n=t[r];for(let i=0;i<n.length;i++)if(vr(e,n[i]))return!0}for(let r=0;r<e.length;r++)if(Uu(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(ss(e,t[r]))return!0;return!1}function qu(e,t,r){for(let n=0;n<t.length;n++){let i=t[n];if(e.length>=3){for(let o=0;o<i.length;o++)if(vr(e,i[o]))return!0}if(Qm(e,i,r))return!0}return!1}function Qm(e,t,r){if(e.length>1){if(ss(e,t))return!0;for(let n=0;n<t.length;n++)if(as(t[n],e,r))return!0}for(let n=0;n<e.length;n++)if(as(e[n],t,r))return!0;return!1}function ss(e,t){if(e.length===0||t.length===0)return!1;for(let r=0;r<e.length-1;r++){let n=e[r],i=e[r+1];for(let o=0;o<t.length-1;o++){let a=t[o],s=t[o+1];if(eh(n,i,a,s))return!0}}return!1}function eh(e,t,r,n){return nt(e,r,n)!==nt(t,r,n)&&nt(e,t,r)!==nt(e,t,n)}function as(e,t,r){let n=r*r;if(t.length===1)return e.distSqr(t[0])<n;for(let i=1;i<t.length;i++){let o=t[i-1],a=t[i];if(ls(e,o,a)<n)return!0}return!1}function ls(e,t,r){let n=t.distSqr(r);if(n===0)return e.distSqr(t);let i=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/n;return i<0?e.distSqr(t):i>1?e.distSqr(r):e.distSqr(r.sub(t)._mult(i)._add(t))}function Uu(e,t){let r=!1,n,i,o;for(let a=0;a<e.length;a++){n=e[a];for(let s=0,l=n.length-1;s<n.length;l=s++)i=n[s],o=n[l],i.y>t.y!=o.y>t.y&&t.x<(o.x-i.x)*(t.y-i.y)/(o.y-i.y)+i.x&&(r=!r)}return r}function vr(e,t){let r=!1;for(let n=0,i=e.length-1;n<e.length;i=n++){let o=e[n],a=e[i];o.y>t.y!=a.y>t.y&&t.x<(a.x-o.x)*(t.y-o.y)/(a.y-o.y)+o.x&&(r=!r)}return r}function ju(e,t,r,n,i){for(let a of e)if(t<=a.x&&r<=a.y&&n>=a.x&&i>=a.y)return!0;let o=[new Mn.default(t,r),new Mn.default(t,i),new Mn.default(n,i),new Mn.default(n,r)];if(e.length>2){for(let a of o)if(vr(e,a))return!0}for(let a=0;a<e.length-1;a++){let s=e[a],l=e[a+1];if(th(s,l,o))return!0}return!1}function th(e,t,r){let n=r[0],i=r[2];if(e.x<n.x&&t.x<n.x||e.x>i.x&&t.x>i.x||e.y<n.y&&t.y<n.y||e.y>i.y&&t.y>i.y)return!1;let o=nt(e,t,r[0]);return o!==nt(e,t,r[1])||o!==nt(e,t,r[2])||o!==nt(e,t,r[3])}var vo=Z(he(),1);function Zt(e,t,r){let n=t.paint.get(e).value;return n.kind==="constant"?n.value:r.programConfigurations.get(t.id).getMaxValue(e)}function At(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function _t(e,t,r,n,i){if(!t[0]&&!t[1])return e;let o=vo.default.convert(t)._mult(i);r==="viewport"&&o._rotate(-n);let a=[];for(let s=0;s<e.length;s++){let l=e[s];a.push(l.sub(o))}return a}function Zu(e,t){let r=[];for(let n=0;n<e.length;n++){let i=e[n],o=[];for(let a=0;a<i.length;a++){let s=i[a-1],l=i[a],u=i[a+1],c=a===0?new vo.default(0,0):l.sub(s)._unit()._perp(),p=a===i.length-1?new vo.default(0,0):u.sub(l)._unit()._perp(),f=c._add(p)._unit(),y=f.x*p.x+f.y*p.y;y!==0&&f._mult(1/y),o.push(f._mult(t)._add(l))}r.push(o)}return r}var Ju,rh=()=>Ju=Ju||new ie({"circle-sort-key":new R(S.layout_circle["circle-sort-key"])}),Wu,nh=()=>Wu=Wu||new ie({"circle-radius":new R(S.paint_circle["circle-radius"]),"circle-color":new R(S.paint_circle["circle-color"]),"circle-blur":new R(S.paint_circle["circle-blur"]),"circle-opacity":new R(S.paint_circle["circle-opacity"]),"circle-translate":new z(S.paint_circle["circle-translate"]),"circle-translate-anchor":new z(S.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new z(S.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new z(S.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new R(S.paint_circle["circle-stroke-width"]),"circle-stroke-color":new R(S.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new R(S.paint_circle["circle-stroke-opacity"])}),Hu={get paint(){return nh()},get layout(){return rh()}};var X=1e-6,Ne=typeof Float32Array<"u"?Float32Array:Array,Ln=Math.random;var Pv=Math.PI/180;Math.hypot||(Math.hypot=function(){for(var e=0,t=arguments.length;t--;)e+=arguments[t]*arguments[t];return Math.sqrt(e)});var Dn={};sl(Dn,{add:()=>Uh,adjoint:()=>ph,clone:()=>oh,copy:()=>ah,create:()=>ih,determinant:()=>fh,equals:()=>jh,exactEquals:()=>qh,frob:()=>Nh,fromQuat:()=>Eh,fromQuat2:()=>_h,fromRotation:()=>Ph,fromRotationTranslation:()=>Qu,fromRotationTranslationScale:()=>kh,fromRotationTranslationScaleOrigin:()=>Th,fromScaling:()=>vh,fromTranslation:()=>bh,fromValues:()=>sh,fromXRotation:()=>Sh,fromYRotation:()=>wh,fromZRotation:()=>Ah,frustum:()=>Fh,getRotation:()=>Ch,getScaling:()=>ec,getTranslation:()=>Ih,identity:()=>Yu,invert:()=>ch,lookAt:()=>zh,mul:()=>Zh,multiply:()=>Xu,multiplyScalar:()=>$h,multiplyScalarAndAdd:()=>Gh,ortho:()=>Vh,orthoNO:()=>rc,orthoZO:()=>Bh,perspective:()=>Mh,perspectiveFromFieldOfView:()=>Dh,perspectiveNO:()=>tc,perspectiveZO:()=>Lh,rotate:()=>hh,rotateX:()=>dh,rotateY:()=>gh,rotateZ:()=>xh,scale:()=>mh,set:()=>lh,str:()=>Oh,sub:()=>Jh,subtract:()=>nc,targetTo:()=>Rh,translate:()=>yh,transpose:()=>uh});function ih(){var e=new Ne(16);return Ne!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function oh(e){var t=new Ne(16);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}function ah(e,t){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}function sh(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m,h){var d=new Ne(16);return d[0]=e,d[1]=t,d[2]=r,d[3]=n,d[4]=i,d[5]=o,d[6]=a,d[7]=s,d[8]=l,d[9]=u,d[10]=c,d[11]=p,d[12]=f,d[13]=y,d[14]=m,d[15]=h,d}function lh(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e[4]=o,e[5]=a,e[6]=s,e[7]=l,e[8]=u,e[9]=c,e[10]=p,e[11]=f,e[12]=y,e[13]=m,e[14]=h,e[15]=d,e}function Yu(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function uh(e,t){if(e===t){var r=t[1],n=t[2],i=t[3],o=t[6],a=t[7],s=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=o,e[11]=t[14],e[12]=i,e[13]=a,e[14]=s}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function ch(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],p=t[9],f=t[10],y=t[11],m=t[12],h=t[13],d=t[14],g=t[15],v=r*s-n*a,b=r*l-i*a,x=r*u-o*a,P=n*l-i*s,w=n*u-o*s,A=i*u-o*l,T=c*h-p*m,I=c*d-f*m,E=c*g-y*m,_=p*d-f*h,F=p*g-y*h,M=f*g-y*d,B=v*M-b*F+x*_+P*E-w*I+A*T;return B?(B=1/B,e[0]=(s*M-l*F+u*_)*B,e[1]=(i*F-n*M-o*_)*B,e[2]=(h*A-d*w+g*P)*B,e[3]=(f*w-p*A-y*P)*B,e[4]=(l*E-a*M-u*I)*B,e[5]=(r*M-i*E+o*I)*B,e[6]=(d*x-m*A-g*b)*B,e[7]=(c*A-f*x+y*b)*B,e[8]=(a*F-s*E+u*T)*B,e[9]=(n*E-r*F-o*T)*B,e[10]=(m*w-h*x+g*v)*B,e[11]=(p*x-c*w-y*v)*B,e[12]=(s*I-a*_-l*T)*B,e[13]=(r*_-n*I+i*T)*B,e[14]=(h*b-m*P-d*v)*B,e[15]=(c*P-p*b+f*v)*B,e):null}function ph(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],l=t[6],u=t[7],c=t[8],p=t[9],f=t[10],y=t[11],m=t[12],h=t[13],d=t[14],g=t[15];return e[0]=s*(f*g-y*d)-p*(l*g-u*d)+h*(l*y-u*f),e[1]=-(n*(f*g-y*d)-p*(i*g-o*d)+h*(i*y-o*f)),e[2]=n*(l*g-u*d)-s*(i*g-o*d)+h*(i*u-o*l),e[3]=-(n*(l*y-u*f)-s*(i*y-o*f)+p*(i*u-o*l)),e[4]=-(a*(f*g-y*d)-c*(l*g-u*d)+m*(l*y-u*f)),e[5]=r*(f*g-y*d)-c*(i*g-o*d)+m*(i*y-o*f),e[6]=-(r*(l*g-u*d)-a*(i*g-o*d)+m*(i*u-o*l)),e[7]=r*(l*y-u*f)-a*(i*y-o*f)+c*(i*u-o*l),e[8]=a*(p*g-y*h)-c*(s*g-u*h)+m*(s*y-u*p),e[9]=-(r*(p*g-y*h)-c*(n*g-o*h)+m*(n*y-o*p)),e[10]=r*(s*g-u*h)-a*(n*g-o*h)+m*(n*u-o*s),e[11]=-(r*(s*y-u*p)-a*(n*y-o*p)+c*(n*u-o*s)),e[12]=-(a*(p*d-f*h)-c*(s*d-l*h)+m*(s*f-l*p)),e[13]=r*(p*d-f*h)-c*(n*d-i*h)+m*(n*f-i*p),e[14]=-(r*(s*d-l*h)-a*(n*d-i*h)+m*(n*l-i*s)),e[15]=r*(s*f-l*p)-a*(n*f-i*p)+c*(n*l-i*s),e}function fh(e){var t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],a=e[5],s=e[6],l=e[7],u=e[8],c=e[9],p=e[10],f=e[11],y=e[12],m=e[13],h=e[14],d=e[15],g=t*a-r*o,v=t*s-n*o,b=t*l-i*o,x=r*s-n*a,P=r*l-i*a,w=n*l-i*s,A=u*m-c*y,T=u*h-p*y,I=u*d-f*y,E=c*h-p*m,_=c*d-f*m,F=p*d-f*h;return g*F-v*_+b*E+x*I-P*T+w*A}function Xu(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],p=t[8],f=t[9],y=t[10],m=t[11],h=t[12],d=t[13],g=t[14],v=t[15],b=r[0],x=r[1],P=r[2],w=r[3];return e[0]=b*n+x*s+P*p+w*h,e[1]=b*i+x*l+P*f+w*d,e[2]=b*o+x*u+P*y+w*g,e[3]=b*a+x*c+P*m+w*v,b=r[4],x=r[5],P=r[6],w=r[7],e[4]=b*n+x*s+P*p+w*h,e[5]=b*i+x*l+P*f+w*d,e[6]=b*o+x*u+P*y+w*g,e[7]=b*a+x*c+P*m+w*v,b=r[8],x=r[9],P=r[10],w=r[11],e[8]=b*n+x*s+P*p+w*h,e[9]=b*i+x*l+P*f+w*d,e[10]=b*o+x*u+P*y+w*g,e[11]=b*a+x*c+P*m+w*v,b=r[12],x=r[13],P=r[14],w=r[15],e[12]=b*n+x*s+P*p+w*h,e[13]=b*i+x*l+P*f+w*d,e[14]=b*o+x*u+P*y+w*g,e[15]=b*a+x*c+P*m+w*v,e}function yh(e,t,r){var n=r[0],i=r[1],o=r[2],a,s,l,u,c,p,f,y,m,h,d,g;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*o+t[12],e[13]=t[1]*n+t[5]*i+t[9]*o+t[13],e[14]=t[2]*n+t[6]*i+t[10]*o+t[14],e[15]=t[3]*n+t[7]*i+t[11]*o+t[15]):(a=t[0],s=t[1],l=t[2],u=t[3],c=t[4],p=t[5],f=t[6],y=t[7],m=t[8],h=t[9],d=t[10],g=t[11],e[0]=a,e[1]=s,e[2]=l,e[3]=u,e[4]=c,e[5]=p,e[6]=f,e[7]=y,e[8]=m,e[9]=h,e[10]=d,e[11]=g,e[12]=a*n+c*i+m*o+t[12],e[13]=s*n+p*i+h*o+t[13],e[14]=l*n+f*i+d*o+t[14],e[15]=u*n+y*i+g*o+t[15]),e}function mh(e,t,r){var n=r[0],i=r[1],o=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function hh(e,t,r,n){var i=n[0],o=n[1],a=n[2],s=Math.hypot(i,o,a),l,u,c,p,f,y,m,h,d,g,v,b,x,P,w,A,T,I,E,_,F,M,B,C;return s<X?null:(s=1/s,i*=s,o*=s,a*=s,l=Math.sin(r),u=Math.cos(r),c=1-u,p=t[0],f=t[1],y=t[2],m=t[3],h=t[4],d=t[5],g=t[6],v=t[7],b=t[8],x=t[9],P=t[10],w=t[11],A=i*i*c+u,T=o*i*c+a*l,I=a*i*c-o*l,E=i*o*c-a*l,_=o*o*c+u,F=a*o*c+i*l,M=i*a*c+o*l,B=o*a*c-i*l,C=a*a*c+u,e[0]=p*A+h*T+b*I,e[1]=f*A+d*T+x*I,e[2]=y*A+g*T+P*I,e[3]=m*A+v*T+w*I,e[4]=p*E+h*_+b*F,e[5]=f*E+d*_+x*F,e[6]=y*E+g*_+P*F,e[7]=m*E+v*_+w*F,e[8]=p*M+h*B+b*C,e[9]=f*M+d*B+x*C,e[10]=y*M+g*B+P*C,e[11]=m*M+v*B+w*C,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function dh(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[4],a=t[5],s=t[6],l=t[7],u=t[8],c=t[9],p=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*i+u*n,e[5]=a*i+c*n,e[6]=s*i+p*n,e[7]=l*i+f*n,e[8]=u*i-o*n,e[9]=c*i-a*n,e[10]=p*i-s*n,e[11]=f*i-l*n,e}function gh(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[0],a=t[1],s=t[2],l=t[3],u=t[8],c=t[9],p=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i-u*n,e[1]=a*i-c*n,e[2]=s*i-p*n,e[3]=l*i-f*n,e[8]=o*n+u*i,e[9]=a*n+c*i,e[10]=s*n+p*i,e[11]=l*n+f*i,e}function xh(e,t,r){var n=Math.sin(r),i=Math.cos(r),o=t[0],a=t[1],s=t[2],l=t[3],u=t[4],c=t[5],p=t[6],f=t[7];return t!==e&&(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[0]=o*i+u*n,e[1]=a*i+c*n,e[2]=s*i+p*n,e[3]=l*i+f*n,e[4]=u*i-o*n,e[5]=c*i-a*n,e[6]=p*i-s*n,e[7]=f*i-l*n,e}function bh(e,t){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e}function vh(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ph(e,t,r){var n=r[0],i=r[1],o=r[2],a=Math.hypot(n,i,o),s,l,u;return a<X?null:(a=1/a,n*=a,i*=a,o*=a,s=Math.sin(t),l=Math.cos(t),u=1-l,e[0]=n*n*u+l,e[1]=i*n*u+o*s,e[2]=o*n*u-i*s,e[3]=0,e[4]=n*i*u-o*s,e[5]=i*i*u+l,e[6]=o*i*u+n*s,e[7]=0,e[8]=n*o*u+i*s,e[9]=i*o*u-n*s,e[10]=o*o*u+l,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e)}function Sh(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=n,e[6]=r,e[7]=0,e[8]=0,e[9]=-r,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function wh(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=0,e[2]=-r,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=r,e[9]=0,e[10]=n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Ah(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[2]=0,e[3]=0,e[4]=-r,e[5]=n,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Qu(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3],s=n+n,l=i+i,u=o+o,c=n*s,p=n*l,f=n*u,y=i*l,m=i*u,h=o*u,d=a*s,g=a*l,v=a*u;return e[0]=1-(y+h),e[1]=p+v,e[2]=f-g,e[3]=0,e[4]=p-v,e[5]=1-(c+h),e[6]=m+d,e[7]=0,e[8]=f+g,e[9]=m-d,e[10]=1-(c+y),e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function _h(e,t){var r=new Ne(3),n=-t[0],i=-t[1],o=-t[2],a=t[3],s=t[4],l=t[5],u=t[6],c=t[7],p=n*n+i*i+o*o+a*a;return p>0?(r[0]=(s*a+c*n+l*o-u*i)*2/p,r[1]=(l*a+c*i+u*n-s*o)*2/p,r[2]=(u*a+c*o+s*i-l*n)*2/p):(r[0]=(s*a+c*n+l*o-u*i)*2,r[1]=(l*a+c*i+u*n-s*o)*2,r[2]=(u*a+c*o+s*i-l*n)*2),Qu(e,t,r),e}function Ih(e,t){return e[0]=t[12],e[1]=t[13],e[2]=t[14],e}function ec(e,t){var r=t[0],n=t[1],i=t[2],o=t[4],a=t[5],s=t[6],l=t[8],u=t[9],c=t[10];return e[0]=Math.hypot(r,n,i),e[1]=Math.hypot(o,a,s),e[2]=Math.hypot(l,u,c),e}function Ch(e,t){var r=new Ne(3);ec(r,t);var n=1/r[0],i=1/r[1],o=1/r[2],a=t[0]*n,s=t[1]*i,l=t[2]*o,u=t[4]*n,c=t[5]*i,p=t[6]*o,f=t[8]*n,y=t[9]*i,m=t[10]*o,h=a+c+m,d=0;return h>0?(d=Math.sqrt(h+1)*2,e[3]=.25*d,e[0]=(p-y)/d,e[1]=(f-l)/d,e[2]=(s-u)/d):a>c&&a>m?(d=Math.sqrt(1+a-c-m)*2,e[3]=(p-y)/d,e[0]=.25*d,e[1]=(s+u)/d,e[2]=(f+l)/d):c>m?(d=Math.sqrt(1+c-a-m)*2,e[3]=(f-l)/d,e[0]=(s+u)/d,e[1]=.25*d,e[2]=(p+y)/d):(d=Math.sqrt(1+m-a-c)*2,e[3]=(s-u)/d,e[0]=(f+l)/d,e[1]=(p+y)/d,e[2]=.25*d),e}function kh(e,t,r,n){var i=t[0],o=t[1],a=t[2],s=t[3],l=i+i,u=o+o,c=a+a,p=i*l,f=i*u,y=i*c,m=o*u,h=o*c,d=a*c,g=s*l,v=s*u,b=s*c,x=n[0],P=n[1],w=n[2];return e[0]=(1-(m+d))*x,e[1]=(f+b)*x,e[2]=(y-v)*x,e[3]=0,e[4]=(f-b)*P,e[5]=(1-(p+d))*P,e[6]=(h+g)*P,e[7]=0,e[8]=(y+v)*w,e[9]=(h-g)*w,e[10]=(1-(p+m))*w,e[11]=0,e[12]=r[0],e[13]=r[1],e[14]=r[2],e[15]=1,e}function Th(e,t,r,n,i){var o=t[0],a=t[1],s=t[2],l=t[3],u=o+o,c=a+a,p=s+s,f=o*u,y=o*c,m=o*p,h=a*c,d=a*p,g=s*p,v=l*u,b=l*c,x=l*p,P=n[0],w=n[1],A=n[2],T=i[0],I=i[1],E=i[2],_=(1-(h+g))*P,F=(y+x)*P,M=(m-b)*P,B=(y-x)*w,C=(1-(f+g))*w,O=(d+v)*w,N=(m+b)*A,K=(d-v)*A,Y=(1-(f+h))*A;return e[0]=_,e[1]=F,e[2]=M,e[3]=0,e[4]=B,e[5]=C,e[6]=O,e[7]=0,e[8]=N,e[9]=K,e[10]=Y,e[11]=0,e[12]=r[0]+T-(_*T+B*I+N*E),e[13]=r[1]+I-(F*T+C*I+K*E),e[14]=r[2]+E-(M*T+O*I+Y*E),e[15]=1,e}function Eh(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=r+r,s=n+n,l=i+i,u=r*a,c=n*a,p=n*s,f=i*a,y=i*s,m=i*l,h=o*a,d=o*s,g=o*l;return e[0]=1-p-m,e[1]=c+g,e[2]=f-d,e[3]=0,e[4]=c-g,e[5]=1-u-m,e[6]=y+h,e[7]=0,e[8]=f+d,e[9]=y-h,e[10]=1-u-p,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function Fh(e,t,r,n,i,o,a){var s=1/(r-t),l=1/(i-n),u=1/(o-a);return e[0]=o*2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*l,e[6]=0,e[7]=0,e[8]=(r+t)*s,e[9]=(i+n)*l,e[10]=(a+o)*u,e[11]=-1,e[12]=0,e[13]=0,e[14]=a*o*2*u,e[15]=0,e}function tc(e,t,r,n,i){var o=1/Math.tan(t/2),a;return e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0?(a=1/(n-i),e[10]=(i+n)*a,e[14]=2*i*n*a):(e[10]=-1,e[14]=-2*n),e}var Mh=tc;function Lh(e,t,r,n,i){var o=1/Math.tan(t/2),a;return e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0?(a=1/(n-i),e[10]=i*a,e[14]=i*n*a):(e[10]=-1,e[14]=-n),e}function Dh(e,t,r,n){var i=Math.tan(t.upDegrees*Math.PI/180),o=Math.tan(t.downDegrees*Math.PI/180),a=Math.tan(t.leftDegrees*Math.PI/180),s=Math.tan(t.rightDegrees*Math.PI/180),l=2/(a+s),u=2/(i+o);return e[0]=l,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=u,e[6]=0,e[7]=0,e[8]=-((a-s)*l*.5),e[9]=(i-o)*u*.5,e[10]=n/(r-n),e[11]=-1,e[12]=0,e[13]=0,e[14]=n*r/(r-n),e[15]=0,e}function rc(e,t,r,n,i,o,a){var s=1/(t-r),l=1/(n-i),u=1/(o-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*u,e[11]=0,e[12]=(t+r)*s,e[13]=(i+n)*l,e[14]=(a+o)*u,e[15]=1,e}var Vh=rc;function Bh(e,t,r,n,i,o,a){var s=1/(t-r),l=1/(n-i),u=1/(o-a);return e[0]=-2*s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*l,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=u,e[11]=0,e[12]=(t+r)*s,e[13]=(i+n)*l,e[14]=o*u,e[15]=1,e}function zh(e,t,r,n){var i,o,a,s,l,u,c,p,f,y,m=t[0],h=t[1],d=t[2],g=n[0],v=n[1],b=n[2],x=r[0],P=r[1],w=r[2];return Math.abs(m-x)<X&&Math.abs(h-P)<X&&Math.abs(d-w)<X?Yu(e):(c=m-x,p=h-P,f=d-w,y=1/Math.hypot(c,p,f),c*=y,p*=y,f*=y,i=v*f-b*p,o=b*c-g*f,a=g*p-v*c,y=Math.hypot(i,o,a),y?(y=1/y,i*=y,o*=y,a*=y):(i=0,o=0,a=0),s=p*a-f*o,l=f*i-c*a,u=c*o-p*i,y=Math.hypot(s,l,u),y?(y=1/y,s*=y,l*=y,u*=y):(s=0,l=0,u=0),e[0]=i,e[1]=s,e[2]=c,e[3]=0,e[4]=o,e[5]=l,e[6]=p,e[7]=0,e[8]=a,e[9]=u,e[10]=f,e[11]=0,e[12]=-(i*m+o*h+a*d),e[13]=-(s*m+l*h+u*d),e[14]=-(c*m+p*h+f*d),e[15]=1,e)}function Rh(e,t,r,n){var i=t[0],o=t[1],a=t[2],s=n[0],l=n[1],u=n[2],c=i-r[0],p=o-r[1],f=a-r[2],y=c*c+p*p+f*f;y>0&&(y=1/Math.sqrt(y),c*=y,p*=y,f*=y);var m=l*f-u*p,h=u*c-s*f,d=s*p-l*c;return y=m*m+h*h+d*d,y>0&&(y=1/Math.sqrt(y),m*=y,h*=y,d*=y),e[0]=m,e[1]=h,e[2]=d,e[3]=0,e[4]=p*d-f*h,e[5]=f*m-c*d,e[6]=c*h-p*m,e[7]=0,e[8]=c,e[9]=p,e[10]=f,e[11]=0,e[12]=i,e[13]=o,e[14]=a,e[15]=1,e}function Oh(e){return"mat4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+", "+e[4]+", "+e[5]+", "+e[6]+", "+e[7]+", "+e[8]+", "+e[9]+", "+e[10]+", "+e[11]+", "+e[12]+", "+e[13]+", "+e[14]+", "+e[15]+")"}function Nh(e){return Math.hypot(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15])}function Uh(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e[4]=t[4]+r[4],e[5]=t[5]+r[5],e[6]=t[6]+r[6],e[7]=t[7]+r[7],e[8]=t[8]+r[8],e[9]=t[9]+r[9],e[10]=t[10]+r[10],e[11]=t[11]+r[11],e[12]=t[12]+r[12],e[13]=t[13]+r[13],e[14]=t[14]+r[14],e[15]=t[15]+r[15],e}function nc(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e[4]=t[4]-r[4],e[5]=t[5]-r[5],e[6]=t[6]-r[6],e[7]=t[7]-r[7],e[8]=t[8]-r[8],e[9]=t[9]-r[9],e[10]=t[10]-r[10],e[11]=t[11]-r[11],e[12]=t[12]-r[12],e[13]=t[13]-r[13],e[14]=t[14]-r[14],e[15]=t[15]-r[15],e}function $h(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e[4]=t[4]*r,e[5]=t[5]*r,e[6]=t[6]*r,e[7]=t[7]*r,e[8]=t[8]*r,e[9]=t[9]*r,e[10]=t[10]*r,e[11]=t[11]*r,e[12]=t[12]*r,e[13]=t[13]*r,e[14]=t[14]*r,e[15]=t[15]*r,e}function Gh(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e[4]=t[4]+r[4]*n,e[5]=t[5]+r[5]*n,e[6]=t[6]+r[6]*n,e[7]=t[7]+r[7]*n,e[8]=t[8]+r[8]*n,e[9]=t[9]+r[9]*n,e[10]=t[10]+r[10]*n,e[11]=t[11]+r[11]*n,e[12]=t[12]+r[12]*n,e[13]=t[13]+r[13]*n,e[14]=t[14]+r[14]*n,e[15]=t[15]+r[15]*n,e}function qh(e,t){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]}function jh(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],l=e[6],u=e[7],c=e[8],p=e[9],f=e[10],y=e[11],m=e[12],h=e[13],d=e[14],g=e[15],v=t[0],b=t[1],x=t[2],P=t[3],w=t[4],A=t[5],T=t[6],I=t[7],E=t[8],_=t[9],F=t[10],M=t[11],B=t[12],C=t[13],O=t[14],N=t[15];return Math.abs(r-v)<=X*Math.max(1,Math.abs(r),Math.abs(v))&&Math.abs(n-b)<=X*Math.max(1,Math.abs(n),Math.abs(b))&&Math.abs(i-x)<=X*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(o-P)<=X*Math.max(1,Math.abs(o),Math.abs(P))&&Math.abs(a-w)<=X*Math.max(1,Math.abs(a),Math.abs(w))&&Math.abs(s-A)<=X*Math.max(1,Math.abs(s),Math.abs(A))&&Math.abs(l-T)<=X*Math.max(1,Math.abs(l),Math.abs(T))&&Math.abs(u-I)<=X*Math.max(1,Math.abs(u),Math.abs(I))&&Math.abs(c-E)<=X*Math.max(1,Math.abs(c),Math.abs(E))&&Math.abs(p-_)<=X*Math.max(1,Math.abs(p),Math.abs(_))&&Math.abs(f-F)<=X*Math.max(1,Math.abs(f),Math.abs(F))&&Math.abs(y-M)<=X*Math.max(1,Math.abs(y),Math.abs(M))&&Math.abs(m-B)<=X*Math.max(1,Math.abs(m),Math.abs(B))&&Math.abs(h-C)<=X*Math.max(1,Math.abs(h),Math.abs(C))&&Math.abs(d-O)<=X*Math.max(1,Math.abs(d),Math.abs(O))&&Math.abs(g-N)<=X*Math.max(1,Math.abs(g),Math.abs(N))}var Zh=Xu,Jh=nc;var Jt={};sl(Jt,{add:()=>Xh,ceil:()=>Qh,clone:()=>Wh,copy:()=>Kh,create:()=>ic,cross:()=>cd,dist:()=>Sd,distance:()=>lc,div:()=>Pd,divide:()=>sc,dot:()=>ud,equals:()=>xd,exactEquals:()=>gd,floor:()=>ed,forEach:()=>Id,fromValues:()=>Hh,inverse:()=>sd,len:()=>Ad,length:()=>cc,lerp:()=>pd,max:()=>rd,min:()=>td,mul:()=>vd,multiply:()=>ac,negate:()=>ad,normalize:()=>ld,random:()=>fd,round:()=>nd,scale:()=>id,scaleAndAdd:()=>od,set:()=>Yh,sqrDist:()=>wd,sqrLen:()=>_d,squaredDistance:()=>uc,squaredLength:()=>pc,str:()=>dd,sub:()=>bd,subtract:()=>oc,transformMat4:()=>yd,transformQuat:()=>md,zero:()=>hd});function ic(){var e=new Ne(4);return Ne!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0,e[3]=0),e}function Wh(e){var t=new Ne(4);return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t}function Hh(e,t,r,n){var i=new Ne(4);return i[0]=e,i[1]=t,i[2]=r,i[3]=n,i}function Kh(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e}function Yh(e,t,r,n,i){return e[0]=t,e[1]=r,e[2]=n,e[3]=i,e}function Xh(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function oc(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e[3]=t[3]-r[3],e}function ac(e,t,r){return e[0]=t[0]*r[0],e[1]=t[1]*r[1],e[2]=t[2]*r[2],e[3]=t[3]*r[3],e}function sc(e,t,r){return e[0]=t[0]/r[0],e[1]=t[1]/r[1],e[2]=t[2]/r[2],e[3]=t[3]/r[3],e}function Qh(e,t){return e[0]=Math.ceil(t[0]),e[1]=Math.ceil(t[1]),e[2]=Math.ceil(t[2]),e[3]=Math.ceil(t[3]),e}function ed(e,t){return e[0]=Math.floor(t[0]),e[1]=Math.floor(t[1]),e[2]=Math.floor(t[2]),e[3]=Math.floor(t[3]),e}function td(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e[3]=Math.min(t[3],r[3]),e}function rd(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e[3]=Math.max(t[3],r[3]),e}function nd(e,t){return e[0]=Math.round(t[0]),e[1]=Math.round(t[1]),e[2]=Math.round(t[2]),e[3]=Math.round(t[3]),e}function id(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function od(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e[3]=t[3]+r[3]*n,e}function lc(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],o=t[3]-e[3];return Math.hypot(r,n,i,o)}function uc(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2],o=t[3]-e[3];return r*r+n*n+i*i+o*o}function cc(e){var t=e[0],r=e[1],n=e[2],i=e[3];return Math.hypot(t,r,n,i)}function pc(e){var t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function ad(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e}function sd(e,t){return e[0]=1/t[0],e[1]=1/t[1],e[2]=1/t[2],e[3]=1/t[3],e}function ld(e,t){var r=t[0],n=t[1],i=t[2],o=t[3],a=r*r+n*n+i*i+o*o;return a>0&&(a=1/Math.sqrt(a)),e[0]=r*a,e[1]=n*a,e[2]=i*a,e[3]=o*a,e}function ud(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function cd(e,t,r,n){var i=r[0]*n[1]-r[1]*n[0],o=r[0]*n[2]-r[2]*n[0],a=r[0]*n[3]-r[3]*n[0],s=r[1]*n[2]-r[2]*n[1],l=r[1]*n[3]-r[3]*n[1],u=r[2]*n[3]-r[3]*n[2],c=t[0],p=t[1],f=t[2],y=t[3];return e[0]=p*u-f*l+y*s,e[1]=-(c*u)+f*a-y*o,e[2]=c*l-p*a+y*i,e[3]=-(c*s)+p*o-f*i,e}function pd(e,t,r,n){var i=t[0],o=t[1],a=t[2],s=t[3];return e[0]=i+n*(r[0]-i),e[1]=o+n*(r[1]-o),e[2]=a+n*(r[2]-a),e[3]=s+n*(r[3]-s),e}function fd(e,t){t=t||1;var r,n,i,o,a,s;do r=Ln()*2-1,n=Ln()*2-1,a=r*r+n*n;while(a>=1);do i=Ln()*2-1,o=Ln()*2-1,s=i*i+o*o;while(s>=1);var l=Math.sqrt((1-a)/s);return e[0]=t*r,e[1]=t*n,e[2]=t*i*l,e[3]=t*o*l,e}function yd(e,t,r){var n=t[0],i=t[1],o=t[2],a=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*a,e[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*a,e[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*a,e[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*a,e}function md(e,t,r){var n=t[0],i=t[1],o=t[2],a=r[0],s=r[1],l=r[2],u=r[3],c=u*n+s*o-l*i,p=u*i+l*n-a*o,f=u*o+a*i-s*n,y=-a*n-s*i-l*o;return e[0]=c*u+y*-a+p*-l-f*-s,e[1]=p*u+y*-s+f*-a-c*-l,e[2]=f*u+y*-l+c*-s-p*-a,e[3]=t[3],e}function hd(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=0,e}function dd(e){return"vec4("+e[0]+", "+e[1]+", "+e[2]+", "+e[3]+")"}function gd(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]&&e[3]===t[3]}function xd(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=t[0],s=t[1],l=t[2],u=t[3];return Math.abs(r-a)<=X*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(n-s)<=X*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-l)<=X*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(o-u)<=X*Math.max(1,Math.abs(o),Math.abs(u))}var bd=oc,vd=ac,Pd=sc,Sd=lc,wd=uc,Ad=cc,_d=pc,Id=function(){var e=ic();return function(t,r,n,i,o,a){var s,l;for(r||(r=4),n||(n=0),i?l=Math.min(i*r+n,t.length):l=t.length,s=n;s<l;s+=r)e[0]=t[s],e[1]=t[s+1],e[2]=t[s+2],e[3]=t[s+3],o(e,e,a),t[s]=e[0],t[s+1]=e[1],t[s+2]=e[2],t[s+3]=e[3];return t}}();var fc=Z(he(),1),Po=class extends le{constructor(r){super(r,Hu)}createBucket(r){return new jt(r)}queryRadius(r){let n=r;return Zt("circle-radius",this,n)+Zt("circle-stroke-width",this,n)+At(this.paint.get("circle-translate"))}queryIntersectsFeature(r,n,i,o,a,s,l,u){let c=_t(r,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,l),p=this.paint.get("circle-radius").evaluate(n,i),f=this.paint.get("circle-stroke-width").evaluate(n,i),y=p+f,m=this.paint.get("circle-pitch-alignment")==="map",h=m?c:Cd(c,u),d=m?y*l:y;for(let g of o)for(let v of g){let b=m?v:yc(v,u),x=d,P=Jt.transformMat4([],[v.x,v.y,0,1],u);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?x*=P[3]/s.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(x*=s.cameraToCenterDistance/P[3]),Gu(h,b,x))return!0}return!1}};function yc(e,t){let r=Jt.transformMat4([],[e.x,e.y,0,1],t);return new fc.default(r[0]/r[3],r[1]/r[3])}function Cd(e,t){return e.map(r=>yc(r,t))}var Vn=class extends jt{};k("HeatmapBucket",Vn,{omit:["layers"]});var mc,kd=()=>mc=mc||new ie({"heatmap-radius":new R(S.paint_heatmap["heatmap-radius"]),"heatmap-weight":new R(S.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new z(S.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Nt(S.paint_heatmap["heatmap-color"]),"heatmap-opacity":new z(S.paint_heatmap["heatmap-opacity"])}),hc={get paint(){return kd()}};function us(e,{width:t,height:r},n,i){if(!i)i=new Uint8Array(t*r*n);else if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==t*r*n)throw new RangeError("mismatched image size. expected: ".concat(i.length," but got: ").concat(t*r*n));return e.width=t,e.height=r,e.data=i,e}function dc(e,{width:t,height:r},n){if(t===e.width&&r===e.height)return;let i=us({},{width:t,height:r},n);cs(e,i,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,t),height:Math.min(e.height,r)},n),e.width=t,e.height=r,e.data=i.data}function cs(e,t,r,n,i,o){if(i.width===0||i.height===0)return t;if(i.width>e.width||i.height>e.height||r.x>e.width-i.width||r.y>e.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>t.width||i.height>t.height||n.x>t.width-i.width||n.y>t.height-i.height)throw new RangeError("out of range destination coordinates for image copy");let a=e.data,s=t.data;if(a===s)throw new Error("srcData equals dstData, so image is already copied");for(let l=0;l<i.height;l++){let u=((r.y+l)*e.width+r.x)*o,c=((n.y+l)*t.width+n.x)*o;for(let p=0;p<i.width*o;p++)s[c+p]=a[u+p]}return t}var Wt=class e{constructor(t,r){us(this,t,1,r)}resize(t){dc(this,t,1)}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,n,i,o){cs(t,r,n,i,o,1)}},de=class e{constructor(t,r){us(this,t,4,r)}resize(t){dc(this,t,4)}replace(t,r){r?this.data.set(t):t instanceof Uint8ClampedArray?this.data=new Uint8Array(t.buffer):this.data=t}clone(){return new e({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,n,i,o){cs(t,r,n,i,o,4)}};k("AlphaImage",Wt);k("RGBAImage",de);function gc(e){let t={},r=e.resolution||256,n=e.clips?e.clips.length:1,i=e.image||new de({width:r,height:n});if(!hl(r))throw new Error("width is not a power of 2 - ".concat(r));let o=(a,s,l)=>{t[e.evaluationKey]=l;let u=e.expression.evaluate(t);i.data[a+s+0]=Math.floor(u.r*255/u.a),i.data[a+s+1]=Math.floor(u.g*255/u.a),i.data[a+s+2]=Math.floor(u.b*255/u.a),i.data[a+s+3]=Math.floor(u.a*255)};if(e.clips)for(let a=0,s=0;a<n;++a,s+=r*4)for(let l=0,u=0;l<r;l++,u+=4){let c=l/(r-1),{start:p,end:f}=e.clips[a],y=p*(1-c)+f*c;o(s,u,y)}else for(let a=0,s=0;a<r;a++,s+=4){let l=a/(r-1);o(0,s,l)}return i}var So=class extends le{constructor(r){super(r,hc);this._updateColorRamp()}createBucket(r){return new Vn(r)}_handleSpecialPaintPropertyUpdate(r){r==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){let r=this._transitionablePaint._values["heatmap-color"].value.expression;this.colorRamp=gc({expression:r,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}};var xc,Td=()=>xc=xc||new ie({"hillshade-illumination-direction":new z(S.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new z(S.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new z(S.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new z(S.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new z(S.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new z(S.paint_hillshade["hillshade-accent-color"])}),bc={get paint(){return Td()}};var wo=class extends le{constructor(r){super(r,bc)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}};var Ed=ee([{name:"a_pos",components:2,type:"Int16"}],4);var{members:vc,size:m1,alignment:h1}=Ed;var Ic=Z(hs(),1);function ds(e,t,r,n,i){_c(e,t,r||0,n||e.length-1,i||Zd)}function _c(e,t,r,n,i){for(;n>r;){if(n-r>600){var o=n-r+1,a=t-r+1,s=Math.log(o),l=.5*Math.exp(2*s/3),u=.5*Math.sqrt(s*l*(o-l)/o)*(a-o/2<0?-1:1),c=Math.max(r,Math.floor(t-a*l/o+u)),p=Math.min(n,Math.floor(t+(o-a)*l/o+u));_c(e,t,c,p,i)}var f=e[t],y=r,m=n;for(On(e,r,t),i(e[n],f)>0&&On(e,r,n);y<m;){for(On(e,y,m),y++,m--;i(e[y],f)<0;)y++;for(;i(e[m],f)>0;)m--}i(e[r],f)===0?On(e,r,m):(m++,On(e,m,n)),m<=t&&(r=m+1),t<=m&&(n=m-1)}}function On(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function Zd(e,t){return e<t?-1:e>t?1:0}function Sr(e,t){let r=e.length;if(r<=1)return[e];let n=[],i,o;for(let a=0;a<r;a++){let s=xl(e[a]);s!==0&&(e[a].area=Math.abs(s),o===void 0&&(o=s<0),o===s<0?(i&&n.push(i),i=[e[a]]):i.push(e[a]))}if(i&&n.push(i),t>1)for(let a=0;a<n.length;a++)n[a].length<=t||(ds(n[a],t,1,n[a].length-1,Jd),n[a]=n[a].slice(0,t));return n}function Jd(e,t){return t.area-e.area}function wr(e,t,r){let n=r.patternDependencies,i=!1;for(let o of t){let a=o.paint.get("".concat(e,"-pattern"));a.isConstant()||(i=!0);let s=a.constantOr(null);s&&(i=!0,n[s.to]=!0,n[s.from]=!0)}return i}function Ar(e,t,r,n,i){let o=i.patternDependencies;for(let a of t){let l=a.paint.get("".concat(e,"-pattern")).value;if(l.kind!=="constant"){let u=l.evaluate({zoom:n-1},r,{},i.availableImages),c=l.evaluate({zoom:n},r,{},i.availableImages),p=l.evaluate({zoom:n+1},r,{},i.availableImages);u=u&&u.name?u.name:u,c=c&&c.name?c.name:c,p=p&&p.name?p.name:p,o[u]=!0,o[c]=!0,o[p]=!0,r.patterns[a.id]={min:u,mid:c,max:p}}}return r}var Wd=500,Kt=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new io,this.indexArray=new Le,this.indexArray2=new St,this.programConfigurations=new ke(t.layers,t.zoom),this.segments=new me,this.segments2=new me,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){this.hasPattern=wr("fill",this.layers,r);let i=this.layers[0].layout.get("fill-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of t){let p=this.layers[0]._featureFilter.needGeometry,f=Oe(s,p);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),f,n))continue;let y=o?i.evaluate(f,{},n,r.availableImages):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:Te(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Ar("fill",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});let p=t[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}addFeatures(t,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,vc),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,r,n,i,o){for(let a of Sr(r,Wd)){let s=0;for(let y of a)s+=y.length;let l=this.segments.prepareSegment(s,this.layoutVertexArray,this.indexArray),u=l.vertexLength,c=[],p=[];for(let y of a){if(y.length===0)continue;y!==a[0]&&p.push(c.length/2);let m=this.segments2.prepareSegment(y.length,this.layoutVertexArray,this.indexArray2),h=m.vertexLength;this.layoutVertexArray.emplaceBack(y[0].x,y[0].y),this.indexArray2.emplaceBack(h+y.length-1,h),c.push(y[0].x),c.push(y[0].y);for(let d=1;d<y.length;d++)this.layoutVertexArray.emplaceBack(y[d].x,y[d].y),this.indexArray2.emplaceBack(h+d-1,h+d),c.push(y[d].x),c.push(y[d].y);m.vertexLength+=y.length,m.primitiveLength+=y.length}let f=(0,Ic.default)(c,p);for(let y=0;y<f.length;y+=3)this.indexArray.emplaceBack(u+f[y],u+f[y+1],u+f[y+2]);l.vertexLength+=s,l.primitiveLength+=f.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,o,i)}};k("FillBucket",Kt,{omit:["layers","patternFeatures"]});var Cc,Hd=()=>Cc=Cc||new ie({"fill-sort-key":new R(S.layout_fill["fill-sort-key"])}),kc,Kd=()=>kc=kc||new ie({"fill-antialias":new z(S.paint_fill["fill-antialias"]),"fill-opacity":new R(S.paint_fill["fill-opacity"]),"fill-color":new R(S.paint_fill["fill-color"]),"fill-outline-color":new R(S.paint_fill["fill-outline-color"]),"fill-translate":new z(S.paint_fill["fill-translate"]),"fill-translate-anchor":new z(S.paint_fill["fill-translate-anchor"]),"fill-pattern":new st(S.paint_fill["fill-pattern"])}),Tc={get paint(){return Kd()},get layout(){return Hd()}};var ko=class extends le{constructor(r){super(r,Tc)}recalculate(r,n){super.recalculate(r,n);let i=this.paint._values["fill-outline-color"];i.value.kind==="constant"&&i.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(r){return new Kt(r)}queryRadius(){return At(this.paint.get("fill-translate"))}queryIntersectsFeature(r,n,i,o,a,s,l){let u=_t(r,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,l);return bo(u,o)}isTileClipped(){return!0}};var Yd=ee([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ec=ee([{name:"a_centroid",components:2,type:"Int16"}],4);var{members:Fc,size:Y1,alignment:X1}=Yd;var zc=Z(hs(),1),Rc=Z(It(),1);var ug=Rc.default.VectorTileFeature.types,cg=500,bs=Math.pow(2,13);function Nn(e,t,r,n,i,o,a,s){e.emplaceBack(t,r,Math.floor(n*bs)*2+a,i*bs*2,o*bs*2,Math.round(s))}var Yt=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new oo,this.centroidVertexArray=new ro,this.indexArray=new Le,this.programConfigurations=new ke(t.layers,t.zoom),this.segments=new me,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){this.features=[],this.hasPattern=wr("fill-extrusion",this.layers,r);for(let{feature:i,id:o,index:a,sourceLayerIndex:s}of t){let l=this.layers[0]._featureFilter.needGeometry,u=Oe(i,l);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),u,n))continue;let c={id:o,sourceLayerIndex:s,index:a,geometry:l?u.geometry:Te(i),properties:i.properties,type:i.type,patterns:{}};this.hasPattern?this.features.push(Ar("fill-extrusion",this.layers,c,this.zoom,r)):this.addFeature(c,c.geometry,a,n,{}),r.featureIndex.insert(i,c.geometry,a,s,this.index,!0)}}addFeatures(t,r,n){for(let i of this.features){let{geometry:o}=i;this.addFeature(i,o,i.index,r,n)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Fc),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ec.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,r,n,i,o){let a={x:0,y:0,vertexCount:0};for(let s of Sr(r,cg)){let l=0;for(let m of s)l+=m.length;let u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(let m of s){if(m.length===0||fg(m))continue;let h=0;for(let d=0;d<m.length;d++){let g=m[d];if(d>=1){let v=m[d-1];if(!pg(g,v)){u.vertexLength+4>me.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));let b=g.sub(v)._perp()._unit(),x=v.dist(g);h+x>32768&&(h=0),Nn(this.layoutVertexArray,g.x,g.y,b.x,b.y,0,0,h),Nn(this.layoutVertexArray,g.x,g.y,b.x,b.y,0,1,h),a.x+=2*g.x,a.y+=2*g.y,a.vertexCount+=2,h+=x,Nn(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,0,h),Nn(this.layoutVertexArray,v.x,v.y,b.x,b.y,0,1,h),a.x+=2*v.x,a.y+=2*v.y,a.vertexCount+=2;let P=u.vertexLength;this.indexArray.emplaceBack(P,P+2,P+1),this.indexArray.emplaceBack(P+1,P+2,P+3),u.vertexLength+=4,u.primitiveLength+=2}}}}if(u.vertexLength+l>me.MAX_VERTEX_ARRAY_LENGTH&&(u=this.segments.prepareSegment(l,this.layoutVertexArray,this.indexArray)),ug[t.type]!=="Polygon")continue;let c=[],p=[],f=u.vertexLength;for(let m of s)if(m.length!==0){m!==s[0]&&p.push(c.length/2);for(let h=0;h<m.length;h++){let d=m[h];Nn(this.layoutVertexArray,d.x,d.y,0,0,1,1,0),a.x+=d.x,a.y+=d.y,a.vertexCount+=1,c.push(d.x),c.push(d.y)}}let y=(0,zc.default)(c,p);for(let m=0;m<y.length;m+=3)this.indexArray.emplaceBack(f+y[m],f+y[m+2],f+y[m+1]);u.primitiveLength+=y.length/3,u.vertexLength+=l}for(let s=0;s<a.vertexCount;s++)this.centroidVertexArray.emplaceBack(Math.floor(a.x/a.vertexCount),Math.floor(a.y/a.vertexCount));this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,o,i)}};k("FillExtrusionBucket",Yt,{omit:["layers","features"]});function pg(e,t){return e.x===t.x&&(e.x<0||e.x>8192)||e.y===t.y&&(e.y<0||e.y>8192)}function fg(e){return e.every(t=>t.x<0)||e.every(t=>t.x>8192)||e.every(t=>t.y<0)||e.every(t=>t.y>8192)}var Oc,yg=()=>Oc=Oc||new ie({"fill-extrusion-opacity":new z(S["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new R(S["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new z(S["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new z(S["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new st(S["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new R(S["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new R(S["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new z(S["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])}),Nc={get paint(){return yg()}};var Eo=Z(he(),1);var Fo=class extends le{constructor(r){super(r,Nc)}createBucket(r){return new Yt(r)}queryRadius(){return At(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(r,n,i,o,a,s,l,u){let c=_t(r,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,l),p=this.paint.get("fill-extrusion-height").evaluate(n,i),f=this.paint.get("fill-extrusion-base").evaluate(n,i),y=dg(c,u,s,0),m=hg(o,f,p,u),h=m[0],d=m[1];return mg(h,d,y)}};function Un(e,t){return e.x*t.x+e.y*t.y}function Uc(e,t){if(e.length===1){let r=0,n=t[r++],i;for(;!i||n.equals(i);)if(i=t[r++],!i)return 1/0;for(;r<t.length;r++){let o=t[r],a=e[0],s=i.sub(n),l=o.sub(n),u=a.sub(n),c=Un(s,s),p=Un(s,l),f=Un(l,l),y=Un(u,s),m=Un(u,l),h=c*f-p*p,d=(f*y-p*m)/h,g=(c*m-p*y)/h,v=1-d-g,b=n.z*v+i.z*d+o.z*g;if(isFinite(b))return b}return 1/0}else{let r=1/0;for(let n of t)r=Math.min(r,n.z);return r}}function mg(e,t,r){let n=1/0;bo(r,t)&&(n=Uc(r,t[0]));for(let i=0;i<t.length;i++){let o=t[i],a=e[i];for(let s=0;s<o.length-1;s++){let l=o[s],u=o[s+1],c=a[s],p=a[s+1],f=[l,u,p,c,l];$u(r,f)&&(n=Math.min(n,Uc(r,f)))}}return n===1/0?!1:n}function hg(e,t,r,n){let i=[],o=[],a=n[8]*t,s=n[9]*t,l=n[10]*t,u=n[11]*t,c=n[8]*r,p=n[9]*r,f=n[10]*r,y=n[11]*r;for(let m of e){let h=[],d=[];for(let g of m){let v=g.x,b=g.y,x=n[0]*v+n[4]*b+n[12],P=n[1]*v+n[5]*b+n[13],w=n[2]*v+n[6]*b+n[14],A=n[3]*v+n[7]*b+n[15],T=x+a,I=P+s,E=w+l,_=A+u,F=x+c,M=P+p,B=w+f,C=A+y,O=new Eo.default(T/_,I/_);O.z=E/_,h.push(O);let N=new Eo.default(F/C,M/C);N.z=B/C,d.push(N)}i.push(h),o.push(d)}return[i,o]}function dg(e,t,r,n){let i=[];for(let o of e){let a=[o.x,o.y,n,1];Jt.transformMat4(a,a,t),i.push(new Eo.default(a[0]/a[3],a[1]/a[3]))}return i}var gg=ee([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:$c,size:DP,alignment:VP}=gg;var xg=ee([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Gc,size:RP,alignment:OP}=xg;var Zc=Z(It(),1);var bg=Zc.default.VectorTileFeature.types,qc=63,vg=Math.cos(75/2*(Math.PI/180)),Pg=15,Sg=20,wg=15,Jc=1/2,jc=Math.pow(2,wg-1)/Jc,Xt=class{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new ao,this.layoutVertexArray2=new so,this.indexArray=new Le,this.programConfigurations=new ke(t.layers,t.zoom),this.segments=new me,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,n){this.hasPattern=wr("line",this.layers,r);let i=this.layers[0].layout.get("line-sort-key"),o=!i.isConstant(),a=[];for(let{feature:s,id:l,index:u,sourceLayerIndex:c}of t){let p=this.layers[0]._featureFilter.needGeometry,f=Oe(s,p);if(!this.layers[0]._featureFilter.filter(new q(this.zoom),f,n))continue;let y=o?i.evaluate(f,{},n):void 0,m={id:l,properties:s.properties,type:s.type,sourceLayerIndex:c,index:u,geometry:p?f.geometry:Te(s),patterns:{},sortKey:y};a.push(m)}o&&a.sort((s,l)=>s.sortKey-l.sortKey);for(let s of a){let{geometry:l,index:u,sourceLayerIndex:c}=s;if(this.hasPattern){let f=Ar("line",this.layers,s,this.zoom,r);this.patternFeatures.push(f)}else this.addFeature(s,l,u,n,{});let p=t[u].feature;r.featureIndex.insert(p,l,u,c,this.index)}}update(t,r,n){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,n)}addFeatures(t,r,n){for(let i of this.patternFeatures)this.addFeature(i,i.geometry,i.index,r,n)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Gc)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,$c),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end")){let r=+t.properties.mapbox_clip_start,n=+t.properties.mapbox_clip_end;return{start:r,end:n}}}addFeature(t,r,n,i,o){let a=this.layers[0].layout,s=a.get("line-join").evaluate(t,{}),l=a.get("line-cap"),u=a.get("line-miter-limit"),c=a.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(let p of r)this.addLine(p,t,s,l,u,c);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,o,i)}addLine(t,r,n,i,o,a){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let g=0;g<t.length-1;g++)this.totalDistance+=t[g].dist(t[g+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}let s=bg[r.type]==="Polygon",l=t.length;for(;l>=2&&t[l-1].equals(t[l-2]);)l--;let u=0;for(;u<l-1&&t[u].equals(t[u+1]);)u++;if(l<(s?3:2))return;n==="bevel"&&(o=1.05);let c=this.overscaling<=16?Pg*8192/(512*this.overscaling):0,p=this.segments.prepareSegment(l*10,this.layoutVertexArray,this.indexArray),f,y,m,h,d;this.e1=this.e2=-1,s&&(f=t[l-2],d=t[u].sub(f)._unit()._perp());for(let g=u;g<l;g++){if(m=g===l-1?s?t[u+1]:void 0:t[g+1],m&&t[g].equals(m))continue;d&&(h=d),f&&(y=f),f=t[g],d=m?m.sub(f)._unit()._perp():h,h=h||d;let v=h.add(d);(v.x!==0||v.y!==0)&&v._unit();let b=h.x*d.x+h.y*d.y,x=v.x*d.x+v.y*d.y,P=x!==0?1/x:1/0,w=2*Math.sqrt(2-2*x),A=x<vg&&y&&m,T=h.x*d.y-h.y*d.x>0;if(A&&g>u){let _=f.dist(y);if(_>2*c){let F=f.sub(f.sub(y)._mult(c/_)._round());this.updateDistance(y,F),this.addCurrentVertex(F,h,0,0,p),y=F}}let I=y&&m,E=I?n:s?"butt":i;if(I&&E==="round"&&(P<a?E="miter":P<=2&&(E="fakeround")),E==="miter"&&P>o&&(E="bevel"),E==="bevel"&&(P>2&&(E="flipbevel"),P<o&&(E="miter")),y&&this.updateDistance(y,f),E==="miter")v._mult(P),this.addCurrentVertex(f,v,0,0,p);else if(E==="flipbevel"){if(P>100)v=d.mult(-1);else{let _=P*h.add(d).mag()/h.sub(d).mag();v._perp()._mult(_*(T?-1:1))}this.addCurrentVertex(f,v,0,0,p),this.addCurrentVertex(f,v.mult(-1),0,0,p)}else if(E==="bevel"||E==="fakeround"){let _=-Math.sqrt(P*P-1),F=T?_:0,M=T?0:_;if(y&&this.addCurrentVertex(f,h,F,M,p),E==="fakeround"){let B=Math.round(w*180/Math.PI/Sg);for(let C=1;C<B;C++){let O=C/B;if(O!==.5){let K=O-.5,Y=1.0904+b*(-3.2452+b*(3.55645-b*1.43519)),Q=.848013+b*(-1.06021+b*.215638);O=O+O*K*(O-1)*(Y*K*K+Q)}let N=d.sub(h)._mult(O)._add(h)._unit()._mult(T?-1:1);this.addHalfVertex(f,N.x,N.y,!1,T,0,p)}}m&&this.addCurrentVertex(f,d,-F,-M,p)}else if(E==="butt")this.addCurrentVertex(f,v,0,0,p);else if(E==="square"){let _=y?1:-1;this.addCurrentVertex(f,v,_,_,p)}else E==="round"&&(y&&(this.addCurrentVertex(f,h,0,0,p),this.addCurrentVertex(f,h,1,1,p,!0)),m&&(this.addCurrentVertex(f,d,-1,-1,p,!0),this.addCurrentVertex(f,d,0,0,p)));if(A&&g<l-1){let _=f.dist(m);if(_>2*c){let F=f.add(m.sub(f)._mult(c/_)._round());this.updateDistance(f,F),this.addCurrentVertex(F,d,0,0,p),f=F}}}}addCurrentVertex(t,r,n,i,o,a=!1){let s=r.x+r.y*n,l=r.y-r.x*n,u=-r.x+r.y*i,c=-r.y-r.x*i;this.addHalfVertex(t,s,l,a,!1,n,o),this.addHalfVertex(t,u,c,a,!0,-i,o),this.distance>jc/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,n,i,o,a))}addHalfVertex({x:t,y:r},n,i,o,a,s,l){let c=(this.lineClips?this.scaledDistance*(jc-1):this.scaledDistance)*Jc;if(this.layoutVertexArray.emplaceBack((t<<1)+(o?1:0),(r<<1)+(a?1:0),Math.round(qc*n)+128,Math.round(qc*i)+128,(s===0?0:s<0?-1:1)+1|(c&63)<<2,c>>6),this.lineClips){let f=this.scaledDistance-this.lineClips.start,y=this.lineClips.end-this.lineClips.start,m=f/y;this.layoutVertexArray2.emplaceBack(m,this.lineClipsArray.length)}let p=l.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,p),l.primitiveLength++),a?this.e2=p:this.e1=p}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}};k("LineBucket",Xt,{omit:["layers","patternFeatures"]});var Wc,Ag=()=>Wc=Wc||new ie({"line-cap":new z(S.layout_line["line-cap"]),"line-join":new R(S.layout_line["line-join"]),"line-miter-limit":new z(S.layout_line["line-miter-limit"]),"line-round-limit":new z(S.layout_line["line-round-limit"]),"line-sort-key":new R(S.layout_line["line-sort-key"])}),Hc,_g=()=>Hc=Hc||new ie({"line-opacity":new R(S.paint_line["line-opacity"]),"line-color":new R(S.paint_line["line-color"]),"line-translate":new z(S.paint_line["line-translate"]),"line-translate-anchor":new z(S.paint_line["line-translate-anchor"]),"line-width":new R(S.paint_line["line-width"]),"line-gap-width":new R(S.paint_line["line-gap-width"]),"line-offset":new R(S.paint_line["line-offset"]),"line-blur":new R(S.paint_line["line-blur"]),"line-dasharray":new Ot(S.paint_line["line-dasharray"]),"line-pattern":new st(S.paint_line["line-pattern"]),"line-gradient":new Nt(S.paint_line["line-gradient"])}),vs={get paint(){return _g()},get layout(){return Ag()}};var Ps=class extends R{possiblyEvaluate(r,n){return n=new q(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),super.possiblyEvaluate(r,n)}evaluate(r,n,i,o){return n=Ae({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(r,n,i,o)}},Mo,Lo=class extends le{constructor(r){super(r,vs);this.gradientVersion=0,Mo||(Mo=new Ps(vs.paint.properties["line-width"].specification),Mo.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(r){if(r==="line-gradient"){let n=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=n._styleExpression.expression instanceof lr,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(r,n){super.recalculate(r,n),this.paint._values["line-floorwidth"]=Mo.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,r)}createBucket(r){return new Xt(r)}queryRadius(r){let n=r,i=Kc(Zt("line-width",this,n),Zt("line-gap-width",this,n)),o=Zt("line-offset",this,n);return i/2+Math.abs(o)+At(this.paint.get("line-translate"))}queryIntersectsFeature(r,n,i,o,a,s,l){let u=_t(r,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,l),c=l/2*Kc(this.paint.get("line-width").evaluate(n,i),this.paint.get("line-gap-width").evaluate(n,i)),p=this.paint.get("line-offset").evaluate(n,i);return p&&(o=Zu(o,p*l)),qu(u,o,c)}isTileClipped(){return!0}};function Kc(e,t){return t>0?t+2*e:e}var Yc=ee([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Xc=ee([{name:"a_projected_pos",components:3,type:"Float32"}],4),SS=ee([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),Qc=ee([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]),wS=ee([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]),Ss=ee([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),AS=ee([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),_S=ee([{name:"triangle",components:3,type:"Uint16"}]),IS=ee([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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"}]),CS=ee([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{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",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),kS=ee([{type:"Float32",name:"offsetX"}]),TS=ee([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);var Jn=Z(he(),1);function Ig(e,t,r){let n=t.layout.get("text-transform").evaluate(r,{});return n==="uppercase"?e=e.toLocaleUpperCase():n==="lowercase"&&(e=e.toLocaleLowerCase()),ae.applyArabicShaping&&(e=ae.applyArabicShaping(e)),e}function ep(e,t,r){return e.sections.forEach(n=>{n.text=Ig(n.text,t,r)}),e}function tp(e){let t={},r={},n=[],i=0;function o(u){n.push(e[u]),i++}function a(u,c,p){let f=r[u];return delete r[u],r[c]=f,n[f].geometry[0].pop(),n[f].geometry[0]=n[f].geometry[0].concat(p[0]),f}function s(u,c,p){let f=t[c];return delete t[c],t[u]=f,n[f].geometry[0].shift(),n[f].geometry[0]=p[0].concat(n[f].geometry[0]),f}function l(u,c,p){let f=p?c[0][c[0].length-1]:c[0][0];return"".concat(u,":").concat(f.x,":").concat(f.y)}for(let u=0;u<e.length;u++){let c=e[u],p=c.geometry,f=c.text?c.text.toString():null;if(!f){o(u);continue}let y=l(f,p),m=l(f,p,!0);if(y in r&&m in t&&r[y]!==t[m]){let h=s(y,m,p),d=a(y,m,n[h].geometry);delete t[y],delete r[m],r[l(f,n[d].geometry,!0)]=d,n[h].geometry=null}else y in r?a(y,m,p):m in t?s(y,m,p):(o(u),t[y]=i-1,r[m]=i-1)}return n.filter(u=>u.geometry)}var Ir={"!":"\\uFE15","#":"\\uFF03",$:"\\uFF04","%":"\\uFF05","&":"\\uFF06","(":"\\uFE35",")":"\\uFE36","*":"\\uFF0A","+":"\\uFF0B",",":"\\uFE10","-":"\\uFE32",".":"\\u30FB","/":"\\uFF0F",":":"\\uFE13",";":"\\uFE14","<":"\\uFE3F","=":"\\uFF1D",">":"\\uFE40","?":"\\uFE16","@":"\\uFF20","[":"\\uFE47","\\\\":"\\uFF3C","]":"\\uFE48","^":"\\uFF3E",_:"\\uFE33","`":"\\uFF40","{":"\\uFE37","|":"\\u2015","}":"\\uFE38","~":"\\uFF5E","\\xA2":"\\uFFE0","\\xA3":"\\uFFE1","\\xA5":"\\uFFE5","\\xA6":"\\uFFE4","\\xAC":"\\uFFE2","\\xAF":"\\uFFE3","\\u2013":"\\uFE32","\\u2014":"\\uFE31","\\u2018":"\\uFE43","\\u2019":"\\uFE44","\\u201C":"\\uFE41","\\u201D":"\\uFE42","\\u2026":"\\uFE19","\\u2027":"\\u30FB","\\u20A9":"\\uFFE6","\\u3001":"\\uFE11","\\u3002":"\\uFE12","\\u3008":"\\uFE3F","\\u3009":"\\uFE40","\\u300A":"\\uFE3D","\\u300B":"\\uFE3E","\\u300C":"\\uFE41","\\u300D":"\\uFE42","\\u300E":"\\uFE43","\\u300F":"\\uFE44","\\u3010":"\\uFE3B","\\u3011":"\\uFE3C","\\u3014":"\\uFE39","\\u3015":"\\uFE3A","\\u3016":"\\uFE17","\\u3017":"\\uFE18","\\uFF01":"\\uFE15","\\uFF08":"\\uFE35","\\uFF09":"\\uFE36","\\uFF0C":"\\uFE10","\\uFF0D":"\\uFE32","\\uFF0E":"\\u30FB","\\uFF1A":"\\uFE13","\\uFF1B":"\\uFE14","\\uFF1C":"\\uFE3F","\\uFF1E":"\\uFE40","\\uFF1F":"\\uFE16","\\uFF3B":"\\uFE47","\\uFF3D":"\\uFE48","\\uFF3F":"\\uFE33","\\uFF5B":"\\uFE37","\\uFF5C":"\\u2015","\\uFF5D":"\\uFE38","\\uFF5F":"\\uFE35","\\uFF60":"\\uFE36","\\uFF61":"\\uFE12","\\uFF62":"\\uFE41","\\uFF63":"\\uFE42"};function rp(e){let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r+1)||null,i=e.charCodeAt(r-1)||null;(!n||!Ka(n)||Ir[e[r+1]])&&(!i||!Ka(i)||Ir[e[r-1]])&&Ir[e[r]]?t+=Ir[e[r]]:t+=e[r]}return t}var ue=24;var qg=Z($n(),1),jg=3;var Bo=jg;function Gn(e){let t=0,r=0;for(let s of e)t+=s.w*s.h,r=Math.max(r,s.w);e.sort((s,l)=>l.h-s.h);let i=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}],o=0,a=0;for(let s of e)for(let l=i.length-1;l>=0;l--){let u=i[l];if(!(s.w>u.w||s.h>u.h)){if(s.x=u.x,s.y=u.y,a=Math.max(a,s.y+s.h),o=Math.max(o,s.x+s.w),s.w===u.w&&s.h===u.h){let c=i.pop();l<i.length&&(i[l]=c)}else s.h===u.h?(u.x+=s.w,u.w-=s.w):s.w===u.w?(u.y+=s.h,u.h-=s.h):(i.push({x:u.x+s.w,y:u.y,w:u.w-s.w,h:s.h}),u.y+=s.h,u.h-=s.h);break}}return{w:o,h:a,fill:t/(o*a)||0}}var ge=1;var zo=class{constructor(t,{pixelRatio:r,version:n,stretchX:i,stretchY:o,content:a}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=i,this.stretchY=o,this.content=a,this.version=n}get tl(){return[this.paddedRect.x+ge,this.paddedRect.y+ge]}get br(){return[this.paddedRect.x+this.paddedRect.w-ge,this.paddedRect.y+this.paddedRect.h-ge]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-ge*2)/this.pixelRatio,(this.paddedRect.h-ge*2)/this.pixelRatio]}},qn=class{constructor(t,r){let n={},i={};this.haveRenderCallbacks=[];let o=[];this.addImages(t,n,o),this.addImages(r,i,o);let{w:a,h:s}=Gn(o),l=new de({width:a||1,height:s||1});for(let u in t){let c=t[u],p=n[u].paddedRect;de.copy(c.data,l,{x:0,y:0},{x:p.x+ge,y:p.y+ge},c.data)}for(let u in r){let c=r[u],p=i[u].paddedRect,f=p.x+ge,y=p.y+ge,m=c.data.width,h=c.data.height;de.copy(c.data,l,{x:0,y:0},{x:f,y},c.data),de.copy(c.data,l,{x:0,y:h-1},{x:f,y:y-1},{width:m,height:1}),de.copy(c.data,l,{x:0,y:0},{x:f,y:y+h},{width:m,height:1}),de.copy(c.data,l,{x:m-1,y:0},{x:f-1,y},{width:1,height:h}),de.copy(c.data,l,{x:0,y:0},{x:f+m,y},{width:1,height:h})}this.image=l,this.iconPositions=n,this.patternPositions=i}addImages(t,r,n){for(let i in t){let o=t[i],a={x:0,y:0,w:o.data.width+2*ge,h:o.data.height+2*ge};n.push(a),r[i]=new zo(a,o),o.hasRenderCallback&&this.haveRenderCallbacks.push(i)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(let n in t.updatedImages)this.patchUpdatedImage(this.iconPositions[n],t.getImage(n),r),this.patchUpdatedImage(this.patternPositions[n],t.getImage(n),r)}patchUpdatedImage(t,r,n){if(!t||!r||t.version===r.version)return;t.version=r.version;let[i,o]=t.tl;n.update(r.data,void 0,{x:i,y:o})}};k("ImagePosition",zo);k("ImageAtlas",qn);var No=(i=>(i[i.none=0]="none",i[i.horizontal=1]="horizontal",i[i.vertical=2]="vertical",i[i.horizontalOnly=3]="horizontalOnly",i))(No||{}),Tr=-17;function Zg(e){for(let t of e)if(t.positionedGlyphs.length!==0)return!1;return!0}var up=57344,cp=63743,Ro=class e{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(t,r){let n=new e;return n.scale=t||1,n.fontStack=r,n}static forImage(t){let r=new e;return r.imageName=t,r}},jn=class e{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){let n=new e;for(let i=0;i<t.sections.length;i++){let o=t.sections[i];o.image?n.addImageSection(o):n.addTextSection(o,r)}return n}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=rp(this.text)}trim(){let t=0;for(let n=0;n<this.text.length&&Oo[this.text.charCodeAt(n)];n++)t++;let r=this.text.length;for(let n=this.text.length-1;n>=0&&n>=t&&Oo[this.text.charCodeAt(n)];n--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){let n=new e;return n.text=this.text.substring(t,r),n.sectionIndex=this.sectionIndex.slice(t,r),n.sections=this.sections,n}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}addTextSection(t,r){this.text+=t.text,this.sections.push(Ro.forText(t.scale,t.fontStack||r));let n=this.sections.length-1;for(let i=0;i<t.text.length;++i)this.sectionIndex.push(n)}addImageSection(t){let r=t.image?t.image.name:"";if(r.length===0){ce("Can\'t add FormattedSection with an empty image.");return}let n=this.getNextImageSectionCharCode();if(!n){ce("Reached maximum number of images ".concat(cp-up+2));return}this.text+=String.fromCharCode(n),this.sections.push(Ro.forImage(r)),this.sectionIndex.push(this.sections.length-1)}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=cp?null:++this.imageSectionID:(this.imageSectionID=up,this.imageSectionID)}};function Jg(e,t){let r=[],n=e.text,i=0;for(let o of t)r.push(e.substring(i,o)),i=o;return i<n.length&&r.push(e.substring(i,n.length)),r}function Zn(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m,h){let d=jn.fromFeature(e,i);p===2&&d.verticalizePunctuation();let g,{processBidirectionalText:v,processStyledBidirectionalText:b}=ae;if(v&&d.sections.length===1){g=[];let w=v(d.toString(),_s(d,u,o,t,n,y,m));for(let A of w){let T=new jn;T.text=A,T.sections=d.sections;for(let I=0;I<A.length;I++)T.sectionIndex.push(0);g.push(T)}}else if(b){g=[];let w=b(d.text,d.sectionIndex,_s(d,u,o,t,n,y,m));for(let A of w){let T=new jn;T.text=A[0],T.sectionIndex=A[1],T.sections=d.sections,g.push(T)}}else g=Jg(d,_s(d,u,o,t,n,y,m));let x=[],P={positionedLines:x,text:d.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:p,iconsInText:!1,verticalizable:!1};return Yg(P,t,r,n,g,a,s,l,p,u,f,h),Zg(x)?!1:P}var Oo={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Wg={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 yp(e,t,r,n,i,o){if(t.imageName){let a=n[t.imageName];return a?a.displaySize[0]*t.scale*ue/o+i:0}else{let a=r[t.fontStack],s=a&&a[e];return s?s.metrics.advance*t.scale+i:0}}function Hg(e,t,r,n,i,o){let a=0;for(let l=0;l<e.length();l++){let u=e.getSection(l);a+=yp(e.getCharCode(l),u,n,i,t,o)}let s=Math.max(1,Math.ceil(a/r));return a/s}function pp(e,t,r,n){let i=Math.pow(e-t,2);return n?e<t?i/2:i*2:i+Math.abs(r)*r}function Kg(e,t,r){let n=0;return e===10&&(n-=1e4),r&&(n+=150),(e===40||e===65288)&&(n+=50),(t===41||t===65289)&&(n+=50),n}function fp(e,t,r,n,i,o){let a=null,s=pp(t,r,i,o);for(let l of n){let u=t-l.x,c=pp(u,r,i,o)+l.badness;c<=s&&(a=l,s=c)}return{index:e,x:t,priorBreak:a,badness:s}}function mp(e){return e?mp(e.priorBreak).concat(e.index):[]}function _s(e,t,r,n,i,o,a){if(o!=="point")return[];if(!e)return[];let s=[],l=Hg(e,t,r,n,i,a),u=e.text.indexOf("\\u200B")>=0,c=0;for(let p=0;p<e.length();p++){let f=e.getSection(p),y=e.getCharCode(p);if(Oo[y]||(c+=yp(y,f,n,i,t,a)),p<e.length()-1){let m=Au(y);(Wg[y]||m||f.imageName)&&s.push(fp(p+1,c,l,s,Kg(y,e.getCharCode(p+1),m&&u),!1))}}return mp(fp(e.length(),c,l,s,0,!0))}function hp(e){let t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0;break}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0;break}return{horizontalAlign:t,verticalAlign:r}}function Yg(e,t,r,n,i,o,a,s,l,u,c,p){let f=0,y=Tr,m=0,h=0,d=s==="right"?1:s==="left"?0:.5,g=0;for(let P of i){P.trim();let w=P.getMaxScale(),A=(w-1)*ue,T={positionedGlyphs:[],lineOffset:0};e.positionedLines[g]=T;let I=T.positionedGlyphs,E=0;if(!P.length()){y+=o,++g;continue}for(let F=0;F<P.length();F++){let M=P.getSection(F),B=P.getSectionIndex(F),C=P.getCharCode(F),O=0,N=null,K=null,Y=null,Q=ue,ye=!(l===1||!c&&!Ui(C)||c&&(Oo[C]||_u(C)));if(M.imageName){let _e=n[M.imageName];if(!_e)continue;Y=M.imageName,e.iconsInText=e.iconsInText||!0,K=_e.paddedRect;let re=_e.displaySize;M.scale=M.scale*ue/p,N={width:re[0],height:re[1],left:ge,top:-Bo,advance:ye?re[1]:re[0]};let Pe=ue-re[1]*M.scale;O=A+Pe,Q=N.advance;let $e=ye?re[0]*M.scale-ue*w:re[1]*M.scale-ue*w;$e>0&&$e>E&&(E=$e)}else{let _e=r[M.fontStack],re=_e&&_e[C];if(re&&re.rect)K=re.rect,N=re.metrics;else{let Pe=t[M.fontStack],$e=Pe&&Pe[C];if(!$e)continue;N=$e.metrics}O=(w-M.scale)*ue}ye?(e.verticalizable=!0,I.push({glyph:C,imageName:Y,x:f,y:y+O,vertical:ye,scale:M.scale,fontStack:M.fontStack,sectionIndex:B,metrics:N,rect:K}),f+=Q*M.scale+u):(I.push({glyph:C,imageName:Y,x:f,y:y+O,vertical:ye,scale:M.scale,fontStack:M.fontStack,sectionIndex:B,metrics:N,rect:K}),f+=N.advance*M.scale+u)}if(I.length!==0){let F=f-u;m=Math.max(F,m),Xg(I,0,I.length-1,d,E)}f=0;let _=o*w+E;T.lineOffset=Math.max(E,A),y+=_,h=Math.max(_,h),++g}let v=y-Tr,{horizontalAlign:b,verticalAlign:x}=hp(a);Qg(e.positionedLines,d,b,x,m,h,o,v,i.length),e.top+=-x*v,e.bottom=e.top+v,e.left+=-b*m,e.right=e.left+m}function Xg(e,t,r,n,i){if(!n&&!i)return;let o=e[r],a=o.metrics.advance*o.scale,s=(e[r].x+a)*n;for(let l=t;l<=r;l++)e[l].x-=s,e[l].y+=i}function Qg(e,t,r,n,i,o,a,s,l){let u=(t-r)*i,c=0;o!==a?c=-s*n-Tr:c=(-n*l+.5)*a;for(let p of e)for(let f of p.positionedGlyphs)f.x+=u,f.y+=c}function dp(e,t,r){let{horizontalAlign:n,verticalAlign:i}=hp(r),o=t[0],a=t[1],s=o-e.displaySize[0]*n,l=s+e.displaySize[0],u=a-e.displaySize[1]*i,c=u+e.displaySize[1];return{image:e,top:u,bottom:c,left:s,right:l}}function Is(e,t,r,n,i,o){let a=e.image,s;if(a.content){let d=a.content,g=a.pixelRatio||1;s=[d[0]/g,d[1]/g,a.displaySize[0]-d[2]/g,a.displaySize[1]-d[3]/g]}let l=t.left*o,u=t.right*o,c,p,f,y;r==="width"||r==="both"?(y=i[0]+l-n[3],p=i[0]+u+n[1]):(y=i[0]+(l+u-a.displaySize[0])/2,p=y+a.displaySize[0]);let m=t.top*o,h=t.bottom*o;return r==="height"||r==="both"?(c=i[1]+m-n[0],f=i[1]+h+n[2]):(c=i[1]+(m+h-a.displaySize[1])/2,f=c+a.displaySize[1]),{image:a,top:c,right:p,bottom:f,left:y,collisionPadding:s}}var gp=Z(It(),1);var Er=255,Ct=128,Qe=Er*Ct;function Cs(e,t){let{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new q(e+1))};if(r.kind==="source")return{kind:"source"};{let{zoomStops:n,interpolationType:i}=r,o=0;for(;o<n.length&&n[o]<=e;)o++;o=Math.max(0,o-1);let a=o;for(;a<n.length&&n[a]<e+1;)a++;a=Math.min(n.length-1,a);let s=n[o],l=n[a];if(r.kind==="composite")return{kind:"composite",minZoom:s,maxZoom:l,interpolationType:i};let u=r.evaluate(new q(s)),c=r.evaluate(new q(l));return{kind:"camera",minZoom:s,maxZoom:l,minSize:u,maxSize:c,interpolationType:i}}}function ks(e,t,r){let n="never",i=e.get(t);return i?n=i:e.get(r)&&(n="always"),n}var ex=gp.default.VectorTileFeature.types,tx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Uo(e,t,r,n,i,o,a,s,l,u,c,p,f){let y=s?Math.min(Qe,Math.round(s[0])):0,m=s?Math.min(Qe,Math.round(s[1])):0;e.emplaceBack(t,r,Math.round(n*32),Math.round(i*32),o,a,(y<<1)+(l?1:0),m,u*16,c*16,p*256,f*256)}function xp(e,t,r){e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r),e.emplaceBack(t.x,t.y,r)}function rx(e){for(let t of e.sections)if(Cu(t.text))return!0;return!1}var Wn=class{constructor(t){this.layoutVertexArray=new lo,this.indexArray=new Le,this.programConfigurations=t,this.segments=new me,this.dynamicLayoutVertexArray=new uo,this.opacityVertexArray=new co,this.hasVisibleVertices=!1,this.placedSymbolArray=new wn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,n,i){this.isEmpty()||(n&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Yc.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Xc.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,tx,!0),this.opacityVertexBuffer.itemSize=1),(n||i)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}};k("SymbolBuffers",Wn);var Hn=class{constructor(t,r,n){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new n,this.segments=new me,this.collisionVertexArray=new po}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Qc.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}};k("CollisionBuffers",Hn);var We=class{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(l=>l.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Dn.identity([]),this.placementViewportMatrix=Dn.identity([]);let n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Cs(this.zoom,n["text-size"]),this.iconSizeData=Cs(this.zoom,n["icon-size"]);let i=this.layers[0].layout,o=i.get("symbol-sort-key"),a=i.get("symbol-z-order");this.canOverlap=ks(i,"text-overlap","text-allow-overlap")!=="never"||ks(i,"icon-overlap","icon-allow-overlap")!=="never"||i.get("text-ignore-placement")||i.get("icon-ignore-placement"),this.sortFeaturesByKey=a!=="viewport-y"&&!o.isConstant();let s=a==="viewport-y"||a==="auto"&&!this.sortFeaturesByKey;this.sortFeaturesByY=s&&this.canOverlap,i.get("symbol-placement")==="point"&&(this.writingModes=i.get("text-writing-mode").map(l=>No[l])),this.stateDependentLayerIds=this.layers.filter(l=>l.isStateDependent()).map(l=>l.id),this.sourceID=t.sourceID}createArrays(){this.text=new Wn(new ke(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Wn(new ke(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new _n,this.lineVertexArray=new In,this.symbolInstances=new An}calculateGlyphDependencies(t,r,n,i,o){for(let a=0;a<t.length;a++)if(r[t.charCodeAt(a)]=!0,(n||i)&&o){let s=Ir[t.charAt(a)];s&&(r[s.charCodeAt(0)]=!0)}}populate(t,r,n){let i=this.layers[0],o=i.layout,a=o.get("text-font"),s=o.get("text-field"),l=o.get("icon-image"),u=(s.value.kind!=="constant"||s.value.value instanceof Me&&!s.value.value.isEmpty()||s.value.value.toString().length>0)&&(a.value.kind!=="constant"||a.value.value.length>0),c=l.value.kind!=="constant"||!!l.value.value||Object.keys(l.parameters).length>0,p=o.get("symbol-sort-key");if(this.features=[],!u&&!c)return;let f=r.iconDependencies,y=r.glyphDependencies,m=r.availableImages,h=new q(this.zoom);for(let{feature:d,id:g,index:v,sourceLayerIndex:b}of t){let x=i._featureFilter.needGeometry,P=Oe(d,x);if(!i._featureFilter.filter(h,P,n))continue;x||(P.geometry=Te(d));let w;if(u){let E=i.getValueAndResolveTokens("text-field",P,n,m),_=Me.factory(E);rx(_)&&(this.hasRTLText=!0),(!this.hasRTLText||Eu()==="unavailable"||this.hasRTLText&&ae.isParsed())&&(w=ep(_,i,P))}let A;if(c){let E=i.getValueAndResolveTokens("icon-image",P,n,m);E instanceof Ce?A=E:A=Ce.fromString(E)}if(!w&&!A)continue;let T=this.sortFeaturesByKey?p.evaluate(P,{},n):void 0,I={id:g,text:w,icon:A,index:v,sourceLayerIndex:b,geometry:P.geometry,properties:d.properties,type:ex[d.type],sortKey:T};if(this.features.push(I),A&&(f[A.name]=!0),w){let E=a.evaluate(P,{},n).join(","),_=o.get("text-rotation-alignment")!=="viewport"&&o.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(2)>=0;for(let F of w.sections)if(F.image)f[F.image.name]=!0;else{let M=on(w.toString()),B=F.fontStack||E,C=y[B]=y[B]||{};this.calculateGlyphDependencies(F.text,C,_,this.allowVerticalPlacement,M)}}}o.get("symbol-placement")==="line"&&(this.features=tp(this.features)),this.sortFeaturesByKey&&this.features.sort((d,g)=>d.sortKey-g.sortKey)}update(t,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,n),this.icon.programConfigurations.updatePaintArrays(t,r,this.layers,n))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,r){let n=this.lineVertexArray.length;if(t.segment!==void 0){let i=t.dist(r[t.segment+1]),o=t.dist(r[t.segment]),a={};for(let s=t.segment+1;s<r.length;s++)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:i},s<r.length-1&&(i+=r[s+1].dist(r[s]));for(let s=t.segment||0;s>=0;s--)a[s]={x:r[s].x,y:r[s].y,tileUnitDistanceFromAnchor:o},s>0&&(o+=r[s-1].dist(r[s]));for(let s=0;s<r.length;s++){let l=a[s];this.lineVertexArray.emplaceBack(l.x,l.y,l.tileUnitDistanceFromAnchor)}}return{lineStartIndex:n,lineLength:this.lineVertexArray.length-n}}addSymbols(t,r,n,i,o,a,s,l,u,c,p,f){let y=t.indexArray,m=t.layoutVertexArray,h=t.segments.prepareSegment(4*r.length,m,y,this.canOverlap?a.sortKey:void 0),d=this.glyphOffsetArray.length,g=h.vertexLength,v=this.allowVerticalPlacement&&s===2?Math.PI/2:0,b=a.text&&a.text.sections;for(let x=0;x<r.length;x++){let{tl:P,tr:w,bl:A,br:T,tex:I,pixelOffsetTL:E,pixelOffsetBR:_,minFontScaleX:F,minFontScaleY:M,glyphOffset:B,isSDF:C,sectionIndex:O}=r[x],N=h.vertexLength,K=B[1];Uo(m,l.x,l.y,P.x,K+P.y,I.x,I.y,n,C,E.x,E.y,F,M),Uo(m,l.x,l.y,w.x,K+w.y,I.x+I.w,I.y,n,C,_.x,E.y,F,M),Uo(m,l.x,l.y,A.x,K+A.y,I.x,I.y+I.h,n,C,E.x,_.y,F,M),Uo(m,l.x,l.y,T.x,K+T.y,I.x+I.w,I.y+I.h,n,C,_.x,_.y,F,M),xp(t.dynamicLayoutVertexArray,l,v),y.emplaceBack(N,N+1,N+2),y.emplaceBack(N+1,N+2,N+3),h.vertexLength+=4,h.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(B[0]),(x===r.length-1||O!==r[x+1].sectionIndex)&&t.programConfigurations.populatePaintArrays(m.length,a,a.index,{},f,b&&b[O])}t.placedSymbolArray.emplaceBack(l.x,l.y,d,this.glyphOffsetArray.length-d,g,u,c,l.segment,n?n[0]:0,n?n[1]:0,i[0],i[1],s,0,!1,0,p)}_addCollisionDebugVertex(t,r,n,i,o,a){return r.emplaceBack(0,0),t.emplaceBack(n.x,n.y,i,o,Math.round(a.x),Math.round(a.y))}addCollisionDebugVertices(t,r,n,i,o,a,s){let l=o.segments.prepareSegment(4,o.layoutVertexArray,o.indexArray),u=l.vertexLength,c=o.layoutVertexArray,p=o.collisionVertexArray,f=s.anchorX,y=s.anchorY;this._addCollisionDebugVertex(c,p,a,f,y,new Jn.default(t,r)),this._addCollisionDebugVertex(c,p,a,f,y,new Jn.default(n,r)),this._addCollisionDebugVertex(c,p,a,f,y,new Jn.default(n,i)),this._addCollisionDebugVertex(c,p,a,f,y,new Jn.default(t,i)),l.vertexLength+=4;let m=o.indexArray;m.emplaceBack(u,u+1),m.emplaceBack(u+1,u+2),m.emplaceBack(u+2,u+3),m.emplaceBack(u+3,u),l.primitiveLength+=4}addDebugCollisionBoxes(t,r,n,i){for(let o=t;o<r;o++){let a=this.collisionBoxArray.get(o),s=a.x1,l=a.y1,u=a.x2,c=a.y2;this.addCollisionDebugVertices(s,l,u,c,i?this.textCollisionBox:this.iconCollisionBox,a.anchorPoint,n)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Hn(kn,Ss.members,St),this.iconCollisionBox=new Hn(kn,Ss.members,St);for(let t=0;t<this.symbolInstances.length;t++){let r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,n,i,o,a,s,l,u){let c={};for(let p=r;p<n;p++){let f=t.get(p);c.textBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.textFeatureIndex=f.featureIndex;break}for(let p=i;p<o;p++){let f=t.get(p);c.verticalTextBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalTextFeatureIndex=f.featureIndex;break}for(let p=a;p<s;p++){let f=t.get(p);c.iconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.iconFeatureIndex=f.featureIndex;break}for(let p=l;p<u;p++){let f=t.get(p);c.verticalIconBox={x1:f.x1,y1:f.y1,x2:f.x2,y2:f.y2,anchorPointX:f.anchorPointX,anchorPointY:f.anchorPointY},c.verticalIconFeatureIndex=f.featureIndex;break}return c}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){let n=this.symbolInstances.get(r);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,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}addIndicesForPlacedSymbol(t,r){let n=t.placedSymbolArray.get(r),i=n.vertexStartIndex+n.numGlyphs*4;for(let o=n.vertexStartIndex;o<i;o+=4)t.indexArray.emplaceBack(o,o+1,o+2),t.indexArray.emplaceBack(o+1,o+2,o+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;let r=Math.sin(t),n=Math.cos(t),i=[],o=[],a=[];for(let s=0;s<this.symbolInstances.length;++s){a.push(s);let l=this.symbolInstances.get(s);i.push(Math.round(r*l.anchorX+n*l.anchorY)|0),o.push(l.featureIndex)}return a.sort((s,l)=>i[s]-i[l]||o[l]-o[s]),a}addToSortKeyRanges(t,r){let n=this.sortKeyRanges[this.sortKeyRanges.length-1];n&&n.sortKey===r?n.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(let r of this.symbolInstanceIndexes){let n=this.symbolInstances.get(r);this.featureSortOrder.push(n.featureIndex),[n.rightJustifiedTextSymbolIndex,n.centerJustifiedTextSymbolIndex,n.leftJustifiedTextSymbolIndex].forEach((i,o,a)=>{i>=0&&a.indexOf(i)===o&&this.addIndicesForPlacedSymbol(this.text,i)}),n.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,n.verticalPlacedTextSymbolIndex),n.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.placedIconSymbolIndex),n.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,n.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}};k("SymbolBucket",We,{omit:["layers","collisionBoxArray","features","compareText"]});We.MAX_GLYPHS=65535;We.addDynamicAttributes=xp;function bp(e,t){return t.replace(/{([^{}]+)}/g,(r,n)=>n in e?String(e[n]):"")}var vp,nx=()=>vp=vp||new ie({"symbol-placement":new z(S.layout_symbol["symbol-placement"]),"symbol-spacing":new z(S.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new z(S.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new R(S.layout_symbol["symbol-sort-key"]),"symbol-z-order":new z(S.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new z(S.layout_symbol["icon-allow-overlap"]),"icon-overlap":new z(S.layout_symbol["icon-overlap"]),"icon-ignore-placement":new z(S.layout_symbol["icon-ignore-placement"]),"icon-optional":new z(S.layout_symbol["icon-optional"]),"icon-rotation-alignment":new z(S.layout_symbol["icon-rotation-alignment"]),"icon-size":new R(S.layout_symbol["icon-size"]),"icon-text-fit":new z(S.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new z(S.layout_symbol["icon-text-fit-padding"]),"icon-image":new R(S.layout_symbol["icon-image"]),"icon-rotate":new R(S.layout_symbol["icon-rotate"]),"icon-padding":new R(S.layout_symbol["icon-padding"]),"icon-keep-upright":new z(S.layout_symbol["icon-keep-upright"]),"icon-offset":new R(S.layout_symbol["icon-offset"]),"icon-anchor":new R(S.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new z(S.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new z(S.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new z(S.layout_symbol["text-rotation-alignment"]),"text-field":new R(S.layout_symbol["text-field"]),"text-font":new R(S.layout_symbol["text-font"]),"text-size":new R(S.layout_symbol["text-size"]),"text-max-width":new R(S.layout_symbol["text-max-width"]),"text-line-height":new z(S.layout_symbol["text-line-height"]),"text-letter-spacing":new R(S.layout_symbol["text-letter-spacing"]),"text-justify":new R(S.layout_symbol["text-justify"]),"text-radial-offset":new R(S.layout_symbol["text-radial-offset"]),"text-variable-anchor":new z(S.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new R(S.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new R(S.layout_symbol["text-anchor"]),"text-max-angle":new z(S.layout_symbol["text-max-angle"]),"text-writing-mode":new z(S.layout_symbol["text-writing-mode"]),"text-rotate":new R(S.layout_symbol["text-rotate"]),"text-padding":new z(S.layout_symbol["text-padding"]),"text-keep-upright":new z(S.layout_symbol["text-keep-upright"]),"text-transform":new R(S.layout_symbol["text-transform"]),"text-offset":new R(S.layout_symbol["text-offset"]),"text-allow-overlap":new z(S.layout_symbol["text-allow-overlap"]),"text-overlap":new z(S.layout_symbol["text-overlap"]),"text-ignore-placement":new z(S.layout_symbol["text-ignore-placement"]),"text-optional":new z(S.layout_symbol["text-optional"])}),Pp,ix=()=>Pp=Pp||new ie({"icon-opacity":new R(S.paint_symbol["icon-opacity"]),"icon-color":new R(S.paint_symbol["icon-color"]),"icon-halo-color":new R(S.paint_symbol["icon-halo-color"]),"icon-halo-width":new R(S.paint_symbol["icon-halo-width"]),"icon-halo-blur":new R(S.paint_symbol["icon-halo-blur"]),"icon-translate":new z(S.paint_symbol["icon-translate"]),"icon-translate-anchor":new z(S.paint_symbol["icon-translate-anchor"]),"text-opacity":new R(S.paint_symbol["text-opacity"]),"text-color":new R(S.paint_symbol["text-color"],{runtimeType:ze,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new R(S.paint_symbol["text-halo-color"]),"text-halo-width":new R(S.paint_symbol["text-halo-width"]),"text-halo-blur":new R(S.paint_symbol["text-halo-blur"]),"text-translate":new z(S.paint_symbol["text-translate"]),"text-translate-anchor":new z(S.paint_symbol["text-translate-anchor"])}),$o={get paint(){return ix()},get layout(){return nx()}};var Kn=class{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:cr,this.defaultValue=t}evaluate(t){if(t.formattedSection){let r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){if(!this.defaultValue.isConstant()){let r=this.defaultValue.value;t(r._styleExpression.expression)}}outputDefined(){return!1}serialize(){return null}};k("FormatSectionOverride",Kn,{omit:["defaultValue"]});var Go=class e extends le{constructor(r){super(r,$o)}recalculate(r,n){if(super.recalculate(r,n),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["icon-rotation-alignment"]="map":this.layout._values["icon-rotation-alignment"]="viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout.get("symbol-placement")!=="point"?this.layout._values["text-rotation-alignment"]="map":this.layout._values["text-rotation-alignment"]="viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){let i=this.layout.get("text-writing-mode");if(i){let o=[];for(let a of i)o.indexOf(a)<0&&o.push(a);this.layout._values["text-writing-mode"]=o}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(r,n,i,o){let a=this.layout.get(r).evaluate(n,{},i,o),s=this._unevaluatedLayout._values[r];return!s.isDataDriven()&&!en(s.value)&&a?bp(n.properties,a):a}createBucket(r){return new We(r)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(let r of $o.paint.overridableProperties){if(!e.hasPaintOverride(this.layout,r))continue;let n=this.paint.get(r),i=new Kn(n),o=new Dt(i,n.property.specification),a=null;n.value.kind==="constant"||n.value.kind==="source"?a=new dt("source",o):a=new gt("composite",o,n.value.zoomStops),this.paint._values[r]=new be(n.property,a,n.parameters)}}_handleOverridablePaintPropertyUpdate(r,n,i){return!this.layout||n.isDataDriven()||i.isDataDriven()?!1:e.hasPaintOverride(this.layout,r)}static hasPaintOverride(r,n){let i=r.get("text-field"),o=$o.paint.properties[n],a=!1,s=l=>{for(let u of l)if(o.overrides&&o.overrides.hasOverride(u)){a=!0;return}};if(i.value.kind==="constant"&&i.value.value instanceof Me)s(i.value.value.sections);else if(i.value.kind==="source"){let l=c=>{if(!a)if(c instanceof mt&&fe(c.value)===pr){let p=c.value;s(p.sections)}else c instanceof Hr?s(c.sections):c.eachChild(l)},u=i.value;u._styleExpression&&l(u._styleExpression.expression)}return a}};function Sp(e,t,r,n=1){let i=e.get("icon-padding").evaluate(t,{},r),o=i&&i.values;return[o[0]*n,o[1]*n,o[2]*n,o[3]*n]}var wp,ox=()=>wp=wp||new ie({"background-color":new z(S.paint_background["background-color"]),"background-pattern":new Ot(S.paint_background["background-pattern"]),"background-opacity":new z(S.paint_background["background-opacity"])}),Ap={get paint(){return ox()}};var qo=class extends le{constructor(r){super(r,Ap)}};var _p,ax=()=>_p=_p||new ie({"raster-opacity":new z(S.paint_raster["raster-opacity"]),"raster-hue-rotate":new z(S.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new z(S.paint_raster["raster-brightness-min"]),"raster-brightness-max":new z(S.paint_raster["raster-brightness-max"]),"raster-saturation":new z(S.paint_raster["raster-saturation"]),"raster-contrast":new z(S.paint_raster["raster-contrast"]),"raster-resampling":new z(S.paint_raster["raster-resampling"]),"raster-fade-duration":new z(S.paint_raster["raster-fade-duration"])}),Ip={get paint(){return ax()}};var jo=class extends le{constructor(r){super(r,Ip)}};var Zo=class extends le{constructor(r){super(r,{});this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)};this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.painter.context.gl)};this.implementation=r}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}};function Cp(e){if(e.type==="custom")return new Zo(e);switch(e.type){case"background":return new qo(e);case"circle":return new Po(e);case"fill":return new ko(e);case"fill-extrusion":return new Fo(e);case"heatmap":return new So(e);case"hillshade":return new wo(e);case"line":return new Lo(e);case"raster":return new jo(e);case"symbol":return new Go(e)}}var Jo=class{constructor(t){this.keyCache={},t&&this.replace(t)}replace(t){this._layerConfigs={},this._layers={},this.update(t,[])}update(t,r){for(let i of t){this._layerConfigs[i.id]=i;let o=this._layers[i.id]=Cp(i);o._featureFilter=tn(o.filter),this.keyCache[i.id]&&delete this.keyCache[i.id]}for(let i of r)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];this.familiesBySource={};let n=Ql(Object.values(this._layerConfigs),this.keyCache);for(let i of n){let o=i.map(p=>this._layers[p.id]),a=o[0];if(a.visibility==="none")continue;let s=a.source||"",l=this.familiesBySource[s];l||(l=this.familiesBySource[s]={});let u=a.sourceLayer||"_geojsonTileLayer",c=l[u];c||(c=l[u]=[]),c.push(o)}}};var Xp=Z(It(),1),Qp=Z($n(),1);var Fr=class{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){let n=t[r];this._stringToNumber[n]=r,this._numberToString[r]=n}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error("Out of bounds. Index requested n=".concat(t," can\'t be >= this._numberToString.length ").concat(this._numberToString.length));return this._numberToString[t]}};var Ep=Z(It(),1),Fp=Z($n(),1);var Wo=class{constructor(t,r,n,i,o){this.type="Feature",this._vectorTileFeature=t,t._z=r,t._x=n,t._y=i,this.properties=t.properties,this.id=o}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){let t={geometry:this.geometry};for(let r in this)r==="_geometry"||r==="_vectorTileFeature"||(t[r]=this[r]);return t}};var Yn=class{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Ft(8192,16,0),this.grid3D=new Ft(8192,16,0),this.featureIndexArray=new Cn,this.promoteId=r}insert(t,r,n,i,o,a){let s=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(n,i,o);let l=a?this.grid3D:this.grid;for(let u=0;u<r.length;u++){let c=r[u],p=[1/0,1/0,-1/0,-1/0];for(let f=0;f<c.length;f++){let y=c[f];p[0]=Math.min(p[0],y.x),p[1]=Math.min(p[1],y.y),p[2]=Math.max(p[2],y.x),p[3]=Math.max(p[3],y.y)}p[0]<8192&&p[1]<8192&&p[2]>=0&&p[3]>=0&&l.insert(s,p[0],p[1],p[2],p[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Ep.default.VectorTile(new Fp.default(this.rawTileData)).layers,this.sourceLayerCoder=new Fr(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,n,i){this.loadVTLayers();let o=t.params||{},a=8192/t.tileSize/t.scale,s=tn(o.filter),l=t.queryGeometry,u=t.queryPadding*a,c=Tp(l),p=this.grid.query(c.minX-u,c.minY-u,c.maxX+u,c.maxY+u),f=Tp(t.cameraQueryGeometry),y=this.grid3D.query(f.minX-u,f.minY-u,f.maxX+u,f.maxY+u,(d,g,v,b)=>ju(t.cameraQueryGeometry,d-u,g-u,v+u,b+u));for(let d of y)p.push(d);p.sort(sx);let m={},h;for(let d=0;d<p.length;d++){let g=p[d];if(g===h)continue;h=g;let v=this.featureIndexArray.get(g),b=null;this.loadMatchingFeature(m,v.bucketIndex,v.sourceLayerIndex,v.featureIndex,s,o.layers,o.availableImages,r,n,i,(x,P,w)=>(b||(b=Te(x)),P.queryIntersectsFeature(l,x,w,b,this.z,t.transform,a,t.pixelPosMatrix)))}return m}loadMatchingFeature(t,r,n,i,o,a,s,l,u,c,p){let f=this.bucketLayerIDs[r];if(a&&!gl(a,f))return;let y=this.sourceLayerCoder.decode(n),h=this.vtLayers[y].feature(i);if(o.needGeometry){let g=Oe(h,!0);if(!o.filter(new q(this.tileID.overscaledZ),g,this.tileID.canonical))return}else if(!o.filter(new q(this.tileID.overscaledZ),h))return;let d=this.getId(h,y);for(let g=0;g<f.length;g++){let v=f[g];if(a&&a.indexOf(v)<0)continue;let b=l[v];if(!b)continue;let x={};d&&c&&(x=c.getState(b.sourceLayer||"_geojsonTileLayer",d));let P=Ae({},u[v]);P.paint=kp(P.paint,b.paint,h,x,s),P.layout=kp(P.layout,b.layout,h,x,s);let w=!p||p(h,b,x);if(!w)continue;let A=new Wo(h,this.z,this.x,this.y,d);A.layer=P;let T=t[v];T===void 0&&(T=t[v]=[]),T.push({featureIndex:i,feature:A,intersectionZ:w})}}lookupSymbolFeatures(t,r,n,i,o,a,s,l){let u={};this.loadVTLayers();let c=tn(o);for(let p of t)this.loadMatchingFeature(u,n,i,p,c,a,s,l,r);return u}hasLayer(t){for(let r of this.bucketLayerIDs)for(let n of r)if(t===n)return!0;return!1}getId(t,r){let n=t.id;if(this.promoteId){let i=typeof this.promoteId=="string"?this.promoteId:this.promoteId[r];n=t.properties[i],typeof n=="boolean"&&(n=Number(n))}return n}};k("FeatureIndex",Yn,{omit:["rawTileData","sourceLayerCoder"]});function kp(e,t,r,n,i){return Rr(e,(o,a)=>{let s=t instanceof vt?t.get(a):null;return s&&s.evaluate?s.evaluate(r,n,i):s})}function Tp(e){let t=1/0,r=1/0,n=-1/0,i=-1/0;for(let o of e)t=Math.min(t,o.x),r=Math.min(r,o.y),n=Math.max(n,o.x),i=Math.max(i,o.y);return{minX:t,minY:r,maxX:n,maxY:i}}function sx(e,t){return t-e}var Mp=Z(he(),1);var et=class e extends Mp.default{constructor(r,n,i,o){super(r,n);this.angle=i,o!==void 0&&(this.segment=o)}clone(){return new e(this.x,this.y,this.angle,this.segment)}};k("Anchor",et);function Ts(e,t,r,n,i){if(t.segment===void 0||r===0)return!0;let o=t,a=t.segment+1,s=0;for(;s>-r/2;){if(a--,a<0)return!1;s-=e[a].dist(o),o=e[a]}s+=e[a].dist(e[a+1]),a++;let l=[],u=0;for(;s<r/2;){let c=e[a-1],p=e[a],f=e[a+1];if(!f)return!1;let y=c.angleTo(p)-p.angleTo(f);for(y=Math.abs((y+3*Math.PI)%(Math.PI*2)-Math.PI),l.push({distance:s,angleDelta:y}),u+=y;s-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;a++,s+=p.dist(f)}return!0}function Lp(e){let t=0;for(let r=0;r<e.length-1;r++)t+=e[r].dist(e[r+1]);return t}function Dp(e,t,r){return e?3/5*t*r:0}function Vp(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function Bp(e,t,r,n,i,o){let a=Dp(r,i,o),s=Vp(r,n)*o,l=0,u=Lp(e)/2;for(let c=0;c<e.length-1;c++){let p=e[c],f=e[c+1],y=p.dist(f);if(l+y>u){let m=(u-l)/y,h=Re.number(p.x,f.x,m),d=Re.number(p.y,f.y,m),g=new et(h,d,f.angleTo(p),c);return g._round(),!a||Ts(e,g,s,a,t)?g:void 0}l+=y}}function zp(e,t,r,n,i,o,a,s,l){let u=Dp(n,o,a),c=Vp(n,i),p=c*a,f=e[0].x===0||e[0].x===l||e[0].y===0||e[0].y===l;t-p<t/4&&(t=p+t/4);let y=o*2,m=f?t/2*s%t:(c/2+y)*a*s%t;return Rp(e,m,t,u,r,p,f,!1,l)}function Rp(e,t,r,n,i,o,a,s,l){let u=o/2,c=Lp(e),p=0,f=t-r,y=[];for(let m=0;m<e.length-1;m++){let h=e[m],d=e[m+1],g=h.dist(d),v=d.angleTo(h);for(;f+r<p+g;){f+=r;let b=(f-p)/g,x=Re.number(h.x,d.x,b),P=Re.number(h.y,d.y,b);if(x>=0&&x<l&&P>=0&&P<l&&f-u>=0&&f+u<=c){let w=new et(x,P,v,m);w._round(),(!n||Ts(e,w,o,n,i))&&y.push(w)}}p+=g}return!s&&!y.length&&!a&&(y=Rp(e,p/2,r,n,i,o,a,!0,l)),y}var ct=Z(he(),1);function Op(e,t,r,n,i){let o=[];for(let a=0;a<e.length;a++){let s=e[a],l;for(let u=0;u<s.length-1;u++){let c=s[u],p=s[u+1];c.x<t&&p.x<t||(c.x<t?c=new ct.default(t,c.y+(p.y-c.y)*((t-c.x)/(p.x-c.x)))._round():p.x<t&&(p=new ct.default(t,c.y+(p.y-c.y)*((t-c.x)/(p.x-c.x)))._round()),!(c.y<r&&p.y<r)&&(c.y<r?c=new ct.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round():p.y<r&&(p=new ct.default(c.x+(p.x-c.x)*((r-c.y)/(p.y-c.y)),r)._round()),!(c.x>=n&&p.x>=n)&&(c.x>=n?c=new ct.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round():p.x>=n&&(p=new ct.default(n,c.y+(p.y-c.y)*((n-c.x)/(p.x-c.x)))._round()),!(c.y>=i&&p.y>=i)&&(c.y>=i?c=new ct.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round():p.y>=i&&(p=new ct.default(c.x+(p.x-c.x)*((i-c.y)/(p.y-c.y)),i)._round()),(!l||!c.equals(l[l.length-1]))&&(l=[c],o.push(l)),l.push(p)))))}}return o}var ve=Z(he(),1);var Mr=ge;function Es(e,t,r,n){let i=[],o=e.image,a=o.pixelRatio,s=o.paddedRect.w-2*Mr,l=o.paddedRect.h-2*Mr,u=e.right-e.left,c=e.bottom-e.top,p=o.stretchX||[[0,s]],f=o.stretchY||[[0,l]],y=(_,F)=>_+F[1]-F[0],m=p.reduce(y,0),h=f.reduce(y,0),d=s-m,g=l-h,v=0,b=m,x=0,P=h,w=0,A=d,T=0,I=g;if(o.content&&n){let _=o.content;v=Ho(p,0,_[0]),x=Ho(f,0,_[1]),b=Ho(p,_[0],_[2]),P=Ho(f,_[1],_[3]),w=_[0]-v,T=_[1]-x,A=_[2]-_[0]-b,I=_[3]-_[1]-P}let E=(_,F,M,B)=>{let C=Ko(_.stretch-v,b,u,e.left),O=Yo(_.fixed-w,A,_.stretch,m),N=Ko(F.stretch-x,P,c,e.top),K=Yo(F.fixed-T,I,F.stretch,h),Y=Ko(M.stretch-v,b,u,e.left),Q=Yo(M.fixed-w,A,M.stretch,m),ye=Ko(B.stretch-x,P,c,e.top),_e=Yo(B.fixed-T,I,B.stretch,h),re=new ve.default(C,N),Pe=new ve.default(Y,N),$e=new ve.default(Y,ye),fi=new ve.default(C,ye),ya=new ve.default(O/a,K/a),ma=new ve.default(Q/a,_e/a),zr=t*Math.PI/180;if(zr){let xe=Math.sin(zr),He=Math.cos(zr),Ke=[He,-xe,xe,He];re._matMult(Ke),Pe._matMult(Ke),fi._matMult(Ke),$e._matMult(Ke)}let yi=_.stretch+_.fixed,ha=M.stretch+M.fixed,mi=F.stretch+F.fixed,Ee=B.stretch+B.fixed,tr={x:o.paddedRect.x+Mr+yi,y:o.paddedRect.y+Mr+mi,w:ha-yi,h:Ee-mi},hi=A/a/u,Se=I/a/c;return{tl:re,tr:Pe,bl:fi,br:$e,tex:tr,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ya,pixelOffsetBR:ma,minFontScaleX:hi,minFontScaleY:Se,isSDF:r}};if(!n||!o.stretchX&&!o.stretchY)i.push(E({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:s+1},{fixed:0,stretch:l+1}));else{let _=Np(p,d,m),F=Np(f,g,h);for(let M=0;M<_.length-1;M++){let B=_[M],C=_[M+1];for(let O=0;O<F.length-1;O++){let N=F[O],K=F[O+1];i.push(E(B,N,C,K))}}}return i}function Ho(e,t,r){let n=0;for(let i of e)n+=Math.max(t,Math.min(r,i[1]))-Math.max(t,Math.min(r,i[0]));return n}function Np(e,t,r){let n=[{fixed:-Mr,stretch:0}];for(let[i,o]of e){let a=n[n.length-1];n.push({fixed:i-a.stretch,stretch:a.stretch}),n.push({fixed:i-a.stretch,stretch:a.stretch+(o-i)})}return n.push({fixed:t+Mr,stretch:r}),n}function Ko(e,t,r,n){return e/t*r+n}function Yo(e,t,r,n){return e-t*r/n}function Up(e,t,r,n,i,o,a,s){let l=n.layout.get("text-rotate").evaluate(o,{})*Math.PI/180,u=[];for(let c of t.positionedLines)for(let p of c.positionedGlyphs){if(!p.rect)continue;let f=p.rect||{},m=Bo+1,h=!0,d=1,g=0,v=(i||s)&&p.vertical,b=p.metrics.advance*p.scale/2;if(s&&t.verticalizable){let Y=(p.scale-1)*ue,Q=(ue-p.metrics.width*p.scale)/2;g=c.lineOffset/2-(p.imageName?-Q:Y)}if(p.imageName){let Y=a[p.imageName];h=Y.sdf,d=Y.pixelRatio,m=ge/d}let x=i?[p.x+b,p.y]:[0,0],P=i?[0,0]:[p.x+b+r[0],p.y+r[1]-g],w=[0,0];v&&(w=P,P=[0,0]);let A=(p.metrics.left-m)*p.scale-b+P[0],T=(-p.metrics.top-m)*p.scale+P[1],I=A+f.w*p.scale/d,E=T+f.h*p.scale/d,_=new ve.default(A,T),F=new ve.default(I,T),M=new ve.default(A,E),B=new ve.default(I,E);if(v){let Y=new ve.default(-b,b-Tr),Q=-Math.PI/2,ye=ue/2-b,_e=p.imageName?ye:0,re=new ve.default(5-Tr-ye,-_e),Pe=new ve.default(...w);_._rotateAround(Q,Y)._add(re)._add(Pe),F._rotateAround(Q,Y)._add(re)._add(Pe),M._rotateAround(Q,Y)._add(re)._add(Pe),B._rotateAround(Q,Y)._add(re)._add(Pe)}if(l){let Y=Math.sin(l),Q=Math.cos(l),ye=[Q,-Y,Y,Q];_._matMult(ye),F._matMult(ye),M._matMult(ye),B._matMult(ye)}let C=new ve.default(0,0),O=new ve.default(0,0),N=0,K=0;u.push({tl:_,tr:F,bl:M,br:B,tex:f,writingMode:t.writingMode,glyphOffset:x,sectionIndex:p.sectionIndex,isSDF:h,pixelOffsetTL:C,pixelOffsetBR:O,minFontScaleX:N,minFontScaleY:K})}return u}var Xn=Z(he(),1),Qt=class{constructor(t,r,n,i,o,a,s,l,u,c){if(this.boxStartIndex=t.length,u){let p=a.top,f=a.bottom,y=a.collisionPadding;y&&(p-=y[1],f+=y[3]);let m=f-p;m>0&&(m=Math.max(10,m),this.circleDiameter=m)}else{let p=a.top*s-l[0],f=a.bottom*s+l[2],y=a.left*s-l[3],m=a.right*s+l[1],h=a.collisionPadding;if(h&&(y-=h[0]*s,p-=h[1]*s,m+=h[2]*s,f+=h[3]*s),c){let d=new Xn.default(y,p),g=new Xn.default(m,p),v=new Xn.default(y,f),b=new Xn.default(m,f),x=c*Math.PI/180;d._rotate(x),g._rotate(x),v._rotate(x),b._rotate(x),y=Math.min(d.x,g.x,v.x,b.x),m=Math.max(d.x,g.x,v.x,b.x),p=Math.min(d.y,g.y,v.y,b.y),f=Math.max(d.y,g.y,v.y,b.y)}t.emplaceBack(r.x,r.y,y,p,m,f,n,i,o)}this.boxEndIndex=t.length}};var Qn=class{constructor(t=[],r=lx){if(this.data=t,this.length=this.data.length,this.compare=r,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let t=this.data[0],r=this.data.pop();return this.length--,this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){let{data:r,compare:n}=this,i=r[t];for(;t>0;){let o=t-1>>1,a=r[o];if(n(i,a)>=0)break;r[t]=a,t=o}r[t]=i}_down(t){let{data:r,compare:n}=this,i=this.length>>1,o=r[t];for(;t<i;){let a=(t<<1)+1,s=r[a],l=a+1;if(l<this.length&&n(r[l],s)<0&&(a=l,s=r[l]),n(s,o)>=0)break;r[t]=s,t=a}r[t]=o}};function lx(e,t){return e<t?-1:e>t?1:0}var Fs=Z(he(),1);function $p(e,t=1,r=!1){let n=1/0,i=1/0,o=-1/0,a=-1/0,s=e[0];for(let h=0;h<s.length;h++){let d=s[h];(!h||d.x<n)&&(n=d.x),(!h||d.y<i)&&(i=d.y),(!h||d.x>o)&&(o=d.x),(!h||d.y>a)&&(a=d.y)}let l=o-n,u=a-i,c=Math.min(l,u),p=c/2,f=new Qn([],ux);if(c===0)return new Fs.default(n,i);for(let h=n;h<o;h+=c)for(let d=i;d<a;d+=c)f.push(new Lr(h+p,d+p,p,e));let y=px(e),m=f.length;for(;f.length;){let h=f.pop();(h.d>y.d||!y.d)&&(y=h,r&&console.log("found best %d after %d probes",Math.round(1e4*h.d)/1e4,m)),!(h.max-y.d<=t)&&(p=h.h/2,f.push(new Lr(h.p.x-p,h.p.y-p,p,e)),f.push(new Lr(h.p.x+p,h.p.y-p,p,e)),f.push(new Lr(h.p.x-p,h.p.y+p,p,e)),f.push(new Lr(h.p.x+p,h.p.y+p,p,e)),m+=4)}return r&&(console.log("num probes: ".concat(m)),console.log("best distance: ".concat(y.d))),y.p}function ux(e,t){return t.max-e.max}function Lr(e,t,r,n){this.p=new Fs.default(e,t),this.h=r,this.d=cx(this.p,n),this.max=this.d+this.h*Math.SQRT2}function cx(e,t){let r=!1,n=1/0;for(let i=0;i<t.length;i++){let o=t[i];for(let a=0,s=o.length,l=s-1;a<s;l=a++){let u=o[a],c=o[l];u.y>e.y!=c.y>e.y&&e.x<(c.x-u.x)*(e.y-u.y)/(c.y-u.y)+u.x&&(r=!r),n=Math.min(n,ls(e,u,c))}}return(r?1:-1)*Math.sqrt(n)}function px(e){let t=0,r=0,n=0,i=e[0];for(let o=0,a=i.length,s=a-1;o<a;s=o++){let l=i[o],u=i[s],c=l.x*u.y-u.x*l.y;r+=(l.x+u.x)*c,n+=(l.y+u.y)*c,t+=c*3}return new Lr(r/t,n/t,0,e)}var Ms=Z(rs(),1);var Dr=7,Ls=Number.POSITIVE_INFINITY;function fx(e,t){function r(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.sqrt(2);switch(i){case"top-right":case"top-left":s=l-Dr;break;case"bottom-right":case"bottom-left":s=-l+Dr;break;case"bottom":s=-o+Dr;break;case"top":s=o-Dr;break}switch(i){case"top-right":case"bottom-right":a=-l;break;case"top-left":case"bottom-left":a=l;break;case"left":a=o;break;case"right":a=-o;break}return[a,s]}function n(i,o,a){let s=0,l=0;switch(o=Math.abs(o),a=Math.abs(a),i){case"top-right":case"top-left":case"top":l=a-Dr;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+Dr;break}switch(i){case"top-right":case"bottom-right":case"right":s=-o;break;case"top-left":case"bottom-left":case"left":s=o;break}return[s,l]}return t[1]!==Ls?n(e,t[0],t[1]):r(e,t[0])}function jp(e){e.bucket.createArrays();let t=512*e.bucket.overscaling;e.bucket.tilePixelRatio=8192/t,e.bucket.compareText={},e.bucket.iconsNeedLinear=!1;let r=e.bucket.layers[0].layout,n=e.bucket.layers[0]._unevaluatedLayout._values,i={layoutIconSize:n["icon-size"].possiblyEvaluate(new q(e.bucket.zoom+1),e.canonical),layoutTextSize:n["text-size"].possiblyEvaluate(new q(e.bucket.zoom+1),e.canonical),textMaxSize:n["text-size"].possiblyEvaluate(new q(18))};if(e.bucket.textSizeData.kind==="composite"){let{minZoom:u,maxZoom:c}=e.bucket.textSizeData;i.compositeTextSizes=[n["text-size"].possiblyEvaluate(new q(u),e.canonical),n["text-size"].possiblyEvaluate(new q(c),e.canonical)]}if(e.bucket.iconSizeData.kind==="composite"){let{minZoom:u,maxZoom:c}=e.bucket.iconSizeData;i.compositeIconSizes=[n["icon-size"].possiblyEvaluate(new q(u),e.canonical),n["icon-size"].possiblyEvaluate(new q(c),e.canonical)]}let o=r.get("text-line-height")*ue,a=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",s=r.get("text-keep-upright"),l=r.get("text-size");for(let u of e.bucket.features){let c=r.get("text-font").evaluate(u,{},e.canonical).join(","),p=l.evaluate(u,{},e.canonical),f=i.layoutTextSize.evaluate(u,{},e.canonical),y=i.layoutIconSize.evaluate(u,{},e.canonical),m={horizontal:{},vertical:void 0},h=u.text,d=[0,0];if(h){let x=h.toString(),P=r.get("text-letter-spacing").evaluate(u,{},e.canonical)*ue,w=wu(x)?P:0,A=r.get("text-anchor").evaluate(u,{},e.canonical),T=r.get("text-variable-anchor");if(!T){let M=r.get("text-radial-offset").evaluate(u,{},e.canonical);M?d=fx(A,[M*ue,Ls]):d=r.get("text-offset").evaluate(u,{},e.canonical).map(B=>B*ue)}let I=a?"center":r.get("text-justify").evaluate(u,{},e.canonical),E=r.get("symbol-placement"),_=E==="point"?r.get("text-max-width").evaluate(u,{},e.canonical)*ue:0,F=()=>{e.bucket.allowVerticalPlacement&&on(x)&&(m.vertical=Zn(h,e.glyphMap,e.glyphPositions,e.imagePositions,c,_,o,A,"left",w,d,2,!0,E,f,p))};if(!a&&T){let M=I==="auto"?T.map(C=>Gp(C)):[I],B=!1;for(let C=0;C<M.length;C++){let O=M[C];if(!m.horizontal[O])if(B)m.horizontal[O]=m.horizontal[0];else{let N=Zn(h,e.glyphMap,e.glyphPositions,e.imagePositions,c,_,o,"center",O,w,d,1,!1,E,f,p);N&&(m.horizontal[O]=N,B=N.positionedLines.length===1)}}F()}else{I==="auto"&&(I=Gp(A));let M=Zn(h,e.glyphMap,e.glyphPositions,e.imagePositions,c,_,o,A,I,w,d,1,!1,E,f,p);M&&(m.horizontal[I]=M),F(),on(x)&&a&&s&&(m.vertical=Zn(h,e.glyphMap,e.glyphPositions,e.imagePositions,c,_,o,A,I,w,d,2,!1,E,f,p))}}let g,v=!1;if(u.icon&&u.icon.name){let x=e.imageMap[u.icon.name];x&&(g=dp(e.imagePositions[u.icon.name],r.get("icon-offset").evaluate(u,{},e.canonical),r.get("icon-anchor").evaluate(u,{},e.canonical)),v=!!x.sdf,e.bucket.sdfIcons===void 0?e.bucket.sdfIcons=v:e.bucket.sdfIcons!==v&&ce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(x.pixelRatio!==e.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(e.bucket.iconsNeedLinear=!0))}let b=Zp(m.horizontal)||m.vertical;e.bucket.iconsInText=b?b.iconsInText:!1,(b||g)&&yx(e.bucket,u,m,g,e.imageMap,i,f,y,d,v,e.canonical)}e.showCollisionBoxes&&e.bucket.generateCollisionDebugBuffers()}function Gp(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function yx(e,t,r,n,i,o,a,s,l,u,c){let p=o.textMaxSize.evaluate(t,{});p===void 0&&(p=a);let f=e.layers[0].layout,y=f.get("icon-offset").evaluate(t,{},c),m=Zp(r.horizontal),h=24,d=a/h,g=e.tilePixelRatio*d,v=e.tilePixelRatio*p/h,b=e.tilePixelRatio*s,x=e.tilePixelRatio*f.get("symbol-spacing"),P=f.get("text-padding")*e.tilePixelRatio,w=Sp(f,t,c,e.tilePixelRatio),A=f.get("text-max-angle")/180*Math.PI,T=f.get("text-rotation-alignment")!=="viewport"&&f.get("symbol-placement")!=="point",I=f.get("icon-rotation-alignment")==="map"&&f.get("symbol-placement")!=="point",E=f.get("symbol-placement"),_=x/2,F=f.get("icon-text-fit"),M;n&&F!=="none"&&(e.allowVerticalPlacement&&r.vertical&&(M=Is(n,r.vertical,F,f.get("icon-text-fit-padding"),y,d)),m&&(n=Is(n,m,F,f.get("icon-text-fit-padding"),y,d)));let B=(C,O)=>{O.x<0||O.x>=8192||O.y<0||O.y>=8192||mx(e,O,C,r,n,i,M,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,g,[P,P,P,P],T,l,b,w,I,y,t,o,u,c,a)};if(E==="line")for(let C of Op(t.geometry,0,0,8192,8192)){let O=zp(C,x,A,r.vertical||m,n,h,v,e.overscaling,8192);for(let N of O){let K=m;(!K||!hx(e,K.text,_,N))&&B(C,N)}}else if(E==="line-center"){for(let C of t.geometry)if(C.length>1){let O=Bp(C,A,r.vertical||m,n,h,v);O&&B(C,O)}}else if(t.type==="Polygon")for(let C of Sr(t.geometry,0)){let O=$p(C,16);B(C[0],new et(O.x,O.y,0))}else if(t.type==="LineString")for(let C of t.geometry)B(C,new et(C[0].x,C[0].y,0));else if(t.type==="Point")for(let C of t.geometry)for(let O of C)B([O],new et(O.x,O.y,0))}function qp(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m){let h=Up(t,r,s,i,o,a,n,e.allowVerticalPlacement),d=e.textSizeData,g=null;d.kind==="source"?(g=[Ct*i.layout.get("text-size").evaluate(a,{})],g[0]>Qe&&ce("".concat(e.layerIds[0],\': Value for "text-size" is >= \').concat(Er,\'. Reduce your "text-size".\'))):d.kind==="composite"&&(g=[Ct*y.compositeTextSizes[0].evaluate(a,{},m),Ct*y.compositeTextSizes[1].evaluate(a,{},m)],(g[0]>Qe||g[1]>Qe)&&ce("".concat(e.layerIds[0],\': Value for "text-size" is >= \').concat(Er,\'. Reduce your "text-size".\'))),e.addSymbols(e.text,h,g,s,o,a,u,t,l.lineStartIndex,l.lineLength,f,m);for(let v of c)p[v]=e.text.placedSymbolArray.length-1;return h.length*4}function Zp(e){for(let t in e)return e[t];return null}function mx(e,t,r,n,i,o,a,s,l,u,c,p,f,y,m,h,d,g,v,b,x,P,w,A,T){let I=e.addToLineVertexArray(t,r),E,_,F,M,B=0,C=0,O=0,N=0,K=-1,Y=-1,Q={},ye=(0,Ms.default)(""),_e=0,re=0;if(s._unevaluatedLayout.getValue("text-radial-offset")===void 0?[_e,re]=s.layout.get("text-offset").evaluate(x,{},A).map(Se=>Se*ue):(_e=s.layout.get("text-radial-offset").evaluate(x,{},A)*ue,re=Ls),e.allowVerticalPlacement&&n.vertical){let xe=s.layout.get("text-rotate").evaluate(x,{},A)+90,He=n.vertical;F=new Qt(l,t,u,c,p,He,f,y,m,xe),a&&(M=new Qt(l,t,u,c,p,a,d,g,m,xe))}if(i){let Se=s.layout.get("icon-rotate").evaluate(x,{}),xe=s.layout.get("icon-text-fit")!=="none",He=Es(i,Se,w,xe),Ke=a?Es(a,Se,w,xe):void 0;_=new Qt(l,t,u,c,p,i,d,g,!1,Se),B=He.length*4;let al=e.iconSizeData,Et=null;al.kind==="source"?(Et=[Ct*s.layout.get("icon-size").evaluate(x,{})],Et[0]>Qe&&ce("".concat(e.layerIds[0],\': Value for "icon-size" is >= \').concat(Er,\'. Reduce your "icon-size".\'))):al.kind==="composite"&&(Et=[Ct*P.compositeIconSizes[0].evaluate(x,{},A),Ct*P.compositeIconSizes[1].evaluate(x,{},A)],(Et[0]>Qe||Et[1]>Qe)&&ce("".concat(e.layerIds[0],\': Value for "icon-size" is >= \').concat(Er,\'. Reduce your "icon-size".\'))),e.addSymbols(e.icon,He,Et,b,v,x,0,t,I.lineStartIndex,I.lineLength,-1,A),K=e.icon.placedSymbolArray.length-1,Ke&&(C=Ke.length*4,e.addSymbols(e.icon,Ke,Et,b,v,x,2,t,I.lineStartIndex,I.lineLength,-1,A),Y=e.icon.placedSymbolArray.length-1)}let Pe=Object.keys(n.horizontal);for(let Se of Pe){let xe=n.horizontal[Se];if(!E){ye=(0,Ms.default)(xe.text);let Ke=s.layout.get("text-rotate").evaluate(x,{},A);E=new Qt(l,t,u,c,p,xe,f,y,m,Ke)}let He=xe.positionedLines.length===1;if(O+=qp(e,t,xe,o,s,m,x,h,I,n.vertical?1:3,He?Pe:[Se],Q,K,P,A),He)break}n.vertical&&(N+=qp(e,t,n.vertical,o,s,m,x,h,I,2,["vertical"],Q,Y,P,A));let $e=E?E.boxStartIndex:e.collisionBoxArray.length,fi=E?E.boxEndIndex:e.collisionBoxArray.length,ya=F?F.boxStartIndex:e.collisionBoxArray.length,ma=F?F.boxEndIndex:e.collisionBoxArray.length,zr=_?_.boxStartIndex:e.collisionBoxArray.length,yi=_?_.boxEndIndex:e.collisionBoxArray.length,ha=M?M.boxStartIndex:e.collisionBoxArray.length,mi=M?M.boxEndIndex:e.collisionBoxArray.length,Ee=-1,tr=(Se,xe)=>Se&&Se.circleDiameter?Math.max(Se.circleDiameter,xe):xe;Ee=tr(E,Ee),Ee=tr(F,Ee),Ee=tr(_,Ee),Ee=tr(M,Ee);let hi=Ee>-1?1:0;hi&&(Ee*=T/ue),e.glyphOffsetArray.length>=We.MAX_GLYPHS&&ce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),x.sortKey!==void 0&&e.addToSortKeyRanges(e.symbolInstances.length,x.sortKey),e.symbolInstances.emplaceBack(t.x,t.y,Q.right>=0?Q.right:-1,Q.center>=0?Q.center:-1,Q.left>=0?Q.left:-1,Q.vertical||-1,K,Y,ye,$e,fi,ya,ma,zr,yi,ha,mi,u,O,N,B,C,hi,0,f,_e,re,Ee)}function hx(e,t,r,n){let i=e.compareText;if(!(t in i))i[t]=[];else{let o=i[t];for(let a=o.length-1;a>=0;a--)if(n.dist(o[a])<r)return!0}return i[t].push(n),!1}var Xo=1,ei=class{constructor(t){let r={},n=[];for(let s in t){let l=t[s],u=r[s]={};for(let c in l){let p=l[+c];if(!p||p.bitmap.width===0||p.bitmap.height===0)continue;let f={x:0,y:0,w:p.bitmap.width+2*Xo,h:p.bitmap.height+2*Xo};n.push(f),u[c]={rect:f,metrics:p.metrics}}}let{w:i,h:o}=Gn(n),a=new Wt({width:i||1,height:o||1});for(let s in t){let l=t[s];for(let u in l){let c=l[+u];if(!c||c.bitmap.width===0||c.bitmap.height===0)continue;let p=r[s][u].rect;Wt.copy(c.bitmap,a,{x:0,y:0},{x:p.x+Xo,y:p.y+Xo},c.bitmap)}}this.image=a,this.positions=r}};k("GlyphAtlas",ei);function Wp(e,t,r){t=Math.pow(2,r)-t-1;var n=Jp(e*256,t*256,r),i=Jp((e+1)*256,(t+1)*256,r);return n[0]+","+n[1]+","+i[0]+","+i[1]}function Jp(e,t,r){var n=2*Math.PI*6378137/256/Math.pow(2,r),i=e*n-2*Math.PI*6378137/2,o=t*n-2*Math.PI*6378137/2;return[i,o]}var Yp=Z(he(),1);var Ds=63710088e-1,ti=class e{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error("Invalid LngLat object: (".concat(t,", ").concat(r,")"));if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new e(ml(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return"LngLat(".concat(this.lng,", ").concat(this.lat,")")}distanceTo(t){let r=Math.PI/180,n=this.lat*r,i=t.lat*r,o=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((t.lng-this.lng)*r);return Ds*Math.acos(Math.min(o,1))}static convert(t){if(t instanceof e)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new e(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new e(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}};var Hp=2*Math.PI*Ds;function Kp(e){return Hp*Math.cos(e*Math.PI/180)}function dx(e){return(180+e)/360}function gx(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function xx(e,t){return e/Kp(t)}function bx(e){return e*360-180}function Vs(e){let t=180-e*360;return 360/Math.PI*Math.atan(Math.exp(t*Math.PI/180))-90}function vx(e,t){return e*Kp(Vs(t))}function Px(e){return 1/Math.cos(e*Math.PI/180)}var Qo=class e{constructor(t,r,n=0){this.x=+t,this.y=+r,this.z=+n}static fromLngLat(t,r=0){let n=ti.convert(t);return new e(dx(n.lng),gx(n.lat),xx(r,n.lat))}toLngLat(){return new ti(bx(this.x),Vs(this.y))}toAltitude(){return vx(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Hp*Px(Vs(this.y))}};var ea=class{constructor(t,r,n){if(t<0||t>25||n<0||n>=Math.pow(2,t)||r<0||r>=Math.pow(2,t))throw new Error("x=".concat(r,", y=").concat(n,", z=").concat(t," outside of bounds. 0<=x<").concat(Math.pow(2,t),", 0<=y<").concat(Math.pow(2,t)," 0<=z<=25 "));this.z=t,this.x=r,this.y=n,this.key=ri(0,t,t,r,n)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,n){let i=Wp(this.x,this.y,this.z),o=Sx(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(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(n==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,r>1?"@2x":"").replace(/{quadkey}/g,o).replace(/{bbox-epsg-3857}/g,i)}isChildOf(t){let r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){let r=Math.pow(2,this.z);return new Yp.default((t.x*r-this.x)*8192,(t.y*r-this.y)*8192)}toString(){return"".concat(this.z,"/").concat(this.x,"/").concat(this.y)}},Bs=class{constructor(t,r){this.wrap=t,this.canonical=r,this.key=ri(t,r.z,r.z,r.x,r.y)}},ni=class e{constructor(t,r,n,i,o){if(t<n)throw new Error("overscaledZ should be >= z; overscaledZ = ".concat(t,"; z = ").concat(n));this.overscaledZ=t,this.wrap=r,this.canonical=new ea(n,+i,+o),this.key=ri(r,t,n,i,o)}clone(){return new e(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let r=this.canonical.z-t;return t>this.canonical.z?new e(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new e(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){if(t>this.overscaledZ)throw new Error("targetZ > this.overscaledZ; targetZ = ".concat(t,"; overscaledZ = ").concat(this.overscaledZ));let n=this.canonical.z-t;return t>this.canonical.z?ri(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):ri(this.wrap*+r,t,t,this.canonical.x>>n,this.canonical.y>>n)}isChildOf(t){if(t.wrap!==this.wrap)return!1;let r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new e(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];let r=this.canonical.z+1,n=this.canonical.x*2,i=this.canonical.y*2;return[new e(r,this.wrap,r,n,i),new e(r,this.wrap,r,n+1,i),new e(r,this.wrap,r,n,i+1),new e(r,this.wrap,r,n+1,i+1)]}isLessThan(t){return this.wrap<t.wrap?!0:this.wrap>t.wrap?!1:this.overscaledZ<t.overscaledZ?!0:this.overscaledZ>t.overscaledZ?!1:this.canonical.x<t.canonical.x?!0:this.canonical.x>t.canonical.x?!1:this.canonical.y<t.canonical.y}wrapped(){return new e(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new e(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Bs(this.wrap,this.canonical)}toString(){return"".concat(this.overscaledZ,"/").concat(this.canonical.x,"/").concat(this.canonical.y)}getTilePoint(t){return this.canonical.getTilePoint(new Qo(t.x-this.wrap,t.y))}};function ri(e,t,r,n,i){e*=2,e<0&&(e=e*-1-1);let o=1<<r;return(o*o*e+o*i+n).toString(36)+r.toString(36)+t.toString(36)}function Sx(e,t,r){let n="",i;for(let o=e;o>0;o--)i=1<<o-1,n+=(t&i?1:0)+(r&i?2:0);return n}k("CanonicalTileID",ea);k("OverscaledTileID",ni,{omit:["posMatrix"]});var ta=class{constructor(t){this.tileID=new ni(t.tileID.overscaledZ,t.tileID.wrap,t.tileID.canonical.z,t.tileID.canonical.x,t.tileID.canonical.y),this.uid=t.uid,this.zoom=t.zoom,this.pixelRatio=t.pixelRatio,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=t.showCollisionBoxes,this.collectResourceTiming=!!t.collectResourceTiming,this.returnDependencies=!!t.returnDependencies,this.promoteId=t.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(t,r,n,i,o){this.status="parsing",this.data=t,this.collisionBoxArray=new Sn;let a=new Fr(Object.keys(t.layers).sort()),s=new Yn(this.tileID,this.promoteId);s.bucketLayerIDs=[];let l={},u={featureIndex:s,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:n},c=r.familiesBySource[this.source];for(let x in c){let P=t.layers[x];if(!P)continue;P.version===1&&ce(\'Vector tile source "\'.concat(this.source,\'" layer "\').concat(x,\'" \')+"does not use vector tile spec v2 and therefore may have some rendering errors.");let w=a.encode(x),A=[];for(let T=0;T<P.length;T++){let I=P.feature(T),E=s.getId(I,x);A.push({feature:I,id:E,index:T,sourceLayerIndex:w})}for(let T of c[x]){let I=T[0];if(I.source!==this.source&&ce("layer.source = ".concat(I.source," does not equal this.source = ").concat(this.source)),I.minzoom&&this.zoom<Math.floor(I.minzoom)||I.maxzoom&&this.zoom>=I.maxzoom||I.visibility==="none")continue;zs(T,this.zoom,n),(l[I.id]=I.createBucket({index:s.bucketLayerIDs.length,layers:T,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:w,sourceID:this.source})).populate(A,u,this.tileID.canonical),s.bucketLayerIDs.push(T.map(_=>_.id))}}let p,f,y,m,h=Rr(u.glyphDependencies,x=>Object.keys(x).map(Number));this.inFlightDependencies.forEach(x=>x==null?void 0:x.cancel()),this.inFlightDependencies=[];let d=++this.dependencySentinel;Object.keys(h).length?this.inFlightDependencies.push(i.send("getGlyphs",{uid:this.uid,stacks:h,source:this.source,tileID:this.tileID,type:"glyphs"},(x,P)=>{d===this.dependencySentinel&&(p||(p=x,f=P,b.call(this)))})):f={};let g=Object.keys(u.iconDependencies);g.length?this.inFlightDependencies.push(i.send("getImages",{icons:g,source:this.source,tileID:this.tileID,type:"icons"},(x,P)=>{d===this.dependencySentinel&&(p||(p=x,y=P,b.call(this)))})):y={};let v=Object.keys(u.patternDependencies);v.length?this.inFlightDependencies.push(i.send("getImages",{icons:v,source:this.source,tileID:this.tileID,type:"patterns"},(x,P)=>{d===this.dependencySentinel&&(p||(p=x,m=P,b.call(this)))})):m={},b.call(this);function b(){if(p)return o(p);if(f&&y&&m){let x=new ei(f),P=new qn(y,m);for(let w in l){let A=l[w];A instanceof We?(zs(A.layers,this.zoom,n),jp({bucket:A,glyphMap:f,glyphPositions:x.positions,imageMap:y,imagePositions:P.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):A.hasPattern&&(A instanceof Xt||A instanceof Kt||A instanceof Yt)&&(zs(A.layers,this.zoom,n),A.addFeatures(u,this.tileID.canonical,P.patternPositions))}this.status="done",o(null,{buckets:Object.values(l).filter(w=>!w.isEmpty()),featureIndex:s,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:x.image,imageAtlas:P,glyphMap:this.returnDependencies?f:null,iconMap:this.returnDependencies?y:null,glyphPositions:this.returnDependencies?x.positions:null})}}}};function zs(e,t,r){let n=new q(t);for(let i of e)i.recalculate(n,r)}var wx=60,f_=1e3/wx;var Vr=class{constructor(t){this._marks={start:[t.url,"start"].join("#"),end:[t.url,"end"].join("#"),measure:t.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let t=performance.getEntriesByName(this._marks.measure);return t.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),t=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),t}};function Ax(e,t){let r=Wa(e.request,(n,i,o,a)=>{n?t(n):i&&t(null,{vectorTile:new Xp.default.VectorTile(new Qp.default(i)),rawData:i,cacheControl:o,expires:a})});return()=>{r.cancel(),t()}}var Br=class{constructor(t,r,n,i){this.actor=t,this.layerIndex=r,this.availableImages=n,this.loadVectorData=i||Ax,this.loading={},this.loaded={}}loadTile(t,r){let n=t.uid;this.loading||(this.loading={});let i=t&&t.request&&t.request.collectResourceTiming?new Vr(t.request):!1,o=this.loading[n]=new ta(t);o.abort=this.loadVectorData(t,(a,s)=>{if(delete this.loading[n],a||!s)return o.status="done",this.loaded[n]=o,r(a);let l=s.rawData,u={};s.expires&&(u.expires=s.expires),s.cacheControl&&(u.cacheControl=s.cacheControl);let c={};if(i){let p=i.finish();p&&(c.resourceTiming=JSON.parse(JSON.stringify(p)))}o.vectorTile=s.vectorTile,o.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,(p,f)=>{if(p||!f)return r(p);r(null,Ae({rawTileData:l.slice(0)},f,u,c))}),this.loaded=this.loaded||{},this.loaded[n]=o})}reloadTile(t,r){let n=this.loaded,i=t.uid,o=this;if(n&&n[i]){let a=n[i];a.showCollisionBoxes=t.showCollisionBoxes,a.status==="parsing"?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,r):a.status==="done"&&(a.vectorTile?a.parse(a.vectorTile,this.layerIndex,this.availableImages,this.actor,r):r())}}abortTile(t,r){let n=this.loading,i=t.uid;n&&n[i]&&n[i].abort&&(n[i].abort(),delete n[i]),r()}removeTile(t,r){let n=this.loaded,i=t.uid;n&&n[i]&&delete n[i],r()}};var ii=class{constructor(t,r,n){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(n&&n!=="mapbox"&&n!=="terrarium"){ce(\'"\'.concat(n,\'" is not a valid encoding type. Valid types include "mapbox" and "terrarium".\'));return}this.stride=r.height;let i=this.dim=r.height-2;this.data=new Uint32Array(r.data.buffer),this.encoding=n||"mapbox";for(let o=0;o<i;o++)this.data[this._idx(-1,o)]=this.data[this._idx(0,o)],this.data[this._idx(i,o)]=this.data[this._idx(i-1,o)],this.data[this._idx(o,-1)]=this.data[this._idx(o,0)],this.data[this._idx(o,i)]=this.data[this._idx(o,i-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(i,-1)]=this.data[this._idx(i-1,0)],this.data[this._idx(-1,i)]=this.data[this._idx(0,i-1)],this.data[this._idx(i,i)]=this.data[this._idx(i-1,i-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let o=0;o<i;o++)for(let a=0;a<i;a++){let s=this.get(o,a);s>this.max&&(this.max=s),s<this.min&&(this.min=s)}}get(t,r){let n=new Uint8Array(this.data.buffer),i=this._idx(t,r)*4;return(this.encoding==="terrarium"?this._unpackTerrarium:this._unpackMapbox)(n[i],n[i+1],n[i+2])}getUnpackVector(){return this.encoding==="terrarium"?[256,1,1/256,32768]:[6553.6,25.6,.1,1e4]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}_unpackMapbox(t,r,n){return(t*256*256+r*256+n)/10-1e4}_unpackTerrarium(t,r,n){return t*256+r+n/256-32768}getPixels(){return new de({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,n){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let i=r*this.dim,o=r*this.dim+this.dim,a=n*this.dim,s=n*this.dim+this.dim;switch(r){case-1:i=o-1;break;case 1:o=i+1;break}switch(n){case-1:a=s-1;break;case 1:s=a+1;break}let l=-r*this.dim,u=-n*this.dim;for(let c=a;c<s;c++)for(let p=i;p<o;p++)this.data[this._idx(p,c)]=t.data[this._idx(p+l,c+u)]}};k("DEMData",ii);var ra=class{constructor(){this.loaded={}}loadTile(t,r){let{uid:n,encoding:i,rawImageData:o}=t,a=Or(o)?this.getImageData(o):o,s=new ii(n,a,i);this.loaded=this.loaded||{},this.loaded[n]=s,r(null,s)}getImageData(t){(!this.offscreenCanvas||!this.offscreenCanvasContext)&&(this.offscreenCanvas=new OffscreenCanvas(t.width,t.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=t.width,this.offscreenCanvas.height=t.height,this.offscreenCanvasContext.drawImage(t,0,0,t.width,t.height);let r=this.offscreenCanvasContext.getImageData(-1,-1,t.width+2,t.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new de({width:r.width,height:r.height},r.data)}removeTile(t){let r=this.loaded,n=t.uid;r&&r[n]&&delete r[n]}};var Cf=Z(nf(),1);var Rs=Z(he(),1),of=Z(It(),1);var _x=of.default.VectorTileFeature.prototype.toGeoJSON,Os=class{constructor(t){this._feature=t,this.extent=8192,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))}loadGeometry(){if(this._feature.type===1){let t=[];for(let r of this._feature.geometry)t.push([new Rs.default(r[0],r[1])]);return t}else{let t=[];for(let r of this._feature.geometry){let n=[];for(let i of r)n.push(new Rs.default(i[0],i[1]));t.push(n)}return t}}toGeoJSON(t,r,n){return _x.call(this,t,r,n)}},ia=class{constructor(t){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=8192,this.length=t.length,this._features=t}feature(t){return new Os(this._features[t])}};var kf=Z(pf(),1);var ff=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],$s=1,ai=8,li=class e{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");let[r,n]=new Uint8Array(t,0,2);if(r!==219)throw new Error("Data does not appear to be in a KDBush format.");let i=n>>4;if(i!==$s)throw new Error("Got v".concat(i," data when expected v").concat($s,"."));let o=ff[n&15];if(!o)throw new Error("Unrecognized array type.");let[a]=new Uint16Array(t,2,1),[s]=new Uint32Array(t,4,1);return new e(s,a,o,t)}constructor(t,r=64,n=Float64Array,i){if(isNaN(t)||t<0)throw new Error("Unpexpected numItems value: ".concat(t,"."));this.numItems=+t,this.nodeSize=Math.min(Math.max(+r,2),65535),this.ArrayType=n,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;let o=ff.indexOf(this.ArrayType),a=t*2*this.ArrayType.BYTES_PER_ELEMENT,s=t*this.IndexArrayType.BYTES_PER_ELEMENT,l=(8-s%8)%8;if(o<0)throw new Error("Unexpected typed array class: ".concat(n,"."));i&&i instanceof ArrayBuffer?(this.data=i,this.ids=new this.IndexArrayType(this.data,ai,t),this.coords=new this.ArrayType(this.data,ai+s+l,t*2),this._pos=t*2,this._finished=!0):(this.data=new ArrayBuffer(ai+a+s+l),this.ids=new this.IndexArrayType(this.data,ai,t),this.coords=new this.ArrayType(this.data,ai+s+l,t*2),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,($s<<4)+o]),new Uint16Array(this.data,2,1)[0]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){let n=this._pos>>1;return this.ids[n]=n,this.coords[this._pos++]=t,this.coords[this._pos++]=r,n}finish(){let t=this._pos>>1;if(t!==this.numItems)throw new Error("Added ".concat(t," items when expected ").concat(this.numItems,"."));return qs(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,n,i){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:o,coords:a,nodeSize:s}=this,l=[0,o.length-1,0],u=[];for(;l.length;){let c=l.pop()||0,p=l.pop()||0,f=l.pop()||0;if(p-f<=s){for(let d=f;d<=p;d++){let g=a[2*d],v=a[2*d+1];g>=t&&g<=n&&v>=r&&v<=i&&u.push(o[d])}continue}let y=f+p>>1,m=a[2*y],h=a[2*y+1];m>=t&&m<=n&&h>=r&&h<=i&&u.push(o[y]),(c===0?t<=m:r<=h)&&(l.push(f),l.push(y-1),l.push(1-c)),(c===0?n>=m:i>=h)&&(l.push(y+1),l.push(p),l.push(1-c))}return u}within(t,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");let{ids:i,coords:o,nodeSize:a}=this,s=[0,i.length-1,0],l=[],u=n*n;for(;s.length;){let c=s.pop()||0,p=s.pop()||0,f=s.pop()||0;if(p-f<=a){for(let d=f;d<=p;d++)yf(o[2*d],o[2*d+1],t,r)<=u&&l.push(i[d]);continue}let y=f+p>>1,m=o[2*y],h=o[2*y+1];yf(m,h,t,r)<=u&&l.push(i[y]),(c===0?t-n<=m:r-n<=h)&&(s.push(f),s.push(y-1),s.push(1-c)),(c===0?t+n>=m:r+n>=h)&&(s.push(y+1),s.push(p),s.push(1-c))}return l}};function qs(e,t,r,n,i,o){if(i-n<=r)return;let a=n+i>>1;mf(e,t,a,n,i,o),qs(e,t,r,n,a-1,1-o),qs(e,t,r,a+1,i,1-o)}function mf(e,t,r,n,i,o){for(;i>n;){if(i-n>600){let u=i-n+1,c=r-n+1,p=Math.log(u),f=.5*Math.exp(2*p/3),y=.5*Math.sqrt(p*f*(u-f)/u)*(c-u/2<0?-1:1),m=Math.max(n,Math.floor(r-c*f/u+y)),h=Math.min(i,Math.floor(r+(u-c)*f/u+y));mf(e,t,r,m,h,o)}let a=t[2*r+o],s=n,l=i;for(si(e,t,n,r),t[2*i+o]>a&&si(e,t,n,i);s<l;){for(si(e,t,s,l),s++,l--;t[2*s+o]<a;)s++;for(;t[2*l+o]>a;)l--}t[2*n+o]===a?si(e,t,n,l):(l++,si(e,t,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function si(e,t,r,n){Gs(e,r,n),Gs(t,2*r,2*n),Gs(t,2*r+1,2*n+1)}function Gs(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function yf(e,t,r,n){let i=e-r,o=t-n;return i*i+o*o}var Bx={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},hf=Math.fround||(e=>t=>(e[0]=+t,e[0]))(new Float32Array(1)),er=2,Tt=3,js=4,kt=5,gf=6,ui=class{constructor(t){this.options=Object.assign(Object.create(Bx),t),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(t){let{log:r,minZoom:n,maxZoom:i}=this.options;r&&console.time("total time");let o="prepare ".concat(t.length," points");r&&console.time(o),this.points=t;let a=[];for(let l=0;l<t.length;l++){let u=t[l];if(!u.geometry)continue;let[c,p]=u.geometry.coordinates,f=hf(aa(c)),y=hf(sa(p));a.push(f,y,1/0,l,-1,1),this.options.reduce&&a.push(0)}let s=this.trees[i+1]=this._createTree(a);r&&console.timeEnd(o);for(let l=i;l>=n;l--){let u=+Date.now();s=this.trees[l]=this._createTree(this._cluster(s,l)),r&&console.log("z%d: %d clusters in %dms",l,s.numItems,+Date.now()-u)}return r&&console.timeEnd("total time"),this}getClusters(t,r){let n=((t[0]+180)%360+360)%360-180,i=Math.max(-90,Math.min(90,t[1])),o=t[2]===180?180:((t[2]+180)%360+360)%360-180,a=Math.max(-90,Math.min(90,t[3]));if(t[2]-t[0]>=360)n=-180,o=180;else if(n>o){let p=this.getClusters([n,i,180,a],r),f=this.getClusters([-180,i,o,a],r);return p.concat(f)}let s=this.trees[this._limitZoom(r)],l=s.range(aa(n),sa(a),aa(o),sa(i)),u=s.data,c=[];for(let p of l){let f=this.stride*p;c.push(u[f+kt]>1?df(u,f,this.clusterProps):this.points[u[f+Tt]])}return c}getChildren(t){let r=this._getOriginId(t),n=this._getOriginZoom(t),i="No cluster with the specified id.",o=this.trees[n];if(!o)throw new Error(i);let a=o.data;if(r*this.stride>=a.length)throw new Error(i);let s=this.options.radius/(this.options.extent*Math.pow(2,n-1)),l=a[r*this.stride],u=a[r*this.stride+1],c=o.within(l,u,s),p=[];for(let f of c){let y=f*this.stride;a[y+js]===t&&p.push(a[y+kt]>1?df(a,y,this.clusterProps):this.points[a[y+Tt]])}if(p.length===0)throw new Error(i);return p}getLeaves(t,r,n){r=r||10,n=n||0;let i=[];return this._appendLeaves(i,t,r,n,0),i}getTile(t,r,n){let i=this.trees[this._limitZoom(t)],o=Math.pow(2,t),{extent:a,radius:s}=this.options,l=s/a,u=(n-l)/o,c=(n+1+l)/o,p={features:[]};return this._addTileFeatures(i.range((r-l)/o,u,(r+1+l)/o,c),i.data,r,n,o,p),r===0&&this._addTileFeatures(i.range(1-l/o,u,1,c),i.data,o,n,o,p),r===o-1&&this._addTileFeatures(i.range(0,u,l/o,c),i.data,-1,n,o,p),p.features.length?p:null}getClusterExpansionZoom(t){let r=this._getOriginZoom(t)-1;for(;r<=this.options.maxZoom;){let n=this.getChildren(t);if(r++,n.length!==1)break;t=n[0].properties.cluster_id}return r}_appendLeaves(t,r,n,i,o){let a=this.getChildren(r);for(let s of a){let l=s.properties;if(l&&l.cluster?o+l.point_count<=i?o+=l.point_count:o=this._appendLeaves(t,l.cluster_id,n,i,o):o<i?o++:t.push(s),t.length===n)break}return o}_createTree(t){let r=new li(t.length/this.stride|0,this.options.nodeSize,Float32Array);for(let n=0;n<t.length;n+=this.stride)r.add(t[n],t[n+1]);return r.finish(),r.data=t,r}_addTileFeatures(t,r,n,i,o,a){for(let s of t){let l=s*this.stride,u=r[l+kt]>1,c,p,f;if(u)c=xf(r,l,this.clusterProps),p=r[l],f=r[l+1];else{let h=this.points[r[l+Tt]];c=h.properties;let[d,g]=h.geometry.coordinates;p=aa(d),f=sa(g)}let y={type:1,geometry:[[Math.round(this.options.extent*(p*o-n)),Math.round(this.options.extent*(f*o-i))]],tags:c},m;u||this.options.generateId?m=r[l+Tt]:m=this.points[r[l+Tt]].id,m!==void 0&&(y.id=m),a.features.push(y)}}_limitZoom(t){return Math.max(this.options.minZoom,Math.min(Math.floor(+t),this.options.maxZoom+1))}_cluster(t,r){let{radius:n,extent:i,reduce:o,minPoints:a}=this.options,s=n/(i*Math.pow(2,r)),l=t.data,u=[],c=this.stride;for(let p=0;p<l.length;p+=c){if(l[p+er]<=r)continue;l[p+er]=r;let f=l[p],y=l[p+1],m=t.within(l[p],l[p+1],s),h=l[p+kt],d=h;for(let g of m){let v=g*c;l[v+er]>r&&(d+=l[v+kt])}if(d>h&&d>=a){let g=f*h,v=y*h,b,x=-1,P=((p/c|0)<<5)+(r+1)+this.points.length;for(let w of m){let A=w*c;if(l[A+er]<=r)continue;l[A+er]=r;let T=l[A+kt];g+=l[A]*T,v+=l[A+1]*T,l[A+js]=P,o&&(b||(b=this._map(l,p,!0),x=this.clusterProps.length,this.clusterProps.push(b)),o(b,this._map(l,A)))}l[p+js]=P,u.push(g/d,v/d,1/0,P,-1,d),o&&u.push(x)}else{for(let g=0;g<c;g++)u.push(l[p+g]);if(d>1)for(let g of m){let v=g*c;if(!(l[v+er]<=r)){l[v+er]=r;for(let b=0;b<c;b++)u.push(l[v+b])}}}}return u}_getOriginId(t){return t-this.points.length>>5}_getOriginZoom(t){return(t-this.points.length)%32}_map(t,r,n){if(t[r+kt]>1){let a=this.clusterProps[t[r+gf]];return n?Object.assign({},a):a}let i=this.points[t[r+Tt]].properties,o=this.options.map(i);return n&&o===i?Object.assign({},o):o}};function df(e,t,r){return{type:"Feature",id:e[t+Tt],properties:xf(e,t,r),geometry:{type:"Point",coordinates:[zx(e[t]),Rx(e[t+1])]}}}function xf(e,t,r){let n=e[t+kt],i=n>=1e4?"".concat(Math.round(n/1e3),"k"):n>=1e3?"".concat(Math.round(n/100)/10,"k"):n,o=e[t+gf],a=o===-1?{}:Object.assign({},r[o]);return Object.assign(a,{cluster:!0,cluster_id:e[t+Tt],point_count:n,point_count_abbreviated:i})}function aa(e){return e/360+.5}function sa(e){let t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function zx(e){return(e-.5)*360}function Rx(e){let t=(180-e*360)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function ci(e,t,r,n){for(var i=n,o=r-t>>1,a=r-t,s,l=e[t],u=e[t+1],c=e[r],p=e[r+1],f=t+3;f<r;f+=3){var y=Ox(e[f],e[f+1],l,u,c,p);if(y>i)s=f,i=y;else if(y===i){var m=Math.abs(f-o);m<a&&(s=f,a=m)}}i>n&&(s-t>3&&ci(e,t,s,n),e[s+2]=i,r-s>3&&ci(e,s,r,n))}function Ox(e,t,r,n,i,o){var a=i-r,s=o-n;if(a!==0||s!==0){var l=((e-r)*a+(t-n)*s)/(a*a+s*s);l>1?(r=i,n=o):l>0&&(r+=a*l,n+=s*l)}return a=e-r,s=t-n,a*a+s*s}function pt(e,t,r,n){var i={id:typeof e>"u"?null:e,type:t,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return Nx(i),i}function Nx(e){var t=e.geometry,r=e.type;if(r==="Point"||r==="MultiPoint"||r==="LineString")Zs(e,t);else if(r==="Polygon"||r==="MultiLineString")for(var n=0;n<t.length;n++)Zs(e,t[n]);else if(r==="MultiPolygon")for(n=0;n<t.length;n++)for(var i=0;i<t[n].length;i++)Zs(e,t[n][i])}function Zs(e,t){for(var r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function Hs(e,t){var r=[];if(e.type==="FeatureCollection")for(var n=0;n<e.features.length;n++)la(r,e.features[n],t,n);else e.type==="Feature"?la(r,e,t):la(r,{geometry:e},t);return r}function la(e,t,r,n){if(t.geometry){var i=t.geometry.coordinates,o=t.geometry.type,a=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2),s=[],l=t.id;if(r.promoteId?l=t.properties[r.promoteId]:r.generateId&&(l=n||0),o==="Point")bf(i,s);else if(o==="MultiPoint")for(var u=0;u<i.length;u++)bf(i[u],s);else if(o==="LineString")Ws(i,s,a,!1);else if(o==="MultiLineString")if(r.lineMetrics){for(u=0;u<i.length;u++)s=[],Ws(i[u],s,a,!1),e.push(pt(l,"LineString",s,t.properties));return}else Js(i,s,a,!1);else if(o==="Polygon")Js(i,s,a,!0);else if(o==="MultiPolygon")for(u=0;u<i.length;u++){var c=[];Js(i[u],c,a,!0),s.push(c)}else if(o==="GeometryCollection"){for(u=0;u<t.geometry.geometries.length;u++)la(e,{id:l,geometry:t.geometry.geometries[u],properties:t.properties},r,n);return}else throw new Error("Input data is not a valid GeoJSON object.");e.push(pt(l,o,s,t.properties))}}function bf(e,t){t.push(vf(e[0])),t.push(Pf(e[1])),t.push(0)}function Ws(e,t,r,n){for(var i,o,a=0,s=0;s<e.length;s++){var l=vf(e[s][0]),u=Pf(e[s][1]);t.push(l),t.push(u),t.push(0),s>0&&(n?a+=(i*u-l*o)/2:a+=Math.sqrt(Math.pow(l-i,2)+Math.pow(u-o,2))),i=l,o=u}var c=t.length-3;t[2]=1,ci(t,0,c,r),t[c+2]=1,t.size=Math.abs(a),t.start=0,t.end=t.size}function Js(e,t,r,n){for(var i=0;i<e.length;i++){var o=[];Ws(e[i],o,r,n),t.push(o)}}function vf(e){return e/360+.5}function Pf(e){var t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function Ue(e,t,r,n,i,o,a,s){if(r/=t,n/=t,o>=r&&a<n)return e;if(a<r||o>=n)return null;for(var l=[],u=0;u<e.length;u++){var c=e[u],p=c.geometry,f=c.type,y=i===0?c.minX:c.minY,m=i===0?c.maxX:c.maxY;if(y>=r&&m<n){l.push(c);continue}else if(m<r||y>=n)continue;var h=[];if(f==="Point"||f==="MultiPoint")Ux(p,h,r,n,i);else if(f==="LineString")wf(p,h,r,n,i,!1,s.lineMetrics);else if(f==="MultiLineString")Ks(p,h,r,n,i,!1);else if(f==="Polygon")Ks(p,h,r,n,i,!0);else if(f==="MultiPolygon")for(var d=0;d<p.length;d++){var g=[];Ks(p[d],g,r,n,i,!0),g.length&&h.push(g)}if(h.length){if(s.lineMetrics&&f==="LineString"){for(d=0;d<h.length;d++)l.push(pt(c.id,f,h[d],c.tags));continue}(f==="LineString"||f==="MultiLineString")&&(h.length===1?(f="LineString",h=h[0]):f="MultiLineString"),(f==="Point"||f==="MultiPoint")&&(f=h.length===3?"Point":"MultiPoint"),l.push(pt(c.id,f,h,c.tags))}}return l.length?l:null}function Ux(e,t,r,n,i){for(var o=0;o<e.length;o+=3){var a=e[o+i];a>=r&&a<=n&&(t.push(e[o]),t.push(e[o+1]),t.push(e[o+2]))}}function wf(e,t,r,n,i,o,a){for(var s=Sf(e),l=i===0?$x:Gx,u=e.start,c,p,f=0;f<e.length-3;f+=3){var y=e[f],m=e[f+1],h=e[f+2],d=e[f+3],g=e[f+4],v=i===0?y:m,b=i===0?d:g,x=!1;a&&(c=Math.sqrt(Math.pow(y-d,2)+Math.pow(m-g,2))),v<r?b>r&&(p=l(s,y,m,d,g,r),a&&(s.start=u+c*p)):v>n?b<n&&(p=l(s,y,m,d,g,n),a&&(s.start=u+c*p)):Ys(s,y,m,h),b<r&&v>=r&&(p=l(s,y,m,d,g,r),x=!0),b>n&&v<=n&&(p=l(s,y,m,d,g,n),x=!0),!o&&x&&(a&&(s.end=u+c*p),t.push(s),s=Sf(e)),a&&(u+=c)}var P=e.length-3;y=e[P],m=e[P+1],h=e[P+2],v=i===0?y:m,v>=r&&v<=n&&Ys(s,y,m,h),P=s.length-3,o&&P>=3&&(s[P]!==s[0]||s[P+1]!==s[1])&&Ys(s,s[0],s[1],s[2]),s.length&&t.push(s)}function Sf(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function Ks(e,t,r,n,i,o){for(var a=0;a<e.length;a++)wf(e[a],t,r,n,i,o,!1)}function Ys(e,t,r,n){e.push(t),e.push(r),e.push(n)}function $x(e,t,r,n,i,o){var a=(o-t)/(n-t);return e.push(o),e.push(r+(i-r)*a),e.push(1),a}function Gx(e,t,r,n,i,o){var a=(o-r)/(i-r);return e.push(t+(n-t)*a),e.push(o),e.push(1),a}function Qs(e,t){var r=t.buffer/t.extent,n=e,i=Ue(e,1,-1-r,r,0,-1,2,t),o=Ue(e,1,1-r,2+r,0,-1,2,t);return(i||o)&&(n=Ue(e,1,-r,1+r,0,-1,2,t)||[],i&&(n=Af(i,1).concat(n)),o&&(n=n.concat(Af(o,-1)))),n}function Af(e,t){for(var r=[],n=0;n<e.length;n++){var i=e[n],o=i.type,a;if(o==="Point"||o==="MultiPoint"||o==="LineString")a=Xs(i.geometry,t);else if(o==="MultiLineString"||o==="Polygon"){a=[];for(var s=0;s<i.geometry.length;s++)a.push(Xs(i.geometry[s],t))}else if(o==="MultiPolygon")for(a=[],s=0;s<i.geometry.length;s++){for(var l=[],u=0;u<i.geometry[s].length;u++)l.push(Xs(i.geometry[s][u],t));a.push(l)}r.push(pt(i.id,o,a,i.tags))}return r}function Xs(e,t){var r=[];r.size=e.size,e.start!==void 0&&(r.start=e.start,r.end=e.end);for(var n=0;n<e.length;n+=3)r.push(e[n]+t,e[n+1],e[n+2]);return r}function ua(e,t){if(e.transformed)return e;var r=1<<e.z,n=e.x,i=e.y,o,a,s;for(o=0;o<e.features.length;o++){var l=e.features[o],u=l.geometry,c=l.type;if(l.geometry=[],c===1)for(a=0;a<u.length;a+=2)l.geometry.push(_f(u[a],u[a+1],t,r,n,i));else for(a=0;a<u.length;a++){var p=[];for(s=0;s<u[a].length;s+=2)p.push(_f(u[a][s],u[a][s+1],t,r,n,i));l.geometry.push(p)}}return e.transformed=!0,e}function _f(e,t,r,n,i,o){return[Math.round(r*(e*n-i)),Math.round(r*(t*n-o))]}function tl(e,t,r,n,i){for(var o=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),a={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0},s=0;s<e.length;s++){a.numFeatures++,qx(a,e[s],o,i);var l=e[s].minX,u=e[s].minY,c=e[s].maxX,p=e[s].maxY;l<a.minX&&(a.minX=l),u<a.minY&&(a.minY=u),c>a.maxX&&(a.maxX=c),p>a.maxY&&(a.maxY=p)}return a}function qx(e,t,r,n){var i=t.geometry,o=t.type,a=[];if(o==="Point"||o==="MultiPoint")for(var s=0;s<i.length;s+=3)a.push(i[s]),a.push(i[s+1]),e.numPoints++,e.numSimplified++;else if(o==="LineString")el(a,i,e,r,!1,!1);else if(o==="MultiLineString"||o==="Polygon")for(s=0;s<i.length;s++)el(a,i[s],e,r,o==="Polygon",s===0);else if(o==="MultiPolygon")for(var l=0;l<i.length;l++){var u=i[l];for(s=0;s<u.length;s++)el(a,u[s],e,r,!0,s===0)}if(a.length){var c=t.tags||null;if(o==="LineString"&&n.lineMetrics){c={};for(var p in t.tags)c[p]=t.tags[p];c.mapbox_clip_start=i.start/i.size,c.mapbox_clip_end=i.end/i.size}var f={geometry:a,type:o==="Polygon"||o==="MultiPolygon"?3:o==="LineString"||o==="MultiLineString"?2:1,tags:c};t.id!==null&&(f.id=t.id),e.features.push(f)}}function el(e,t,r,n,i,o){var a=n*n;if(n>0&&t.size<(i?a:n)){r.numPoints+=t.length/3;return}for(var s=[],l=0;l<t.length;l+=3)(n===0||t[l+2]>a)&&(r.numSimplified++,s.push(t[l]),s.push(t[l+1])),r.numPoints++;i&&jx(s,o),e.push(s)}function jx(e,t){for(var r=0,n=0,i=e.length,o=i-2;n<i;o=n,n+=2)r+=(e[n]-e[o])*(e[n+1]+e[o+1]);if(r>0===t)for(n=0,i=e.length;n<i/2;n+=2){var a=e[n],s=e[n+1];e[n]=e[i-2-n],e[n+1]=e[i-1-n],e[i-2-n]=a,e[i-1-n]=s}}function nl(e,t){return new ca(e,t)}function ca(e,t){t=this.options=Zx(Object.create(this.options),t);var r=t.debug;if(r&&console.time("preprocess data"),t.maxZoom<0||t.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(t.promoteId&&t.generateId)throw new Error("promoteId and generateId cannot be used together.");var n=Hs(e,t);this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",t.indexMaxZoom,t.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),n=Qs(n,t),n.length&&this.splitTile(n,0,0,0),r&&(n.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)))}ca.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};ca.prototype.splitTile=function(e,t,r,n,i,o,a){for(var s=[e,t,r,n],l=this.options,u=l.debug;s.length;){n=s.pop(),r=s.pop(),t=s.pop(),e=s.pop();var c=1<<t,p=rl(t,r,n),f=this.tiles[p];if(!f&&(u>1&&console.time("creation"),f=this.tiles[p]=tl(e,t,r,n,l),this.tileCoords.push({z:t,x:r,y:n}),u)){u>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",t,r,n,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd("creation"));var y="z"+t;this.stats[y]=(this.stats[y]||0)+1,this.total++}if(f.source=e,i){if(t===l.maxZoom||t===i)continue;var m=1<<i-t;if(r!==Math.floor(o/m)||n!==Math.floor(a/m))continue}else if(t===l.indexMaxZoom||f.numPoints<=l.indexMaxPoints)continue;if(f.source=null,e.length!==0){u>1&&console.time("clipping");var h=.5*l.buffer/l.extent,d=.5-h,g=.5+h,v=1+h,b,x,P,w,A,T;b=x=P=w=null,A=Ue(e,c,r-h,r+g,0,f.minX,f.maxX,l),T=Ue(e,c,r+d,r+v,0,f.minX,f.maxX,l),e=null,A&&(b=Ue(A,c,n-h,n+g,1,f.minY,f.maxY,l),x=Ue(A,c,n+d,n+v,1,f.minY,f.maxY,l),A=null),T&&(P=Ue(T,c,n-h,n+g,1,f.minY,f.maxY,l),w=Ue(T,c,n+d,n+v,1,f.minY,f.maxY,l),T=null),u>1&&console.timeEnd("clipping"),s.push(b||[],t+1,r*2,n*2),s.push(x||[],t+1,r*2,n*2+1),s.push(P||[],t+1,r*2+1,n*2),s.push(w||[],t+1,r*2+1,n*2+1)}}};ca.prototype.getTile=function(e,t,r){var n=this.options,i=n.extent,o=n.debug;if(e<0||e>24)return null;var a=1<<e;t=(t%a+a)%a;var s=rl(e,t,r);if(this.tiles[s])return ua(this.tiles[s],i);o>1&&console.log("drilling down to z%d-%d-%d",e,t,r);for(var l=e,u=t,c=r,p;!p&&l>0;)l--,u=Math.floor(u/2),c=Math.floor(c/2),p=this.tiles[rl(l,u,c)];return!p||!p.source?null:(o>1&&console.log("found parent tile z%d-%d-%d",l,u,c),o>1&&console.time("drilling down"),this.splitTile(p.source,l,u,c,e,t,r),o>1&&console.timeEnd("drilling down"),this.tiles[s]?ua(this.tiles[s],i):null)};function rl(e,t,r){return((1<<e)*r+t)*32+e}function Zx(e,t){for(var r in t)e[r]=t[r];return e}function pi(e,t){return t?e.properties[t]:e.id}function il(e,t){if(e==null)return!0;if(e.type==="Feature")return pi(e,t)!=null;if(e.type==="FeatureCollection"){let r=new Set;for(let n of e.features){let i=pi(n,t);if(i==null||r.has(i))return!1;r.add(i)}return!0}return!1}function ol(e,t){let r=new Map;if(e!=null)if(e.type==="Feature")r.set(pi(e,t),e);else for(let n of e.features)r.set(pi(n,t),n);return r}function If(e,t,r){var n,i,o,a;if(t.removeAll&&e.clear(),t.remove)for(let s of t.remove)e.delete(s);if(t.add)for(let s of t.add){let l=pi(s,r);l!=null&&e.set(l,s)}if(t.update)for(let s of t.update){let l=e.get(s.id);if(l==null)continue;let u=s.newGeometry||s.removeAllProperties,c=!s.removeAllProperties&&(((n=s.removeProperties)==null?void 0:n.length)>0||((i=s.addOrUpdateProperties)==null?void 0:i.length)>0);if((u||c)&&(l={...l},e.set(s.id,l),c&&(l.properties={...l.properties})),s.newGeometry&&(l.geometry=s.newGeometry),s.removeAllProperties)l.properties={};else if(((o=s.removeProperties)==null?void 0:o.length)>0)for(let p of s.removeProperties)Object.prototype.hasOwnProperty.call(l.properties,p)&&delete l.properties[p];if(((a=s.addOrUpdateProperties)==null?void 0:a.length)>0)for(let{key:p,value:f}of s.addOrUpdateProperties)l.properties[p]=f}}function Jx(e,t){let r=e.tileID.canonical;if(!this._geoJSONIndex)return t(null,null);let n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return t(null,null);let i=new ia(n.features),o=(0,kf.default)(i);(o.byteOffset!==0||o.byteLength!==o.buffer.byteLength)&&(o=new Uint8Array(o)),t(null,{vectorTile:i,rawData:o.buffer})}var pa=class extends Br{constructor(r,n,i,o){super(r,n,i,Jx);this._dataUpdateable=new Map;this.loadGeoJSON=(r,n)=>{let{promoteId:i}=r;if(r.request)return gu(r.request,(o,a,s,l)=>{this._dataUpdateable=il(a,i)?ol(a,i):void 0,n(o,a,s,l)});if(typeof r.data=="string")try{let o=JSON.parse(r.data);this._dataUpdateable=il(o,i)?ol(o,i):void 0,n(null,o)}catch{n(new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object.")))}else r.dataDiff?this._dataUpdateable?(If(this._dataUpdateable,r.dataDiff,i),n(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):n(new Error("Cannot update existing geojson data in ".concat(r.source))):n(new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object.")));return{cancel:()=>{}}};o&&(this.loadGeoJSON=o)}loadData(r,n){var o;(o=this._pendingRequest)==null||o.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});let i=r&&r.request&&r.request.collectResourceTiming?new Vr(r.request):!1;this._pendingCallback=n,this._pendingRequest=this.loadGeoJSON(r,(a,s)=>{if(delete this._pendingCallback,delete this._pendingRequest,a||!s)return n(a);if(typeof s!="object")return n(new Error("Input data given to \'".concat(r.source,"\' is not a valid GeoJSON object.")));{(0,Cf.default)(s,!0);try{if(r.filter){let u=Rt(r.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(u.result==="error")throw new Error(u.value.map(p=>"".concat(p.key,": ").concat(p.message)).join(", "));s={type:"FeatureCollection",features:s.features.filter(p=>u.value.evaluate({zoom:0},p))}}this._geoJSONIndex=r.cluster?new ui(Wx(r)).load(s.features):nl(s,r.geojsonVtOptions)}catch(u){return n(u)}this.loaded={};let l={};if(i){let u=i.finish();u&&(l.resourceTiming={},l.resourceTiming[r.source]=JSON.parse(JSON.stringify(u)))}n(null,l)}})}reloadTile(r,n){let i=this.loaded,o=r.uid;return i&&i[o]?super.reloadTile(r,n):this.loadTile(r,n)}removeSource(r,n){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),n()}getClusterExpansionZoom(r,n){try{n(null,this._geoJSONIndex.getClusterExpansionZoom(r.clusterId))}catch(i){n(i)}}getClusterChildren(r,n){try{n(null,this._geoJSONIndex.getChildren(r.clusterId))}catch(i){n(i)}}getClusterLeaves(r,n){try{n(null,this._geoJSONIndex.getLeaves(r.clusterId,r.limit,r.offset))}catch(i){n(i)}}};function Wx({superclusterOptions:e,clusterProperties:t}){if(!t||!e)return e;let r={},n={},i={accumulated:null,zoom:0},o={properties:null},a=Object.keys(t);for(let s of a){let[l,u]=t[s],c=Rt(u),p=Rt(typeof l=="string"?[l,["accumulated"],["get",s]]:l);r[s]=c.value,n[s]=p.value}return e.map=s=>{o.properties=s;let l={};for(let u of a)l[u]=r[u].evaluate(i,o);return l},e.reduce=(s,l)=>{o.properties=l;for(let u of a)i.accumulated=s[u],s[u]=n[u].evaluate(i,o)},e}var fa=class{constructor(t){this.self=t,this.actor=new Oi(t,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:Br,geojson:pa},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(r,n)=>{if(this.workerSourceTypes[r])throw new Error(\'Worker source with name "\'.concat(r,\'" already registered.\'));this.workerSourceTypes[r]=n},this.self.registerRTLTextPlugin=r=>{if(ae.isParsed())throw new Error("RTL text plugin already registered.");ae.applyArabicShaping=r.applyArabicShaping,ae.processBidirectionalText=r.processBidirectionalText,ae.processStyledBidirectionalText=r.processStyledBidirectionalText}}setReferrer(t,r){this.referrer=r}setImages(t,r,n){this.availableImages[t]=r;for(let i in this.workerSources[t]){let o=this.workerSources[t][i];for(let a in o)o[a].availableImages=r}n()}setLayers(t,r,n){this.getLayerIndex(t).replace(r),n()}updateLayers(t,r,n){this.getLayerIndex(t).update(r.layers,r.removedIds),n()}loadTile(t,r,n){this.getWorkerSource(t,r.type,r.source).loadTile(r,n)}loadDEMTile(t,r,n){this.getDEMWorkerSource(t,r.source).loadTile(r,n)}reloadTile(t,r,n){this.getWorkerSource(t,r.type,r.source).reloadTile(r,n)}abortTile(t,r,n){this.getWorkerSource(t,r.type,r.source).abortTile(r,n)}removeTile(t,r,n){this.getWorkerSource(t,r.type,r.source).removeTile(r,n)}removeDEMTile(t,r){this.getDEMWorkerSource(t,r.source).removeTile(r)}removeSource(t,r,n){if(!this.workerSources[t]||!this.workerSources[t][r.type]||!this.workerSources[t][r.type][r.source])return;let i=this.workerSources[t][r.type][r.source];delete this.workerSources[t][r.type][r.source],i.removeSource!==void 0?i.removeSource(r,n):n()}loadWorkerSource(t,r,n){try{this.self.importScripts(r.url),n()}catch(i){n(i.toString())}}syncRTLPluginState(t,r,n){try{ae.setState(r);let i=ae.getPluginURL();if(ae.isLoaded()&&!ae.isParsed()&&i!=null){this.self.importScripts(i);let o=ae.isParsed(),a=o?void 0:new Error("RTL Text Plugin failed to import scripts from ".concat(i));n(a,o)}}catch(i){n(i.toString())}}getAvailableImages(t){let r=this.availableImages[t];return r||(r=[]),r}getLayerIndex(t){let r=this.layerIndexes[t];return r||(r=this.layerIndexes[t]=new Jo),r}getWorkerSource(t,r,n){if(this.workerSources[t]||(this.workerSources[t]={}),this.workerSources[t][r]||(this.workerSources[t][r]={}),!this.workerSources[t][r][n]){let i={send:(o,a,s)=>{this.actor.send(o,a,s,t)}};this.workerSources[t][r][n]=new this.workerSourceTypes[r](i,this.getLayerIndex(t),this.getAvailableImages(t))}return this.workerSources[t][r][n]}getDEMWorkerSource(t,r){return this.demWorkerSources[t]||(this.demWorkerSources[t]={}),this.demWorkerSources[t][r]||(this.demWorkerSources[t][r]=new ra),this.demWorkerSources[t][r]}};Ie()&&(self.worker=new fa(self));})();\n/*! Bundled license information:\n\nieee754/index.js:\n (*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)\n*/\n';var Cb=u(()=>URL.createObjectURL(new Blob([ty],{type:"text/javascript"})),"getWorkerURL");function ry(){return new Worker(Cb())}u(ry,"workerFactory");var Qo="mapboxgl_preloaded_worker_pool",Yo=class Yo{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length<Yo.workerCount;)this.workers.push(ry());return this.active[t]=!0,this.workers.slice()}release(t){delete this.active[t],this.numActive()===0&&(this.workers.forEach(e=>{e.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Qo]}numActive(){return Object.keys(this.active).length}};u(Yo,"WorkerPool");var Yt=Yo,Eb=Math.floor(ee.hardwareConcurrency/2);Yt.workerCount=ar(globalThis)?Math.max(Math.min(Eb,3),1):1;var pn;function sp(){return pn||(pn=new Yt),pn}u(sp,"getGlobalWorkerPool");function iy(){sp().acquire(Qo)}u(iy,"prewarm");function ny(){let n=pn;n&&(n.isPreloaded()&&n.numActive()===1?(n.release(Qo),pn=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()"))}u(ny,"clearPrewarmedResources");f();f();f();var _t=te(be(),1);f();var Et=te(be(),1);function lp(n,t,e,r,i){let o=[];for(let a=0;a<n.length;a++){let s=n[a],l;for(let c=0;c<s.length-1;c++){let p=s[c],m=s[c+1];p.x<t&&m.x<t||(p.x<t?p=new Et.default(t,p.y+(m.y-p.y)*((t-p.x)/(m.x-p.x)))._round():m.x<t&&(m=new Et.default(t,p.y+(m.y-p.y)*((t-p.x)/(m.x-p.x)))._round()),!(p.y<e&&m.y<e)&&(p.y<e?p=new Et.default(p.x+(m.x-p.x)*((e-p.y)/(m.y-p.y)),e)._round():m.y<e&&(m=new Et.default(p.x+(m.x-p.x)*((e-p.y)/(m.y-p.y)),e)._round()),!(p.x>=r&&m.x>=r)&&(p.x>=r?p=new Et.default(r,p.y+(m.y-p.y)*((r-p.x)/(m.x-p.x)))._round():m.x>=r&&(m=new Et.default(r,p.y+(m.y-p.y)*((r-p.x)/(m.x-p.x)))._round()),!(p.y>=i&&m.y>=i)&&(p.y>=i?p=new Et.default(p.x+(m.x-p.x)*((i-p.y)/(m.y-p.y)),i)._round():m.y>=i&&(m=new Et.default(p.x+(m.x-p.x)*((i-p.y)/(m.y-p.y)),i)._round()),(!l||!p.equals(l[l.length-1]))&&(l=[p],o.push(l)),l.push(m)))))}}return o}u(lp,"clipLine");f();var up=class up{constructor(t,e){this.reset(t,e)}reset(t,e){this.points=t||[],this._distances=[0];for(let r=1;r<this.points.length;r++)this._distances[r]=this._distances[r-1]+this.points[r].dist(this.points[r-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(e||0,this.length*.5),this.paddedLength=this.length-this.padding*2}lerp(t){if(this.points.length===1)return this.points[0];t=ye(t,0,1);let e=1,r=this._distances[e],i=t*this.paddedLength+this.padding;for(;r<i&&e<this._distances.length;)r=this._distances[++e];let o=e-1,a=this._distances[o],s=r-a,l=s>0?(i-a)/s:0;return this.points[o].mult(1-l).add(this.points[e].mult(l))}};u(up,"PathInterpolator");var ea=up;f();function ta(n,t){let e=!0;return n==="always"||(n==="never"||t==="never")&&(e=!1),e}u(ta,"overlapAllowed");var cp=class cp{constructor(t,e,r){let i=this.boxCells=[],o=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(let a=0;a<this.xCellCount*this.yCellCount;a++)i.push([]),o.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=t,this.height=e,this.xScale=this.xCellCount/t,this.yScale=this.yCellCount/e,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(t,e,r,i,o){this._forEachCell(e,r,i,o,this._insertBoxCell,this.boxUid++),this.boxKeys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(i),this.bboxes.push(o)}insertCircle(t,e,r,i){this._forEachCell(e-i,r-i,e+i,r+i,this._insertCircleCell,this.circleUid++),this.circleKeys.push(t),this.circles.push(e),this.circles.push(r),this.circles.push(i)}_insertBoxCell(t,e,r,i,o,a){this.boxCells[o].push(a)}_insertCircleCell(t,e,r,i,o,a){this.circleCells[o].push(a)}_query(t,e,r,i,o,a,s){if(r<0||t>this.width||i<0||e>this.height)return[];let l=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=i){if(o)return[{key:null,x1:t,y1:e,x2:r,y2:i}];for(let c=0;c<this.boxKeys.length;c++)l.push({key:this.boxKeys[c],x1:this.bboxes[c*4],y1:this.bboxes[c*4+1],x2:this.bboxes[c*4+2],y2:this.bboxes[c*4+3]});for(let c=0;c<this.circleKeys.length;c++){let p=this.circles[c*3],m=this.circles[c*3+1],h=this.circles[c*3+2];l.push({key:this.circleKeys[c],x1:p-h,y1:m-h,x2:p+h,y2:m+h})}}else{let c={hitTest:o,overlapMode:a,seenUids:{box:{},circle:{}}};this._forEachCell(t,e,r,i,this._queryCell,l,c,s)}return l}query(t,e,r,i){return this._query(t,e,r,i,!1,null)}hitTest(t,e,r,i,o,a){return this._query(t,e,r,i,!0,o,a).length>0}hitTestCircle(t,e,r,i,o){let a=t-r,s=t+r,l=e-r,c=e+r;if(s<0||a>this.width||c<0||l>this.height)return!1;let p=[],m={hitTest:!0,overlapMode:i,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(a,l,s,c,this._queryCellCircle,p,m,o),p.length>0}_queryCell(t,e,r,i,o,a,s,l){let{seenUids:c,hitTest:p,overlapMode:m}=s,h=this.boxCells[o];if(h!==null){let g=this.bboxes;for(let y of h)if(!c.box[y]){c.box[y]=!0;let x=y*4,v=this.boxKeys[y];if(t<=g[x+2]&&e<=g[x+3]&&r>=g[x+0]&&i>=g[x+1]&&(!l||l(v))&&(!p||!ta(m,v.overlapMode))&&(a.push({key:v,x1:g[x],y1:g[x+1],x2:g[x+2],y2:g[x+3]}),p))return!0}}let d=this.circleCells[o];if(d!==null){let g=this.circles;for(let y of d)if(!c.circle[y]){c.circle[y]=!0;let x=y*3,v=this.circleKeys[y];if(this._circleAndRectCollide(g[x],g[x+1],g[x+2],t,e,r,i)&&(!l||l(v))&&(!p||!ta(m,v.overlapMode))){let b=g[x],w=g[x+1],S=g[x+2];if(a.push({key:v,x1:b-S,y1:w-S,x2:b+S,y2:w+S}),p)return!0}}}return!1}_queryCellCircle(t,e,r,i,o,a,s,l){let{circle:c,seenUids:p,overlapMode:m}=s,h=this.boxCells[o];if(h!==null){let g=this.bboxes;for(let y of h)if(!p.box[y]){p.box[y]=!0;let x=y*4,v=this.boxKeys[y];if(this._circleAndRectCollide(c.x,c.y,c.radius,g[x+0],g[x+1],g[x+2],g[x+3])&&(!l||l(v))&&!ta(m,v.overlapMode))return a.push(!0),!0}}let d=this.circleCells[o];if(d!==null){let g=this.circles;for(let y of d)if(!p.circle[y]){p.circle[y]=!0;let x=y*3,v=this.circleKeys[y];if(this._circlesCollide(g[x],g[x+1],g[x+2],c.x,c.y,c.radius)&&(!l||l(v))&&!ta(m,v.overlapMode))return a.push(!0),!0}}}_forEachCell(t,e,r,i,o,a,s,l){let c=this._convertToXCellCoord(t),p=this._convertToYCellCoord(e),m=this._convertToXCellCoord(r),h=this._convertToYCellCoord(i);for(let d=c;d<=m;d++)for(let g=p;g<=h;g++){let y=this.xCellCount*g+d;if(o.call(this,t,e,r,i,y,a,s,l))return}}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,e,r,i,o,a){let s=i-t,l=o-e,c=r+a;return c*c>s*s+l*l}_circleAndRectCollide(t,e,r,i,o,a,s){let l=(a-i)/2,c=Math.abs(t-(i+l));if(c>l+r)return!1;let p=(s-o)/2,m=Math.abs(e-(o+p));if(m>p+r)return!1;if(c<=l||m<=p)return!0;let h=c-l,d=m-p;return h*h+d*d<=r*r}};u(cp,"GridIndex");var mn=cp;f();var oi=te(be(),1);function hn(n,t,e,r,i){let o=G.create();return t?(G.scale(o,o,[1/i,1/i,1]),e||G.rotateZ(o,o,r.angle)):G.multiply(o,r.labelPlaneMatrix,n),o}u(hn,"getLabelPlaneMatrix");function ia(n,t,e,r,i){if(t){let o=G.clone(n);return G.scale(o,o,[i,i,1]),e||G.rotateZ(o,o,-r.angle),o}else return r.glCoordMatrix}u(ia,"getGlCoordMatrix");function rt(n,t,e){let r;e?(r=[n.x,n.y,e(n.x,n.y),1],Re.transformMat4(r,r,t)):(r=[n.x,n.y,0,1],na(r,r,t));let i=r[3];return{point:new oi.default(r[0]/i,r[1]/i),signedDistanceFromCamera:i}}u(rt,"project");function fn(n,t){return .5+.5*(n/t)}u(fn,"getPerspectiveRatio");function Mb(n,t){let e=n[0]/n[3],r=n[1]/n[3];return e>=-t[0]&&e<=t[0]&&r>=-t[1]&&r<=t[1]}u(Mb,"isVisible");function sy(n,t,e,r,i,o,a,s,l,c){let p=r?n.textSizeData:n.iconSizeData,m=br(p,e.transform.zoom),h=[256/e.width*2+1,256/e.height*2+1],d=r?n.text.dynamicLayoutVertexArray:n.icon.dynamicLayoutVertexArray;d.clear();let g=n.lineVertexArray,y=r?n.text.placedSymbolArray:n.icon.placedSymbolArray,x=e.transform.width/e.transform.height,v=!1;for(let b=0;b<y.length;b++){let w=y.get(b);if(w.hidden||w.writingMode===2&&!v){Ir(w.numGlyphs,d);continue}v=!1;let S;if(c?(S=[w.anchorX,w.anchorY,c(w.anchorX,w.anchorY),1],Re.transformMat4(S,S,t)):(S=[w.anchorX,w.anchorY,0,1],na(S,S,t)),!Mb(S,h)){Ir(w.numGlyphs,d);continue}let P=S[3],I=fn(e.transform.cameraToCenterDistance,P),C=Zr(p,m,w),z=a?C/I:C*I,D=new oi.default(w.anchorX,w.anchorY),A=rt(D,i,c).point,R={projections:{},offsets:{}},U=ay(w,z,!1,s,t,i,o,n.glyphOffsetArray,g,d,A,D,R,x,l,c);v=U.useVertical,(U.notEnoughRoom||v||U.needsFlipping&&ay(w,z,!0,s,t,i,o,n.glyphOffsetArray,g,d,A,D,R,x,l,c).notEnoughRoom)&&Ir(w.numGlyphs,d)}r?n.text.dynamicLayoutVertexBuffer.updateData(d):n.icon.dynamicLayoutVertexBuffer.updateData(d)}u(sy,"updateLineLabels");function hp(n,t,e,r,i,o,a,s,l,c,p,m,h){let d=s.glyphStartIndex+s.numGlyphs,g=s.lineStartIndex,y=s.lineStartIndex+s.lineLength,x=t.getoffsetX(s.glyphStartIndex),v=t.getoffsetX(d-1),b=ra(n*x,e,r,i,o,a,s.segment,g,y,l,c,p,m,h);if(!b)return null;let w=ra(n*v,e,r,i,o,a,s.segment,g,y,l,c,p,m,h);return w?{first:b,last:w}:null}u(hp,"placeFirstAndLastGlyph");function oy(n,t,e,r){if(n===1){let i=Math.abs(e.y-t.y),o=Math.abs(e.x-t.x)*r;if(i>o)return{useVertical:!0}}return(n===2?t.y<e.y:t.x>e.x)?{needsFlipping:!0}:null}u(oy,"requiresOrientationChange");function ay(n,t,e,r,i,o,a,s,l,c,p,m,h,d,g,y){let x=t/24,v=n.lineOffsetX*x,b=n.lineOffsetY*x,w;if(n.numGlyphs>1){let S=n.glyphStartIndex+n.numGlyphs,P=n.lineStartIndex,I=n.lineStartIndex+n.lineLength,C=hp(x,s,v,b,e,p,m,n,l,o,h,g,y);if(!C)return{notEnoughRoom:!0};let z=rt(C.first.point,a,y).point,D=rt(C.last.point,a,y).point;if(r&&!e){let A=oy(n.writingMode,z,D,d);if(A)return A}w=[C.first];for(let A=n.glyphStartIndex+1;A<S-1;A++)w.push(ra(x*s.getoffsetX(A),v,b,e,p,m,n.segment,P,I,l,o,h,g,y));w.push(C.last)}else{if(r&&!e){let P=rt(m,i,y).point,I=n.lineStartIndex+n.segment+1,C=new oi.default(l.getx(I),l.gety(I)),z=rt(C,i,y),D=z.signedDistanceFromCamera>0?z.point:ly(m,C,P,1,i,y),A=oy(n.writingMode,P,D,d);if(A)return A}let S=ra(x*s.getoffsetX(n.glyphStartIndex),v,b,e,p,m,n.segment,n.lineStartIndex,n.lineStartIndex+n.lineLength,l,o,h,g,y);if(!S)return{notEnoughRoom:!0};w=[S]}for(let S of w)vr(c,S.point,S.angle);return{}}u(ay,"placeGlyphsAlongLine");function ly(n,t,e,r,i,o){let a=rt(n.add(n.sub(t)._unit()),i,o).point,s=e.sub(a);return e.add(s._mult(r/s.mag()))}u(ly,"projectTruncatedLineSegment");function pp(n,t){let{projectionCache:e,lineVertexArray:r,labelPlaneMatrix:i,tileAnchorPoint:o,distanceFromAnchor:a,getElevation:s,previousVertex:l,direction:c,absOffsetX:p}=t;if(e.projections[n])return e.projections[n];let m=new oi.default(r.getx(n),r.gety(n)),h=rt(m,i,s);if(h.signedDistanceFromCamera>0)return e.projections[n]=h.point,h.point;let d=n-c,g=a===0?o:new oi.default(r.getx(d),r.gety(d));return ly(g,m,l,p-a+1,i,s)}u(pp,"projectVertexToViewport");function mp(n,t,e){return n._unit()._perp()._mult(t*e)}u(mp,"transformToOffsetNormal");function Lb(n,t,e,r,i,o,a,s){let{projectionCache:l,direction:c}=s;if(l.offsets[n])return l.offsets[n];let p=e.add(t);if(n+c<r||n+c>=i)return l.offsets[n]=p,p;let m=pp(n+c,s),h=mp(m.sub(e),a,c),d=e.add(h),g=m.add(h);return l.offsets[n]=Jh(o,p,d,g)||p,l.offsets[n]}u(Lb,"findOffsetIntersectionPoint");function ra(n,t,e,r,i,o,a,s,l,c,p,m,h,d){let g=r?n-t:n+t,y=g>0?1:-1,x=0;r&&(y*=-1,x=Math.PI),y<0&&(x+=Math.PI);let v=y>0?s+a:s+a+1,b=i,w=i,S,P,I=0,C=0,z=Math.abs(g),D=[],A;for(;I+C<=z;){if(v+=y,v<s||v>=l)return null;I+=C,w=b,P=S;let N={projectionCache:m,lineVertexArray:c,labelPlaneMatrix:p,tileAnchorPoint:o,distanceFromAnchor:I,getElevation:d,previousVertex:w,direction:y,absOffsetX:z};if(b=pp(v,N),e===0)D.push(w),A=b.sub(w);else{let V,W=b.sub(w);if(W.mag()===0){let Z=pp(v+y,N);V=mp(Z.sub(b),e,y)}else V=mp(W,e,y);P||(P=w.add(V)),S=Lb(v,V,b,s,l,P,e,N),D.push(P),A=S.sub(P)}C=A.mag()}let R=(z-I)/C,U=A._mult(R)._add(P||w),L=x+Math.atan2(b.y-w.y,b.x-w.x);return D.push(U),{point:U,angle:h?L:0,path:D}}u(ra,"placeGlyphAlongLine");var kb=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ir(n,t){for(let e=0;e<n;e++){let r=t.length;t.resize(r+4),t.float32.set(kb,r*3)}}u(Ir,"hideGlyphs");function na(n,t,e){let r=t[0],i=t[1];return n[0]=e[0]*r+e[4]*i+e[12],n[1]=e[1]*r+e[5]*i+e[13],n[3]=e[3]*r+e[7]*i+e[15],n}u(na,"xyTransformMat4");var ze=100,dp=class dp{constructor(t,e=new mn(t.width+2*ze,t.height+2*ze,25),r=new mn(t.width+2*ze,t.height+2*ze,25)){this.transform=t,this.grid=e,this.ignoredGrid=r,this.pitchfactor=Math.cos(t._pitch)*t.cameraToCenterDistance,this.screenRightBoundary=t.width+ze,this.screenBottomBoundary=t.height+ze,this.gridRightBoundary=t.width+2*ze,this.gridBottomBoundary=t.height+2*ze,this.perspectiveRatioCutoff=.6}placeCollisionBox(t,e,r,i,o,a){let s=this.projectAndGetPerspectiveRatio(i,t.anchorPointX,t.anchorPointY,a),l=r*s.perspectiveRatio,c=t.x1*l+s.point.x,p=t.y1*l+s.point.y,m=t.x2*l+s.point.x,h=t.y2*l+s.point.y;return!this.isInsideGrid(c,p,m,h)||e!=="always"&&this.grid.hitTest(c,p,m,h,e,o)||s.perspectiveRatio<this.perspectiveRatioCutoff?{box:[],offscreen:!1}:{box:[c,p,m,h],offscreen:this.isOffscreen(c,p,m,h)}}placeCollisionCircles(t,e,r,i,o,a,s,l,c,p,m,h,d,g){let y=[],x=new _t.default(e.anchorX,e.anchorY),v=rt(x,a,g),b=fn(this.transform.cameraToCenterDistance,v.signedDistanceFromCamera),S=(p?o/b:o*b)/xr,P=rt(x,s,g).point,I={projections:{},offsets:{}},C=e.lineOffsetX*S,z=e.lineOffsetY*S,D=hp(S,i,C,z,!1,P,x,e,r,s,I,!1,g),A=!1,R=!1,U=!0;if(D){let L=h*.5*b+d,N=new _t.default(-ze,-ze),V=new _t.default(this.screenRightBoundary,this.screenBottomBoundary),W=new ea,Z=D.first,ue=D.last,Y=[];for(let ie=Z.path.length-1;ie>=1;ie--)Y.push(Z.path[ie]);for(let ie=1;ie<ue.path.length;ie++)Y.push(ue.path[ie]);let Oe=L*2.5;if(l){let ie=Y.map(ge=>rt(ge,l,g));ie.some(ge=>ge.signedDistanceFromCamera<=0)?Y=[]:Y=ie.map(ge=>ge.point)}let Be=[];if(Y.length>0){let ie=Y[0].clone(),ge=Y[0].clone();for(let Ve=1;Ve<Y.length;Ve++)ie.x=Math.min(ie.x,Y[Ve].x),ie.y=Math.min(ie.y,Y[Ve].y),ge.x=Math.max(ge.x,Y[Ve].x),ge.y=Math.max(ge.y,Y[Ve].y);ie.x>=N.x&&ge.x<=V.x&&ie.y>=N.y&&ge.y<=V.y?Be=[Y]:ge.x<N.x||ie.x>V.x||ge.y<N.y||ie.y>V.y?Be=[]:Be=lp([Y],N.x,N.y,V.x,V.y)}for(let ie of Be){W.reset(ie,L*.25);let ge=0;W.length<=.5*L?ge=1:ge=Math.ceil(W.paddedLength/Oe)+1;for(let Ve=0;Ve<ge;Ve++){let Lt=Ve/Math.max(ge-1,1),kt=W.lerp(Lt),mt=kt.x+ze,vt=kt.y+ze;y.push(mt,vt,L,0);let nr=mt-L,Ue=vt-L,De=mt+L,ce=vt+L;if(U=U&&this.isOffscreen(nr,Ue,De,ce),R=R||this.isInsideGrid(nr,Ue,De,ce),t!=="always"&&this.grid.hitTestCircle(mt,vt,L,t,m)&&(A=!0,!c))return{circles:[],offscreen:!1,collisionDetected:A}}}}return{circles:!c&&A||!R||b<this.perspectiveRatioCutoff?[]:y,offscreen:U,collisionDetected:A}}queryRenderedSymbols(t){if(t.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};let e=[],r=1/0,i=1/0,o=-1/0,a=-1/0;for(let p of t){let m=new _t.default(p.x+ze,p.y+ze);r=Math.min(r,m.x),i=Math.min(i,m.y),o=Math.max(o,m.x),a=Math.max(a,m.y),e.push(m)}let s=this.grid.query(r,i,o,a).concat(this.ignoredGrid.query(r,i,o,a)),l={},c={};for(let p of s){let m=p.key;if(l[m.bucketInstanceId]===void 0&&(l[m.bucketInstanceId]={}),l[m.bucketInstanceId][m.featureIndex])continue;let h=[new _t.default(p.x1,p.y1),new _t.default(p.x2,p.y1),new _t.default(p.x2,p.y2),new _t.default(p.x1,p.y2)];yo(e,h)&&(l[m.bucketInstanceId][m.featureIndex]=!0,c[m.bucketInstanceId]===void 0&&(c[m.bucketInstanceId]=[]),c[m.bucketInstanceId].push(m.featureIndex))}return c}insertCollisionBox(t,e,r,i,o,a){let s=r?this.ignoredGrid:this.grid,l={bucketInstanceId:i,featureIndex:o,collisionGroupID:a,overlapMode:e};s.insert(l,t[0],t[1],t[2],t[3])}insertCollisionCircles(t,e,r,i,o,a){let s=r?this.ignoredGrid:this.grid,l={bucketInstanceId:i,featureIndex:o,collisionGroupID:a,overlapMode:e};for(let c=0;c<t.length;c+=4)s.insertCircle(l,t[c],t[c+1],t[c+2])}projectAndGetPerspectiveRatio(t,e,r,i){let o;return i?(o=[e,r,i(e,r),1],Re.transformMat4(o,o,t)):(o=[e,r,0,1],na(o,o,t)),{point:new _t.default((o[0]/o[3]+1)/2*this.transform.width+ze,(-o[1]/o[3]+1)/2*this.transform.height+ze),perspectiveRatio:.5+.5*(this.transform.cameraToCenterDistance/o[3])}}isOffscreen(t,e,r,i){return r<ze||t>=this.screenRightBoundary||i<ze||e>this.screenBottomBoundary}isInsideGrid(t,e,r,i){return r>=0&&t<this.gridRightBoundary&&i>=0&&e<this.gridBottomBoundary}getViewportMatrix(){let t=G.identity([]);return G.translate(t,t,[-ze,-ze,0]),t}};u(dp,"CollisionIndex");var oa=dp;f();f();var uy=te(be(),1);var aa=class aa extends uy.default{constructor(e,r,i,o){super(e,r);this.angle=i,o!==void 0&&(this.segment=o)}clone(){return new aa(this.x,this.y,this.angle,this.segment)}};u(aa,"Anchor");var dn=aa;O("Anchor",dn);f();f();f();var Db=te(be(),1);f();var Fb=te(be(),1);f();var zb=te(be(),1);var Bb=te(zh(),1);var ai=7,Rb=Number.POSITIVE_INFINITY;function sa(n,t){function e(i,o){let a=0,s=0;o<0&&(o=0);let l=o/Math.sqrt(2);switch(i){case"top-right":case"top-left":s=l-ai;break;case"bottom-right":case"bottom-left":s=-l+ai;break;case"bottom":s=-o+ai;break;case"top":s=o-ai;break}switch(i){case"top-right":case"bottom-right":a=-l;break;case"top-left":case"bottom-left":a=l;break;case"left":a=o;break;case"right":a=-o;break}return[a,s]}u(e,"fromRadialOffset");function r(i,o,a){let s=0,l=0;switch(o=Math.abs(o),a=Math.abs(a),i){case"top-right":case"top-left":case"top":l=a-ai;break;case"bottom-right":case"bottom-left":case"bottom":l=-a+ai;break}switch(i){case"top-right":case"bottom-right":case"right":s=-o;break;case"top-left":case"bottom-left":case"left":s=o;break}return[s,l]}return u(r,"fromTextOffset"),t[1]!==Rb?r(n,t[0],t[1]):e(n,t[0])}u(sa,"evaluateVariableOffset");function cy(n){switch(n){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}u(cy,"getAnchorJustification");f();function Fe(n,t,e){return t*(8192/(n.tileSize*Math.pow(2,e-n.tileID.overscaledZ)))}u(Fe,"pixelsToTileUnits");var ma=te(be(),1);var bp=class bp{constructor(t,e,r,i){t?this.opacity=Math.max(0,Math.min(1,t.opacity+(t.placed?e:-e))):this.opacity=i&&r?1:0,this.placed=r}isHidden(){return this.opacity===0&&!this.placed}};u(bp,"OpacityState");var ua=bp,vp=class vp{constructor(t,e,r,i,o){this.text=new ua(t?t.text:null,e,r,o),this.icon=new ua(t?t.icon:null,e,i,o)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}};u(vp,"JointOpacityState");var Ar=vp,wp=class wp{constructor(t,e,r){this.text=t,this.icon=e,this.skipFade=r}};u(wp,"JointPlacement");var ca=wp,Sp=class Sp{constructor(){this.invProjMatrix=G.create(),this.viewportMatrix=G.create(),this.circles=[]}};u(Sp,"CollisionCircleArray");var gp=Sp,Pp=class Pp{constructor(t,e,r,i,o){this.bucketInstanceId=t,this.featureIndex=e,this.sourceLayerIndex=r,this.bucketIndex=i,this.tileID=o}};u(Pp,"RetainedQueryData");var xp=Pp,Tp=class Tp{constructor(t){this.crossSourceCollisions=t,this.maxGroupID=0,this.collisionGroups={}}get(t){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[t]){let e=++this.maxGroupID;this.collisionGroups[t]={ID:e,predicate:r=>r.collisionGroupID===e}}return this.collisionGroups[t]}};u(Tp,"CollisionGroups");var _p=Tp;function py(n,t,e,r,i){let{horizontalAlign:o,verticalAlign:a}=Mo(n),s=-(o-.5)*t,l=-(a-.5)*e,c=sa(n,r);return new ma.default(s+c[0]*i,l+c[1]*i)}u(py,"calculateVariableLayoutShift");function yp(n,t,e,r,i,o){let{x1:a,x2:s,y1:l,y2:c,anchorPointX:p,anchorPointY:m}=n,h=new ma.default(t,e);return r&&h._rotate(i?o:-o),{x1:a+h.x,y1:l+h.y,x2:s+h.x,y2:c+h.y,anchorPointX:p,anchorPointY:m}}u(yp,"shiftVariableCollisionBox");var Ip=class Ip{constructor(t,e,r,i,o){this.transform=t.clone(),this.terrain=e,this.collisionIndex=new oa(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=r,this.retainedQueryData={},this.collisionGroups=new _p(i),this.collisionCircleArrays={},this.prevPlacement=o,o&&(o.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,e,r,i){let o=r.getBucket(e),a=r.latestFeatureIndex;if(!o||!a||e.id!==o.layerIds[0])return;let s=r.collisionBoxArray,l=o.layers[0].layout,c=Math.pow(2,this.transform.zoom-r.tileID.overscaledZ),p=r.tileSize/8192,m=this.transform.calculatePosMatrix(r.tileID.toUnwrapped()),h=l.get("text-pitch-alignment")==="map",d=l.get("text-rotation-alignment")==="map",g=Fe(r,1,this.transform.zoom),y=hn(m,h,d,this.transform,g),x=null;if(h){let b=ia(m,h,d,this.transform,g);x=G.multiply([],this.transform.labelPlaneMatrix,b)}this.retainedQueryData[o.bucketInstanceId]=new xp(o.bucketInstanceId,a,o.sourceLayerIndex,o.index,r.tileID);let v={bucket:o,layout:l,posMatrix:m,textLabelPlaneMatrix:y,labelToScreenMatrix:x,scale:c,textPixelRatio:p,holdingForFade:r.holdingForFade(),collisionBoxArray:s,partiallyEvaluatedTextSize:br(o.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(o.sourceID)};if(i)for(let b of o.sortKeyRanges){let{sortKey:w,symbolInstanceStart:S,symbolInstanceEnd:P}=b;t.push({sortKey:w,symbolInstanceStart:S,symbolInstanceEnd:P,parameters:v})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:o.symbolInstances.length,parameters:v})}attemptAnchorPlacement(t,e,r,i,o,a,s,l,c,p,m,h,d,g,y,x){let v=[h.textOffset0,h.textOffset1],b=py(t,r,i,v,o),w=this.collisionIndex.placeCollisionBox(yp(e,b.x,b.y,a,s,this.transform.angle),m,l,c,p.predicate,x);if(!(y&&this.collisionIndex.placeCollisionBox(yp(y,b.x,b.y,a,s,this.transform.angle),m,l,c,p.predicate,x).box.length===0)&&w.box.length>0){let S;if(this.prevPlacement&&this.prevPlacement.variableOffsets[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID]&&this.prevPlacement.placements[h.crossTileID].text&&(S=this.prevPlacement.variableOffsets[h.crossTileID].anchor),h.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[h.crossTileID]={textOffset:v,width:r,height:i,anchor:t,textBoxScale:o,prevAnchor:S},this.markUsedJustification(d,t,h,g),d.allowVerticalPlacement&&(this.markUsedOrientation(d,g,h),this.placedOrientations[h.crossTileID]=g),{shift:b,placedGlyphBoxes:w}}}placeLayerBucketPart(t,e,r){let{bucket:i,layout:o,posMatrix:a,textLabelPlaneMatrix:s,labelToScreenMatrix:l,textPixelRatio:c,holdingForFade:p,collisionBoxArray:m,partiallyEvaluatedTextSize:h,collisionGroup:d}=t.parameters,g=o.get("text-optional"),y=o.get("icon-optional"),x=Wr(o,"text-overlap","text-allow-overlap"),v=x==="always",b=Wr(o,"icon-overlap","icon-allow-overlap"),w=b==="always",S=o.get("text-rotation-alignment")==="map",P=o.get("text-pitch-alignment")==="map",I=o.get("icon-text-fit")!=="none",C=o.get("symbol-z-order")==="viewport-y",z=v&&(w||!i.hasIconData()||y),D=w&&(v||!i.hasTextData()||g);!i.collisionArrays&&m&&i.deserializeCollisionBoxes(m);let A=this.retainedQueryData[i.bucketInstanceId].tileID,R=this.terrain?(L,N)=>this.terrain.getElevation(A,L,N):null,U=u((L,N)=>{if(e[L.crossTileID])return;if(p){this.placements[L.crossTileID]=new ca(!1,!1,!1);return}let V=!1,W=!1,Z=!0,ue=null,Y={box:null,offscreen:null},Oe={box:null,offscreen:null},Be=null,ie=null,ge=null,Ve=0,Lt=0,kt=0;N.textFeatureIndex?Ve=N.textFeatureIndex:L.useRuntimeCollisionCircles&&(Ve=L.featureIndex),N.verticalTextFeatureIndex&&(Lt=N.verticalTextFeatureIndex);let mt=N.textBox;if(mt){let Ue=u(ce=>{let it=1;if(i.allowVerticalPlacement&&!ce&&this.prevPlacement){let st=this.prevPlacement.placedOrientations[L.crossTileID];st&&(this.placedOrientations[L.crossTileID]=st,it=st,this.markUsedOrientation(i,it,L))}return it},"updatePreviousOrientationIfNotPlaced"),De=u((ce,it)=>{if(i.allowVerticalPlacement&&L.numVerticalGlyphVertices>0&&N.verticalTextBox){for(let st of i.writingModes)if(st===2?(Y=it(),Oe=Y):Y=ce(),Y&&Y.box&&Y.box.length)break}else Y=ce()},"placeTextForPlacementModes");if(o.get("text-variable-anchor")){let ce=o.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[L.crossTileID]){let Pe=this.prevPlacement.variableOffsets[L.crossTileID];ce.indexOf(Pe.anchor)>0&&(ce=ce.filter(or=>or!==Pe.anchor),ce.unshift(Pe.anchor))}let it=u((Pe,or,Zs)=>{let t_=Pe.x2-Pe.x1,r_=Pe.y2-Pe.y1,i_=L.textBoxScale,n_=I&&b==="never"?or:null,hi={box:[],offscreen:!1},o_=x!=="never"?ce.length*2:ce.length;for(let In=0;In<o_;++In){let a_=ce[In%ce.length],s_=In>=ce.length?x:"never",Ws=this.attemptAnchorPlacement(a_,Pe,t_,r_,i_,S,P,c,a,d,s_,L,i,Zs,n_,R);if(Ws&&(hi=Ws.placedGlyphBoxes,hi&&hi.box&&hi.box.length)){V=!0,ue=Ws.shift;break}}return hi},"placeBoxForVariableAnchors");De(u(()=>it(mt,N.iconBox,1),"placeHorizontal"),u(()=>{let Pe=N.verticalTextBox,or=Y&&Y.box&&Y.box.length;return i.allowVerticalPlacement&&!or&&L.numVerticalGlyphVertices>0&&Pe?it(Pe,N.verticalIconBox,2):{box:null,offscreen:null}},"placeVertical")),Y&&(V=Y.box,Z=Y.offscreen);let lt=Ue(Y&&Y.box);if(!V&&this.prevPlacement){let Pe=this.prevPlacement.variableOffsets[L.crossTileID];Pe&&(this.variableOffsets[L.crossTileID]=Pe,this.markUsedJustification(i,Pe.anchor,L,lt))}}else{let ce=u((Dt,lt)=>{let Pe=this.collisionIndex.placeCollisionBox(Dt,x,c,a,d.predicate,R);return Pe&&Pe.box&&Pe.box.length&&(this.markUsedOrientation(i,lt,L),this.placedOrientations[L.crossTileID]=lt),Pe},"placeBox");De(u(()=>ce(mt,1),"placeHorizontal"),u(()=>{let Dt=N.verticalTextBox;return i.allowVerticalPlacement&&L.numVerticalGlyphVertices>0&&Dt?ce(Dt,2):{box:null,offscreen:null}},"placeVertical")),Ue(Y&&Y.box&&Y.box.length)}}if(Be=Y,V=Be&&Be.box&&Be.box.length>0,Z=Be&&Be.offscreen,L.useRuntimeCollisionCircles){let Ue=i.text.placedSymbolArray.get(L.centerJustifiedTextSymbolIndex),De=Zr(i.textSizeData,h,Ue),ce=o.get("text-padding"),it=L.collisionCircleDiameter;ie=this.collisionIndex.placeCollisionCircles(x,Ue,i.lineVertexArray,i.glyphOffsetArray,De,a,s,l,r,P,d.predicate,it,ce,R),ie.circles.length&&ie.collisionDetected&&!r&&xe("Collisions detected, but collision boxes are not shown"),V=v||ie.circles.length>0&&!ie.collisionDetected,Z=Z&&ie.offscreen}if(N.iconFeatureIndex&&(kt=N.iconFeatureIndex),N.iconBox){let Ue=u(De=>{let ce=I&&ue?yp(De,ue.x,ue.y,S,P,this.transform.angle):De;return this.collisionIndex.placeCollisionBox(ce,b,c,a,d.predicate,R)},"placeIconFeature");Oe&&Oe.box&&Oe.box.length&&N.verticalIconBox?(ge=Ue(N.verticalIconBox),W=ge.box.length>0):(ge=Ue(N.iconBox),W=ge.box.length>0),Z=Z&&ge.offscreen}let vt=g||L.numHorizontalGlyphVertices===0&&L.numVerticalGlyphVertices===0,nr=y||L.numIconVertices===0;if(!vt&&!nr?W=V=W&&V:nr?vt||(W=W&&V):V=W&&V,V&&Be&&Be.box&&(Oe&&Oe.box&&Lt?this.collisionIndex.insertCollisionBox(Be.box,x,o.get("text-ignore-placement"),i.bucketInstanceId,Lt,d.ID):this.collisionIndex.insertCollisionBox(Be.box,x,o.get("text-ignore-placement"),i.bucketInstanceId,Ve,d.ID)),W&&ge&&this.collisionIndex.insertCollisionBox(ge.box,b,o.get("icon-ignore-placement"),i.bucketInstanceId,kt,d.ID),ie&&(V&&this.collisionIndex.insertCollisionCircles(ie.circles,x,o.get("text-ignore-placement"),i.bucketInstanceId,Ve,d.ID),r)){let Ue=i.bucketInstanceId,De=this.collisionCircleArrays[Ue];De===void 0&&(De=this.collisionCircleArrays[Ue]=new gp);for(let ce=0;ce<ie.circles.length;ce+=4)De.circles.push(ie.circles[ce+0]),De.circles.push(ie.circles[ce+1]),De.circles.push(ie.circles[ce+2]),De.circles.push(ie.collisionDetected?1:0)}if(L.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(i.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[L.crossTileID]=new ca(V||z,W||D,Z||i.justReloaded),e[L.crossTileID]=!0},"placeSymbol");if(C){if(t.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");let L=i.getSortedSymbolIndexes(this.transform.angle);for(let N=L.length-1;N>=0;--N){let V=L[N];U(i.symbolInstances.get(V),i.collisionArrays[V])}}else for(let L=t.symbolInstanceStart;L<t.symbolInstanceEnd;L++)U(i.symbolInstances.get(L),i.collisionArrays[L]);if(r&&i.bucketInstanceId in this.collisionCircleArrays){let L=this.collisionCircleArrays[i.bucketInstanceId];G.invert(L.invProjMatrix,a),L.viewportMatrix=this.collisionIndex.getViewportMatrix()}i.justReloaded=!1}markUsedJustification(t,e,r,i){let o={left:r.leftJustifiedTextSymbolIndex,center:r.centerJustifiedTextSymbolIndex,right:r.rightJustifiedTextSymbolIndex},a;i===2?a=r.verticalPlacedTextSymbolIndex:a=o[cy(e)];let s=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex,r.verticalPlacedTextSymbolIndex];for(let l of s)l>=0&&(a>=0&&l!==a?t.text.placedSymbolArray.get(l).crossTileID=0:t.text.placedSymbolArray.get(l).crossTileID=r.crossTileID)}markUsedOrientation(t,e,r){let i=e===1||e===3?e:0,o=e===2?e:0,a=[r.leftJustifiedTextSymbolIndex,r.centerJustifiedTextSymbolIndex,r.rightJustifiedTextSymbolIndex];for(let s of a)t.text.placedSymbolArray.get(s).placedOrientation=i;r.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(r.verticalPlacedTextSymbolIndex).placedOrientation=o)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;let e=this.prevPlacement,r=!1;this.prevZoomAdjustment=e?e.zoomAdjustment(this.transform.zoom):0;let i=e?e.symbolFadeChange(t):1,o=e?e.opacities:{},a=e?e.variableOffsets:{},s=e?e.placedOrientations:{};for(let l in this.placements){let c=this.placements[l],p=o[l];p?(this.opacities[l]=new Ar(p,i,c.text,c.icon),r=r||c.text!==p.text.placed||c.icon!==p.icon.placed):(this.opacities[l]=new Ar(null,i,c.text,c.icon,c.skipFade),r=r||c.text||c.icon)}for(let l in o){let c=o[l];if(!this.opacities[l]){let p=new Ar(c,i,!1,!1);p.isHidden()||(this.opacities[l]=p,r=r||c.text.placed||c.icon.placed)}}for(let l in a)!this.variableOffsets[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.variableOffsets[l]=a[l]);for(let l in s)!this.placedOrientations[l]&&this.opacities[l]&&!this.opacities[l].isHidden()&&(this.placedOrientations[l]=s[l]);if(e&&e.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");r?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=e?e.lastPlacementChangeTime:t)}updateLayerOpacities(t,e){let r={};for(let i of e){let o=i.getBucket(t);o&&i.latestFeatureIndex&&t.id===o.layerIds[0]&&this.updateBucketOpacities(o,r,i.collisionBoxArray)}}updateBucketOpacities(t,e,r){t.hasTextData()&&(t.text.opacityVertexArray.clear(),t.text.hasVisibleVertices=!1),t.hasIconData()&&(t.icon.opacityVertexArray.clear(),t.icon.hasVisibleVertices=!1),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();let i=t.layers[0].layout,o=new Ar(null,0,!1,!1,!0),a=i.get("text-allow-overlap"),s=i.get("icon-allow-overlap"),l=i.get("text-variable-anchor"),c=i.get("text-rotation-alignment")==="map",p=i.get("text-pitch-alignment")==="map",m=i.get("icon-text-fit")!=="none",h=new Ar(null,0,a&&(s||!t.hasIconData()||i.get("icon-optional")),s&&(a||!t.hasTextData()||i.get("text-optional")),!0);!t.collisionArrays&&r&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(r);let d=u((g,y,x)=>{for(let v=0;v<y/4;v++)g.opacityVertexArray.emplaceBack(x);g.hasVisibleVertices=g.hasVisibleVertices||x!==yn},"addOpacities");for(let g=0;g<t.symbolInstances.length;g++){let y=t.symbolInstances.get(g),{numHorizontalGlyphVertices:x,numVerticalGlyphVertices:v,crossTileID:b}=y,w=e[b],S=this.opacities[b];w?S=o:S||(S=h,this.opacities[b]=S),e[b]=!0;let P=x>0||v>0,I=y.numIconVertices>0,C=this.placedOrientations[y.crossTileID],z=C===2,D=C===1||C===3;if(P){let A=my(S.text),R=z?yn:A;d(t.text,x,R);let U=D?yn:A;d(t.text,v,U);let L=S.text.isHidden();[y.rightJustifiedTextSymbolIndex,y.centerJustifiedTextSymbolIndex,y.leftJustifiedTextSymbolIndex].forEach(W=>{W>=0&&(t.text.placedSymbolArray.get(W).hidden=L||z?1:0)}),y.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(y.verticalPlacedTextSymbolIndex).hidden=L||D?1:0);let N=this.variableOffsets[y.crossTileID];N&&this.markUsedJustification(t,N.anchor,y,C);let V=this.placedOrientations[y.crossTileID];V&&(this.markUsedJustification(t,"left",y,V),this.markUsedOrientation(t,V,y))}if(I){let A=my(S.icon),R=!(m&&y.verticalPlacedIconSymbolIndex&&z);if(y.placedIconSymbolIndex>=0){let U=R?A:yn;d(t.icon,y.numIconVertices,U),t.icon.placedSymbolArray.get(y.placedIconSymbolIndex).hidden=S.icon.isHidden()}if(y.verticalPlacedIconSymbolIndex>=0){let U=R?yn:A;d(t.icon,y.numVerticalIconVertices,U),t.icon.placedSymbolArray.get(y.verticalPlacedIconSymbolIndex).hidden=S.icon.isHidden()}}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){let A=t.collisionArrays[g];if(A){let R=new ma.default(0,0);if(A.textBox||A.verticalTextBox){let L=!0;if(l){let N=this.variableOffsets[b];N?(R=py(N.anchor,N.width,N.height,N.textOffset,N.textBoxScale),c&&R._rotate(p?this.transform.angle:-this.transform.angle)):L=!1}A.textBox&&la(t.textCollisionBox.collisionVertexArray,S.text.placed,!L||z,R.x,R.y),A.verticalTextBox&&la(t.textCollisionBox.collisionVertexArray,S.text.placed,!L||D,R.x,R.y)}let U=!!(!D&&A.verticalIconBox);A.iconBox&&la(t.iconCollisionBox.collisionVertexArray,S.icon.placed,U,m?R.x:0,m?R.y:0),A.verticalIconBox&&la(t.iconCollisionBox.collisionVertexArray,S.icon.placed,!U,m?R.x:0,m?R.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error("bucket.text.opacityVertexArray.length (= ".concat(t.text.opacityVertexArray.length,") !== bucket.text.layoutVertexArray.length (= ").concat(t.text.layoutVertexArray.length,") / 4"));if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error("bucket.icon.opacityVertexArray.length (= ".concat(t.icon.opacityVertexArray.length,") !== bucket.icon.layoutVertexArray.length (= ").concat(t.icon.layoutVertexArray.length,") / 4"));if(t.bucketInstanceId in this.collisionCircleArrays){let g=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=g.invProjMatrix,t.placementViewportMatrix=g.viewportMatrix,t.collisionCircleArray=g.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(t,e){let r=this.zoomAtLastRecencyCheck===e?1-this.zoomAdjustment(e):1;return this.zoomAtLastRecencyCheck=e,this.commitTime+this.fadeDuration*r>t}setStale(){this.stale=!0}};u(Ip,"Placement");var pa=Ip;function la(n,t,e,r,i){n.emplaceBack(t?1:0,e?1:0,r||0,i||0),n.emplaceBack(t?1:0,e?1:0,r||0,i||0),n.emplaceBack(t?1:0,e?1:0,r||0,i||0),n.emplaceBack(t?1:0,e?1:0,r||0,i||0)}u(la,"updateCollisionVertices");var Ob=Math.pow(2,25),Vb=Math.pow(2,24),Ub=Math.pow(2,17),Nb=Math.pow(2,16),Gb=Math.pow(2,9),qb=Math.pow(2,8),jb=Math.pow(2,1);function my(n){if(n.opacity===0&&!n.placed)return 0;if(n.opacity===1&&n.placed)return 4294967295;let t=n.placed?1:0,e=Math.floor(n.opacity*127);return e*Ob+t*Vb+e*Ub+t*Nb+e*Gb+t*qb+e*jb+t}u(my,"packOpacity");var yn=0;var Cp=class Cp{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,e,r,i,o){let a=this._bucketParts;for(;this._currentTileIndex<t.length;){let s=t[this._currentTileIndex];if(e.getBucketParts(a,i,s,this._sortAcrossTiles),this._currentTileIndex++,o())return!0}for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,a.sort((s,l)=>s.sortKey-l.sortKey));this._currentPartIndex<a.length;){let s=a[this._currentPartIndex];if(e.placeLayerBucketPart(s,this._seenCrossTileIDs,r),this._currentPartIndex++,o())return!0}return!1}};u(Cp,"LayerPlacement");var Ap=Cp,Ep=class Ep{constructor(t,e,r,i,o,a,s,l){this.placement=new pa(t,e,a,s,l),this._currentPlacementIndex=r.length-1,this._forceFullPlacement=i,this._showCollisionBoxes=o,this._done=!1}isDone(){return this._done}continuePlacement(t,e,r){let i=ee.now(),o=u(()=>this._forceFullPlacement?!1:ee.now()-i>2,"shouldPausePlacement");for(;this._currentPlacementIndex>=0;){let a=t[this._currentPlacementIndex],s=e[a],l=this.placement.collisionIndex.transform.zoom;if(s.type==="symbol"&&(!s.minzoom||s.minzoom<=l)&&(!s.maxzoom||s.maxzoom>l)){if(this._inProgressLayer||(this._inProgressLayer=new Ap(s)),this._inProgressLayer.continuePlacement(r[s.source],this.placement,this._showCollisionBoxes,s,o))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}};u(Ep,"PauseablePlacement");var ha=Ep;f();var gn=512/8192/2,Hb=128,Dp=class Dp{constructor(t,e,r){this.tileID=t;this.bucketInstanceId=r;this._symbolsByKey={};let i=new Map;for(let o=0;o<e.length;o++){let a=e.get(o),s=a.key,l=i.get(s);l?l.push(a):i.set(s,[a])}for(let[o,a]of i){let s=a.map(p=>({x:Math.floor(p.anchorX*gn),y:Math.floor(p.anchorY*gn)})),l=a.map(p=>p.crossTileID),c={positions:s,crossTileIDs:l};if(c.positions.length>Hb){let p=new Nh(c.positions.length,16,Uint16Array);for(let{x:m,y:h}of c.positions)p.add(m,h);p.finish(),delete c.positions,c.index=p}this._symbolsByKey[o]=c}}getScaledCoordinates(t,e){let{x:r,y:i,z:o}=this.tileID.canonical,{x:a,y:s,z:l}=e.canonical,c=l-o,p=gn/Math.pow(2,c),m=(a*8192+t.anchorX)*p,h=(s*8192+t.anchorY)*p,d=r*8192*gn,g=i*8192*gn;return{x:Math.floor(m-d),y:Math.floor(h-g)}}findMatches(t,e,r){let i=this.tileID.canonical.z<e.canonical.z?1:Math.pow(2,this.tileID.canonical.z-e.canonical.z);for(let o=0;o<t.length;o++){let a=t.get(o);if(a.crossTileID)continue;let s=this._symbolsByKey[a.key];if(!s)continue;let l=this.getScaledCoordinates(a,e);if(s.index){let c=s.index.range(l.x-i,l.y-i,l.x+i,l.y+i).sort();for(let p of c){let m=s.crossTileIDs[p];if(!r[m]){r[m]=!0,a.crossTileID=m;break}}}else if(s.positions)for(let c=0;c<s.positions.length;c++){let p=s.positions[c],m=s.crossTileIDs[c];if(Math.abs(p.x-l.x)<=i&&Math.abs(p.y-l.y)<=i&&!r[m]){r[m]=!0,a.crossTileID=m;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:t})=>t)}};u(Dp,"TileLayerIndex");var Mp=Dp,Fp=class Fp{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}};u(Fp,"CrossTileIDs");var Lp=Fp,zp=class zp{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(t){let e=Math.round((t-this.lng)/360);if(e!==0)for(let r in this.indexes){let i=this.indexes[r],o={};for(let a in i){let s=i[a];s.tileID=s.tileID.unwrapTo(s.tileID.wrap+e),o[s.tileID.key]=s}this.indexes[r]=o}this.lng=t}addBucket(t,e,r){if(this.indexes[t.overscaledZ]&&this.indexes[t.overscaledZ][t.key]){if(this.indexes[t.overscaledZ][t.key].bucketInstanceId===e.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(t.overscaledZ,this.indexes[t.overscaledZ][t.key])}for(let o=0;o<e.symbolInstances.length;o++){let a=e.symbolInstances.get(o);a.crossTileID=0}this.usedCrossTileIDs[t.overscaledZ]||(this.usedCrossTileIDs[t.overscaledZ]={});let i=this.usedCrossTileIDs[t.overscaledZ];for(let o in this.indexes){let a=this.indexes[o];if(Number(o)>t.overscaledZ)for(let s in a){let l=a[s];l.tileID.isChildOf(t)&&l.findMatches(e.symbolInstances,t,i)}else{let s=t.scaledTo(Number(o)),l=a[s.key];l&&l.findMatches(e.symbolInstances,t,i)}}for(let o=0;o<e.symbolInstances.length;o++){let a=e.symbolInstances.get(o);a.crossTileID||(a.crossTileID=r.generate(),i[a.crossTileID]=!0)}return this.indexes[t.overscaledZ]===void 0&&(this.indexes[t.overscaledZ]={}),this.indexes[t.overscaledZ][t.key]=new Mp(t,e.symbolInstances,e.bucketInstanceId),!0}removeBucketCrossTileIDs(t,e){for(let r of e.getCrossTileIDsLists())for(let i of r)delete this.usedCrossTileIDs[t][i]}removeStaleBuckets(t){let e=!1;for(let r in this.indexes){let i=this.indexes[r];for(let o in i)t[i[o].bucketInstanceId]||(this.removeBucketCrossTileIDs(r,i[o]),delete i[o],e=!0)}return e}};u(zp,"CrossTileSymbolLayerIndex");var kp=zp,Bp=class Bp{constructor(){this.layerIndexes={},this.crossTileIDs=new Lp,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(t,e,r){let i=this.layerIndexes[t.id];i===void 0&&(i=this.layerIndexes[t.id]=new kp);let o=!1,a={};i.handleWrapJump(r);for(let s of e){let l=s.getBucket(t);!l||t.id!==l.layerIds[0]||(l.bucketInstanceId||(l.bucketInstanceId=++this.maxBucketInstanceId),i.addBucket(s.tileID,l,this.crossTileIDs)&&(o=!0),a[l.bucketInstanceId]=!0)}return i.removeStaleBuckets(a)&&(o=!0),o}pruneUnusedLayers(t){let e={};t.forEach(r=>{e[r]=!0});for(let r in this.layerIndexes)e[r]||delete this.layerIndexes[r]}};u(Bp,"CrossTileSymbolIndex");var si=Bp;var fa=u((n,t)=>kr(n,t&&t.filter(e=>e.identifier!=="source.canvas")),"emitValidationErrors"),Zb=ht(Ks,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),Wb=ht(Ks,["setCenter","setZoom","setBearing","setPitch"]),Xb=Dh(),da=class da extends se{constructor(e,r={}){super();this.map=e,this.dispatcher=new un(sp(),this,e._getMapId()),this.imageManager=new Uo,this.imageManager.setEventedParent(this),this.glyphManager=new No(e._requestManager,r.localIdeographFontFamily),this.lineAtlas=new qo(256,512),this.crossTileSymbolIndex=new si,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new zr,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",Un());let i=this;this._rtlTextPluginCallback=da.registerForPluginStateChange(o=>{let a={pluginStatus:o.pluginStatus,pluginURL:o.pluginURL};i.dispatcher.broadcast("syncRTLPluginState",a,(s,l)=>{if(yl(s),l&&l.every(p=>p))for(let p in i.sourceCaches){let m=i.sourceCaches[p].getSource().type;(m==="vector"||m==="geojson")&&i.sourceCaches[p].reload()}})}),this.on("data",o=>{if(o.dataType!=="source"||o.sourceDataType!=="metadata")return;let a=this.sourceCaches[o.sourceId];if(!a)return;let s=a.getSource();if(!(!s||!s.vectorLayerIds))for(let l in this._layers){let c=this._layers[l];c.source===s.id&&this._validateLayer(c)}})}loadURL(e,r={},i){this.fire(new E("dataloading",{dataType:"style"})),r.validate=typeof r.validate=="boolean"?r.validate:!0;let o=this.map._requestManager.transformRequest(e,"Style");this._request=Bt(o,(a,s)=>{this._request=null,a?this.fire(new j(a)):s&&this._load(s,r,i)})}loadJSON(e,r={},i){this.fire(new E("dataloading",{dataType:"style"})),this._request=ee.frame(()=>{this._request=null,r.validate=r.validate!==!1,this._load(e,r,i)})}loadEmpty(){this.fire(new E("dataloading",{dataType:"style"})),this._load(Xb,{validate:!1})}_load(e,r,i){let o=r.transformStyle?r.transformStyle(i,e):e;if(!(r.validate&&fa(this,Me(o)))){this._loaded=!0,this.stylesheet=o;for(let a in o.sources)this.addSource(a,o.sources[a],{validate:!1});o.sprite?this._loadSprite(o.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(o.glyphs),this._createLayers(),this.light=new Go(this.stylesheet.light),this.map.setTerrain(this.stylesheet.terrain),this.fire(new E("data",{dataType:"style"})),this.fire(new E("style.load"))}}_createLayers(){let e=Xs(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",e),this._order=e.map(r=>r.id),this._layers={},this._serializedLayers=null;for(let r of e){let i=Oo(r);i.setEventedParent(this,{layer:{id:r.id}}),this._layers[r.id]=i}}_loadSprite(e,r=!1,i=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=Dd(e,this.map._requestManager,this.map.getPixelRatio(),(o,a)=>{if(this._spriteRequest=null,o)this.fire(new j(o));else if(a)for(let s in a){this._spritesImagesIds[s]=[];let l=this._spritesImagesIds[s]?this._spritesImagesIds[s].filter(c=>!(c in a)):[];for(let c of l)this.imageManager.removeImage(c),this._changedImages[c]=!0;for(let c in a[s]){let p=s==="default"?c:"".concat(s,":").concat(c);this._spritesImagesIds[s].push(p),p in this.imageManager.images?this.imageManager.updateImage(p,a[s][c],!1):this.imageManager.addImage(p,a[s][c]),r&&(this._changedImages[p]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),r&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new E("data",{dataType:"style"})),i&&i(o)})}_unloadSprite(){for(let e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new E("data",{dataType:"style"}))}_validateLayer(e){let r=this.sourceCaches[e.source];if(!r)return;let i=e.sourceLayer;if(!i)return;let o=r.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(i)===-1)&&this.fire(new j(new Error('Source layer "'.concat(i,'" ')+'does not exist on source "'.concat(o.id,'" ')+'as specified by style layer "'.concat(e.id,'".'))))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(let e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e){let r=this._serializedAllLayers();if(!e||e.length===0)return Object.values(r);let i=[];for(let o of e)r[o]&&i.push(r[o]);return i}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};let r=Object.keys(this._layers);for(let i of r){let o=this._layers[i];o.type!=="custom"&&(e[i]=o.serialize())}return e}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(let e in this.sourceCaches)if(this.sourceCaches[e].hasTransition())return!0;for(let e in this._layers)if(this._layers[e].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;let r=this._changed;if(this._changed){let o=Object.keys(this._updatedLayers),a=Object.keys(this._removedLayers);(o.length||a.length)&&this._updateWorkerLayers(o,a);for(let s in this._updatedSources){let l=this._updatedSources[s];if(l==="reload")this._reloadSource(s);else if(l==="clear")this._clearSource(s);else throw new Error("Invalid action ".concat(l))}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(let s in this._updatedPaintProps)this._layers[s].updateTransitions(e);this.light.updateTransitions(e),this._resetUpdates()}let i={};for(let o in this.sourceCaches){let a=this.sourceCaches[o];i[o]=a.used,a.used=!1}for(let o of this._order){let a=this._layers[o];a.recalculate(e,this._availableImages),!a.isHidden(e.zoom)&&a.source&&(this.sourceCaches[a.source].used=!0)}for(let o in i){let a=this.sourceCaches[o];i[o]!==a.used&&a.fire(new E("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(e),this.z=e.zoom,r&&this.fire(new E("data",{dataType:"style"}))}_updateTilesForChangedImages(){let e=Object.keys(this._changedImages);if(e.length){for(let r in this.sourceCaches)this.sourceCaches[r].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(let e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,r){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(e),removedIds:r})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,r={}){this._checkLoaded();let i=this.serialize();if(e=r.transformStyle?r.transformStyle(i,e):e,fa(this,Me(e)))return!1;e=Xe(e),e.layers=Xs(e.layers);let o=bh(i,e).filter(s=>!(s.command in Wb));if(o.length===0)return!1;let a=o.filter(s=>!(s.command in Zb));if(a.length>0)throw new Error("Unimplemented: ".concat(a.map(s=>s.command).join(", "),"."));for(let s of o)s.command!=="setTransition"&&this[s.command].apply(this,s.args);return this.stylesheet=e,!0}addImage(e,r){if(this.getImage(e))return this.fire(new j(new Error('An image named "'.concat(e,'" already exists.'))));this.imageManager.addImage(e,r),this._afterImageUpdated(e)}updateImage(e,r){this.imageManager.updateImage(e,r)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new j(new Error('An image named "'.concat(e,'" does not exist.'))));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new E("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,r,i={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error('Source "'.concat(e,'" already exists.'));if(!r.type)throw new Error("The type property must be defined, but only the following properties were given: ".concat(Object.keys(r).join(", "),"."));if(["vector","raster","geojson","video","image"].indexOf(r.type)>=0&&this._validate(Me.source,"sources.".concat(e),r,null,i))return;this.map&&this.map._collectResourceTiming&&(r.collectResourceTiming=!0);let s=this.sourceCaches[e]=new Ct(e,r,this.dispatcher);s.style=this,s.setEventedParent(this,()=>({isSourceLoaded:s.loaded(),source:s.serialize(),sourceId:e})),s.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(let i in this._layers)if(this._layers[i].source===e)return this.fire(new j(new Error('Source "'.concat(e,'" cannot be removed while layer "').concat(i,'" is using it.'))));let r=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],r.fire(new E("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),r.setEventedParent(null),r.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,r){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID=".concat(e));let i=this.sourceCaches[e].getSource();if(i.type!=="geojson")throw new Error("geojsonSource.type is ".concat(i.type,", which is !== 'geojson"));i.setData(r),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,r,i={}){this._checkLoaded();let o=e.id;if(this.getLayer(o)){this.fire(new j(new Error('Layer "'.concat(o,'" already exists on this map.'))));return}let a;if(e.type==="custom"){if(fa(this,Ld(e)))return;a=Oo(e)}else{if(typeof e.source=="object"&&(this.addSource(o,e.source),e=Xe(e),e=k(e,{source:o})),this._validate(Me.layer,"layers.".concat(o),e,{arrayIndex:-1},i))return;a=Oo(e),this._validateLayer(a),a.setEventedParent(this,{layer:{id:o}})}let s=r?this._order.indexOf(r):this._order.length;if(r&&s===-1){this.fire(new j(new Error('Cannot add layer "'.concat(o,'" before non-existing layer "').concat(r,'".'))));return}if(this._order.splice(s,0,o),this._layerOrderChanged=!0,this._layers[o]=a,this._removedLayers[o]&&a.source&&a.type!=="custom"){let l=this._removedLayers[o];delete this._removedLayers[o],l.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a),a.onAdd&&a.onAdd(this.map)}moveLayer(e,r){if(this._checkLoaded(),this._changed=!0,!this._layers[e]){this.fire(new j(new Error("The layer '".concat(e,"' does not exist in the map's style and cannot be moved."))));return}if(e===r)return;let o=this._order.indexOf(e);this._order.splice(o,1);let a=r?this._order.indexOf(r):this._order.length;if(r&&a===-1){this.fire(new j(new Error('Cannot move layer "'.concat(e,'" before non-existing layer "').concat(r,'".'))));return}this._order.splice(a,0,e),this._layerOrderChanged=!0}removeLayer(e){this._checkLoaded();let r=this._layers[e];if(!r){this.fire(new j(new Error('Cannot remove non-existing layer "'.concat(e,'".'))));return}r.setEventedParent(null);let i=this._order.indexOf(e);this._order.splice(i,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=r,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],r.onRemove&&r.onRemove(this.map)}getLayer(e){return this._layers[e]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,r,i){this._checkLoaded();let o=this.getLayer(e);if(!o){this.fire(new j(new Error('Cannot set the zoom range of non-existing layer "'.concat(e,'".'))));return}o.minzoom===r&&o.maxzoom===i||(r!=null&&(o.minzoom=r),i!=null&&(o.maxzoom=i),this._updateLayer(o))}setFilter(e,r,i={}){this._checkLoaded();let o=this.getLayer(e);if(!o){this.fire(new j(new Error('Cannot filter non-existing layer "'.concat(e,'".'))));return}if(!wt(o.filter,r)){if(r==null){o.filter=void 0,this._updateLayer(o);return}this._validate(Me.filter,"layers.".concat(o.id,".filter"),r,null,i)||(o.filter=Xe(r),this._updateLayer(o))}}getFilter(e){return Xe(this.getLayer(e).filter)}setLayoutProperty(e,r,i,o={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new j(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}wt(a.getLayoutProperty(r),i)||(a.setLayoutProperty(r,i,o),this._updateLayer(a))}getLayoutProperty(e,r){let i=this.getLayer(e);if(!i){this.fire(new j(new Error('Cannot get style of non-existing layer "'.concat(e,'".'))));return}return i.getLayoutProperty(r)}setPaintProperty(e,r,i,o={}){this._checkLoaded();let a=this.getLayer(e);if(!a){this.fire(new j(new Error('Cannot style non-existing layer "'.concat(e,'".'))));return}if(wt(a.getPaintProperty(r),i))return;a.setPaintProperty(r,i,o)&&this._updateLayer(a),this._changed=!0,this._updatedPaintProps[e]=!0}getPaintProperty(e,r){return this.getLayer(e).getPaintProperty(r)}setFeatureState(e,r){this._checkLoaded();let i=e.source,o=e.sourceLayer,a=this.sourceCaches[i];if(a===void 0){this.fire(new j(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let s=a.getSource().type;if(s==="geojson"&&o){this.fire(new j(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));return}if(s==="vector"&&!o){this.fire(new j(new Error("The sourceLayer parameter must be provided for vector source types.")));return}e.id===void 0&&this.fire(new j(new Error("The feature id parameter must be provided."))),a.setFeatureState(o,e.id,r)}removeFeatureState(e,r){this._checkLoaded();let i=e.source,o=this.sourceCaches[i];if(o===void 0){this.fire(new j(new Error("The source '".concat(i,"' does not exist in the map's style."))));return}let a=o.getSource().type,s=a==="vector"?e.sourceLayer:void 0;if(a==="vector"&&!s){this.fire(new j(new Error("The sourceLayer parameter must be provided for vector source types.")));return}if(r&&typeof e.id!="string"&&typeof e.id!="number"){this.fire(new j(new Error("A feature id is required to remove its specific state property.")));return}o.removeFeatureState(s,e.id,r)}getFeatureState(e){this._checkLoaded();let r=e.source,i=e.sourceLayer,o=this.sourceCaches[r];if(o===void 0){this.fire(new j(new Error("The source '".concat(r,"' does not exist in the map's style."))));return}if(o.getSource().type==="vector"&&!i){this.fire(new j(new Error("The sourceLayer parameter must be provided for vector source types.")));return}return e.id===void 0&&this.fire(new j(new Error("The feature id parameter must be provided."))),o.getFeatureState(i,e.id)}getTransition(){return k({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;let e=gi(this.sourceCaches,o=>o.serialize()),r=this._serializeByIds(this._order),i=this.stylesheet;return On({version:i.version,name:i.name,metadata:i.metadata,light:i.light,center:i.center,zoom:i.zoom,bearing:i.bearing,pitch:i.pitch,sprite:i.sprite,glyphs:i.glyphs,transition:i.transition,sources:e,layers:r},o=>o!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){let r=u(s=>this._layers[s].type==="fill-extrusion","isLayer3D"),i={},o=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(r(l)){i[l]=s;for(let c of e){let p=c[l];if(p)for(let m of p)o.push(m)}}}o.sort((s,l)=>l.intersectionZ-s.intersectionZ);let a=[];for(let s=this._order.length-1;s>=0;s--){let l=this._order[s];if(r(l))for(let c=o.length-1;c>=0;c--){let p=o[c].feature;if(i[p.layer.id]<s)break;a.push(p),o.pop()}else for(let c of e){let p=c[l];if(p)for(let m of p)a.push(m.feature)}}return a}queryRenderedFeatures(e,r,i){r&&r.filter&&this._validate(Me.filter,"queryRenderedFeatures.filter",r.filter,null,r);let o={};if(r&&r.layers){if(!Array.isArray(r.layers))return this.fire(new j(new Error("parameters.layers must be an Array."))),[];for(let l of r.layers){let c=this._layers[l];if(!c)return this.fire(new j(new Error("The layer '".concat(l,"' does not exist in the map's style and cannot be queried for features.")))),[];o[c.source]=!0}}let a=[];r.availableImages=this._availableImages;let s=this._serializedAllLayers();for(let l in this.sourceCaches)r.layers&&!o[l]||a.push(jd(this.sourceCaches[l],this._layers,s,e,r,i));return this.placement&&a.push(Hd(this._layers,s,this.sourceCaches,e,r,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(a)}querySourceFeatures(e,r){r&&r.filter&&this._validate(Me.filter,"querySourceFeatures.filter",r.filter,null,r);let i=this.sourceCaches[e];return i?Zd(i,r):[]}addSourceType(e,r,i){if(Yc(e))return i(new Error('A source type called "'.concat(e,'" already exists.')));if(qd(e,r),!r.workerSourceURL)return i(null,null);this.dispatcher.broadcast("loadWorkerSource",{name:e,url:r.workerSourceURL},i)}getLight(){return this.light.getLight()}setLight(e,r={}){this._checkLoaded();let i=this.light.getLight(),o=!1;for(let s in e)if(!wt(e[s],i[s])){o=!0;break}if(!o)return;let a={now:ee.now(),transition:k({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,r),this.light.updateTransitions(a)}_validate(e,r,i,o,a={}){return a&&a.validate===!1?!1:fa(this,e.call(Me,k({key:r,style:this.serialize(),value:i,styleSpec:T},o)))}_remove(e=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),jn.off("pluginStateChange",this._rtlTextPluginCallback);for(let r in this._layers)this._layers[r].setEventedParent(null);for(let r in this.sourceCaches){let i=this.sourceCaches[r];i.setEventedParent(null),i.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(let r in this.sourceCaches)this.sourceCaches[r].update(e,this.map.terrain)}_generateCollisionBoxes(){for(let e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,r,i,o,a=!1){let s=!1,l=!1,c={};for(let m of this._order){let h=this._layers[m];if(h.type!=="symbol")continue;if(!c[h.source]){let g=this.sourceCaches[h.source];c[h.source]=g.getRenderableIds(!0).map(y=>g.getTileByID(y)).sort((y,x)=>x.tileID.overscaledZ-y.tileID.overscaledZ||(y.tileID.isLessThan(x.tileID)?-1:1))}let d=this.crossTileSymbolIndex.addLayer(h,c[h.source],e.center.lng);s=s||d}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),a=a||this._layerOrderChanged||i===0,(a||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(ee.now(),e.zoom))&&(this.pauseablePlacement=new ha(e,this.map.terrain,this._order,a,r,i,o,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,c),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(ee.now()),l=!0),s&&this.pauseablePlacement.placement.setStale()),l||s)for(let m of this._order){let h=this._layers[m];h.type==="symbol"&&this.placement.updateLayerOpacities(h,c[h.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(ee.now())}_releaseSymbolFadeTiles(){for(let e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,r,i){this.imageManager.getImages(r.icons,i),this._updateTilesForChangedImages();let o=this.sourceCaches[r.source];o&&o.setDependencies(r.tileID.key,r.type,r.icons)}getGlyphs(e,r,i){this.glyphManager.getGlyphs(r.stacks,i);let o=this.sourceCaches[r.source];o&&o.setDependencies(r.tileID.key,r.type,[""])}getResource(e,r,i){return Mr(r,i)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,r={}){this._checkLoaded(),!(e&&this._validate(Me.glyphs,"glyphs",e,null,r))&&(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,r,i={},o){this._checkLoaded();let a=[{id:e,url:r}],s=[...Xr(this.stylesheet.sprite),...a];this._validate(Me.sprite,"sprite",s,null,i)||(this.stylesheet.sprite=s,this._loadSprite(a,!0,o))}removeSprite(e){this._checkLoaded();let r=Xr(this.stylesheet.sprite);if(!r.find(i=>i.id===e)){this.fire(new j(new Error('Sprite "'.concat(e,"\" doesn't exists on this map."))));return}if(this._spritesImagesIds[e])for(let i of this._spritesImagesIds[e])this.imageManager.removeImage(i),this._changedImages[i]=!0;r.splice(r.findIndex(i=>i.id===e),1),this.stylesheet.sprite=r.length>0?r:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new E("data",{dataType:"style"}))}getSprite(){return Xr(this.stylesheet.sprite)}setSprite(e,r={},i){this._checkLoaded(),!(e&&this._validate(Me.sprite,"sprite",e,null,r))&&(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,i):(this._unloadSprite(),i&&i(null)))}};u(da,"Style");var Qt=da;Qt.registerForPluginStateChange=gf;f();f();var ya=fe([{name:"a_pos",type:"Int16",components:2}]);f();f();var hy="#ifdef GL_ES\nprecision mediump float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\n";f();var fy="#ifdef GL_ES\nprecision highp float;\n#else\n#if !defined(lowp)\n#define lowp\n#endif\n#if !defined(mediump)\n#define mediump\n#endif\n#if !defined(highp)\n#define highp\n#endif\n#endif\nvec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0\n);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}\n#ifdef TERRAIN3D\nuniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;\n#endif\nconst highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {\n#ifdef TERRAIN3D\nhighp float d=unpack(texture2D(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));\n#else\nreturn 1.0;\n#endif\n}float calculate_visibility(vec4 pos) {\n#ifdef TERRAIN3D\nvec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;\n#else\nreturn 1.0;\n#endif\n}float ele(vec2 pos) {\n#ifdef TERRAIN3D\nvec4 rgb=(texture2D(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;\n#else\nreturn 0.0;\n#endif\n}float get_elevation(vec2 pos) {\n#ifdef TERRAIN3D\nvec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;\n#else\nreturn 0.0;\n#endif\n}";f();var dy="uniform vec4 u_color;uniform float u_opacity;void main() {gl_FragColor=u_color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var yy="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";f();var gy="uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_mix)*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var xy="uniform mat4 u_matrix;uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}";f();var _y="varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=v_data.xy;float extrude_length=length(extrude);lowp float antialiasblur=v_data.z;float antialiased_blur=-max(blur,antialiasblur);float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));gl_FragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var by="uniform mat4 u_matrix;uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;attribute vec2 a_pos;varying vec3 v_data;varying float v_visibility;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define highp vec4 stroke_color\n#pragma mapbox: define mediump float stroke_width\n#pragma mapbox: define lowp float stroke_opacity\nvoid main(void) {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize mediump float radius\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize highp vec4 stroke_color\n#pragma mapbox: initialize mediump float stroke_width\n#pragma mapbox: initialize lowp float stroke_opacity\nvec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);float ele=get_elevation(circle_center);v_visibility=calculate_visibility(u_matrix*vec4(circle_center,ele,1.0));if (u_pitch_with_map) {vec2 corner_position=circle_center;if (u_scale_with_map) {corner_position+=extrude*(radius+stroke_width)*u_extrude_scale;} else {vec4 projected_center=u_matrix*vec4(circle_center,0,1);corner_position+=extrude*(radius+stroke_width)*u_extrude_scale*(projected_center.w/u_camera_to_center_distance);}gl_Position=u_matrix*vec4(corner_position,ele,1);} else {gl_Position=u_matrix*vec4(circle_center,ele,1);if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur);}";f();var vy="void main() {gl_FragColor=vec4(1.0);}";f();var wy="attribute vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}";f();var Sy="uniform highp float u_intensity;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#define GAUSS_COEF 0.3989422804014327\nvoid main() {\n#pragma mapbox: initialize highp float weight\nfloat d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);gl_FragColor=vec4(val,1.0,1.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Py="uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;attribute vec2 a_pos;varying vec2 v_extrude;\n#pragma mapbox: define highp float weight\n#pragma mapbox: define mediump float radius\nconst highp float ZERO=1.0/255.0/16.0;\n#define GAUSS_COEF 0.3989422804014327\nvoid main(void) {\n#pragma mapbox: initialize highp float weight\n#pragma mapbox: initialize mediump float radius\nvec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec4 pos=vec4(floor(a_pos*0.5)+extrude,0,1);gl_Position=u_matrix*pos;}";f();var Ty="uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;varying vec2 v_pos;void main() {float t=texture2D(u_image,v_pos).r;vec4 color=texture2D(u_color_ramp,vec2(t,0.5));gl_FragColor=color*u_opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(0.0);\n#endif\n}";f();var Iy="uniform mat4 u_matrix;uniform vec2 u_world;attribute vec2 a_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}";f();var Ay="varying float v_placed;varying float v_notUsed;void main() {float alpha=0.5;gl_FragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {gl_FragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {gl_FragColor*=.1;}}";f();var Cy="attribute vec2 a_pos;attribute vec2 a_anchor_pos;attribute vec2 a_extrude;attribute vec2 a_placed;attribute vec2 a_shift;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance;varying float v_placed;varying float v_notUsed;void main() {vec4 projectedPoint=u_matrix*vec4(a_anchor_pos,0,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp(0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);gl_Position.xy+=(a_extrude+a_shift)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}";f();var Ey="varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);gl_FragColor=color*alpha*opacity_t;}";f();var My="attribute vec2 a_pos;attribute float a_radius;attribute vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;varying float v_radius;varying vec2 v_extrude;varying float v_perspective_ratio;varying float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-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(0.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);}";f();var Ly="uniform highp vec4 u_color;uniform sampler2D u_overlay;varying vec2 v_uv;void main() {vec4 overlay_color=texture2D(u_overlay,v_uv);gl_FragColor=mix(u_color,overlay_color,overlay_color.a);}";f();var ky="attribute vec2 a_pos;varying vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,get_elevation(a_pos),1);}";f();var Dy="#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_FragColor=color*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Fy="attribute vec2 a_pos;uniform mat4 u_matrix;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);}";f();var zy="varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=outline_color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var By="attribute vec2 a_pos;uniform mat4 u_matrix;uniform vec2 u_world;varying vec2 v_pos;\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 outline_color\n#pragma mapbox: initialize lowp float opacity\ngl_Position=u_matrix*vec4(a_pos,0,1);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}";f();var Ry="uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);gl_FragColor=mix(color1,color2,u_fade)*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Oy="uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec2 v_pos;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=u_matrix*vec4(a_pos,0,1);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;}";f();var Vy="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);gl_FragColor=mix(color1,color2,u_fade)*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Uy="uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;attribute vec2 a_pos;varying vec2 v_pos_a;varying vec2 v_pos_b;\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=u_matrix*vec4(a_pos,0,1);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}";f();var Ny="varying vec4 v_color;void main() {gl_FragColor=v_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Gy="uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec4 v_color;\n#pragma mapbox: define highp float base\n#pragma mapbox: define highp float height\n#pragma mapbox: define highp vec4 color\nvoid main() {\n#pragma mapbox: initialize highp float base\n#pragma mapbox: initialize highp float height\n#pragma mapbox: initialize highp vec4 color\nvec3 normal=a_normal_ed.xyz;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);gl_Position=u_matrix*vec4(a_pos,t > 0.0 ? height : base,1);float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;float directional=clamp(dot(normal/16384.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}";f();var qy="uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;varying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture2D(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture2D(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);gl_FragColor=mixedColor*v_lighting;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var jy="uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;attribute vec2 a_pos;attribute vec4 a_normal_ed;\n#ifdef TERRAIN3D\nattribute vec2 a_centroid;\n#endif\nvarying vec2 v_pos_a;varying vec2 v_pos_b;varying vec4 v_lighting;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float base\n#pragma mapbox: initialize lowp float height\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;\n#ifdef TERRAIN3D\nfloat height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);\n#else\nfloat height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;\n#endif\nbase=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float z=t > 0.0 ? height : base;gl_Position=u_matrix*vec4(a_pos,z,1);vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0\n? a_pos\n: vec2(edgedistance,z*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}";f();var Hy="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture2D(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))/pow(2.0,exaggeration+(19.2562-u_zoom));gl_FragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Zy="uniform mat4 u_matrix;uniform vec2 u_dimension;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}";f();var Wy="uniform sampler2D u_image;varying vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;\n#define PI 3.141592653589793\nvoid main() {vec4 pixel=texture2D(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);gl_FragColor=accent_color*(1.0-shade_color.a)+shade_color;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Xy="uniform mat4 u_matrix;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0;}";f();var Ky="uniform lowp float u_device_pixel_ratio;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var $y="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp float v_linesofar;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}";f();var Jy="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;varying vec2 v_width2;varying vec2 v_normal;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture2D(u_image,v_uv);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var Yy="\n#define scale 0.015873016\nattribute vec2 a_pos_normal;attribute vec4 a_data;attribute float a_uv_x;attribute float a_split_index;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;varying vec2 v_normal;varying vec2 v_width2;varying float v_gamma_scale;varying highp vec2 v_uv;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_width2=vec2(outset,inset);}";f();var Qy="#ifdef GL_ES\nprecision highp float;\n#endif\nuniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\nvec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture2D(u_image,pos_a),texture2D(u_image,pos_b),u_fade);gl_FragColor=color*alpha*opacity;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var eg="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;varying vec2 v_normal;varying vec2 v_width2;varying float v_linesofar;varying float v_gamma_scale;varying float v_width;\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n#pragma mapbox: define lowp vec4 pattern_from\n#pragma mapbox: define lowp vec4 pattern_to\n#pragma mapbox: define lowp float pixel_ratio_from\n#pragma mapbox: define lowp float pixel_ratio_to\nvoid main() {\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\n#pragma mapbox: initialize mediump vec4 pattern_from\n#pragma mapbox: initialize mediump vec4 pattern_to\n#pragma mapbox: initialize lowp float pixel_ratio_from\n#pragma mapbox: initialize lowp float pixel_ratio_to\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}";f();var tg="uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture2D(u_image,v_tex_a).a;float sdfdist_b=texture2D(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);gl_FragColor=color*(alpha*opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var rg="\n#define scale 0.015873016\n#define LINE_DISTANCE_SCALE 2.0\nattribute vec2 a_pos_normal;attribute vec4 a_data;uniform mat4 u_matrix;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;varying vec2 v_normal;varying vec2 v_width2;varying vec2 v_tex_a;varying vec2 v_tex_b;varying float v_gamma_scale;\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\nvoid main() {\n#pragma mapbox: initialize highp vec4 color\n#pragma mapbox: initialize lowp float blur\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize mediump float gapwidth\n#pragma mapbox: initialize lowp float offset\n#pragma mapbox: initialize mediump float width\n#pragma mapbox: initialize lowp float floorwidth\nfloat ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);vec4 projected_extrude=u_matrix*vec4(dist/u_ratio,0.0,0.0);gl_Position=u_matrix*vec4(pos+offset2/u_ratio,0.0,1.0)+projected_extrude;\n#ifdef TERRAIN3D\nv_gamma_scale=1.0;\n#else\nfloat extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude.xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;\n#endif\nv_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}";f();var ig="uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;varying vec2 v_pos0;varying vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture2D(u_image0,v_pos0);vec4 color1=texture2D(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);gl_FragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var ng="uniform mat4 u_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;attribute vec2 a_pos;attribute vec2 a_texture_pos;varying vec2 v_pos0;varying vec2 v_pos1;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos0=(((a_texture_pos/8192.0)-0.5)/u_buffer_scale )+0.5;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}";f();var og="uniform sampler2D u_texture;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nlowp float alpha=opacity*v_fade_opacity;gl_FragColor=texture2D(u_texture,v_tex)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var ag="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;varying vec2 v_tex;varying float v_fade_opacity;\n#pragma mapbox: define lowp float opacity\nvoid main() {\n#pragma mapbox: initialize lowp float opacity\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0),z,1.0);v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}";f();var sg="#define SDF_PX 8.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var lg="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec4 a_pixeloffset;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;varying vec2 v_data0;varying vec3 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}";f();var ug="#define SDF_PX 8.0\n#define SDF 1.0\n#define ICON 0.0\nuniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nfloat fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;gl_FragColor=texture2D(u_texture_icon,tex_icon)*alpha;\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\nreturn;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture2D(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);gl_FragColor=color*(alpha*opacity*fade_opacity);\n#ifdef OVERDRAW_INSPECTOR\ngl_FragColor=vec4(1.0);\n#endif\n}";f();var cg="const float PI=3.141592653589793;attribute vec4 a_pos_offset;attribute vec4 a_data;attribute vec3 a_projected_pos;attribute float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;varying vec4 v_data0;varying vec4 v_data1;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\nvoid main() {\n#pragma mapbox: initialize highp vec4 fill_color\n#pragma mapbox: initialize highp vec4 halo_color\n#pragma mapbox: initialize lowp float opacity\n#pragma mapbox: initialize lowp float halo_width\n#pragma mapbox: initialize lowp float halo_blur\nvec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec4 projectedPoint=u_matrix*vec4(a_pos,ele,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?\ncamera_to_anchor_distance/u_camera_to_center_distance :\nu_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=u_matrix*vec4(a_pos+vec2(1,0),ele,1);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,ele,1.0);float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;gl_Position=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale),z,1.0);float gamma_scale=gl_Position.w;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}";f();var pg="varying float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {gl_FragColor=pack(v_depth);}";f();var mg="precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;varying vec2 v_texture_pos;void main() {vec4 rgba=texture2D(u_texture,v_texture_pos);gl_FragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}";f();var hg="uniform sampler2D u_texture;varying vec2 v_texture_pos;void main() {gl_FragColor=texture2D(u_texture,v_texture_pos);}";f();var ga="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";var Cr={prelude:ve(hy,fy),background:ve(dy,yy),backgroundPattern:ve(gy,xy),circle:ve(_y,by),clippingMask:ve(vy,wy),heatmap:ve(Sy,Py),heatmapTexture:ve(Ty,Iy),collisionBox:ve(Ay,Cy),collisionCircle:ve(Ey,My),debug:ve(Ly,ky),fill:ve(Dy,Fy),fillOutline:ve(zy,By),fillOutlinePattern:ve(Ry,Oy),fillPattern:ve(Vy,Uy),fillExtrusion:ve(Ny,Gy),fillExtrusionPattern:ve(qy,jy),hillshadePrepare:ve(Hy,Zy),hillshade:ve(Wy,Xy),line:ve(Ky,$y),lineGradient:ve(Jy,Yy),linePattern:ve(Qy,eg),lineSDF:ve(tg,rg),raster:ve(ig,ng),symbolIcon:ve(og,ag),symbolSDF:ve(sg,lg),symbolTextAndIcon:ve(ug,cg),terrain:ve(hg,ga),terrainDepth:ve(pg,ga),terrainCoords:ve(mg,ga)};function ve(n,t){let e=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,r=t.match(/attribute ([\w]+) ([\w]+)/g),i=n.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),o=t.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),a=o?o.concat(i):i,s={};return n=n.replace(e,(l,c,p,m,h)=>(s[h]=!0,c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\nvarying ").concat(p," ").concat(m," ").concat(h,";\n#else\nuniform ").concat(p," ").concat(m," u_").concat(h,";\n#endif\n"):"\n#ifdef HAS_UNIFORM_u_".concat(h,"\n ").concat(p," ").concat(m," ").concat(h," = u_").concat(h,";\n#endif\n"))),t=t.replace(e,(l,c,p,m,h)=>{let d=m==="float"?"vec2":"vec4",g=h.match(/color/)?"color":d;return s[h]?c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\nuniform lowp float u_").concat(h,"_t;\nattribute ").concat(p," ").concat(d," a_").concat(h,";\nvarying ").concat(p," ").concat(m," ").concat(h,";\n#else\nuniform ").concat(p," ").concat(m," u_").concat(h,";\n#endif\n"):g==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(h," = a_").concat(h,";\n#else\n ").concat(p," ").concat(m," ").concat(h," = u_").concat(h,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(h," = unpack_mix_").concat(g,"(a_").concat(h,", u_").concat(h,"_t);\n#else\n ").concat(p," ").concat(m," ").concat(h," = u_").concat(h,";\n#endif\n"):c==="define"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\nuniform lowp float u_").concat(h,"_t;\nattribute ").concat(p," ").concat(d," a_").concat(h,";\n#else\nuniform ").concat(p," ").concat(m," u_").concat(h,";\n#endif\n"):g==="vec4"?"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(p," ").concat(m," ").concat(h," = a_").concat(h,";\n#else\n ").concat(p," ").concat(m," ").concat(h," = u_").concat(h,";\n#endif\n"):"\n#ifndef HAS_UNIFORM_u_".concat(h,"\n ").concat(p," ").concat(m," ").concat(h," = unpack_mix_").concat(g,"(a_").concat(h,", u_").concat(h,"_t);\n#else\n ").concat(p," ").concat(m," ").concat(h," = u_").concat(h,";\n#endif\n")}),{fragmentSource:n,vertexSource:t,staticAttributes:r,staticUniforms:a}}u(ve,"compile");f();f();var Rp=class Rp{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,e,r,i,o,a,s,l,c){this.context=t;let p=this.boundPaintVertexBuffers.length!==i.length;for(let h=0;!p&&h<i.length;h++)this.boundPaintVertexBuffers[h]!==i[h]&&(p=!0);!this.vao||this.boundProgram!==e||this.boundLayoutVertexBuffer!==r||p||this.boundIndexBuffer!==o||this.boundVertexOffset!==a||this.boundDynamicVertexBuffer!==s||this.boundDynamicVertexBuffer2!==l||this.boundDynamicVertexBuffer3!==c?this.freshBind(e,r,i,o,a,s,l,c):(t.bindVertexArray.set(this.vao),s&&s.bind(),o&&o.dynamicDraw&&o.bind(),l&&l.bind(),c&&c.bind())}freshBind(t,e,r,i,o,a,s,l){let c=t.numAttributes,p=this.context,m=p.gl;this.vao&&this.destroy(),this.vao=p.createVertexArray(),p.bindVertexArray.set(this.vao),this.boundProgram=t,this.boundLayoutVertexBuffer=e,this.boundPaintVertexBuffers=r,this.boundIndexBuffer=i,this.boundVertexOffset=o,this.boundDynamicVertexBuffer=a,this.boundDynamicVertexBuffer2=s,this.boundDynamicVertexBuffer3=l,e.enableAttributes(m,t);for(let h of r)h.enableAttributes(m,t);a&&a.enableAttributes(m,t),s&&s.enableAttributes(m,t),l&&l.enableAttributes(m,t),e.bind(),e.setVertexAttribPointers(m,t,o);for(let h of r)h.bind(),h.setVertexAttribPointers(m,t,o);a&&(a.bind(),a.setVertexAttribPointers(m,t,o)),i&&i.bind(),s&&(s.bind(),s.setVertexAttribPointers(m,t,o)),l&&(l.bind(),l.setVertexAttribPointers(m,t,o)),p.currentNumAttributes=c}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}};u(Rp,"VertexArrayObject");var xa=Rp;f();var fg=u((n,t)=>({u_depth:new X(n,t.u_depth),u_terrain:new X(n,t.u_terrain),u_terrain_dim:new B(n,t.u_terrain_dim),u_terrain_matrix:new J(n,t.u_terrain_matrix),u_terrain_unpack:new qt(n,t.u_terrain_unpack),u_terrain_exaggeration:new B(n,t.u_terrain_exaggeration)}),"terrainPreludeUniforms"),dg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_texture:new X(n,t.u_texture),u_ele_delta:new B(n,t.u_ele_delta)}),"terrainUniforms"),yg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_ele_delta:new B(n,t.u_ele_delta)}),"terrainDepthUniforms"),gg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_texture:new X(n,t.u_texture),u_terrain_coords_id:new B(n,t.u_terrain_coords_id),u_ele_delta:new B(n,t.u_ele_delta)}),"terrainCoordsUniforms"),xg=u((n,t)=>({u_matrix:n,u_texture:0,u_ele_delta:t}),"terrainUniformValues"),_g=u((n,t)=>({u_matrix:n,u_ele_delta:t}),"terrainDepthUniformValues"),bg=u((n,t,e)=>({u_matrix:n,u_terrain_coords_id:t/255,u_texture:0,u_ele_delta:e}),"terrainCoordsUniformValues");function Op(n){let t=[];for(let e=0;e<n.length;e++){if(n[e]===null)continue;let r=n[e].split(" ");t.push(r.pop())}return t}u(Op,"getTokenizedAttributesAndUniforms");var Vp=class Vp{constructor(t,e,r,i,o,a){let s=t.gl;this.program=s.createProgram();let l=Op(e.staticAttributes),c=r?r.getBinderAttributes():[],p=l.concat(c),m=Cr.prelude.staticUniforms?Op(Cr.prelude.staticUniforms):[],h=e.staticUniforms?Op(e.staticUniforms):[],d=r?r.getBinderUniforms():[],g=m.concat(h).concat(d),y=[];for(let I of g)y.indexOf(I)<0&&y.push(I);let x=r?r.defines():[];o&&x.push("#define OVERDRAW_INSPECTOR;"),a&&x.push("#define TERRAIN3D;");let v=x.concat(Cr.prelude.fragmentSource,e.fragmentSource).join("\n"),b=x.concat(Cr.prelude.vertexSource,e.vertexSource).join("\n"),w=s.createShader(s.FRAGMENT_SHADER);if(s.isContextLost()){this.failedToCreate=!0;return}s.shaderSource(w,v),s.compileShader(w),s.attachShader(this.program,w);let S=s.createShader(s.VERTEX_SHADER);if(s.isContextLost()){this.failedToCreate=!0;return}s.shaderSource(S,b),s.compileShader(S),s.attachShader(this.program,S),this.attributes={};let P={};this.numAttributes=p.length;for(let I=0;I<this.numAttributes;I++)p[I]&&(s.bindAttribLocation(this.program,I,p[I]),this.attributes[p[I]]=I);s.linkProgram(this.program),s.deleteShader(S),s.deleteShader(w);for(let I=0;I<y.length;I++){let C=y[I];if(C&&!P[C]){let z=s.getUniformLocation(this.program,C);z&&(P[C]=z)}}this.fixedUniforms=i(t,P),this.terrainUniforms=fg(t,P),this.binderUniforms=r?r.getUniforms(t,P):[]}draw(t,e,r,i,o,a,s,l,c,p,m,h,d,g,y,x,v,b){let w=t.gl;if(this.failedToCreate)return;t.program.set(this.program),t.setDepthMode(r),t.setStencilMode(i),t.setColorMode(o),t.setCullFace(a);for(let P in this.fixedUniforms)this.fixedUniforms[P].set(s[P]);y&&y.setUniforms(t,this.binderUniforms,d,{zoom:g});let S=0;switch(e){case w.LINES:S=2;break;case w.TRIANGLES:S=3;break;case w.LINE_STRIP:S=1;break}for(let P of h.get()){let I=P.vaos||(P.vaos={});(I[c]||(I[c]=new xa)).bind(t,this,p,y?y.getPaintVertexBuffers():[],m,P.vertexOffset,x,v,b),w.drawElements(e,P.primitiveLength*S,w.UNSIGNED_SHORT,P.primitiveOffset*S*2)}}};u(Vp,"Program");var _a=Vp;f();f();f();function ba(n,t,e){let r=1/Fe(e,1,t.transform.tileZoom),i=Math.pow(2,e.tileID.overscaledZ),o=e.tileSize*Math.pow(2,t.transform.tileZoom)/i,a=o*(e.tileID.canonical.x+e.tileID.wrap*i),s=o*e.tileID.canonical.y;return{u_image:0,u_texsize:e.imageAtlasTexture.size,u_scale:[r,n.fromScale,n.toScale],u_fade:n.t,u_pixel_coord_upper:[a>>16,s>>16],u_pixel_coord_lower:[a&65535,s&65535]}}u(ba,"patternUniformValues");function vg(n,t,e,r){let i=e.imageManager.getPattern(n.from.toString()),o=e.imageManager.getPattern(n.to.toString()),{width:a,height:s}=e.imageManager.getPixelSize(),l=Math.pow(2,r.tileID.overscaledZ),c=r.tileSize*Math.pow(2,e.transform.tileZoom)/l,p=c*(r.tileID.canonical.x+r.tileID.wrap*l),m=c*r.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:i.tl,u_pattern_br_a:i.br,u_pattern_tl_b:o.tl,u_pattern_br_b:o.br,u_texsize:[a,s],u_mix:t.t,u_pattern_size_a:i.displaySize,u_pattern_size_b:o.displaySize,u_scale_a:t.fromScale,u_scale_b:t.toScale,u_tile_units_to_pixels:1/Fe(r,1,e.transform.tileZoom),u_pixel_coord_upper:[p>>16,m>>16],u_pixel_coord_lower:[p&65535,m&65535]}}u(vg,"bgPatternUniformValues");var wg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_lightpos:new Ze(n,t.u_lightpos),u_lightintensity:new B(n,t.u_lightintensity),u_lightcolor:new Ze(n,t.u_lightcolor),u_vertical_gradient:new B(n,t.u_vertical_gradient),u_opacity:new B(n,t.u_opacity)}),"fillExtrusionUniforms"),Sg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_lightpos:new Ze(n,t.u_lightpos),u_lightintensity:new B(n,t.u_lightintensity),u_lightcolor:new Ze(n,t.u_lightcolor),u_vertical_gradient:new B(n,t.u_vertical_gradient),u_height_factor:new B(n,t.u_height_factor),u_image:new X(n,t.u_image),u_texsize:new $(n,t.u_texsize),u_pixel_coord_upper:new $(n,t.u_pixel_coord_upper),u_pixel_coord_lower:new $(n,t.u_pixel_coord_lower),u_scale:new Ze(n,t.u_scale),u_fade:new B(n,t.u_fade),u_opacity:new B(n,t.u_opacity)}),"fillExtrusionPatternUniforms"),Up=u((n,t,e,r)=>{let i=t.style.light,o=i.properties.get("position"),a=[o.x,o.y,o.z],s=Js.create();i.properties.get("anchor")==="viewport"&&Js.fromRotation(s,-t.transform.angle),ut.transformMat3(a,a,s);let l=i.properties.get("color");return{u_matrix:n,u_lightpos:a,u_lightintensity:i.properties.get("intensity"),u_lightcolor:[l.r,l.g,l.b],u_vertical_gradient:+e,u_opacity:r}},"fillExtrusionUniformValues"),Pg=u((n,t,e,r,i,o,a)=>k(Up(n,t,e,r),ba(o,t,a),{u_height_factor:-Math.pow(2,i.overscaledZ)/a.tileSize/8}),"fillExtrusionPatternUniformValues");f();var Tg=u((n,t)=>({u_matrix:new J(n,t.u_matrix)}),"fillUniforms"),Ig=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_image:new X(n,t.u_image),u_texsize:new $(n,t.u_texsize),u_pixel_coord_upper:new $(n,t.u_pixel_coord_upper),u_pixel_coord_lower:new $(n,t.u_pixel_coord_lower),u_scale:new Ze(n,t.u_scale),u_fade:new B(n,t.u_fade)}),"fillPatternUniforms"),Ag=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_world:new $(n,t.u_world)}),"fillOutlineUniforms"),Cg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_world:new $(n,t.u_world),u_image:new X(n,t.u_image),u_texsize:new $(n,t.u_texsize),u_pixel_coord_upper:new $(n,t.u_pixel_coord_upper),u_pixel_coord_lower:new $(n,t.u_pixel_coord_lower),u_scale:new Ze(n,t.u_scale),u_fade:new B(n,t.u_fade)}),"fillOutlinePatternUniforms"),Np=u(n=>({u_matrix:n}),"fillUniformValues"),Gp=u((n,t,e,r)=>k(Np(n),ba(e,t,r)),"fillPatternUniformValues"),Eg=u((n,t)=>({u_matrix:n,u_world:t}),"fillOutlineUniformValues"),Mg=u((n,t,e,r,i)=>k(Gp(n,t,e,r),{u_world:i}),"fillOutlinePatternUniformValues");f();var Lg=u((n,t)=>({u_camera_to_center_distance:new B(n,t.u_camera_to_center_distance),u_scale_with_map:new X(n,t.u_scale_with_map),u_pitch_with_map:new X(n,t.u_pitch_with_map),u_extrude_scale:new $(n,t.u_extrude_scale),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_matrix:new J(n,t.u_matrix)}),"circleUniforms"),kg=u((n,t,e,r)=>{let i=n.transform,o,a;if(r.paint.get("circle-pitch-alignment")==="map"){let s=Fe(e,1,i.zoom);o=!0,a=[s,s]}else o=!1,a=i.pixelsToGLUnits;return{u_camera_to_center_distance:i.cameraToCenterDistance,u_scale_with_map:+(r.paint.get("circle-pitch-scale")==="map"),u_matrix:n.translatePosMatrix(t.posMatrix,e,r.paint.get("circle-translate"),r.paint.get("circle-translate-anchor")),u_pitch_with_map:+o,u_device_pixel_ratio:n.pixelRatio,u_extrude_scale:a}},"circleUniformValues");f();var Dg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_camera_to_center_distance:new B(n,t.u_camera_to_center_distance),u_pixels_to_tile_units:new B(n,t.u_pixels_to_tile_units),u_extrude_scale:new $(n,t.u_extrude_scale),u_overscale_factor:new B(n,t.u_overscale_factor)}),"collisionUniforms"),Fg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_inv_matrix:new J(n,t.u_inv_matrix),u_camera_to_center_distance:new B(n,t.u_camera_to_center_distance),u_viewport_size:new $(n,t.u_viewport_size)}),"collisionCircleUniforms"),zg=u((n,t,e)=>{let r=Fe(e,1,t.zoom),i=Math.pow(2,t.zoom-e.tileID.overscaledZ),o=e.tileID.overscaleFactor();return{u_matrix:n,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:r,u_extrude_scale:[t.pixelsToGLUnits[0]/(r*i),t.pixelsToGLUnits[1]/(r*i)],u_overscale_factor:o}},"collisionUniformValues"),Bg=u((n,t,e)=>({u_matrix:n,u_inv_matrix:t,u_camera_to_center_distance:e.cameraToCenterDistance,u_viewport_size:[e.width,e.height]}),"collisionCircleUniformValues");f();var Rg=u((n,t)=>({u_color:new pt(n,t.u_color),u_matrix:new J(n,t.u_matrix),u_overlay:new X(n,t.u_overlay),u_overlay_scale:new B(n,t.u_overlay_scale)}),"debugUniforms"),qp=u((n,t,e=1)=>({u_matrix:n,u_color:t,u_overlay:0,u_overlay_scale:e}),"debugUniformValues");f();var Og=u((n,t)=>({u_matrix:new J(n,t.u_matrix)}),"clippingMaskUniforms"),jp=u(n=>({u_matrix:n}),"clippingMaskUniformValues");f();var Vg=u((n,t)=>({u_extrude_scale:new B(n,t.u_extrude_scale),u_intensity:new B(n,t.u_intensity),u_matrix:new J(n,t.u_matrix)}),"heatmapUniforms"),Ug=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_world:new $(n,t.u_world),u_image:new X(n,t.u_image),u_color_ramp:new X(n,t.u_color_ramp),u_opacity:new B(n,t.u_opacity)}),"heatmapTextureUniforms"),Ng=u((n,t,e,r)=>({u_matrix:n,u_extrude_scale:Fe(t,1,e),u_intensity:r}),"heatmapUniformValues"),Gg=u((n,t,e,r)=>{let i=G.create();G.ortho(i,0,n.width,n.height,0,0,1);let o=n.context.gl;return{u_matrix:i,u_world:[o.drawingBufferWidth,o.drawingBufferHeight],u_image:e,u_color_ramp:r,u_opacity:t.paint.get("heatmap-opacity")}},"heatmapTextureUniformValues");f();var qg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_image:new X(n,t.u_image),u_latrange:new $(n,t.u_latrange),u_light:new $(n,t.u_light),u_shadow:new pt(n,t.u_shadow),u_highlight:new pt(n,t.u_highlight),u_accent:new pt(n,t.u_accent)}),"hillshadeUniforms"),jg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_image:new X(n,t.u_image),u_dimension:new $(n,t.u_dimension),u_zoom:new B(n,t.u_zoom),u_unpack:new qt(n,t.u_unpack)}),"hillshadePrepareUniforms"),Hg=u((n,t,e,r)=>{let i=e.paint.get("hillshade-shadow-color"),o=e.paint.get("hillshade-highlight-color"),a=e.paint.get("hillshade-accent-color"),s=e.paint.get("hillshade-illumination-direction")*(Math.PI/180);e.paint.get("hillshade-illumination-anchor")==="viewport"&&(s-=n.transform.angle);let l=!n.options.moving;return{u_matrix:r?r.posMatrix:n.transform.calculatePosMatrix(t.tileID.toUnwrapped(),l),u_image:0,u_latrange:Kb(n,t.tileID),u_light:[e.paint.get("hillshade-exaggeration"),s],u_shadow:i,u_highlight:o,u_accent:a}},"hillshadeUniformValues"),Zg=u((n,t)=>{let e=t.stride,r=G.create();return G.ortho(r,0,8192,-8192,0,0,1),G.translate(r,r,[0,-8192,0]),{u_matrix:r,u_image:1,u_dimension:[e,e],u_zoom:n.overscaledZ,u_unpack:t.getUnpackVector()}},"hillshadeUniformPrepareValues");function Kb(n,t){let e=Math.pow(2,t.canonical.z),r=t.canonical.y;return[new Se(0,r/e).toLngLat().lat,new Se(0,(r+1)/e).toLngLat().lat]}u(Kb,"getTileLatRange");f();var Wg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_ratio:new B(n,t.u_ratio),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_units_to_pixels:new $(n,t.u_units_to_pixels)}),"lineUniforms"),Xg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_ratio:new B(n,t.u_ratio),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_units_to_pixels:new $(n,t.u_units_to_pixels),u_image:new X(n,t.u_image),u_image_height:new B(n,t.u_image_height)}),"lineGradientUniforms"),Kg=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_texsize:new $(n,t.u_texsize),u_ratio:new B(n,t.u_ratio),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_image:new X(n,t.u_image),u_units_to_pixels:new $(n,t.u_units_to_pixels),u_scale:new Ze(n,t.u_scale),u_fade:new B(n,t.u_fade)}),"linePatternUniforms"),$g=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_ratio:new B(n,t.u_ratio),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_units_to_pixels:new $(n,t.u_units_to_pixels),u_patternscale_a:new $(n,t.u_patternscale_a),u_patternscale_b:new $(n,t.u_patternscale_b),u_sdfgamma:new B(n,t.u_sdfgamma),u_image:new X(n,t.u_image),u_tex_y_a:new B(n,t.u_tex_y_a),u_tex_y_b:new B(n,t.u_tex_y_b),u_mix:new B(n,t.u_mix)}),"lineSDFUniforms"),va=u((n,t,e,r)=>{let i=n.transform;return{u_matrix:tx(n,t,e,r),u_ratio:1/Fe(t,1,i.zoom),u_device_pixel_ratio:n.pixelRatio,u_units_to_pixels:[1/i.pixelsToGLUnits[0],1/i.pixelsToGLUnits[1]]}},"lineUniformValues"),Jg=u((n,t,e,r,i)=>k(va(n,t,e,i),{u_image:0,u_image_height:r}),"lineGradientUniformValues"),Yg=u((n,t,e,r,i)=>{let o=n.transform,a=ex(t,o);return{u_matrix:tx(n,t,e,i),u_texsize:t.imageAtlasTexture.size,u_ratio:1/Fe(t,1,o.zoom),u_device_pixel_ratio:n.pixelRatio,u_image:0,u_scale:[a,r.fromScale,r.toScale],u_fade:r.t,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},"linePatternUniformValues"),Qg=u((n,t,e,r,i,o)=>{let a=n.transform,s=n.lineAtlas,l=ex(t,a),c=e.layout.get("line-cap")==="round",p=s.getDash(r.from,c),m=s.getDash(r.to,c),h=p.width*i.fromScale,d=m.width*i.toScale;return k(va(n,t,e,o),{u_patternscale_a:[l/h,-p.height/2],u_patternscale_b:[l/d,-m.height/2],u_sdfgamma:s.width/(Math.min(h,d)*256*n.pixelRatio)/2,u_image:0,u_tex_y_a:p.y,u_tex_y_b:m.y,u_mix:i.t})},"lineSDFUniformValues");function ex(n,t){return 1/Fe(n,1,t.tileZoom)}u(ex,"calculateTileRatio");function tx(n,t,e,r){return n.translatePosMatrix(r?r.posMatrix:t.tileID.posMatrix,t,e.paint.get("line-translate"),e.paint.get("line-translate-anchor"))}u(tx,"calculateMatrix");f();var rx=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_tl_parent:new $(n,t.u_tl_parent),u_scale_parent:new B(n,t.u_scale_parent),u_buffer_scale:new B(n,t.u_buffer_scale),u_fade_t:new B(n,t.u_fade_t),u_opacity:new B(n,t.u_opacity),u_image0:new X(n,t.u_image0),u_image1:new X(n,t.u_image1),u_brightness_low:new B(n,t.u_brightness_low),u_brightness_high:new B(n,t.u_brightness_high),u_saturation_factor:new B(n,t.u_saturation_factor),u_contrast_factor:new B(n,t.u_contrast_factor),u_spin_weights:new Ze(n,t.u_spin_weights)}),"rasterUniforms"),ix=u((n,t,e,r,i)=>({u_matrix:n,u_tl_parent:t,u_scale_parent:e,u_buffer_scale:1,u_fade_t:r.mix,u_opacity:r.opacity*i.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:i.paint.get("raster-brightness-min"),u_brightness_high:i.paint.get("raster-brightness-max"),u_saturation_factor:Yb(i.paint.get("raster-saturation")),u_contrast_factor:Jb(i.paint.get("raster-contrast")),u_spin_weights:$b(i.paint.get("raster-hue-rotate"))}),"rasterUniformValues");function $b(n){n*=Math.PI/180;let t=Math.sin(n),e=Math.cos(n);return[(2*e+1)/3,(-Math.sqrt(3)*t-e+1)/3,(Math.sqrt(3)*t-e+1)/3]}u($b,"spinWeights");function Jb(n){return n>0?1/(1-n):1+n}u(Jb,"contrastFactor");function Yb(n){return n>0?1-1/(1.001-n):-n}u(Yb,"saturationFactor");f();var nx=u((n,t)=>({u_is_size_zoom_constant:new X(n,t.u_is_size_zoom_constant),u_is_size_feature_constant:new X(n,t.u_is_size_feature_constant),u_size_t:new B(n,t.u_size_t),u_size:new B(n,t.u_size),u_camera_to_center_distance:new B(n,t.u_camera_to_center_distance),u_pitch:new B(n,t.u_pitch),u_rotate_symbol:new X(n,t.u_rotate_symbol),u_aspect_ratio:new B(n,t.u_aspect_ratio),u_fade_change:new B(n,t.u_fade_change),u_matrix:new J(n,t.u_matrix),u_label_plane_matrix:new J(n,t.u_label_plane_matrix),u_coord_matrix:new J(n,t.u_coord_matrix),u_is_text:new X(n,t.u_is_text),u_pitch_with_map:new X(n,t.u_pitch_with_map),u_texsize:new $(n,t.u_texsize),u_texture:new X(n,t.u_texture)}),"symbolIconUniforms"),ox=u((n,t)=>({u_is_size_zoom_constant:new X(n,t.u_is_size_zoom_constant),u_is_size_feature_constant:new X(n,t.u_is_size_feature_constant),u_size_t:new B(n,t.u_size_t),u_size:new B(n,t.u_size),u_camera_to_center_distance:new B(n,t.u_camera_to_center_distance),u_pitch:new B(n,t.u_pitch),u_rotate_symbol:new X(n,t.u_rotate_symbol),u_aspect_ratio:new B(n,t.u_aspect_ratio),u_fade_change:new B(n,t.u_fade_change),u_matrix:new J(n,t.u_matrix),u_label_plane_matrix:new J(n,t.u_label_plane_matrix),u_coord_matrix:new J(n,t.u_coord_matrix),u_is_text:new X(n,t.u_is_text),u_pitch_with_map:new X(n,t.u_pitch_with_map),u_texsize:new $(n,t.u_texsize),u_texture:new X(n,t.u_texture),u_gamma_scale:new B(n,t.u_gamma_scale),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_is_halo:new X(n,t.u_is_halo)}),"symbolSDFUniforms"),ax=u((n,t)=>({u_is_size_zoom_constant:new X(n,t.u_is_size_zoom_constant),u_is_size_feature_constant:new X(n,t.u_is_size_feature_constant),u_size_t:new B(n,t.u_size_t),u_size:new B(n,t.u_size),u_camera_to_center_distance:new B(n,t.u_camera_to_center_distance),u_pitch:new B(n,t.u_pitch),u_rotate_symbol:new X(n,t.u_rotate_symbol),u_aspect_ratio:new B(n,t.u_aspect_ratio),u_fade_change:new B(n,t.u_fade_change),u_matrix:new J(n,t.u_matrix),u_label_plane_matrix:new J(n,t.u_label_plane_matrix),u_coord_matrix:new J(n,t.u_coord_matrix),u_is_text:new X(n,t.u_is_text),u_pitch_with_map:new X(n,t.u_pitch_with_map),u_texsize:new $(n,t.u_texsize),u_texsize_icon:new $(n,t.u_texsize_icon),u_texture:new X(n,t.u_texture),u_texture_icon:new X(n,t.u_texture_icon),u_gamma_scale:new B(n,t.u_gamma_scale),u_device_pixel_ratio:new B(n,t.u_device_pixel_ratio),u_is_halo:new X(n,t.u_is_halo)}),"symbolTextAndIconUniforms"),Hp=u((n,t,e,r,i,o,a,s,l,c)=>{let p=i.transform;return{u_is_size_zoom_constant:+(n==="constant"||n==="source"),u_is_size_feature_constant:+(n==="constant"||n==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:p.cameraToCenterDistance,u_pitch:p.pitch/360*2*Math.PI,u_rotate_symbol:+e,u_aspect_ratio:p.width/p.height,u_fade_change:i.options.fadeDuration?i.symbolFadeChange:1,u_matrix:o,u_label_plane_matrix:a,u_coord_matrix:s,u_is_text:+l,u_pitch_with_map:+r,u_texsize:c,u_texture:0}},"symbolIconUniformValues"),Zp=u((n,t,e,r,i,o,a,s,l,c,p)=>{let m=i.transform;return k(Hp(n,t,e,r,i,o,a,s,l,c),{u_gamma_scale:r?Math.cos(m._pitch)*m.cameraToCenterDistance:1,u_device_pixel_ratio:i.pixelRatio,u_is_halo:+p})},"symbolSDFUniformValues"),sx=u((n,t,e,r,i,o,a,s,l,c)=>k(Zp(n,t,e,r,i,o,a,s,!0,l,!0),{u_texsize_icon:c,u_texture_icon:1}),"symbolTextAndIconUniformValues");f();var lx=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_opacity:new B(n,t.u_opacity),u_color:new pt(n,t.u_color)}),"backgroundUniforms"),ux=u((n,t)=>({u_matrix:new J(n,t.u_matrix),u_opacity:new B(n,t.u_opacity),u_image:new X(n,t.u_image),u_pattern_tl_a:new $(n,t.u_pattern_tl_a),u_pattern_br_a:new $(n,t.u_pattern_br_a),u_pattern_tl_b:new $(n,t.u_pattern_tl_b),u_pattern_br_b:new $(n,t.u_pattern_br_b),u_texsize:new $(n,t.u_texsize),u_mix:new B(n,t.u_mix),u_pattern_size_a:new $(n,t.u_pattern_size_a),u_pattern_size_b:new $(n,t.u_pattern_size_b),u_scale_a:new B(n,t.u_scale_a),u_scale_b:new B(n,t.u_scale_b),u_pixel_coord_upper:new $(n,t.u_pixel_coord_upper),u_pixel_coord_lower:new $(n,t.u_pixel_coord_lower),u_tile_units_to_pixels:new B(n,t.u_tile_units_to_pixels)}),"backgroundPatternUniforms"),cx=u((n,t,e)=>({u_matrix:n,u_opacity:t,u_color:e}),"backgroundUniformValues"),px=u((n,t,e,r,i,o)=>k(vg(r,o,e,i),{u_matrix:n,u_opacity:t}),"backgroundPatternUniformValues");var mx={fillExtrusion:wg,fillExtrusionPattern:Sg,fill:Tg,fillPattern:Ig,fillOutline:Ag,fillOutlinePattern:Cg,circle:Lg,collisionBox:Dg,collisionCircle:Fg,debug:Rg,clippingMask:Og,heatmap:Vg,heatmapTexture:Ug,hillshade:qg,hillshadePrepare:jg,line:Wg,lineGradient:Xg,linePattern:Kg,lineSDF:$g,raster:rx,symbolIcon:nx,symbolSDF:ox,symbolTextAndIcon:ax,background:lx,backgroundPattern:ux,terrain:dg,terrainDepth:yg,terrainCoords:gg};f();f();var Wp=class Wp{constructor(t,e,r){this.context=t;let i=t.gl;this.buffer=i.createBuffer(),this.dynamicDraw=!!r,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),i.bufferData(i.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){let e=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}};u(Wp,"IndexBuffer");var wa=Wp;f();var Qb={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},Xp=class Xp{constructor(t,e,r,i){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=i,this.context=t;let o=t.gl;this.buffer=o.createBuffer(),t.bindVertexBuffer.set(this.buffer),o.bufferData(o.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error("Length of new data is ".concat(t.length,", which doesn't match current length of ").concat(this.length));let e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,e){for(let r=0;r<this.attributes.length;r++){let i=this.attributes[r],o=e.attributes[i.name];o!==void 0&&t.enableVertexAttribArray(o)}}setVertexAttribPointers(t,e,r){for(let i=0;i<this.attributes.length;i++){let o=this.attributes[i],a=e.attributes[o.name];a!==void 0&&t.vertexAttribPointer(a,o.components,t[Qb[o.type]],!1,this.itemSize,o.offset+this.itemSize*(r||0))}}destroy(){let t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)}};u(Xp,"VertexBuffer");var Sa=Xp;f();f();f();var Kp=new WeakMap;function li(n){if(Kp.has(n))return Kp.get(n);{let t=n.getParameter(n.VERSION).startsWith("WebGL 2.0");return Kp.set(n,t),t}}u(li,"isWebGL2");var $p=class $p{constructor(t){this.gl=t.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(t){}getDefault(){return this.default}setDefault(){this.set(this.default)}};u($p,"BaseValue");var pe=$p,Jp=class Jp extends pe{getDefault(){return me.transparent}set(t){let e=this.current;t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a&&!this.dirty||(this.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}};u(Jp,"ClearColor");var Pa=Jp,Yp=class Yp extends pe{getDefault(){return 1}set(t){t===this.current&&!this.dirty||(this.gl.clearDepth(t),this.current=t,this.dirty=!1)}};u(Yp,"ClearDepth");var Ta=Yp,Qp=class Qp extends pe{getDefault(){return 0}set(t){t===this.current&&!this.dirty||(this.gl.clearStencil(t),this.current=t,this.dirty=!1)}};u(Qp,"ClearStencil");var Ia=Qp,em=class em extends pe{getDefault(){return[!0,!0,!0,!0]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&!this.dirty||(this.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}};u(em,"ColorMask");var Aa=em,tm=class tm extends pe{getDefault(){return!0}set(t){t===this.current&&!this.dirty||(this.gl.depthMask(t),this.current=t,this.dirty=!1)}};u(tm,"DepthMask");var Ca=tm,rm=class rm extends pe{getDefault(){return 255}set(t){t===this.current&&!this.dirty||(this.gl.stencilMask(t),this.current=t,this.dirty=!1)}};u(rm,"StencilMask");var Ea=rm,im=class im extends pe{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(t){let e=this.current;t.func===e.func&&t.ref===e.ref&&t.mask===e.mask&&!this.dirty||(this.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t,this.dirty=!1)}};u(im,"StencilFunc");var Ma=im,nm=class nm extends pe{getDefault(){let t=this.gl;return[t.KEEP,t.KEEP,t.KEEP]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&!this.dirty||(this.gl.stencilOp(t[0],t[1],t[2]),this.current=t,this.dirty=!1)}};u(nm,"StencilOp");var La=nm,om=class om extends pe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t,this.dirty=!1}};u(om,"StencilTest");var ka=om,am=class am extends pe{getDefault(){return[0,1]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&!this.dirty||(this.gl.depthRange(t[0],t[1]),this.current=t,this.dirty=!1)}};u(am,"DepthRange");var Da=am,sm=class sm extends pe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t,this.dirty=!1}};u(sm,"DepthTest");var Fa=sm,lm=class lm extends pe{getDefault(){return this.gl.LESS}set(t){t===this.current&&!this.dirty||(this.gl.depthFunc(t),this.current=t,this.dirty=!1)}};u(lm,"DepthFunc");var za=lm,um=class um extends pe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t,this.dirty=!1}};u(um,"Blend");var Ba=um,cm=class cm extends pe{getDefault(){let t=this.gl;return[t.ONE,t.ZERO]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&!this.dirty||(this.gl.blendFunc(t[0],t[1]),this.current=t,this.dirty=!1)}};u(cm,"BlendFunc");var Ra=cm,pm=class pm extends pe{getDefault(){return me.transparent}set(t){let e=this.current;t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a&&!this.dirty||(this.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t,this.dirty=!1)}};u(pm,"BlendColor");var Oa=pm,mm=class mm extends pe{getDefault(){return this.gl.FUNC_ADD}set(t){t===this.current&&!this.dirty||(this.gl.blendEquation(t),this.current=t,this.dirty=!1)}};u(mm,"BlendEquation");var Va=mm,hm=class hm extends pe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;t?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this.current=t,this.dirty=!1}};u(hm,"CullFace");var Ua=hm,fm=class fm extends pe{getDefault(){return this.gl.BACK}set(t){t===this.current&&!this.dirty||(this.gl.cullFace(t),this.current=t,this.dirty=!1)}};u(fm,"CullFaceSide");var Na=fm,dm=class dm extends pe{getDefault(){return this.gl.CCW}set(t){t===this.current&&!this.dirty||(this.gl.frontFace(t),this.current=t,this.dirty=!1)}};u(dm,"FrontFace");var Ga=dm,ym=class ym extends pe{getDefault(){return null}set(t){t===this.current&&!this.dirty||(this.gl.useProgram(t),this.current=t,this.dirty=!1)}};u(ym,"ProgramValue");var qa=ym,gm=class gm extends pe{getDefault(){return this.gl.TEXTURE0}set(t){t===this.current&&!this.dirty||(this.gl.activeTexture(t),this.current=t,this.dirty=!1)}};u(gm,"ActiveTextureUnit");var ja=gm,xm=class xm extends pe{getDefault(){let t=this.gl;return[0,0,t.drawingBufferWidth,t.drawingBufferHeight]}set(t){let e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&!this.dirty||(this.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t,this.dirty=!1)}};u(xm,"Viewport");var Ha=xm,_m=class _m extends pe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t,this.dirty=!1}};u(_m,"BindFramebuffer");var Za=_m,bm=class bm extends pe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t,this.dirty=!1}};u(bm,"BindRenderbuffer");var Wa=bm,vm=class vm extends pe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t,this.dirty=!1}};u(vm,"BindTexture");var Xa=vm,wm=class wm extends pe{getDefault(){return null}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t,this.dirty=!1}};u(wm,"BindVertexBuffer");var Ka=wm,Sm=class Sm extends pe{getDefault(){return null}set(t){let e=this.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t,this.dirty=!1}};u(Sm,"BindElementBuffer");var $a=Sm,Pm=class Pm extends pe{getDefault(){return null}set(t){var r;if(t===this.current&&!this.dirty)return;let e=this.gl;li(e)?e.bindVertexArray(t):(r=e.getExtension("OES_vertex_array_object"))==null||r.bindVertexArrayOES(t),this.current=t,this.dirty=!1}};u(Pm,"BindVertexArray");var Ja=Pm,Tm=class Tm extends pe{getDefault(){return 4}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t,this.dirty=!1}};u(Tm,"PixelStoreUnpack");var Ya=Tm,Im=class Im extends pe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t,this.dirty=!1}};u(Im,"PixelStoreUnpackPremultiplyAlpha");var Qa=Im,Am=class Am extends pe{getDefault(){return!1}set(t){if(t===this.current&&!this.dirty)return;let e=this.gl;e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t),this.current=t,this.dirty=!1}};u(Am,"PixelStoreUnpackFlipY");var es=Am,Cm=class Cm extends pe{constructor(e,r){super(e);this.context=e,this.parent=r}getDefault(){return null}};u(Cm,"FramebufferAttachment");var xn=Cm,Em=class Em extends xn{setDirty(){this.dirty=!0}set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}};u(Em,"ColorAttachment");var ts=Em,Mm=class Mm extends xn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}};u(Mm,"DepthAttachment");var rs=Mm,Lm=class Lm extends xn{set(t){if(t===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);let e=this.gl;e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,t),this.current=t,this.dirty=!1}};u(Lm,"DepthStencilAttachment");var is=Lm;var km=class km{constructor(t,e,r,i,o){this.context=t,this.width=e,this.height=r;let a=t.gl,s=this.framebuffer=a.createFramebuffer();if(this.colorAttachment=new ts(t,s),i)this.depthAttachment=o?new is(t,s):new rs(t,s);else if(o)throw new Error("Stencil cannot be setted without depth");if(a.checkFramebufferStatus(a.FRAMEBUFFER)!==a.FRAMEBUFFER_COMPLETE)throw new Error("Framebuffer is not complete")}destroy(){let t=this.context.gl,e=this.colorAttachment.get();if(e&&t.deleteTexture(e),this.depthAttachment){let r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r)}t.deleteFramebuffer(this.framebuffer)}};u(km,"Framebuffer");var ns=km;f();var ev=0,hx=1,tv=771,Dm=class Dm{constructor(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r}};u(Dm,"ColorMode");var we=Dm;we.Replace=[hx,ev];we.disabled=new we(we.Replace,me.transparent,[!1,!1,!1,!1]);we.unblended=new we(we.Replace,me.transparent,[!0,!0,!0,!0]);we.alphaBlended=new we([hx,tv],me.transparent,[!0,!0,!0,!0]);var Fm=class Fm{constructor(t){var e,r;if(this.gl=t,this.clearColor=new Pa(this),this.clearDepth=new Ta(this),this.clearStencil=new Ia(this),this.colorMask=new Aa(this),this.depthMask=new Ca(this),this.stencilMask=new Ea(this),this.stencilFunc=new Ma(this),this.stencilOp=new La(this),this.stencilTest=new ka(this),this.depthRange=new Da(this),this.depthTest=new Fa(this),this.depthFunc=new za(this),this.blend=new Ba(this),this.blendFunc=new Ra(this),this.blendColor=new Oa(this),this.blendEquation=new Va(this),this.cullFace=new Ua(this),this.cullFaceSide=new Na(this),this.frontFace=new Ga(this),this.program=new qa(this),this.activeTexture=new ja(this),this.viewport=new Ha(this),this.bindFramebuffer=new Za(this),this.bindRenderbuffer=new Wa(this),this.bindTexture=new Xa(this),this.bindVertexBuffer=new Ka(this),this.bindElementBuffer=new $a(this),this.bindVertexArray=new Ja(this),this.pixelStoreUnpack=new Ya(this),this.pixelStoreUnpackPremultiplyAlpha=new Qa(this),this.pixelStoreUnpackFlipY=new es(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=t.getParameter(t.MAX_TEXTURE_SIZE),li(t)){this.HALF_FLOAT=t.HALF_FLOAT;let i=t.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(e=t.RGBA16F)!=null?e:i==null?void 0:i.RGBA16F_EXT,this.RGB16F=(r=t.RGB16F)!=null?r:i==null?void 0:i.RGB16F_EXT,t.getExtension("EXT_color_buffer_float")}else{t.getExtension("EXT_color_buffer_half_float"),t.getExtension("OES_texture_half_float_linear");let i=t.getExtension("OES_texture_half_float");this.HALF_FLOAT=i==null?void 0:i.HALF_FLOAT_OES}}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.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(t,e){return new wa(this,t,e)}createVertexBuffer(t,e,r){return new Sa(this,t,e,r)}createRenderbuffer(t,e,r){let i=this.gl,o=i.createRenderbuffer();return this.bindRenderbuffer.set(o),i.renderbufferStorage(i.RENDERBUFFER,t,e,r),this.bindRenderbuffer.set(null),o}createFramebuffer(t,e,r,i){return new ns(this,t,e,r,i)}clear({color:t,depth:e,stencil:r}){let i=this.gl,o=0;t&&(o|=i.COLOR_BUFFER_BIT,this.clearColor.set(t),this.colorMask.set([!0,!0,!0,!0])),typeof e<"u"&&(o|=i.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(e),this.depthMask.set(!0)),typeof r<"u"&&(o|=i.STENCIL_BUFFER_BIT,this.clearStencil.set(r),this.stencilMask.set(255)),i.clear(o)}setCullFace(t){t.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(t.mode),this.frontFace.set(t.frontFace))}setDepthMode(t){t.func===this.gl.ALWAYS&&!t.mask?this.depthTest.set(!1):(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range))}setStencilMode(t){t.test.func===this.gl.ALWAYS&&!t.mask?this.stencilTest.set(!1):(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask}))}setColorMode(t){wt(t.blendFunction,we.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)}createVertexArray(){var t;return li(this.gl)?this.gl.createVertexArray():(t=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:t.createVertexArrayOES()}deleteVertexArray(t){var e;return li(this.gl)?this.gl.deleteVertexArray(t):(e=this.gl.getExtension("OES_vertex_array_object"))==null?void 0:e.deleteVertexArrayOES(t)}unbindVAO(){this.bindVertexArray.set(null)}};u(Fm,"Context");var os=Fm;f();var zm=class zm{constructor(t,e,r){this.func=t,this.mask=e,this.range=r}};u(zm,"DepthMode");var K=zm;K.ReadOnly=!1;K.ReadWrite=!0;K.disabled=new K(519,K.ReadOnly,[0,1]);f();var Bm=class Bm{constructor(t,e,r,i,o,a){this.test=t,this.ref=e,this.mask=r,this.fail=i,this.depthFail=o,this.pass=a}};u(Bm,"StencilMode");var oe=Bm;oe.disabled=new oe({func:519,mask:0},0,0,7680,7680,7680);f();var Rm=class Rm{constructor(t,e,r){this.enable=t,this.mode=e,this.frontFace=r}};u(Rm,"CullFaceMode");var re=Rm;re.disabled=new re(!1,1029,2305);re.backCCW=new re(!0,1029,2305);f();var Vm=te(be(),1);f();var as;function Om(n,t,e,r,i,o,a){let s=n.context,l=s.gl,c=n.useProgram("collisionBox"),p=[],m=0,h=0;for(let b=0;b<r.length;b++){let w=r[b],S=t.getTile(w),P=S.getBucket(e);if(!P)continue;let I=w.posMatrix;(i[0]!==0||i[1]!==0)&&(I=n.translatePosMatrix(w.posMatrix,S,i,o));let C=a?P.textCollisionBox:P.iconCollisionBox,z=P.collisionCircleArray;if(z.length>0){let D=G.create(),A=I;G.mul(D,P.placementInvProjMatrix,n.transform.glCoordMatrix),G.mul(D,D,P.placementViewportMatrix),p.push({circleArray:z,circleOffset:h,transform:A,invTransform:D,coord:w}),m+=z.length/4,h=m}C&&c.draw(s,l.LINES,K.disabled,oe.disabled,n.colorModeForRenderPass(),re.disabled,zg(I,n.transform,S),n.style.map.terrain&&n.style.map.terrain.getTerrainData(w),e.id,C.layoutVertexBuffer,C.indexBuffer,C.segments,null,n.transform.zoom,null,null,C.collisionVertexBuffer)}if(!a||!p.length)return;let d=n.useProgram("collisionCircle"),g=new lo;g.resize(m*4),g._trim();let y=0;for(let b of p)for(let w=0;w<b.circleArray.length/4;w++){let S=w*4,P=b.circleArray[S+0],I=b.circleArray[S+1],C=b.circleArray[S+2],z=b.circleArray[S+3];g.emplace(y++,P,I,C,z,0),g.emplace(y++,P,I,C,z,1),g.emplace(y++,P,I,C,z,2),g.emplace(y++,P,I,C,z,3)}(!as||as.length<m*2)&&(as=rv(m));let x=s.createIndexBuffer(as,!0),v=s.createVertexBuffer(g,fd.members,!0);for(let b of p){let w=Bg(b.transform,b.invTransform,n.transform);d.draw(s,l.TRIANGLES,K.disabled,oe.disabled,n.colorModeForRenderPass(),re.disabled,w,n.style.map.terrain&&n.style.map.terrain.getTerrainData(b.coord),e.id,v,x,ae.simpleSegment(0,b.circleOffset*2,b.circleArray.length,b.circleArray.length/2),null,n.transform.zoom,null,null,null)}v.destroy(),x.destroy()}u(Om,"drawCollisionDebug");function rv(n){let t=n*2,e=new co;e.resize(t),e._trim();for(let r=0;r<t;r++){let i=r*6;e.uint16[i+0]=r*4+0,e.uint16[i+1]=r*4+1,e.uint16[i+2]=r*4+2,e.uint16[i+3]=r*4+2,e.uint16[i+4]=r*4+3,e.uint16[i+5]=r*4+0}return e}u(rv,"createQuadTriangles");var iv=G.identity(new Float32Array(16));function yx(n,t,e,r,i){if(n.renderPass!=="translucent")return;let o=oe.disabled,a=n.colorModeForRenderPass();e.layout.get("text-variable-anchor")&&ov(r,n,e,t,e.layout.get("text-rotation-alignment"),e.layout.get("text-pitch-alignment"),i),e.paint.get("icon-opacity").constantOr(1)!==0&&fx(n,t,e,r,!1,e.paint.get("icon-translate"),e.paint.get("icon-translate-anchor"),e.layout.get("icon-rotation-alignment"),e.layout.get("icon-pitch-alignment"),e.layout.get("icon-keep-upright"),o,a),e.paint.get("text-opacity").constantOr(1)!==0&&fx(n,t,e,r,!0,e.paint.get("text-translate"),e.paint.get("text-translate-anchor"),e.layout.get("text-rotation-alignment"),e.layout.get("text-pitch-alignment"),e.layout.get("text-keep-upright"),o,a),t.map.showCollisionBoxes&&(Om(n,t,e,r,e.paint.get("text-translate"),e.paint.get("text-translate-anchor"),!0),Om(n,t,e,r,e.paint.get("icon-translate"),e.paint.get("icon-translate-anchor"),!1))}u(yx,"drawSymbols");function nv(n,t,e,r,i,o){let{horizontalAlign:a,verticalAlign:s}=Mo(n),l=-(a-.5)*t,c=-(s-.5)*e,p=sa(n,r);return new Vm.default((l/i+p[0])*o,(c/i+p[1])*o)}u(nv,"calculateVariableRenderShift");function ov(n,t,e,r,i,o,a){let s=t.transform,l=i==="map",c=o==="map";for(let p of n){let m=r.getTile(p),h=m.getBucket(e);if(!h||!h.text||!h.text.segments.get().length)continue;let d=h.textSizeData,g=br(d,s.zoom),y=Fe(m,1,t.transform.zoom),x=hn(p.posMatrix,c,l,t.transform,y),v=e.layout.get("icon-text-fit")!=="none"&&h.hasIconData();if(g){let b=Math.pow(2,s.zoom-m.tileID.overscaledZ),w=t.style.map.terrain?(S,P)=>t.style.map.terrain.getElevation(p,S,P):null;av(h,l,c,a,s,x,p.posMatrix,b,g,v,w)}}}u(ov,"updateVariableAnchors");function av(n,t,e,r,i,o,a,s,l,c,p){let m=n.text.placedSymbolArray,h=n.text.dynamicLayoutVertexArray,d=n.icon.dynamicLayoutVertexArray,g={};h.clear();for(let y=0;y<m.length;y++){let x=m.get(y),v=n.allowVerticalPlacement&&!x.placedOrientation,b=!x.hidden&&x.crossTileID&&!v?r[x.crossTileID]:null;if(!b)Ir(x.numGlyphs,h);else{let w=new Vm.default(x.anchorX,x.anchorY),S=rt(w,e?a:o,p),P=fn(i.cameraToCenterDistance,S.signedDistanceFromCamera),I=Zr(n.textSizeData,l,x)*P/xr;e&&(I*=n.tilePixelRatio/s);let{width:C,height:z,anchor:D,textOffset:A,textBoxScale:R}=b,U=nv(D,C,z,A,R,I),L=e?rt(w.add(U),o,p).point:S.point.add(t?U.rotate(-i.angle):U),N=n.allowVerticalPlacement&&x.placedOrientation===2?Math.PI/2:0;for(let V=0;V<x.numGlyphs;V++)vr(h,L,N);c&&x.associatedIconIndex>=0&&(g[x.associatedIconIndex]={shiftedAnchor:L,angle:N})}}if(c){d.clear();let y=n.icon.placedSymbolArray;for(let x=0;x<y.length;x++){let v=y.get(x);if(v.hidden)Ir(v.numGlyphs,d);else{let b=g[x];if(!b)Ir(v.numGlyphs,d);else for(let w=0;w<v.numGlyphs;w++)vr(d,b.shiftedAnchor,b.angle)}}n.icon.dynamicLayoutVertexBuffer.updateData(d)}n.text.dynamicLayoutVertexBuffer.updateData(h)}u(av,"updateVariableAnchorsForBucket");function sv(n,t,e){return e.iconsInText&&t?"symbolTextAndIcon":n?"symbolSDF":"symbolIcon"}u(sv,"getSymbolProgramName");function fx(n,t,e,r,i,o,a,s,l,c,p,m){let h=n.context,d=h.gl,g=n.transform,y=s==="map",x=l==="map",v=s!=="viewport"&&e.layout.get("symbol-placement")!=="point",b=y&&!x&&!v,w=!e.layout.get("symbol-sort-key").isConstant(),S=!1,P=n.depthModeForSublayer(0,K.ReadOnly),I=e.layout.get("text-variable-anchor"),C=[];for(let z of r){let D=t.getTile(z),A=D.getBucket(e);if(!A)continue;let R=i?A.text:A.icon;if(!R||!R.segments.get().length||!R.hasVisibleVertices)continue;let U=R.programConfigurations.get(e.id),L=i||A.sdfIcons,N=i?A.textSizeData:A.iconSizeData,V=x||g.pitch!==0,W=n.useProgram(sv(L,i,A),U),Z=br(N,g.zoom),ue=n.style.map.terrain&&n.style.map.terrain.getTerrainData(z),Y,Oe=[0,0],Be,ie,ge=null,Ve;if(i){if(Be=D.glyphAtlasTexture,ie=d.LINEAR,Y=D.glyphAtlasTexture.size,A.iconsInText){Oe=D.imageAtlasTexture.size,ge=D.imageAtlasTexture;let lt=N.kind==="composite"||N.kind==="camera";Ve=V||n.options.rotating||n.options.zooming||lt?d.LINEAR:d.NEAREST}}else{let lt=e.layout.get("icon-size").constantOr(0)!==1||A.iconsNeedLinear;Be=D.imageAtlasTexture,ie=L||n.options.rotating||n.options.zooming||lt||V?d.LINEAR:d.NEAREST,Y=D.imageAtlasTexture.size}let Lt=Fe(D,1,n.transform.zoom),kt=hn(z.posMatrix,x,y,n.transform,Lt),mt=ia(z.posMatrix,x,y,n.transform,Lt),vt=I&&A.hasTextData(),nr=e.layout.get("icon-text-fit")!=="none"&&vt&&A.hasIconData();if(v){let lt=n.style.map.terrain?(or,Zs)=>n.style.map.terrain.getElevation(z,or,Zs):null,Pe=e.layout.get("text-rotation-alignment")==="map";sy(A,z.posMatrix,n,i,kt,mt,x,c,Pe,lt)}let Ue=n.translatePosMatrix(z.posMatrix,D,o,a),De=v||i&&I||nr?iv:kt,ce=n.translatePosMatrix(mt,D,o,a,!0),it=L&&e.paint.get(i?"text-halo-width":"icon-halo-width").constantOr(1)!==0,st;L?A.iconsInText?st=sx(N.kind,Z,b,x,n,Ue,De,ce,Y,Oe):st=Zp(N.kind,Z,b,x,n,Ue,De,ce,i,Y,!0):st=Hp(N.kind,Z,b,x,n,Ue,De,ce,i,Y);let Dt={program:W,buffers:R,uniformValues:st,atlasTexture:Be,atlasTextureIcon:ge,atlasInterpolation:ie,atlasInterpolationIcon:Ve,isSDF:L,hasHalo:it};if(w&&A.canOverlap){S=!0;let lt=R.segments.get();for(let Pe of lt)C.push({segments:new ae([Pe]),sortKey:Pe.sortKey,state:Dt,terrainData:ue})}else C.push({segments:R.segments,sortKey:0,state:Dt,terrainData:ue})}S&&C.sort((z,D)=>z.sortKey-D.sortKey);for(let z of C){let D=z.state;if(h.activeTexture.set(d.TEXTURE0),D.atlasTexture.bind(D.atlasInterpolation,d.CLAMP_TO_EDGE),D.atlasTextureIcon&&(h.activeTexture.set(d.TEXTURE1),D.atlasTextureIcon&&D.atlasTextureIcon.bind(D.atlasInterpolationIcon,d.CLAMP_TO_EDGE)),D.isSDF){let A=D.uniformValues;D.hasHalo&&(A.u_is_halo=1,dx(D.buffers,z.segments,e,n,D.program,P,p,m,A,z.terrainData)),A.u_is_halo=0}dx(D.buffers,z.segments,e,n,D.program,P,p,m,D.uniformValues,z.terrainData)}}u(fx,"drawLayerSymbols");function dx(n,t,e,r,i,o,a,s,l,c){let p=r.context,m=p.gl;i.draw(p,m.TRIANGLES,o,a,s,re.disabled,l,c,e.id,n.layoutVertexBuffer,n.indexBuffer,t,e.paint,r.transform.zoom,n.programConfigurations.get(e.id),n.dynamicLayoutVertexBuffer,n.opacityVertexBuffer)}u(dx,"drawSymbolElements");f();function gx(n,t,e,r){if(n.renderPass!=="translucent")return;let i=e.paint.get("circle-opacity"),o=e.paint.get("circle-stroke-width"),a=e.paint.get("circle-stroke-opacity"),s=!e.layout.get("circle-sort-key").isConstant();if(i.constantOr(1)===0&&(o.constantOr(1)===0||a.constantOr(1)===0))return;let l=n.context,c=l.gl,p=n.depthModeForSublayer(0,K.ReadOnly),m=oe.disabled,h=n.colorModeForRenderPass(),d=[];for(let g=0;g<r.length;g++){let y=r[g],x=t.getTile(y),v=x.getBucket(e);if(!v)continue;let b=v.programConfigurations.get(e.id),w=n.useProgram("circle",b),S=v.layoutVertexBuffer,P=v.indexBuffer,I=n.style.map.terrain&&n.style.map.terrain.getTerrainData(y),C=kg(n,y,x,e),z={programConfiguration:b,program:w,layoutVertexBuffer:S,indexBuffer:P,uniformValues:C,terrainData:I};if(s){let D=v.segments.get();for(let A of D)d.push({segments:new ae([A]),sortKey:A.sortKey,state:z})}else d.push({segments:v.segments,sortKey:0,state:z})}s&&d.sort((g,y)=>g.sortKey-y.sortKey);for(let g of d){let{programConfiguration:y,program:x,layoutVertexBuffer:v,indexBuffer:b,uniformValues:w,terrainData:S}=g.state,P=g.segments;x.draw(l,c.TRIANGLES,p,m,h,re.disabled,w,S,e.id,v,b,P,e.paint,n.transform.zoom,y)}}u(gx,"drawCircles");f();function xx(n,t,e,r){if(e.paint.get("heatmap-opacity")!==0)if(n.renderPass==="offscreen"){let i=n.context,o=i.gl,a=oe.disabled,s=new we([o.ONE,o.ONE],me.transparent,[!0,!0,!0,!0]);lv(i,n,e),i.clear({color:me.transparent});for(let l=0;l<r.length;l++){let c=r[l];if(t.hasRenderableParent(c))continue;let p=t.getTile(c),m=p.getBucket(e);if(!m)continue;let h=m.programConfigurations.get(e.id),d=n.useProgram("heatmap",h),{zoom:g}=n.transform;d.draw(i,o.TRIANGLES,K.disabled,a,s,re.disabled,Ng(c.posMatrix,p,g,e.paint.get("heatmap-intensity")),null,e.id,m.layoutVertexBuffer,m.indexBuffer,m.segments,e.paint,n.transform.zoom,h)}i.viewport.set([0,0,n.width,n.height])}else n.renderPass==="translucent"&&(n.context.setColorMode(n.colorModeForRenderPass()),cv(n,e))}u(xx,"drawHeatmap");function lv(n,t,e){let r=n.gl;n.activeTexture.set(r.TEXTURE1),n.viewport.set([0,0,t.width/4,t.height/4]);let i=e.heatmapFbo;if(i)r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),n.bindFramebuffer.set(i.framebuffer);else{let o=r.createTexture();r.bindTexture(r.TEXTURE_2D,o),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),i=e.heatmapFbo=n.createFramebuffer(t.width/4,t.height/4,!1,!1),uv(n,t,o,i)}}u(lv,"bindFramebuffer");function uv(n,t,e,r){var s,l;let i=n.gl,o=(s=n.HALF_FLOAT)!=null?s:i.UNSIGNED_BYTE,a=(l=n.RGBA16F)!=null?l:i.RGBA;i.texImage2D(i.TEXTURE_2D,0,a,t.width/4,t.height/4,0,i.RGBA,o,null),r.colorAttachment.set(e)}u(uv,"bindTextureToFramebuffer");function cv(n,t){let e=n.context,r=e.gl,i=t.heatmapFbo;if(!i)return;e.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,i.colorAttachment.get()),e.activeTexture.set(r.TEXTURE1);let o=t.colorRampTexture;o||(o=t.colorRampTexture=new he(e,t.colorRamp,r.RGBA)),o.bind(r.LINEAR,r.CLAMP_TO_EDGE),n.useProgram("heatmapTexture").draw(e,r.TRIANGLES,K.disabled,oe.disabled,n.colorModeForRenderPass(),re.disabled,Gg(n,t,0,1),null,t.id,n.viewportBuffer,n.quadTriangleIndexBuffer,n.viewportSegments,t.paint,n.transform.zoom)}u(cv,"renderTextureToMap");f();function _x(n,t,e,r){if(n.renderPass!=="translucent")return;let i=e.paint.get("line-opacity"),o=e.paint.get("line-width");if(i.constantOr(1)===0||o.constantOr(1)===0)return;let a=n.depthModeForSublayer(0,K.ReadOnly),s=n.colorModeForRenderPass(),l=e.paint.get("line-dasharray"),c=e.paint.get("line-pattern"),p=c.constantOr(1),m=e.paint.get("line-gradient"),h=e.getCrossfadeParameters(),d=p?"linePattern":l?"lineSDF":m?"lineGradient":"line",g=n.context,y=g.gl,x=!0;for(let v of r){let b=t.getTile(v);if(p&&!b.patternsLoaded())continue;let w=b.getBucket(e);if(!w)continue;let S=w.programConfigurations.get(e.id),P=n.context.program.get(),I=n.useProgram(d,S),C=x||I.program!==P,z=n.style.map.terrain&&n.style.map.terrain.getTerrainData(v),D=c.constantOr(null);if(D&&b.imageAtlas){let U=b.imageAtlas,L=U.patternPositions[D.to.toString()],N=U.patternPositions[D.from.toString()];L&&N&&S.setConstantPatternPositions(L,N)}let A=z?v:null,R=p?Yg(n,b,e,h,A):l?Qg(n,b,e,l,h,A):m?Jg(n,b,e,w.lineClipsArray.length,A):va(n,b,e,A);if(p)g.activeTexture.set(y.TEXTURE0),b.imageAtlasTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE),S.updatePaintBuffers(h);else if(l&&(C||n.lineAtlas.dirty))g.activeTexture.set(y.TEXTURE0),n.lineAtlas.bind(g);else if(m){let U=w.gradients[e.id],L=U.texture;if(e.gradientVersion!==U.version){let N=256;if(e.stepInterpolant){let V=t.getSource().maxzoom,W=v.canonical.z===V?Math.ceil(1<<n.transform.maxZoom-v.canonical.z):1,Y=w.maxLineLength/8192*1024*W;N=ye(Kh(Y),256,g.maxTextureSize)}U.gradient=wo({expression:e.gradientExpression(),evaluationKey:"lineProgress",resolution:N,image:U.gradient||void 0,clips:w.lineClipsArray}),U.texture?U.texture.update(U.gradient):U.texture=new he(g,U.gradient,y.RGBA),U.version=e.gradientVersion,L=U.texture}g.activeTexture.set(y.TEXTURE0),L.bind(e.stepInterpolant?y.NEAREST:y.LINEAR,y.CLAMP_TO_EDGE)}I.draw(g,y.TRIANGLES,a,n.stencilModeForClipping(v),s,re.disabled,R,z,e.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,e.paint,n.transform.zoom,S,w.layoutVertexBuffer2),x=!1}}u(_x,"drawLine");f();f();function ss(n,t,e,r,i){if(!e||!r||!r.imageAtlas)return;let o=r.imageAtlas.patternPositions,a=o[e.to.toString()],s=o[e.from.toString()];if(!a||!s){let l=i.getPaintProperty(t);a=o[l],s=o[l]}a&&s&&n.setConstantPatternPositions(a,s)}u(ss,"updatePatternPositionsInProgram");function vx(n,t,e,r){let i=e.paint.get("fill-color"),o=e.paint.get("fill-opacity");if(o.constantOr(1)===0)return;let a=n.colorModeForRenderPass(),s=e.paint.get("fill-pattern"),l=n.opaquePassEnabledForLayer()&&!s.constantOr(1)&&i.constantOr(me.transparent).a===1&&o.constantOr(0)===1?"opaque":"translucent";if(n.renderPass===l){let c=n.depthModeForSublayer(1,n.renderPass==="opaque"?K.ReadWrite:K.ReadOnly);bx(n,t,e,r,c,a,!1)}if(n.renderPass==="translucent"&&e.paint.get("fill-antialias")){let c=n.depthModeForSublayer(e.getPaintProperty("fill-outline-color")?2:0,K.ReadOnly);bx(n,t,e,r,c,a,!0)}}u(vx,"drawFill");function bx(n,t,e,r,i,o,a){let s=n.context.gl,l="fill-pattern",c=e.paint.get(l),p=c&&c.constantOr(1),m=e.getCrossfadeParameters(),h,d,g,y,x;a?(d=p&&!e.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",h=s.LINES):(d=p?"fillPattern":"fill",h=s.TRIANGLES);let v=c.constantOr(null);for(let b of r){let w=t.getTile(b);if(p&&!w.patternsLoaded())continue;let S=w.getBucket(e);if(!S)continue;let P=S.programConfigurations.get(e.id),I=n.useProgram(d,P),C=n.style.map.terrain&&n.style.map.terrain.getTerrainData(b);p&&(n.context.activeTexture.set(s.TEXTURE0),w.imageAtlasTexture.bind(s.LINEAR,s.CLAMP_TO_EDGE),P.updatePaintBuffers(m)),ss(P,l,v,w,e);let z=C?b:null,D=z?z.posMatrix:b.posMatrix,A=n.translatePosMatrix(D,w,e.paint.get("fill-translate"),e.paint.get("fill-translate-anchor"));if(!a)y=S.indexBuffer,x=S.segments,g=p?Gp(A,n,m,w):Np(A);else{y=S.indexBuffer2,x=S.segments2;let R=[s.drawingBufferWidth,s.drawingBufferHeight];g=d==="fillOutlinePattern"&&p?Mg(A,n,m,w,R):Eg(A,R)}I.draw(n.context,h,i,n.stencilModeForClipping(b),o,re.disabled,g,C,e.id,S.layoutVertexBuffer,y,x,e.paint,n.transform.zoom,P)}}u(bx,"drawFillTiles");f();function wx(n,t,e,r){let i=e.paint.get("fill-extrusion-opacity");if(i!==0&&n.renderPass==="translucent"){let o=new K(n.context.gl.LEQUAL,K.ReadWrite,n.depthRangeFor3D);if(i===1&&!e.paint.get("fill-extrusion-pattern").constantOr(1)){let a=n.colorModeForRenderPass();Um(n,t,e,r,o,oe.disabled,a)}else Um(n,t,e,r,o,oe.disabled,we.disabled),Um(n,t,e,r,o,n.stencilModeFor3D(),n.colorModeForRenderPass())}}u(wx,"drawFillExtrusion");function Um(n,t,e,r,i,o,a){let s=n.context,l=s.gl,c="fill-extrusion-pattern",p=e.paint.get(c),m=p.constantOr(1),h=e.getCrossfadeParameters(),d=e.paint.get("fill-extrusion-opacity"),g=p.constantOr(null);for(let y of r){let x=t.getTile(y),v=x.getBucket(e);if(!v)continue;let b=n.style.map.terrain&&n.style.map.terrain.getTerrainData(y),w=v.programConfigurations.get(e.id),S=n.useProgram(m?"fillExtrusionPattern":"fillExtrusion",w);m&&(n.context.activeTexture.set(l.TEXTURE0),x.imageAtlasTexture.bind(l.LINEAR,l.CLAMP_TO_EDGE),w.updatePaintBuffers(h)),ss(w,c,g,x,e);let P=n.translatePosMatrix(y.posMatrix,x,e.paint.get("fill-extrusion-translate"),e.paint.get("fill-extrusion-translate-anchor")),I=e.paint.get("fill-extrusion-vertical-gradient"),C=m?Pg(P,n,I,d,y,h,x):Up(P,n,I,d);S.draw(s,s.gl.TRIANGLES,i,o,a,re.backCCW,C,b,e.id,v.layoutVertexBuffer,v.indexBuffer,v.segments,e.paint,n.transform.zoom,w,n.style.map.terrain&&v.centroidVertexBuffer)}}u(Um,"drawExtrusionTiles");f();function Sx(n,t,e,r){if(n.renderPass!=="offscreen"&&n.renderPass!=="translucent")return;let i=n.context,o=n.depthModeForSublayer(0,K.ReadOnly),a=n.colorModeForRenderPass(),[s,l]=n.renderPass==="translucent"?n.stencilConfigForOverlap(r):[{},r];for(let c of l){let p=t.getTile(c);typeof p.needsHillshadePrepare<"u"&&p.needsHillshadePrepare&&n.renderPass==="offscreen"?mv(n,p,e,o,oe.disabled,a):n.renderPass==="translucent"&&pv(n,c,p,e,o,s[c.overscaledZ],a)}i.viewport.set([0,0,n.width,n.height])}u(Sx,"drawHillshade");function pv(n,t,e,r,i,o,a){let s=n.context,l=s.gl,c=e.fbo;if(!c)return;let p=n.useProgram("hillshade"),m=n.style.map.terrain&&n.style.map.terrain.getTerrainData(t);s.activeTexture.set(l.TEXTURE0),l.bindTexture(l.TEXTURE_2D,c.colorAttachment.get());let h=m?t:null;p.draw(s,l.TRIANGLES,i,o,a,re.disabled,Hg(n,e,r,h),m,r.id,n.rasterBoundsBuffer,n.quadTriangleIndexBuffer,n.rasterBoundsSegments)}u(pv,"renderHillshade");function mv(n,t,e,r,i,o){let a=n.context,s=a.gl,l=t.dem;if(l&&l.data){let c=l.dim,p=l.stride,m=l.getPixels();if(a.activeTexture.set(s.TEXTURE1),a.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||n.getTileTexture(p),t.demTexture){let d=t.demTexture;d.update(m,{premultiply:!1}),d.bind(s.NEAREST,s.CLAMP_TO_EDGE)}else t.demTexture=new he(a,m,s.RGBA,{premultiply:!1}),t.demTexture.bind(s.NEAREST,s.CLAMP_TO_EDGE);a.activeTexture.set(s.TEXTURE0);let h=t.fbo;if(!h){let d=new he(a,{width:c,height:c,data:null},s.RGBA);d.bind(s.LINEAR,s.CLAMP_TO_EDGE),h=t.fbo=a.createFramebuffer(c,c,!0,!1),h.colorAttachment.set(d.texture)}a.bindFramebuffer.set(h.framebuffer),a.viewport.set([0,0,c,c]),n.useProgram("hillshadePrepare").draw(a,s.TRIANGLES,r,i,o,re.disabled,Zg(t.tileID,l),null,e.id,n.rasterBoundsBuffer,n.quadTriangleIndexBuffer,n.rasterBoundsSegments),t.needsHillshadePrepare=!1}}u(mv,"prepareHillshade");f();function Px(n,t,e,r){if(n.renderPass!=="translucent"||e.paint.get("raster-opacity")===0||!r.length)return;let i=n.context,o=i.gl,a=t.getSource(),s=n.useProgram("raster"),l=n.colorModeForRenderPass(),[c,p]=a instanceof at?[{},r]:n.stencilConfigForOverlap(r),m=p[p.length-1].overscaledZ,h=!n.options.moving;for(let d of p){let g=n.depthModeForSublayer(d.overscaledZ-m,e.paint.get("raster-opacity")===1?K.ReadWrite:K.ReadOnly,o.LESS),y=t.getTile(d);y.registerFadeDuration(e.paint.get("raster-fade-duration"));let x=t.findLoadedParent(d,0),v=hv(y,x,t,e,n.transform,n.style.map.terrain),b,w,S=e.paint.get("raster-resampling")==="nearest"?o.NEAREST:o.LINEAR;i.activeTexture.set(o.TEXTURE0),y.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),i.activeTexture.set(o.TEXTURE1),x?(x.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST),b=Math.pow(2,x.tileID.overscaledZ-y.tileID.overscaledZ),w=[y.tileID.canonical.x*b%1,y.tileID.canonical.y*b%1]):y.texture.bind(S,o.CLAMP_TO_EDGE,o.LINEAR_MIPMAP_NEAREST);let P=n.style.map.terrain&&n.style.map.terrain.getTerrainData(d),I=P?d:null,C=I?I.posMatrix:n.transform.calculatePosMatrix(d.toUnwrapped(),h),z=ix(C,w||[0,0],b||1,v,e);a instanceof at?s.draw(i,o.TRIANGLES,g,oe.disabled,l,re.disabled,z,P,e.id,a.boundsBuffer,n.quadTriangleIndexBuffer,a.boundsSegments):s.draw(i,o.TRIANGLES,g,c[d.overscaledZ],l,re.disabled,z,P,e.id,n.rasterBoundsBuffer,n.quadTriangleIndexBuffer,n.rasterBoundsSegments)}}u(Px,"drawRaster");function hv(n,t,e,r,i,o){let a=r.paint.get("raster-fade-duration");if(!o&&a>0){let s=ee.now(),l=(s-n.timeAdded)/a,c=t?(s-t.timeAdded)/a:-1,p=e.getSource(),m=i.coveringZoomLevel({tileSize:p.tileSize,roundZoom:p.roundZoom}),h=!t||Math.abs(t.tileID.overscaledZ-m)>Math.abs(n.tileID.overscaledZ-m),d=h&&n.refreshedUponExpiration?1:ye(h?l:1-c,0,1);return n.refreshedUponExpiration&&l>=1&&(n.refreshedUponExpiration=!1),t?{opacity:1,mix:1-d}:{opacity:d,mix:0}}else return{opacity:1,mix:0}}u(hv,"getFadeValues");f();function Tx(n,t,e,r){let i=e.paint.get("background-color"),o=e.paint.get("background-opacity");if(o===0)return;let a=n.context,s=a.gl,l=n.transform,c=l.tileSize,p=e.paint.get("background-pattern");if(n.isPatternMissing(p))return;let m=!p&&i.a===1&&o===1&&n.opaquePassEnabledForLayer()?"opaque":"translucent";if(n.renderPass!==m)return;let h=oe.disabled,d=n.depthModeForSublayer(0,m==="opaque"?K.ReadWrite:K.ReadOnly),g=n.colorModeForRenderPass(),y=n.useProgram(p?"backgroundPattern":"background"),x=r||l.coveringTiles({tileSize:c,terrain:n.style.map.terrain});p&&(a.activeTexture.set(s.TEXTURE0),n.imageManager.bind(n.context));let v=e.getCrossfadeParameters();for(let b of x){let w=r?b.posMatrix:n.transform.calculatePosMatrix(b.toUnwrapped()),S=p?px(w,o,n,p,{tileID:b,tileSize:c},v):cx(w,o,i),P=n.style.map.terrain&&n.style.map.terrain.getTerrainData(b);y.draw(a,s.TRIANGLES,d,h,g,re.disabled,S,P,e.id,n.tileExtentBuffer,n.quadTriangleIndexBuffer,n.tileExtentSegments)}}u(Tx,"drawBackground");f();var fv=new me(1,0,0,1),dv=new me(0,1,0,1),yv=new me(0,0,1,1),gv=new me(1,0,1,1),xv=new me(0,1,1,1);function Cx(n){let t=n.transform.padding,e=3;Ix(n,n.transform.height-(t.top||0),e,fv),Ix(n,t.bottom||0,e,dv),Ax(n,t.left||0,e,yv),Ax(n,n.transform.width-(t.right||0),e,gv);let r=n.transform.centerPoint;_v(n,r.x,n.transform.height-r.y,xv)}u(Cx,"drawDebugPadding");function _v(n,t,e,r){ls(n,t-2/2,e-20/2,2,20,r),ls(n,t-20/2,e-2/2,20,2,r)}u(_v,"drawCrosshair");function Ix(n,t,e,r){ls(n,0,t+e/2,n.transform.width,e,r)}u(Ix,"drawHorizontalLine");function Ax(n,t,e,r){ls(n,t-e/2,0,e,n.transform.height,r)}u(Ax,"drawVerticalLine");function ls(n,t,e,r,i,o){let a=n.context,s=a.gl;s.enable(s.SCISSOR_TEST),s.scissor(t*n.pixelRatio,e*n.pixelRatio,r*n.pixelRatio,i*n.pixelRatio),a.clear({color:o}),s.disable(s.SCISSOR_TEST)}u(ls,"drawDebugSSRect");function Ex(n,t,e){for(let r=0;r<e.length;r++)bv(n,t,e[r])}u(Ex,"drawDebug");function bv(n,t,e){let r=n.context,i=r.gl,o=e.posMatrix,a=n.useProgram("debug"),s=K.disabled,l=oe.disabled,c=n.colorModeForRenderPass(),p="$debug",m=n.style.map.terrain&&n.style.map.terrain.getTerrainData(e);r.activeTexture.set(i.TEXTURE0);let h=t.getTileByID(e.key).latestRawTileData,d=h&&h.byteLength||0,g=Math.floor(d/1024),y=t.getTile(e).tileSize,x=512/Math.min(y,512)*(e.overscaledZ/n.transform.zoom)*.5,v=e.canonical.toString();e.overscaledZ!==e.canonical.z&&(v+=" => ".concat(e.overscaledZ));let b="".concat(v," ").concat(g,"kB");vv(n,b),a.draw(r,i.TRIANGLES,s,l,we.alphaBlended,re.disabled,qp(o,me.transparent,x),null,p,n.debugBuffer,n.quadTriangleIndexBuffer,n.debugSegments),a.draw(r,i.LINE_STRIP,s,l,c,re.disabled,qp(o,me.red),m,p,n.debugBuffer,n.tileBorderIndexBuffer,n.debugSegments)}u(bv,"drawDebugTile");function vv(n,t){n.initDebugOverlayCanvas();let e=n.debugOverlayCanvas,r=n.context.gl,i=n.debugOverlayCanvas.getContext("2d");i.clearRect(0,0,e.width,e.height),i.shadowColor="white",i.shadowBlur=2,i.lineWidth=1.5,i.strokeStyle="white",i.textBaseline="top",i.font="bold 36px Open Sans, sans-serif",i.fillText(t,5,5),i.strokeText(t,5,5),n.debugOverlayTexture.update(e),n.debugOverlayTexture.bind(r.LINEAR,r.CLAMP_TO_EDGE)}u(vv,"drawTextToOverlay");function Mx(n,t){let e=null,i=Object.values(n._layers).flatMap(l=>l.source&&!l.isHidden(t)?[n.sourceCaches[l.source]]:[]),o=i.filter(l=>l.getSource().type==="vector"),a=i.filter(l=>l.getSource().type!=="vector"),s=u(l=>{(!e||e.getSource().maxzoom<l.getSource().maxzoom)&&(e=l)},"considerSource");return o.forEach(l=>s(l)),e||a.forEach(l=>s(l)),e}u(Mx,"selectDebugSource");f();function Lx(n,t,e){let r=n.context,i=e.implementation;if(n.renderPass==="offscreen"){let o=i.prerender;o&&(n.setCustomLayerDefaults(),r.setColorMode(n.colorModeForRenderPass()),o.call(i,r.gl,n.transform.customLayerMatrix()),r.setDirty(),n.setBaseState())}else if(n.renderPass==="translucent"){n.setCustomLayerDefaults(),r.setColorMode(n.colorModeForRenderPass()),r.setStencilMode(oe.disabled);let o=i.renderingMode==="3d"?new K(n.context.gl.LEQUAL,K.ReadWrite,n.depthRangeFor3D):n.depthModeForSublayer(0,K.ReadOnly);r.setDepthMode(o),i.render(r.gl,n.transform.customLayerMatrix()),r.setDirty(),n.setBaseState(),r.bindFramebuffer.set(null)}}u(Lx,"drawCustom");f();function kx(n,t){let e=n.context,r=e.gl,i=we.unblended,o=new K(r.LEQUAL,K.ReadWrite,[0,1]),a=t.getTerrainMesh(),s=t.sourceCache.getRenderableTiles(),l=n.useProgram("terrainDepth");e.bindFramebuffer.set(t.getFramebuffer("depth").framebuffer),e.viewport.set([0,0,n.width/devicePixelRatio,n.height/devicePixelRatio]),e.clear({color:me.transparent,depth:1});for(let c of s){let p=t.getTerrainData(c.tileID),m=n.transform.calculatePosMatrix(c.tileID.toUnwrapped()),h=_g(m,t.getMeshFrameDelta(n.transform.zoom));l.draw(e,r.TRIANGLES,o,oe.disabled,i,re.backCCW,h,p,"terrain",a.vertexBuffer,a.indexBuffer,a.segments)}e.bindFramebuffer.set(null),e.viewport.set([0,0,n.width,n.height])}u(kx,"drawDepth");function Dx(n,t){let e=n.context,r=e.gl,i=we.unblended,o=new K(r.LEQUAL,K.ReadWrite,[0,1]),a=t.getTerrainMesh(),s=t.getCoordsTexture(),l=t.sourceCache.getRenderableTiles(),c=n.useProgram("terrainCoords");e.bindFramebuffer.set(t.getFramebuffer("coords").framebuffer),e.viewport.set([0,0,n.width/devicePixelRatio,n.height/devicePixelRatio]),e.clear({color:me.transparent,depth:1}),t.coordsIndex=[];for(let p of l){let m=t.getTerrainData(p.tileID);e.activeTexture.set(r.TEXTURE0),r.bindTexture(r.TEXTURE_2D,s.texture);let h=n.transform.calculatePosMatrix(p.tileID.toUnwrapped()),d=bg(h,255-t.coordsIndex.length,t.getMeshFrameDelta(n.transform.zoom));c.draw(e,r.TRIANGLES,o,oe.disabled,i,re.backCCW,d,m,"terrain",a.vertexBuffer,a.indexBuffer,a.segments),t.coordsIndex.push(p.tileID.key)}e.bindFramebuffer.set(null),e.viewport.set([0,0,n.width,n.height])}u(Dx,"drawCoords");function Nm(n,t,e){let r=n.context,i=r.gl,o=n.colorModeForRenderPass(),a=new K(i.LEQUAL,K.ReadWrite,n.depthRangeFor3D),s=n.useProgram("terrain"),l=t.getTerrainMesh();r.bindFramebuffer.set(null),r.viewport.set([0,0,n.width,n.height]);for(let c of e){let p=n.renderToTexture.getTexture(c),m=t.getTerrainData(c.tileID);r.activeTexture.set(i.TEXTURE0),i.bindTexture(i.TEXTURE_2D,p.texture);let h=n.transform.calculatePosMatrix(c.tileID.toUnwrapped()),d=xg(h,t.getMeshFrameDelta(n.transform.zoom));s.draw(r,i.TRIANGLES,a,oe.disabled,o,re.backCCW,d,m,"terrain",l.vertexBuffer,l.indexBuffer,l.segments)}}u(Nm,"drawTerrain");var Gm=class Gm{constructor(t,e){this.context=new os(t),this.transform=e,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:G.create(),renderTime:0},this.setup(),this.numSublayers=Ct.maxUnderzooming+Ct.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new si}resize(t,e,r){if(!(t===0||e===0)&&(this.width=Math.floor(t*r),this.height=Math.floor(e*r),this.pixelRatio=r,this.context.viewport.set([0,0,this.width,this.height]),this.setupRemoteFrameRendering(this.width,this.height),this.style))for(let i of this.style._order)this.style._layers[i].resize()}setup(){let t=this.context,e=new Nt;e.emplaceBack(0,0),e.emplaceBack(8192,0),e.emplaceBack(0,8192),e.emplaceBack(8192,8192),this.tileExtentBuffer=t.createVertexBuffer(e,ya.members),this.tileExtentSegments=ae.simpleSegment(0,0,4,2);let r=new Nt;r.emplaceBack(0,0),r.emplaceBack(8192,0),r.emplaceBack(0,8192),r.emplaceBack(8192,8192),this.debugBuffer=t.createVertexBuffer(r,ya.members),this.debugSegments=ae.simpleSegment(0,0,4,5);let i=new Nr;i.emplaceBack(0,0,0,0),i.emplaceBack(8192,0,8192,0),i.emplaceBack(0,8192,0,8192),i.emplaceBack(8192,8192,8192,8192),this.rasterBoundsBuffer=t.createVertexBuffer(i,Jt.members),this.rasterBoundsSegments=ae.simpleSegment(0,0,4,2);let o=new Nt;o.emplaceBack(0,0),o.emplaceBack(1,0),o.emplaceBack(0,1),o.emplaceBack(1,1),this.viewportBuffer=t.createVertexBuffer(o,ya.members),this.viewportSegments=ae.simpleSegment(0,0,4,2);let a=new Hi;a.emplaceBack(0),a.emplaceBack(1),a.emplaceBack(3),a.emplaceBack(2),a.emplaceBack(0),this.tileBorderIndexBuffer=t.createIndexBuffer(a);let s=new qe;s.emplaceBack(0,1,2),s.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=t.createIndexBuffer(s);let l=this.context.gl;this.stencilClearMode=new oe({func:l.ALWAYS,mask:0},0,255,l.ZERO,l.ZERO,l.ZERO),this.setupRemoteFrameRendering(this.width,this.height)}setupRemoteFrameRendering(t,e){if(t==null||e==null||t==0||e==0)return;let r=this.context.gl;r.bindFramebuffer(r.FRAMEBUFFER,null),this.webGLRenderTargetFrameBuffer&&(r.deleteFramebuffer(this.webGLRenderTargetFrameBuffer),r.deleteRenderbuffer(this.webGLRenderTargetRenderBuffer),r.deleteTexture(this.webGLRenderTargetTexture)),this.webGLRenderTargetFrameBuffer=r.createFramebuffer(),this.webGLRenderTargetRenderBuffer=r.createRenderbuffer(),r.bindFramebuffer(r.FRAMEBUFFER,this.webGLRenderTargetFrameBuffer),this.webGLRenderTargetTexture=r.createTexture(),r.bindTexture(r.TEXTURE_2D,this.webGLRenderTargetTexture),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t,e,0,r.RGBA,r.UNSIGNED_BYTE,null),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,this.webGLRenderTargetTexture,0),r.bindRenderbuffer(r.RENDERBUFFER,this.webGLRenderTargetRenderBuffer),r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t,e),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,this.webGLRenderTargetRenderBuffer),r.checkFramebufferStatus(r.FRAMEBUFFER)!==r.FRAMEBUFFER_COMPLETE&&console.error("Framebuffer is not complete")}clearStencil(){let t=this.context,e=t.gl;this.nextStencilID=1,this.currentStencilSource=void 0;let r=G.create();G.ortho(r,0,this.width,this.height,0,0,1),G.scale(r,r,[e.drawingBufferWidth,e.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(t,e.TRIANGLES,K.disabled,this.stencilClearMode,we.disabled,re.disabled,jp(r),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(t,e){if(this.currentStencilSource===t.source||!t.isTileClipped()||!e||!e.length)return;this.currentStencilSource=t.source;let r=this.context,i=r.gl;this.nextStencilID+e.length>256&&this.clearStencil(),r.setColorMode(we.disabled),r.setDepthMode(K.disabled);let o=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(let a of e){let s=this._tileClippingMaskIDs[a.key]=this.nextStencilID++,l=this.style.map.terrain&&this.style.map.terrain.getTerrainData(a);o.draw(r,i.TRIANGLES,K.disabled,new oe({func:i.ALWAYS,mask:0},s,255,i.KEEP,i.KEEP,i.REPLACE),we.disabled,re.disabled,jp(a.posMatrix),l,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();let t=this.nextStencilID++,e=this.context.gl;return new oe({func:e.NOTEQUAL,mask:255},t,255,e.KEEP,e.KEEP,e.REPLACE)}stencilModeForClipping(t){let e=this.context.gl;return new oe({func:e.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,e.KEEP,e.KEEP,e.REPLACE)}stencilConfigForOverlap(t){let e=this.context.gl,r=t.sort((a,s)=>s.overscaledZ-a.overscaledZ),i=r[r.length-1].overscaledZ,o=r[0].overscaledZ-i+1;if(o>1){this.currentStencilSource=void 0,this.nextStencilID+o>256&&this.clearStencil();let a={};for(let s=0;s<o;s++)a[s+i]=new oe({func:e.GEQUAL,mask:255},s+this.nextStencilID,255,e.KEEP,e.KEEP,e.REPLACE);return this.nextStencilID+=o,[a,r]}return[{[i]:oe.disabled},r]}colorModeForRenderPass(){let t=this.context.gl;return this._showOverdrawInspector?new we([t.CONSTANT_COLOR,t.ONE],new me(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?we.unblended:we.alphaBlended}depthModeForSublayer(t,e,r){if(!this.opaquePassEnabledForLayer())return K.disabled;let i=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon;return new K(r||this.context.gl.LEQUAL,e,[i,i])}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(t,e){this.style=t,this.options=e,this.lineAtlas=t.lineAtlas,this.imageManager=t.imageManager,this.glyphManager=t.glyphManager,this.symbolFadeChange=t.placement.symbolFadeChange(ee.now()),this.imageManager.beginFrame();let r=this.style._order,i=this.style.sourceCaches,o={},a={},s={};for(let l in i){let c=i[l];c.used&&c.prepare(this.context),o[l]=c.getVisibleCoordinates(),a[l]=o[l].slice().reverse(),s[l]=c.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let l=0;l<r.length;l++){let c=r[l];if(this.style._layers[c].is3D()){this.opaquePassCutoff=l;break}}if(this.renderToTexture){this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0;let l=this.style.map.terrain.sourceCache.tilesAfterTime(this.terrainFacilitator.renderTime);(this.terrainFacilitator.dirty||!G.equals(this.terrainFacilitator.matrix,this.transform.projMatrix)||l.length)&&(G.copy(this.terrainFacilitator.matrix,this.transform.projMatrix),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,kx(this,this.style.map.terrain),Dx(this,this.style.map.terrain))}this.renderPass="offscreen";for(let l of r){let c=this.style._layers[l];if(!c.hasOffscreenPass()||c.isHidden(this.transform.zoom))continue;let p=a[c.source];c.type!=="custom"&&!p.length||this.renderLayer(this,i[c.source],c,p)}if(this.context.bindFramebuffer.set(this.webGLRenderTargetFrameBuffer),this.context.clear({color:e.showOverdrawInspector?me.black:me.transparent,depth:1}),this.clearStencil(),this._showOverdrawInspector=e.showOverdrawInspector,this.depthRangeFor3D=[0,1-(t._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=r.length-1;this.currentLayer>=0;this.currentLayer--){let l=this.style._layers[r[this.currentLayer]],c=i[l.source],p=o[l.source];this._renderTileClippingMasks(l,p),this.renderLayer(this,c,l,p)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer<r.length;this.currentLayer++){let l=this.style._layers[r[this.currentLayer]],c=i[l.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(l))continue;let p=(l.type==="symbol"?s:a)[l.source];this._renderTileClippingMasks(l,o[l.source]),this.renderLayer(this,c,l,p)}if(this.options.showTileBoundaries){let l=Mx(this.style,this.transform.zoom);l&&Ex(this,l,l.getVisibleCoordinates())}this.options.showPadding&&Cx(this),this.context.setDefault(),this.setCustomLayerDefaults(),this.context.gl.bindFramebuffer(this.context.gl.FRAMEBUFFER,null)}renderLayer(t,e,r,i){if(!r.isHidden(this.transform.zoom)&&!(r.type!=="background"&&r.type!=="custom"&&!(i||[]).length))switch(this.id=r.id,r.type){case"symbol":yx(t,e,r,i,this.style.placement.variableOffsets);break;case"circle":gx(t,e,r,i);break;case"heatmap":xx(t,e,r,i);break;case"line":_x(t,e,r,i);break;case"fill":vx(t,e,r,i);break;case"fill-extrusion":wx(t,e,r,i);break;case"hillshade":Sx(t,e,r,i);break;case"raster":Px(t,e,r,i);break;case"background":Tx(t,e,r,i);break;case"custom":Lx(t,e,r);break}}translatePosMatrix(t,e,r,i,o){if(!r[0]&&!r[1])return t;let a=o?i==="map"?this.transform.angle:0:i==="viewport"?-this.transform.angle:0;if(a){let c=Math.sin(a),p=Math.cos(a);r=[r[0]*p-r[1]*c,r[0]*c+r[1]*p]}let s=[o?r[0]:Fe(e,r[0],this.transform.zoom),o?r[1]:Fe(e,r[1],this.transform.zoom),0],l=new Float32Array(16);return G.translate(l,t,s),l}saveTileTexture(t){let e=this._tileTextures[t.size[0]];e?e.push(t):this._tileTextures[t.size[0]]=[t]}getTileTexture(t){let e=this._tileTextures[t];return e&&e.length>0?e.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;let e=this.imageManager.getPattern(t.from.toString()),r=this.imageManager.getPattern(t.to.toString());return!e||!r}useProgram(t,e){this.cache=this.cache||{};let r=t+(e?e.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[r]||(this.cache[r]=new _a(this.context,Cr[t],e,mx[t],this._showOverdrawInspector,this.style.map.terrain)),this.cache[r]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){let t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){if(this.debugOverlayCanvas==null){this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512;let t=this.context.gl;this.debugOverlayTexture=new he(this.context,this.debugOverlayCanvas,t.RGBA)}}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){let{drawingBufferWidth:t,drawingBufferHeight:e}=this.context.gl;return this.width!==t||this.height!==e}};u(Gm,"Painter");var us=Gm;f();var Ee=te(be(),1);f();var ps=class ps{constructor(t,e){this.points=t;this.planes=e}static fromInvProjectionMatrix(t,e,r){let i=[[-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]],o=Math.pow(2,r),a=i.map(c=>{c=Re.transformMat4([],c,t);let p=1/c[3]/e*o;return Re.mul(c,c,[p,p,1/c[3],p])}),l=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(c=>{let p=ut.sub([],a[c[0]],a[c[1]]),m=ut.sub([],a[c[2]],a[c[1]]),h=ut.normalize([],ut.cross([],p,m)),d=-ut.dot(h,a[c[1]]);return h.concat(d)});return new ps(a,l)}};u(ps,"Frustum");var cs=ps,ms=class ms{constructor(t,e){this.min=t,this.max=e,this.center=ut.scale([],ut.add([],this.min,this.max),.5)}quadrant(t){let e=[t%2===0,t<2],r=ut.clone(this.min),i=ut.clone(this.max);for(let o=0;o<e.length;o++)r[o]=e[o]?this.min[o]:this.center[o],i[o]=e[o]?this.center[o]:this.max[o];return i[2]=this.max[2],new ms(r,i)}distanceX(t){return Math.max(Math.min(this.max[0],t[0]),this.min[0])-t[0]}distanceY(t){return Math.max(Math.min(this.max[1],t[1]),this.min[1])-t[1]}intersects(t){let e=[[this.min[0],this.min[1],this.min[2],1],[this.max[0],this.min[1],this.min[2],1],[this.max[0],this.max[1],this.min[2],1],[this.min[0],this.max[1],this.min[2],1],[this.min[0],this.min[1],this.max[2],1],[this.max[0],this.min[1],this.max[2],1],[this.max[0],this.max[1],this.max[2],1],[this.min[0],this.max[1],this.max[2],1]],r=!0;for(let i=0;i<t.planes.length;i++){let o=t.planes[i],a=0;for(let s=0;s<e.length;s++)Re.dot(o,e[s])>=0&&a++;if(a===0)return 0;a!==e.length&&(r=!1)}if(r)return 2;for(let i=0;i<3;i++){let o=Number.MAX_VALUE,a=-Number.MAX_VALUE;for(let s=0;s<t.points.length;s++){let l=t.points[s][i]-this.min[i];o=Math.min(o,l),a=Math.max(a,l)}if(a<0||o>this.max[i]-this.min[i])return 0}return 1}};u(ms,"Aabb");var _n=ms;f();var Fx=te(be(),1);var fs=class fs{constructor(t=0,e=0,r=0,i=0){if(isNaN(t)||t<0||isNaN(e)||e<0||isNaN(r)||r<0||isNaN(i)||i<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=e,this.left=r,this.right=i}interpolate(t,e,r){return e.top!=null&&t.top!=null&&(this.top=Ae.number(t.top,e.top,r)),e.bottom!=null&&t.bottom!=null&&(this.bottom=Ae.number(t.bottom,e.bottom,r)),e.left!=null&&t.left!=null&&(this.left=Ae.number(t.left,e.left,r)),e.right!=null&&t.right!=null&&(this.right=Ae.number(t.right,e.right,r)),this}getCenter(t,e){let r=ye((this.left+t-this.right)/2,0,t),i=ye((this.top+e-this.bottom)/2,0,e);return new Fx.default(r,i)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new fs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}};u(fs,"EdgeInsets");var hs=fs;var ys=class ys{constructor(t,e,r,i,o){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=o===void 0?!0:!!o,this._minZoom=t||0,this._maxZoom=e||22,this._minPitch=r==null?0:r,this._maxPitch=i==null?60:i,this.setMaxBounds(),this.width=0,this.height=0,this._center=new Q(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.698132,this._pitch=0,this._unmodified=!0,this._edgeInsets=new hs,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){let t=new ys(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.apply(this),t}apply(t){this.tileSize=t.tileSize,this.latRange=t.latRange,this.width=t.width,this.height=t.height,this._center=t._center,this._elevation=t._elevation,this.zoom=t.zoom,this.angle=t.angle,this._fov=t._fov,this._pitch=t._pitch,this._unmodified=t._unmodified,this._edgeInsets=t._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new Ee.default(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){let e=-St(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=$s.create(),$s.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){let e=ye(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){let e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.tileZoom=Math.max(0,Math.floor(e)),this.scale=this.zoomScale(e),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,e,r){this._unmodified=!1,this._edgeInsets.interpolate(t,e,r),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){let e=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,e)}getVisibleUnwrappedCoordinates(t){let e=[new Yr(0,t)];if(this._renderWorldCopies){let r=this.pointCoordinate(new Ee.default(0,0)),i=this.pointCoordinate(new Ee.default(this.width,0)),o=this.pointCoordinate(new Ee.default(this.width,this.height)),a=this.pointCoordinate(new Ee.default(0,this.height)),s=Math.floor(Math.min(r.x,i.x,o.x,a.x)),l=Math.floor(Math.max(r.x,i.x,o.x,a.x)),c=1;for(let p=s-c;p<=l+c;p++)p!==0&&e.push(new Yr(p,t))}return e}coveringTiles(t){var v,b;let e=this.coveringZoomLevel(t),r=e;if(t.minzoom!==void 0&&e<t.minzoom)return[];t.maxzoom!==void 0&&e>t.maxzoom&&(e=t.maxzoom);let i=this.pointCoordinate(this.getCameraPoint()),o=Se.fromLngLat(this.center),a=Math.pow(2,e),s=[a*i.x,a*i.y,0],l=[a*o.x,a*o.y,0],c=cs.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,e),p=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(p=e);let m=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,h=u(w=>({aabb:new _n([w*a,0,0],[(w+1)*a,a,0]),zoom:0,x:0,y:0,wrap:w,fullyVisible:!1}),"newRootTile"),d=[],g=[],y=e,x=t.reparseOverscaled?r:e;if(this._renderWorldCopies)for(let w=1;w<=3;w++)d.push(h(-w)),d.push(h(w));for(d.push(h(0));d.length>0;){let w=d.pop(),S=w.x,P=w.y,I=w.fullyVisible;if(!I){let U=w.aabb.intersects(c);if(U===0)continue;I=U===2}let C=t.terrain?s:l,z=w.aabb.distanceX(C),D=w.aabb.distanceY(C),A=Math.max(Math.abs(z),Math.abs(D)),R=m+(1<<y-w.zoom)-2;if(w.zoom===y||A>R&&w.zoom>=p){let U=y-w.zoom,L=s[0]-.5-(S<<U),N=s[1]-.5-(P<<U);g.push({tileID:new Ne(w.zoom===y?x:w.zoom,w.wrap,w.zoom,S,P),distanceSq:kn.sqrLen([l[0]-.5-S,l[1]-.5-P]),tileDistanceToCamera:Math.sqrt(L*L+N*N)});continue}for(let U=0;U<4;U++){let L=(S<<1)+U%2,N=(P<<1)+(U>>1),V=w.zoom+1,W=w.aabb.quadrant(U);if(t.terrain){let Z=new Ne(V,w.wrap,V,L,N),ue=t.terrain.getMinMaxElevation(Z),Y=(v=ue.minElevation)!=null?v:this.elevation,Oe=(b=ue.maxElevation)!=null?b:this.elevation;W=new _n([W.min[0],W.min[1],Y],[W.max[0],W.max[1],Oe])}d.push({aabb:W,zoom:V,x:L,y:N,wrap:w.wrap,fullyVisible:I})}}return g.sort((w,S)=>w.distanceSq-S.distanceSq).map(w=>w.tileID)}resize(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){let e=ye(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new Ee.default(Xt(t.lng)*this.worldSize,Kt(e)*this.worldSize)}calculateZMercatorFromAltitude(t){let{lat:e}=this.center,r=Pr,i=this.tileSize,o=e*Math.PI/180,s=t+r,l=Math.cos(o)*2*Math.PI*r/(i*Math.pow(2,20)),c=s/l,p=Math.log2(i/c);return Math.abs(p)}unproject(t){return new Se(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=this.getElevation())}getElevation(t,e){let r=Se.fromLngLat(t.wrap()),i=(1<<this.tileZoom)*8192,o=r.x*i,a=r.y*i,s=Math.floor(o/8192),l=Math.floor(a/8192),c=new Ne(this.tileZoom,0,this.tileZoom,s,l);return e.getElevation(c,o%8192,a%8192,8192)}getCameraPosition(){let t=this.pointLocation(this.getCameraPoint()),e=Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter;return{lngLat:t,altitude:e+this.elevation}}recalculateZoom(t){let e=this.pointLocation(this.centerPoint,t),r=this.getElevation(e,t);if(!(this.elevation-r))return;let o=this.getCameraPosition(),a=Se.fromLngLat(o.lngLat,o.altitude),s=Se.fromLngLat(e,r),l=a.x-s.x,c=a.y-s.y,p=a.z-s.z,m=Math.sqrt(l*l+c*c+p*p),h=this.scaleZoom(this.cameraToCenterDistance/m/this.tileSize);this._elevation=r,this._center=e,this.zoom=h}setLocationAtPoint(t,e){let r=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),o=this.locationCoordinate(t),a=new Se(o.x-(r.x-i.x),o.y-(r.y-i.y));this.center=this.coordinateLocation(a),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(t,e){return e?this.coordinatePoint(this.locationCoordinate(t),this.getElevation(t,e),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(t))}pointLocation(t,e){return this.coordinateLocation(this.pointCoordinate(t,e))}locationCoordinate(t){return Se.fromLngLat(t)}coordinateLocation(t){return t&&t.toLngLat()}pointCoordinate(t,e){if(e){let y=e.pointCoordinate(t);if(y!=null)return y}let r=0,i=[t.x,t.y,0,1],o=[t.x,t.y,1,1];Re.transformMat4(i,i,this.pixelMatrixInverse),Re.transformMat4(o,o,this.pixelMatrixInverse);let a=i[3],s=o[3],l=i[0]/a,c=o[0]/s,p=i[1]/a,m=o[1]/s,h=i[2]/a,d=o[2]/s,g=h===d?0:(r-h)/(d-h);return new Se(Ae.number(l,c,g)/this.worldSize,Ae.number(p,m,g)/this.worldSize)}coordinatePoint(t,e=0,r=this.pixelMatrix){let i=[t.x*this.worldSize,t.y*this.worldSize,e,1];return Re.transformMat4(i,i,r),new Ee.default(i[0]/i[3],i[1]/i[3])}getBounds(){let t=Math.max(0,this.height/2-this.getHorizon());return new We().extend(this.pointLocation(new Ee.default(0,t))).extend(this.pointLocation(new Ee.default(this.width,t))).extend(this.pointLocation(new Ee.default(this.width,this.height))).extend(this.pointLocation(new Ee.default(0,this.height)))}getMaxBounds(){return!this.latRange||this.latRange.length!==2||!this.lngRange||this.lngRange.length!==2?null:new We([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]])}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(t){t?(this.lngRange=[t.getWest(),t.getEast()],this.latRange=[t.getSouth(),t.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(t,e=!1){let r=t.key,i=e?this._alignedPosMatrixCache:this._posMatrixCache;if(i[r])return i[r];let o=t.canonical,a=this.worldSize/this.zoomScale(o.z),s=o.x+Math.pow(2,o.z)*t.wrap,l=G.identity(new Float64Array(16));return G.translate(l,l,[s*a,o.y*a,0]),G.scale(l,l,[a/8192,a/8192,1]),G.multiply(l,e?this.alignedProjMatrix:this.projMatrix,l),i[r]=new Float32Array(l),i[r]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let t=-90,e=90,r=-180,i=180,o,a,s,l,c=this.size,p=this._unmodified;if(this.latRange){let d=this.latRange;t=Kt(d[1])*this.worldSize,e=Kt(d[0])*this.worldSize,o=e-t<c.y?c.y/(e-t):0}if(this.lngRange){let d=this.lngRange;r=St(Xt(d[0])*this.worldSize,0,this.worldSize),i=St(Xt(d[1])*this.worldSize,0,this.worldSize),i<r&&(i+=this.worldSize),a=i-r<c.x?c.x/(i-r):0}let m=this.point,h=Math.max(a||0,o||0);if(h){this.center=this.unproject(new Ee.default(a?(i+r)/2:m.x,o?(e+t)/2:m.y)),this.zoom+=this.scaleZoom(h),this._unmodified=p,this._constraining=!1;return}if(this.latRange){let d=m.y,g=c.y/2;d-g<t&&(l=t+g),d+g>e&&(l=e-g)}if(this.lngRange){let d=(r+i)/2,g=St(m.x,d-this.worldSize/2,d+this.worldSize/2),y=c.x/2;g-y<r&&(s=r+y),g+y>i&&(s=i-y)}(s!==void 0||l!==void 0)&&(this.center=this.unproject(new Ee.default(s!==void 0?s:m.x,l!==void 0?l:m.y)).wrap()),this._unmodified=p,this._constraining=!1}_calcMatrices(){if(!this.height)return;let t=this._fov/2,e=this.centerOffset,r=this.point.x,i=this.point.y;this.cameraToCenterDistance=.5/Math.tan(t)*this.height,this._pixelPerMeter=Oc(1,this.center.lat)*this.worldSize;let o=G.identity(new Float64Array(16));G.scale(o,o,[this.width/2,-this.height/2,1]),G.translate(o,o,[1,-1,0]),this.labelPlaneMatrix=o,o=G.identity(new Float64Array(16)),G.scale(o,o,[1,-1,1]),G.translate(o,o,[-1,-1,0]),G.scale(o,o,[2/this.width,2/this.height,1]),this.glCoordMatrix=o,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);let a=this._elevation<0?this.cameraToCenterDistance:this.cameraToSeaLevelDistance,s=Math.PI/2+this._pitch,l=this._fov*(.5+e.y/this.height),c=Math.sin(l)*a/Math.sin(ye(Math.PI-s-l,.01,Math.PI-.01)),p=this.getHorizon(),h=2*Math.atan(p/this.cameraToCenterDistance)*(.5+e.y/(p*2)),d=Math.sin(h)*a/Math.sin(ye(Math.PI-s-h,.01,Math.PI-.01)),g=Math.min(c,d),y=(Math.cos(Math.PI/2-this._pitch)*g+a)*1.01,x=this.height/50;o=new Float64Array(16),G.perspective(o,this._fov,this.width/this.height,x,y),o[8]=-e.x*2/this.width,o[9]=e.y*2/this.height,G.scale(o,o,[1,-1,1]),G.translate(o,o,[0,0,-this.cameraToCenterDistance]),G.rotateX(o,o,this._pitch),G.rotateZ(o,o,this.angle),G.translate(o,o,[-r,-i,0]),this.mercatorMatrix=G.scale([],o,[this.worldSize,this.worldSize,this.worldSize]),G.scale(o,o,[1,1,this._pixelPerMeter]),this.pixelMatrix=G.multiply(new Float64Array(16),this.labelPlaneMatrix,o),G.translate(o,o,[0,0,-this.elevation]),this.projMatrix=o,this.invProjMatrix=G.invert([],o),this.pixelMatrix3D=G.multiply(new Float64Array(16),this.labelPlaneMatrix,o);let v=this.width%2/2,b=this.height%2/2,w=Math.cos(this.angle),S=Math.sin(this.angle),P=r-Math.round(r)+w*v+S*b,I=i-Math.round(i)+w*b+S*v,C=new Float64Array(o);if(G.translate(C,C,[P>.5?P-1:P,I>.5?I-1:I,0]),this.alignedProjMatrix=C,o=G.invert(new Float64Array(16),this.pixelMatrix),!o)throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;let t=this.pointCoordinate(new Ee.default(0,0)),e=[t.x*this.worldSize,t.y*this.worldSize,0,1];return Re.transformMat4(e,e,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){let t=this._pitch,e=Math.tan(t)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new Ee.default(0,e))}getCameraQueryGeometry(t){let e=this.getCameraPoint();if(t.length===1)return[t[0],e];{let r=e.x,i=e.y,o=e.x,a=e.y;for(let s of t)r=Math.min(r,s.x),i=Math.min(i,s.y),o=Math.max(o,s.x),a=Math.max(a,s.y);return[new Ee.default(r,i),new Ee.default(o,i),new Ee.default(o,a),new Ee.default(r,a),new Ee.default(r,i)]}}setCameraPosition(t){let{lng:e,lat:r,altitude:i,pitch:o,bearing:a}=t,s=o*(Math.PI/180),l=.5/Math.tan(this._fov/2)*this.height,c=Math.abs(Math.cos(s)*l),m=2*Math.PI*6378137*Math.abs(Math.cos(r*(Math.PI/180))),h=c/i*m,d=Math.tan(s)*l,g=new Ee.default(this.width/2,this.height/2+d),y=new Q(e,r);this.zoom=Math.log(h/this.tileSize)/Math.LN2,this.pitch=o,this.bearing=a,this.setLocationAtPoint(y,g)}getCameraAltitude(){let t=this._pitch,e=Math.cos(t)*this.cameraToCenterDistance,r=Math.tan(t)*this.cameraToCenterDistance,i=this.pointLocation(this.centerPoint.add(new Ee.default(0,r))),o=2*Math.PI*6378137,a=this.worldSize/(o*Math.abs(Math.cos(i.lat*(Math.PI/180))));return e/a}};u(ys,"Transform");var ds=ys;f();f();function zx(n,t){let e=!1,r=null,i=u(()=>{r=null,e&&(n(),r=setTimeout(i,t),e=!1)},"later");return()=>(e=!0,r||i(),r)}u(zx,"throttle");var qm=class qm{constructor(t){this._getCurrentHash=u(()=>{let t=window.location.hash.replace("#","");if(this._hashName){let e;return t.split("&").map(r=>r.split("=")).forEach(r=>{r[0]===this._hashName&&(e=r)}),(e&&e[1]||"").split("/")}return t.split("/")},"_getCurrentHash");this._onHashChange=u(()=>{let t=this._getCurrentHash();if(t.length>=3&&!t.some(e=>isNaN(e))){let e=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:e,pitch:+(t[4]||0)}),!0}return!1},"_onHashChange");this._updateHashUnthrottled=u(()=>{let t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}},"_updateHashUnthrottled");this._updateHash=zx(this._updateHashUnthrottled,30*1e3/100);this._hashName=t&&encodeURIComponent(t)}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){let e=this._map.getCenter(),r=Math.round(this._map.getZoom()*100)/100,i=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),o=Math.pow(10,i),a=Math.round(e.lng*o)/o,s=Math.round(e.lat*o)/o,l=this._map.getBearing(),c=this._map.getPitch(),p="";if(t?p+="/".concat(a,"/").concat(s,"/").concat(r):p+="".concat(r,"/").concat(s,"/").concat(a),(l||c)&&(p+="/".concat(Math.round(l*10)/10)),c&&(p+="/".concat(Math.round(c))),this._hashName){let m=this._hashName,h=!1,d=window.location.hash.slice(1).split("&").map(g=>{let y=g.split("=")[0];return y===m?(h=!0,"".concat(y,"=").concat(p)):g}).filter(g=>g);return h||d.push("".concat(m,"=").concat(p)),"#".concat(d.join("&"))}return"#".concat(p)}};u(qm,"Hash");var gs=qm;f();f();var Bx=te(be(),1);var vs={linearity:.3,easing:Qs(0,0,.3,1)},wv=k({deceleration:2500,maxSpeed:1400},vs),Sv=k({deceleration:20,maxSpeed:1400},vs),Pv=k({deceleration:1e3,maxSpeed:360},vs),Tv=k({deceleration:1e3,maxSpeed:90},vs),jm=class jm{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ee.now(),settings:t})}_drainInertiaBuffer(){let t=this._inertiaBuffer,e=ee.now(),r=160;for(;t.length>0&&e-t[0].time>r;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;let e={zoom:0,bearing:0,pitch:0,pan:new Bx.default(0,0),pinchAround:void 0,around:void 0};for(let{settings:a}of this._inertiaBuffer)e.zoom+=a.zoomDelta||0,e.bearing+=a.bearingDelta||0,e.pitch+=a.pitchDelta||0,a.panDelta&&e.pan._add(a.panDelta),a.around&&(e.around=a.around),a.pinchAround&&(e.pinchAround=a.pinchAround);let i=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,o={};if(e.pan.mag()){let a=_s(e.pan.mag(),i,k({},wv,t||{}));o.offset=e.pan.mult(a.amount/e.pan.mag()),o.center=this._map.transform.center,xs(o,a)}if(e.zoom){let a=_s(e.zoom,i,Sv);o.zoom=this._map.transform.zoom+a.amount,xs(o,a)}if(e.bearing){let a=_s(e.bearing,i,Pv);o.bearing=this._map.transform.bearing+ye(a.amount,-179,179),xs(o,a)}if(e.pitch){let a=_s(e.pitch,i,Tv);o.pitch=this._map.transform.pitch+a.amount,xs(o,a)}if(o.zoom||o.bearing){let a=e.pinchAround===void 0?e.around:e.pinchAround;o.around=a?this._map.unproject(a):this._map.getCenter()}return this.clear(),k(o,{noMoveStart:!0})}};u(jm,"HandlerInertia");var bs=jm;function xs(n,t){(!n.duration||n.duration<t.duration)&&(n.duration=t.duration,n.easing=t.easing)}u(xs,"extendDuration");function _s(n,t,e){let{maxSpeed:r,linearity:i,deceleration:o}=e,a=ye(n*i/(t/1e3),-r,r),s=Math.abs(a)/(o*i);return{easing:e.easing,duration:s*1e3,amount:a*(s/2)}}u(_s,"calculateEasing");var Rx=te(be(),1);var ws=u(n=>n.zoom||n.drag||n.pitch||n.rotate,"isMoving"),Wm=class Wm extends E{};u(Wm,"RenderFrameEvent");var Zm=Wm;function Hm(n){return n.panDelta&&n.panDelta.mag()||n.zoomDelta||n.bearingDelta||n.pitchDelta}u(Hm,"hasChange");var Xm=class Xm{constructor(t,e){this.handleWindowEvent=u(t=>{this.handleEvent(t,"".concat(t.type,"Window"))},"handleWindowEvent");this.handleEvent=u((t,e)=>{if(t.type==="blur"){this.stop(!0);return}this._updatingCamera=!0;let r=t.type==="renderFrame"?void 0:t,i={needsRenderFrame:!1},o={},a={},s=t.touches,l=s?this._getMapTouches(s):void 0,c=l?M.touchPos(this._el,l):M.mousePos(this._el,t);for(let{handlerName:h,handler:d,allowed:g}of this._handlers){if(!d.isEnabled())continue;let y;this._blockedByActive(a,g,h)?d.reset():d[e||t.type]&&(y=d[e||t.type](t,c,l),this.mergeHandlerResult(i,o,y,h,r),y&&y.needsRenderFrame&&this._triggerRenderFrame()),(y||d.isActive())&&(a[h]=d)}let p={};for(let h in this._previousActiveHandlers)a[h]||(p[h]=r);this._previousActiveHandlers=a,(Object.keys(p).length||Hm(i))&&(this._changes.push([i,o,p]),this._triggerRenderFrame()),(Object.keys(a).length||Hm(i))&&this._map._stop(!0),this._updatingCamera=!1;let{cameraAnimation:m}=i;m&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],m(this._map))},"handleEvent");this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new bs(t),this._bearingSnap=e.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={};let r=this._el;this._listeners=[[r,"touchstart",{passive:!0}],[r,"touchmove",{passive:!1}],[r,"touchend",void 0],[r,"touchcancel",void 0],[r,"mousedown",void 0],[r,"mousemove",void 0],[r,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[r,"mouseover",void 0],[r,"mouseout",void 0],[r,"dblclick",void 0],[r,"click",void 0],[r,"keydown",{capture:!1}],[r,"keyup",void 0],[r,"wheel",{passive:!1}],[r,"contextmenu",void 0],[window,"blur",void 0]]}destroy(){}_addDefaultHandlers(t){}_add(t,e,r){this._handlers.push({handlerName:t,handler:e,allowed:r}),this._handlersById[t]=e}stop(t){if(!this._updatingCamera){for(let{handler:e}of this._handlers)e.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(let{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||!1}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!ws(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,e,r){for(let i in t)if(i!==r&&(!e||e.indexOf(i)<0))return!0;return!1}_getMapTouches(t){let e=[];for(let r of t){let i=r.target;this._el.contains(i)&&e.push(r)}return e}mergeHandlerResult(t,e,r,i,o){if(!r)return;k(t,r);let a={handlerName:i,originalEvent:r.originalEvent||o};r.zoomDelta!==void 0&&(e.zoom=a),r.panDelta!==void 0&&(e.drag=a),r.pitchDelta!==void 0&&(e.pitch=a),r.bearingDelta!==void 0&&(e.rotate=a)}_applyChanges(){let t={},e={},r={};for(let[i,o,a]of this._changes)i.panDelta&&(t.panDelta=(t.panDelta||new Rx.default(0,0))._add(i.panDelta)),i.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+i.zoomDelta),i.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+i.bearingDelta),i.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+i.pitchDelta),i.around!==void 0&&(t.around=i.around),i.pinchAround!==void 0&&(t.pinchAround=i.pinchAround),i.noInertia&&(t.noInertia=i.noInertia),k(e,o),k(r,a);this._updateMapTransform(t,e,r),this._changes=[]}_updateMapTransform(t,e,r){let i=this._map,o=i._getTransformForUpdate(),a=i.terrain;if(!Hm(t)&&!(a&&this._terrainMovement))return this._fireEvents(e,r,!0);let{panDelta:s,zoomDelta:l,bearingDelta:c,pitchDelta:p,around:m,pinchAround:h}=t;h!==void 0&&(m=h),i._stop(!0),m=m||i.transform.centerPoint;let d=o.pointLocation(s?m.sub(s):m);c&&(o.bearing+=c),p&&(o.pitch+=p),l&&(o.zoom+=l),a?!this._terrainMovement&&(e.drag||e.zoom)?(this._terrainMovement=!0,o.freezeElevation=!0,o.setLocationAtPoint(d,m),this._map.once("moveend",()=>{o.freezeElevation=!1,this._terrainMovement=!1,o.recalculateZoom(i.terrain)})):e.drag&&this._terrainMovement?o.center=o.pointLocation(o.centerPoint.sub(s)):o.setLocationAtPoint(d,m):o.setLocationAtPoint(d,m),i._applyUpdatedTransform(o),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(e,r,!0)}_fireEvents(t,e,r){let i=ws(this._eventsInProgress),o=ws(t),a={};for(let p in t){let{originalEvent:m}=t[p];this._eventsInProgress[p]||(a["".concat(p,"start")]=m),this._eventsInProgress[p]=t[p]}!i&&o&&this._fireEvent("movestart",o.originalEvent);for(let p in a)this._fireEvent(p,a[p]);o&&this._fireEvent("move",o.originalEvent);for(let p in t){let{originalEvent:m}=t[p];this._fireEvent(p,m)}let s={},l;for(let p in this._eventsInProgress){let{handlerName:m,originalEvent:h}=this._eventsInProgress[p];this._handlersById[m].isActive()||(delete this._eventsInProgress[p],l=e[m]||h,s["".concat(p,"end")]=l)}for(let p in s)this._fireEvent(p,s[p]);let c=ws(this._eventsInProgress);if(r&&(i||o)&&!c){this._updatingCamera=!0;let p=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),m=u(h=>h!==0&&-this._bearingSnap<h&&h<this._bearingSnap,"shouldSnapToNorth");p?(m(p.bearing||this._map.getBearing())&&(p.bearing=0),p.freezeElevation=!0,this._map.easeTo(p,{originalEvent:l})):(this._map.fire(new E("moveend",{originalEvent:l})),m(this._map.getBearing())&&this._map.resetNorth()),this._updatingCamera=!1}}_fireEvent(t,e){this._map.fire(new E(t,e?{originalEvent:e}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(t=>{delete this._frameId,this.handleEvent(new Zm("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}};u(Xm,"HandlerManager");var Ss=Xm;f();var bt=te(be(),1);var Km=class Km extends se{constructor(e,r){super();this._renderFrameCallback=u(()=>{let e=Math.min((ee.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(e)),e<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},"_renderFrameCallback");this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=r.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,r){return this.jumpTo({center:e},r)}panBy(e,r,i){return e=bt.default.convert(e).mult(-1),this.panTo(this.transform.center,k({offset:e},r),i)}panTo(e,r,i){return this.easeTo(k({center:e},r),i)}getZoom(){return this.transform.zoom}setZoom(e,r){return this.jumpTo({zoom:e},r),this}zoomTo(e,r,i){return this.easeTo(k({zoom:e},r),i)}zoomIn(e,r){return this.zoomTo(this.getZoom()+1,e,r),this}zoomOut(e,r){return this.zoomTo(this.getZoom()-1,e,r),this}getBearing(){return this.transform.bearing}setBearing(e,r){return this.jumpTo({bearing:e},r),this}getPadding(){return this.transform.padding}setPadding(e,r){return this.jumpTo({padding:e},r),this}rotateTo(e,r,i){return this.easeTo(k({bearing:e},r),i)}resetNorth(e,r){return this.rotateTo(0,k({duration:1e3},e),r),this}resetNorthPitch(e,r){return this.easeTo(k({bearing:0,pitch:0,duration:1e3},e),r),this}snapToNorth(e,r){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,r):this}getPitch(){return this.transform.pitch}setPitch(e,r){return this.jumpTo({pitch:e},r),this}cameraForBounds(e,r){e=We.convert(e);let i=r&&r.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),i,r)}_cameraForBoxAndBearing(e,r,i,o){let a={top:0,bottom:0,right:0,left:0};if(o=k({padding:a,offset:[0,0],maxZoom:this.transform.maxZoom},o),typeof o.padding=="number"){let R=o.padding;o.padding={top:R,bottom:R,right:R,left:R}}o.padding=k(a,o.padding);let s=this.transform,l=s.padding,c=s.project(Q.convert(e)),p=s.project(Q.convert(r)),m=c.rotate(-i*Math.PI/180),h=p.rotate(-i*Math.PI/180),d=new bt.default(Math.max(m.x,h.x),Math.max(m.y,h.y)),g=new bt.default(Math.min(m.x,h.x),Math.min(m.y,h.y)),y=d.sub(g),x=(s.width-(l.left+l.right+o.padding.left+o.padding.right))/y.x,v=(s.height-(l.top+l.bottom+o.padding.top+o.padding.bottom))/y.y;if(v<0||x<0){xe("Map cannot fit within canvas with the given bounds, padding, and/or offset.");return}let b=Math.min(s.scaleZoom(s.scale*Math.min(x,v)),o.maxZoom),w=bt.default.convert(o.offset),S=(o.padding.left-o.padding.right)/2,P=(o.padding.top-o.padding.bottom)/2,C=new bt.default(S,P).rotate(i*Math.PI/180),D=w.add(C).mult(s.scale/s.zoomScale(b));return{center:s.unproject(c.add(p).div(2).sub(D)),zoom:b,bearing:i}}fitBounds(e,r,i){return this._fitInternal(this.cameraForBounds(e,r),r,i)}fitScreenCoordinates(e,r,i,o,a){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.pointLocation(bt.default.convert(e)),this.transform.pointLocation(bt.default.convert(r)),i,o),o,a)}_fitInternal(e,r,i){return e?(r=k(e,r),delete r.padding,r.linear?this.easeTo(r,i):this.flyTo(r,i)):this}jumpTo(e,r){this.stop();let i=this._getTransformForUpdate(),o=!1,a=!1,s=!1;return"zoom"in e&&i.zoom!==+e.zoom&&(o=!0,i.zoom=+e.zoom),e.center!==void 0&&(i.center=Q.convert(e.center)),"bearing"in e&&i.bearing!==+e.bearing&&(a=!0,i.bearing=+e.bearing),"pitch"in e&&i.pitch!==+e.pitch&&(s=!0,i.pitch=+e.pitch),e.padding!=null&&!i.isPaddingEqual(e.padding)&&(i.padding=e.padding),this._applyUpdatedTransform(i),this.fire(new E("movestart",r)).fire(new E("move",r)),o&&this.fire(new E("zoomstart",r)).fire(new E("zoom",r)).fire(new E("zoomend",r)),a&&this.fire(new E("rotatestart",r)).fire(new E("rotate",r)).fire(new E("rotateend",r)),s&&this.fire(new E("pitchstart",r)).fire(new E("pitch",r)).fire(new E("pitchend",r)),this.fire(new E("moveend",r))}calculateCameraOptionsFromTo(e,r,i,o=0){let a=Se.fromLngLat(e,r),s=Se.fromLngLat(i,o),l=s.x-a.x,c=s.y-a.y,p=s.z-a.z,m=Math.hypot(l,c,p);if(m===0)throw new Error("Can't calculate camera options with same From and To");let h=Math.hypot(l,c),d=this.transform.scaleZoom(this.transform.cameraToCenterDistance/m/this.transform.tileSize),g=Math.atan2(l,-c)*180/Math.PI,y=Math.acos(h/m)*180/Math.PI;return y=p<0?90-y:90+y,{center:s.toLngLat(),zoom:d,pitch:y,bearing:g}}easeTo(e,r){this._stop(!1,e.easeId),e=k({offset:[0,0],duration:500,easing:el},e),(e.animate===!1||!e.essential&&ee.prefersReducedMotion)&&(e.duration=0);let i=this._getTransformForUpdate(),o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l=this.getPadding(),c="zoom"in e?+e.zoom:o,p="bearing"in e?this._normalizeBearing(e.bearing,a):a,m="pitch"in e?+e.pitch:s,h="padding"in e?e.padding:i.padding;console.log("aaaa",c),console.log("new zoom",c);let d=bt.default.convert(e.offset),g=i.centerPoint.add(d),y=i.pointLocation(g),x=Q.convert(e.center||y);this._normalizeCenter(x);let v=i.project(y),b=i.project(x).sub(v),w=i.zoomScale(c-o),S,P;e.around&&(S=Q.convert(e.around),P=i.locationPoint(S));let I={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=this._zooming||c!==o,this._rotating=this._rotating||a!==p,this._pitching=this._pitching||m!==s,this._padding=!i.isPaddingEqual(h),this._easeId=e.easeId,this._prepareEase(r,e.noMoveStart,I),this.terrain&&this._prepareElevation(x),this._ease(C=>{if(this._zooming&&(i.zoom=Ae.number(o,c,C)),this._rotating&&(i.bearing=Ae.number(a,p,C)),this._pitching&&(i.pitch=ye(Ae.number(s,m,C),this.transform.minPitch,this.transform.maxPitch)),this._padding&&(i.interpolatePadding(l,h,C),g=i.centerPoint.add(d)),this.terrain&&!e.freezeElevation&&this._updateElevation(C),S)i.setLocationAtPoint(S,P);else{let z=i.zoomScale(i.zoom-o),D=c>o?Math.min(2,w):Math.max(.5,w),A=Math.pow(D,1-C),R=i.unproject(v.add(b.mult(C*A)).mult(z));i.setLocationAtPoint(i.renderWorldCopies?R.wrap():R,g)}this._applyUpdatedTransform(i),this._fireMoveEvents(r)},C=>{this.terrain&&this._finalizeElevation(),this._afterEase(r,C)},e),this}_prepareEase(e,r,i={}){this._moving=!0,!r&&!i.moving&&this.fire(new E("movestart",e)),this._zooming&&!i.zooming&&this.fire(new E("zoomstart",e)),this._rotating&&!i.rotating&&this.fire(new E("rotatestart",e)),this._pitching&&!i.pitching&&this.fire(new E("pitchstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.transform.getElevation(e,this.terrain),this.transform.freezeElevation=!0}_updateElevation(e){let r=this.transform.getElevation(this._elevationCenter,this.terrain);if(e<1&&r!==this._elevationTarget){let i=this._elevationTarget-this._elevationStart,o=(r-(i*e+this._elevationStart))/(1-e);this._elevationStart+=e*(i-o),this._elevationTarget=r}this.transform.elevation=Ae.number(this._elevationStart,this._elevationTarget,e)}_finalizeElevation(){this.transform.freezeElevation=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(e){if(!this.transformCameraUpdate)return;let r=e.clone(),{center:i,zoom:o,pitch:a,bearing:s,elevation:l}=this.transformCameraUpdate(r);i&&(r.center=i),o!==void 0&&(r.zoom=o),a!==void 0&&(r.pitch=a),s!==void 0&&(r.bearing=s),l!==void 0&&(r.elevation=l),this.transform.apply(r)}_fireMoveEvents(e){this.fire(new E("move",e)),this._zooming&&this.fire(new E("zoom",e)),this._rotating&&this.fire(new E("rotate",e)),this._pitching&&this.fire(new E("pitch",e))}_afterEase(e,r){if(this._easeId&&r&&this._easeId===r)return;delete this._easeId;let i=this._zooming,o=this._rotating,a=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,i&&this.fire(new E("zoomend",e)),o&&this.fire(new E("rotateend",e)),a&&this.fire(new E("pitchend",e)),this.fire(new E("moveend",e))}flyTo(e,r){if(!e.essential&&ee.prefersReducedMotion){let Z=ht(e,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Z,r)}this.stop(),e=k({offset:[0,0],speed:1.2,curve:1.42,easing:el},e);let i=this._getTransformForUpdate(),o=this.getZoom(),a=this.getBearing(),s=this.getPitch(),l=this.getPadding(),c="zoom"in e?ye(+e.zoom,i.minZoom,i.maxZoom):o,p="bearing"in e?this._normalizeBearing(e.bearing,a):a,m="pitch"in e?+e.pitch:s,h="padding"in e?e.padding:i.padding,d=i.zoomScale(c-o),g=bt.default.convert(e.offset),y=i.centerPoint.add(g),x=i.pointLocation(y),v=Q.convert(e.center||x);this._normalizeCenter(v);let b=i.project(x),w=i.project(v).sub(b),S=e.curve,P=Math.max(i.width,i.height),I=P/d,C=w.mag();if("minZoom"in e){let Z=ye(Math.min(e.minZoom,o,c),i.minZoom,i.maxZoom),ue=P/i.zoomScale(Z-o);S=Math.sqrt(ue/C*2)}let z=S*S;function D(Z){let ue=(I*I-P*P+(Z?-1:1)*z*z*C*C)/(2*(Z?I:P)*z*C);return Math.log(Math.sqrt(ue*ue+1)-ue)}u(D,"zoomOutFactor");function A(Z){return(Math.exp(Z)-Math.exp(-Z))/2}u(A,"sinh");function R(Z){return(Math.exp(Z)+Math.exp(-Z))/2}u(R,"cosh");function U(Z){return A(Z)/R(Z)}u(U,"tanh");let L=D(!1),N=u(function(Z){return R(L)/R(L+S*Z)},"w"),V=u(function(Z){return P*((R(L)*U(L+S*Z)-A(L))/z)/C},"u"),W=(D(!0)-L)/S;if(Math.abs(C)<1e-6||!isFinite(W)){if(Math.abs(P-I)<1e-6)return this.easeTo(e,r);let Z=I<P?-1:1;W=Math.abs(Math.log(I/P))/S,V=u(function(){return 0},"u"),N=u(function(ue){return Math.exp(Z*S*ue)},"w")}if("duration"in e)e.duration=+e.duration;else{let Z="screenSpeed"in e?+e.screenSpeed/S:+e.speed;e.duration=1e3*W/Z}return e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=a!==p,this._pitching=m!==s,this._padding=!i.isPaddingEqual(h),this._prepareEase(r,!1),this.terrain&&this._prepareElevation(v),this._ease(Z=>{let ue=Z*W,Y=1/N(ue);i.zoom=Z===1?c:o+i.scaleZoom(Y),this._rotating&&(i.bearing=Ae.number(a,p,Z)),this._pitching&&(i.pitch=Ae.number(s,m,Z)),this._padding&&(i.interpolatePadding(l,h,Z),y=i.centerPoint.add(g)),this.terrain&&!e.freezeElevation&&this._updateElevation(Z);let Oe=Z===1?v:i.unproject(b.add(w.mult(V(ue))).mult(Y));i.setLocationAtPoint(i.renderWorldCopies?Oe.wrap():Oe,y),this._applyUpdatedTransform(i),this._fireMoveEvents(r)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(r)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,r){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){let i=this._onEaseEnd;delete this._onEaseEnd,i.call(this,r)}if(!e){let i=this.handlers;i&&i.stop(!1)}return this}_ease(e,r,i){i.animate===!1||i.duration===0?(e(1),r()):(this._easeStart=ee.now(),this._easeOptions=i,this._onEaseFrame=e,this._onEaseEnd=r,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,r){e=St(e,-180,180);let i=Math.abs(e-r);return Math.abs(e-360-r)<i&&(e-=360),Math.abs(e+360-r)<i&&(e+=360),e}_normalizeCenter(e){let r=this.transform;if(!r.renderWorldCopies||r.lngRange)return;let i=e.lng-r.center.lng;e.lng+=i>180?-360:i<-180?360:0}queryTerrainElevation(e){return this.terrain?this.transform.getElevation(Q.convert(e),this.terrain)-this.transform.elevation:null}};u(Km,"Camera");var Ps=Km;var Mt=te(be(),1);f();var $m=class $m{constructor(t={}){this._toggleAttribution=u(()=>{this._container.classList.contains("outdoor-compact")&&(this._container.classList.contains("outdoor-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("outdoor-compact-show")):(this._container.classList.add("outdoor-compact-show"),this._container.removeAttribute("open")))},"_toggleAttribution");this._updateData=u(t=>{t&&(t.sourceDataType==="metadata"||t.sourceDataType==="visibility"||t.dataType==="style"||t.type==="terrain")&&this._updateAttributions()},"_updateData");this._updateCompact=u(()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):!this._container.classList.contains("outdoor-compact")&&!this._container.classList.contains("outdoor-attrib-empty")&&(this._container.setAttribute("open",""),this._container.classList.add("outdoor-compact","outdoor-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("outdoor-compact")&&this._container.classList.remove("outdoor-compact","outdoor-compact-show"))},"_updateCompact");this._updateCompactMinimize=u(()=>{this._container.classList.contains("outdoor-compact")&&this._container.classList.contains("outdoor-compact-show")&&this._container.classList.remove("outdoor-compact-show")},"_updateCompactMinimize");this.options=t,this.position=this.options.position||this.getDefaultPosition()}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=M.create("details","outdoor-ctrl-attrib outdoor-ctrl-attrib-".concat(this.position)),this._compactButton=M.create("summary","outdoor-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=M.create("div","outdoor-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._attributions=[],this._container}onRemove(){M.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,e){let r=this._map._getUIString("AttributionControl.".concat(e));t.title=r,t.setAttribute("aria-label",r)}get attributions(){return[...this._attributions]}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(i=>typeof i!="string"?"":i)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){let i=this._map.style.stylesheet;this.styleOwner=i.owner,this.styleId=i.id}let e=this._map.style.sourceCaches;for(let i in e){let o=e[i];if(o.used||o.usedForTerrain){let a=o.getSource();a.attribution&&t.indexOf(a.attribution)<0&&t.push(a.attribution)}}t=t.filter(i=>String(i).trim()),t.sort((i,o)=>i.length-o.length),t=t.filter((i,o)=>{for(let a=o+1;a<t.length;a++)if(t[a].indexOf(i)>=0)return!1;return!0}),this._attributions=t;let r=t.join(" | ");r!==this._attribHTML&&(this._attribHTML=r,t.length?(this._innerContainer.innerHTML=r,this._container.classList.remove("outdoor-attrib-empty")):this._container.classList.add("outdoor-attrib-empty"),this._updateCompact(),this._editLink=null)}show(){this._container.classList.remove("outdoor-ctrl-attrib-hide")}hide(){this._container.classList.add("outdoor-ctrl-attrib-hide")}setPosition(t){this._container.classList.remove("outdoor-ctrl-attrib-".concat(this.position)),this.position=t,this._container.classList.add("outdoor-ctrl-attrib-".concat(this.position))}};u($m,"AttributionControl");var ui=$m;f();var Jm=class Jm{constructor(t={}){this._updateCompact=u(()=>{let t=this._container.children;if(t.length){let e=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&e.classList.add("maplibregl-compact"):e.classList.remove("maplibregl-compact")}},"_updateCompact");this.options=t}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=M.create("div","maplibregl-ctrl");let e=M.create("a","maplibregl-ctrl-logo");return e.target="_blank",e.rel="noopener nofollow",e.href="https://maplibre.org/",e.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),e.setAttribute("rel","noopener nofollow"),this._container.appendChild(e),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){M.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}};u(Jm,"LogoControl");var ci=Jm;f();var Iv=te(be(),1);var Ym=class Ym extends E{constructor(e,r,i,o={}){let a=M.mousePos(r.getCanvasContainer(),i),s=r.unproject(a);super(e,k({point:a,lngLat:s,originalEvent:i},o));this._defaultPrevented=!1,this.target=r}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}};u(Ym,"MapMouseEvent");var pi=Ym;f();var Qm=class Qm{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){let e=++this._id;return this._queue.push({callback:t,id:e,cancelled:!1}),e}remove(t){let e=this._currentlyRunning,r=e?this._queue.concat(e):this._queue;for(let i of r)if(i.id===t){i.cancelled=!0;return}}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");let e=this._currentlyRunning=this._queue;this._queue=[];for(let r of e)if(!r.cancelled&&(r.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}};u(Qm,"TaskQueue");var Ts=Qm;f();var As=(r=>(r.create="create",r.load="load",r.fullLoad="fullLoad",r))(As||{}),Is=null,bn=[],Av=60,eh=1e3/Av,th="loadTime",rh="fullLoadTime",er={mark(n){"mark"in performance&&performance.mark(n)},frame(n){let t=n;if(Is!=null){let e=t-Is;bn.push(e)}Is=t},clearMetrics(){Is=null,bn=[],performance.clearMeasures(th),performance.clearMeasures(rh);for(let n in As)performance.clearMarks(As[n])},getPerformanceMetrics(){performance.measure(th,"create","load"),performance.measure(rh,"create","fullLoad");let n=performance.getEntriesByName(th)[0].duration,t=performance.getEntriesByName(rh)[0].duration,e=bn.length,i=1/(bn.reduce((s,l)=>s+l,0)/e/1e3),o=bn.filter(s=>s>eh).reduce((s,l)=>s+(l-eh)/eh,0),a=o/(e+o)*100;return{loadTime:n,fullLoadTime:t,fps:i,percentDroppedFrames:a,totalFrames:e}}};f();var Ox={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};f();f();var Vx=fe([{name:"a_pos3d",type:"Int16",components:3}]);f();var ih=class ih extends se{constructor(e){super();this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,e.usedForTerrain=!0,e.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,r){this.sourceCache.update(e,r),this._renderableTilesKeys=[];let i={};for(let o of e.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:r}))i[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.posMatrix=new Float64Array(16),G.ortho(o.posMatrix,0,8192,0,8192,0,1),this._tiles[o.key]=new ni(o,this.tileSize));for(let o in this._tiles)i[o]||delete this._tiles[o]}freeRtt(e){for(let r in this._tiles){let i=this._tiles[r];(!e||i.tileID.equals(e)||i.tileID.isChildOf(e)||e.isChildOf(i.tileID))&&(i.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e){let r={};for(let i of this._renderableTilesKeys){let o=this._tiles[i].tileID;if(o.canonical.equals(e.canonical)){let a=e.clone();a.posMatrix=new Float64Array(16),G.ortho(a.posMatrix,0,8192,0,8192,0,1),r[i]=a}else if(o.canonical.isChildOf(e.canonical)){let a=e.clone();a.posMatrix=new Float64Array(16);let s=o.canonical.z-e.canonical.z,l=o.canonical.x-(o.canonical.x>>s<<s),c=o.canonical.y-(o.canonical.y>>s<<s),p=8192>>s;G.ortho(a.posMatrix,0,p,0,p,0,1),G.translate(a.posMatrix,a.posMatrix,[-l*p,-c*p,0]),r[i]=a}else if(e.canonical.isChildOf(o.canonical)){let a=e.clone();a.posMatrix=new Float64Array(16);let s=e.canonical.z-o.canonical.z,l=e.canonical.x-(e.canonical.x>>s<<s),c=e.canonical.y-(e.canonical.y>>s<<s),p=8192>>s;G.ortho(a.posMatrix,0,8192,0,8192,0,1),G.translate(a.posMatrix,a.posMatrix,[l*p,c*p,0]),G.scale(a.posMatrix,a.posMatrix,[1/2**s,1/2**s,0]),r[i]=a}}return r}getSourceTile(e,r){let i=this.sourceCache._source,o=e.overscaledZ-this.deltaZoom;if(o>i.maxzoom&&(o=i.maxzoom),o<i.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(o).key);let a=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if(!(a&&a.dem)&&r)for(;o>=i.minzoom&&!(a&&a.dem);)a=this.sourceCache.getTileByID(e.scaledTo(o--).key);return a}tilesAfterTime(e=Date.now()){return Object.values(this._tiles).filter(r=>r.timeAdded>=e)}};u(ih,"TerrainSourceCache");var Cs=ih;var nh=class nh{constructor(t,e,r){this.painter=t,this.sourceCache=new Cs(e),this.options=r,this.exaggeration=typeof r.exaggeration=="number"?r.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(t,e,r,i=8192){var d;if(!(e>=0&&e<i&&r>=0&&r<i))return 0;let o=this.getTerrainData(t),a=(d=o.tile)==null?void 0:d.dem;if(!a)return 0;let s=kn.transformMat4([],[e/i*8192,r/i*8192],o.u_terrain_matrix),l=[s[0]*a.dim,s[1]*a.dim],c=Math.floor(l[0]),p=Math.floor(l[1]),m=l[0]-c,h=l[1]-p;return a.get(c,p)*(1-m)*(1-h)+a.get(c+1,p)*m*(1-h)+a.get(c,p+1)*(1-m)*h+a.get(c+1,p+1)*m*h}getElevation(t,e,r,i=8192){return this.getDEMElevation(t,e,r,i)*this.exaggeration}getTerrainData(t){if(!this._emptyDemTexture){let i=this.painter.context,o=new _e({width:1,height:1},new Uint8Array(1*4));this._emptyDepthTexture=new he(i,o,i.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new he(i,new _e({width:1,height:1}),i.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=G.identity([])}let e=this.sourceCache.getSourceTile(t,!0);if(e&&e.dem&&(!e.demTexture||e.needsTerrainPrepare)){let i=this.painter.context;e.demTexture=this.painter.getTileTexture(e.dem.stride),e.demTexture?e.demTexture.update(e.dem.getPixels(),{premultiply:!1}):e.demTexture=new he(i,e.dem.getPixels(),i.gl.RGBA,{premultiply:!1}),e.demTexture.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),e.needsTerrainPrepare=!1}let r=e&&e+e.tileID.key+t.key;if(r&&!this._demMatrixCache[r]){let i=this.sourceCache.sourceCache._source.maxzoom,o=t.canonical.z-e.tileID.canonical.z;t.overscaledZ>t.canonical.z&&(t.canonical.z>=i?o=t.canonical.z-i:xe("cannot calculate elevation if elevation maxzoom > source.maxzoom"));let a=t.canonical.x-(t.canonical.x>>o<<o),s=t.canonical.y-(t.canonical.y>>o<<o),l=G.fromScaling(new Float64Array(16),[1/(8192<<o),1/(8192<<o),0]);G.translate(l,l,[a*8192,s*8192,0]),this._demMatrixCache[t.key]={matrix:l,coord:t}}return{u_depth:2,u_terrain:3,u_terrain_dim:e&&e.dem&&e.dem.dim||1,u_terrain_matrix:r?this._demMatrixCache[t.key].matrix:this._emptyDemMatrix,u_terrain_unpack:e&&e.dem&&e.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(e&&e.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:e}}getFramebuffer(t){let e=this.painter,r=e.width/devicePixelRatio,i=e.height/devicePixelRatio;return this._fbo&&(this._fbo.width!==r||this._fbo.height!==i)&&(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new he(e.context,{width:r,height:i,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new he(e.context,{width:r,height:i,data:null},e.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(e.context.gl.NEAREST,e.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=e.context.createFramebuffer(r,i,!0,!1),this._fbo.depthAttachment.set(e.context.createRenderbuffer(e.context.gl.DEPTH_COMPONENT16,r,i))),this._fbo.colorAttachment.set(t==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){let t=this.painter.context;if(this._coordsTexture)return this._coordsTexture;let e=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let o=0,a=0;o<this._coordsTextureSize;o++)for(let s=0;s<this._coordsTextureSize;s++,a+=4)e[a+0]=s&255,e[a+1]=o&255,e[a+2]=s>>8<<4|o>>8,e[a+3]=0;let r=new _e({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(e.buffer)),i=new he(t,r,t.gl.RGBA,{premultiply:!1});return i.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=i,i}pointCoordinate(t){let e=new Uint8Array(4),r=this.painter.context,i=r.gl;r.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),i.readPixels(t.x,this.painter.height/devicePixelRatio-t.y-1,1,1,i.RGBA,i.UNSIGNED_BYTE,e),r.bindFramebuffer.set(null);let o=e[0]+(e[2]>>4<<8),a=e[1]+((e[2]&15)<<8),s=this.coordsIndex[255-e[3]],l=s&&this.sourceCache.getTileByID(s);if(!l)return null;let c=this._coordsTextureSize,p=(1<<l.tileID.canonical.z)*c;return new Se((l.tileID.canonical.x*c+o)/p,(l.tileID.canonical.y*c+a)/p,this.getElevation(l.tileID,o,a,c))}getTerrainMesh(){if(this._mesh)return this._mesh;let t=this.painter.context,e=new Qn,r=new qe,i=this.meshSize,o=8192/i,a=i*i;for(let m=0;m<=i;m++)for(let h=0;h<=i;h++)e.emplaceBack(h*o,m*o,0);for(let m=0;m<a;m+=i+1)for(let h=0;h<i;h++)r.emplaceBack(h+m,i+h+m+1,i+h+m+2),r.emplaceBack(h+m,i+h+m+2,h+m+1);let s=e.length,l=s+(i+1)*2;for(let m of[0,1])for(let h=0;h<=i;h++)for(let d of[0,1])e.emplaceBack(h*o,m*8192,d);for(let m=0;m<i*2;m+=2)r.emplaceBack(l+m,l+m+1,l+m+3),r.emplaceBack(l+m,l+m+3,l+m+2),r.emplaceBack(s+m,s+m+3,s+m+1),r.emplaceBack(s+m,s+m+2,s+m+3);let c=e.length,p=c+(i+1)*2;for(let m of[0,1])for(let h=0;h<=i;h++)for(let d of[0,1])e.emplaceBack(m*8192,h*o,d);for(let m=0;m<i*2;m+=2)r.emplaceBack(c+m,c+m+1,c+m+3),r.emplaceBack(c+m,c+m+3,c+m+2),r.emplaceBack(p+m,p+m+3,p+m+1),r.emplaceBack(p+m,p+m+2,p+m+3);return this._mesh={indexBuffer:t.createIndexBuffer(r),vertexBuffer:t.createVertexBuffer(e,Vx.members),segments:ae.simpleSegment(0,0,e.length,r.length)},this._mesh}getMeshFrameDelta(t){return 2*Math.PI*Pr/Math.pow(2,t)/5}getMinMaxElevation(t){let e=this.getTerrainData(t).tile,r={minElevation:null,maxElevation:null};return e&&e.dem&&(r.minElevation=e.dem.min*this.exaggeration,r.maxElevation=e.dem.max*this.exaggeration),r}};u(nh,"Terrain");var Es=nh;f();f();var oh=class oh{constructor(t,e,r){this._context=t;this._size=e;this._tileSize=r;this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(let t of this._objects)t.texture.destroy(),t.fbo.destroy()}_createObject(t){let e=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),r=new he(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return r.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),e.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),e.colorAttachment.set(r.texture),{id:t,fbo:e,texture:r,stamp:-1,inUse:!1}}getObjectForId(t){return this._objects[t]}useObject(t){t.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(e=>t.id!==e),this._recentlyUsed.push(t.id)}stampObject(t){t.stamp=++this._stamp}getOrCreateFreeObject(){for(let e of this._recentlyUsed)if(!this._objects[e].inUse)return this._objects[e];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");let t=this._createObject(this._objects.length);return this._objects.push(t),t}freeObject(t){t.inUse=!1}freeAllObjects(){for(let t of this._objects)this.freeObject(t)}isFull(){return this._objects.length<this._size?!1:this._objects.some(t=>!t.inUse)===!1}};u(oh,"RenderPool");var Ms=oh;var mi={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0},ah=class ah{constructor(t,e){this.painter=t,this.terrain=e,this.pool=new Ms(t.context,30,e.sourceCache.tileSize*e.qualityFactor)}destruct(){this.pool.destruct()}getTexture(t){return this.pool.getObjectForId(t.rtt[this._stacks.length-1].id).texture}prepareForRender(t,e){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=t._order.filter(r=>!t._layers[r].isHidden(e)),this._coordsDescendingInv={};for(let r in t.sourceCaches){this._coordsDescendingInv[r]={};let i=t.sourceCaches[r].getVisibleCoordinates();for(let o of i){let a=this.terrain.sourceCache.getTerrainCoords(o);for(let s in a)this._coordsDescendingInv[r][s]||(this._coordsDescendingInv[r][s]=[]),this._coordsDescendingInv[r][s].push(a[s])}}this._coordsDescendingInvStr={};for(let r of t._order){let i=t._layers[r],o=i.source;if(mi[i.type]&&!this._coordsDescendingInvStr[o]){this._coordsDescendingInvStr[o]={};for(let a in this._coordsDescendingInv[o])this._coordsDescendingInvStr[o][a]=this._coordsDescendingInv[o][a].map(s=>s.key).sort().join()}}for(let r of this._renderableTiles)for(let i in this._coordsDescendingInvStr){let o=this._coordsDescendingInvStr[i][r.tileID.key];o&&o!==r.rttCoords[i]&&(r.rtt=[])}}renderLayer(t){if(t.isHidden(this.painter.transform.zoom))return!1;let e=t.type,r=this.painter,i=this._renderableLayerIds[this._renderableLayerIds.length-1]===t.id;if(mi[e]&&((!this._prevType||!mi[this._prevType])&&this._stacks.push([]),this._prevType=e,this._stacks[this._stacks.length-1].push(t.id),!i))return!0;if(mi[this._prevType]||mi[e]&&i){this._prevType=e;let o=this._stacks.length-1,a=this._stacks[o]||[];for(let s of this._renderableTiles){if(this.pool.isFull()&&(Nm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(s),s.rtt[o]){let c=this.pool.getObjectForId(s.rtt[o].id);if(c.stamp===s.rtt[o].stamp){this.pool.useObject(c);continue}}let l=this.pool.getOrCreateFreeObject();this.pool.useObject(l),this.pool.stampObject(l),s.rtt[o]={id:l.id,stamp:l.stamp},r.context.bindFramebuffer.set(l.fbo.framebuffer),r.context.clear({color:me.transparent,stencil:0}),r.currentStencilSource=void 0;for(let c=0;c<a.length;c++){let p=r.style._layers[a[c]],m=p.source?this._coordsDescendingInv[p.source][s.tileID.key]:[s.tileID];r.context.viewport.set([0,0,l.fbo.width,l.fbo.height]),r._renderTileClippingMasks(p,m),r.renderLayer(r,r.style.sourceCaches[p.source],p,m),p.source&&(s.rttCoords[p.source]=this._coordsDescendingInvStr[p.source][s.tileID.key])}}return Nm(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects(),mi[e]}return!1}};u(ah,"RenderToTexture");var Ls=ah;var Cv=zn.version,Ds=-2,Ux=22,tr=0,Nx=90,ks=90,Ev={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:Ds,maxZoom:Ux,minPitch:tr,maxPitch:Nx,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:Ge.MAX_TILE_CACHE_ZOOM_LEVELS,localIdeographFontFamily:"sans-serif",transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,validateStyle:!0,maxCanvasSize:[4096,4096]},sh=class sh extends Ps{constructor(e){if(er.mark("create"),e=k({},Ev,e),e.minZoom!=null&&e.maxZoom!=null&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(e.minPitch!=null&&e.maxPitch!=null&&e.minPitch>e.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(e.minPitch!=null&&e.minPitch<tr)throw new Error("minPitch must be greater than or equal to ".concat(tr));if(e.maxPitch!=null&&e.maxPitch>ks)throw new Error("maxPitch must be less than or equal to ".concat(ks));let r=new ds(e.minZoom,e.maxZoom,e.minPitch,e.maxPitch,e.renderWorldCopies);super(r,{bearingSnap:e.bearingSnap});this._cooperativeGesturesOnWheel=u(e=>{this._onCooperativeGesture(e,e[this._metaKey],1)},"_cooperativeGesturesOnWheel");this._contextLost=u(e=>{e.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new E("webglcontextlost",{originalEvent:e}))},"_contextLost");this._contextRestored=u(e=>{this._setupPainter(),this.resize(),this._update(),this.fire(new E("webglcontextrestored",{originalEvent:e}))},"_contextRestored");this._onMapScroll=u(e=>{if(e.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},"_onMapScroll");this._onWindowOnline=u(()=>{this._update()},"_onWindowOnline");if(this._interactive=e.interactive,this._cooperativeGestures=e.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=e.maxTileCacheSize,this._maxTileCacheZoomLevels=e.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._antialias=e.antialias,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossSourceCollisions=e.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming,this._renderTaskQueue=new Ts,this._controls=[],this._mapId=Rn(),this._locale=k({},Ox,e.locale),this._clickTolerance=e.clickTolerance,this._overridePixelRatio=e.pixelRatio,this._maxCanvasSize=e.maxCanvasSize,this.transformCameraUpdate=e.transformCameraUpdate,this._imageQueueHandle=He.addThrottleControl(()=>this.isMoving()),this._requestManager=new Gn(e.transformRequest),this._canvas=e.canvas,this._canvasContainer=e.canvasContainer,typeof e.container=="string"){if(this._container=document.getElementById(e.container),!this._container)throw new Error("Container '".concat(e.container,"' not found."))}else if(e.container instanceof HTMLElement)this._container=e.container;else throw new Error("Invalid type: 'container' must be a String or HTMLElement.");if(e.maxBounds&&this.setMaxBounds(e.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let o=!1;this._resizeObserver=new ResizeObserver(a=>{if(!o){o=!0;return}this._trackResize&&this.resize(a)._update()}),this._resizeObserver.observe(this._container)}this.handlers=new Ss(this,e),this._cooperativeGestures&&this._setupCooperativeGestures();let i=typeof e.hash=="string"&&e.hash||void 0;this._hash=e.hash&&new gs(i).addTo(this),(!this._hash||!this._hash._onHashChange())&&(this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),e.bounds&&(this.resize(),this.fitBounds(e.bounds,k({},e.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=e.localIdeographFontFamily,this._validateStyle=e.validateStyle,e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new ui({customAttribution:e.customAttribution})),e.maplibreLogo&&this.addControl(new ci,e.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",o=>{this._update(o.dataType==="style"),this.fire(new E("".concat(o.dataType,"data"),o))}),this.on("dataloading",o=>{this.fire(new E("".concat(o.dataType,"dataloading"),o))}),this.on("dataabort",o=>{this.fire(new E("sourcedataabort",o))})}_getMapId(){return this._mapId}addControl(e,r){return r===void 0&&(e.getDefaultPosition?r=e.getDefaultPosition():r="top-right"),!e||!e.onAdd?this.fire(new j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods."))):this}removeControl(e){if(!e||!e.onRemove)return this.fire(new j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));let r=this._controls.indexOf(e);return r>-1&&this._controls.splice(r,1),e.onRemove(this),this}hasControl(e){return this._controls.indexOf(e)>-1}calculateCameraOptionsFromTo(e,r,i,o){return o==null&&this.terrain&&(o=this.transform.getElevation(i,this.terrain)),super.calculateCameraOptionsFromTo(e,r,i,o)}resize(e){var l;let r=this._containerDimensions(),i=r[0],o=r[1],a=this._getClampedPixelRatio(i,o);if(this.painter.resize(i,o,a),this.painter.overLimit()){let c=this.painter.context.gl;this._maxCanvasSize=[c.drawingBufferWidth,c.drawingBufferHeight];let p=this._getClampedPixelRatio(i,o);this._resizeCanvas(i,o,p),this.painter.resize(i,o,p)}this.transform.resize(i,o),(l=this._requestedCameraState)==null||l.resize(i,o);let s=!this._moving;return s&&(this.stop(),this.fire(new E("movestart",e)).fire(new E("move",e))),this.fire(new E("resize",e)),s&&this.fire(new E("moveend",e)),this}_getClampedPixelRatio(e,r){let{0:i,1:o}=this._maxCanvasSize,a=this.getPixelRatio(),s=e*a,l=r*a,c=s>i?i/s:1,p=l>o?o/l:1;return Math.min(c,p)*a}getPixelRatio(){var e;return(e=this._overridePixelRatio)!=null?e:devicePixelRatio}setPixelRatio(e){this._overridePixelRatio=e,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(e){return this.transform.setMaxBounds(We.convert(e)),this._update()}setMinZoom(e){if(e=e==null?Ds:e,e>=Ds&&e<=this.transform.maxZoom)return this.transform.minZoom=e,this._update(),this.getZoom()<e&&this.setZoom(e),this;throw new Error("minZoom must be between ".concat(Ds," and the current maxZoom, inclusive"))}getMinZoom(){return this.transform.minZoom}setMaxZoom(e){if(e=e==null?Ux:e,e>=this.transform.minZoom)return this.transform.maxZoom=e,this._update(),this.getZoom()>e&&this.setZoom(e),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(e){if(e=e==null?tr:e,e<tr)throw new Error("minPitch must be greater than or equal to ".concat(tr));if(e>=tr&&e<=this.transform.maxPitch)return this.transform.minPitch=e,this._update(),this.getPitch()<e&&this.setPitch(e),this;throw new Error("minPitch must be between ".concat(tr," and the current maxPitch, inclusive"))}getMinPitch(){return this.transform.minPitch}setMaxPitch(e){if(e=e==null?Nx:e,e>ks)throw new Error("maxPitch must be less than or equal to ".concat(ks));if(e>=this.transform.minPitch)return this.transform.maxPitch=e,this._update(),this.getPitch()>e&&this.setPitch(e),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(e){return this.transform.renderWorldCopies=e,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(e){return this._cooperativeGestures=e,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(e){return this.transform.locationPoint(Q.convert(e),this.style&&this.terrain)}unproject(e){return this.transform.pointLocation(Mt.default.convert(e),this.terrain)}isMoving(){var e;return this._moving||((e=this.handlers)==null?void 0:e.isMoving())}isZooming(){return this._zooming||!1}isRotating(){var e;return this._rotating||((e=this.handlers)==null?void 0:e.isRotating())}_createDelegatedListener(e,r,i){if(e==="mouseenter"||e==="mouseover"){let o=!1;return{layer:r,listener:i,delegates:{mousemove:u(l=>{let c=this.getLayer(r)?this.queryRenderedFeatures(l.point,{layers:[r]}):[];c.length?o||(o=!0,i.call(this,new pi(e,this,l.originalEvent,{features:c}))):o=!1},"mousemove"),mouseout:u(()=>{o=!1},"mouseout")}}}else if(e==="mouseleave"||e==="mouseout"){let o=!1;return{layer:r,listener:i,delegates:{mousemove:u(l=>{(this.getLayer(r)?this.queryRenderedFeatures(l.point,{layers:[r]}):[]).length?o=!0:o&&(o=!1,i.call(this,new pi(e,this,l.originalEvent)))},"mousemove"),mouseout:u(l=>{o&&(o=!1,i.call(this,new pi(e,this,l.originalEvent)))},"mouseout")}}}else{let o=u(a=>{let s=this.getLayer(r)?this.queryRenderedFeatures(a.point,{layers:[r]}):[];s.length&&(a.features=s,i.call(this,a),delete a.features)},"delegate");return{layer:r,listener:i,delegates:{[e]:o}}}}on(e,r,i){if(i===void 0)return super.on(e,r);let o=this._createDelegatedListener(e,r,i);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(o);for(let a in o.delegates)this.on(a,o.delegates[a]);return this}once(e,r,i){if(i===void 0)return super.once(e,r);let o=this._createDelegatedListener(e,r,i);for(let a in o.delegates)this.once(a,o.delegates[a]);return this}off(e,r,i){if(i===void 0)return super.off(e,r);let o=u(a=>{let s=a[e];for(let l=0;l<s.length;l++){let c=s[l];if(c.layer===r&&c.listener===i){for(let p in c.delegates)this.off(p,c.delegates[p]);return s.splice(l,1),this}}},"removeDelegatedListener");return this._delegatedListeners&&this._delegatedListeners[e]&&o(this._delegatedListeners),this}queryRenderedFeatures(e,r){if(!this.style)return[];let i,o=e instanceof Mt.default||Array.isArray(e),a=o?e:[[0,0],[this.transform.width,this.transform.height]];if(r=r||(o?{}:e)||{},a instanceof Mt.default||typeof a[0]=="number")i=[Mt.default.convert(a)];else{let s=Mt.default.convert(a[0]),l=Mt.default.convert(a[1]);i=[s,new Mt.default(l.x,s.y),l,new Mt.default(s.x,l.y),s]}return this.style.queryRenderedFeatures(i,r,this.transform)}querySourceFeatures(e,r){return this.style.querySourceFeatures(e,r)}setStyle(e,r){return r=k({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},r),r.diff!==!1&&r.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&e?(this._diffStyle(e,r),this):(this._localIdeographFontFamily=r.localIdeographFontFamily,this._updateStyle(e,r))}setTransformRequest(e){return this._requestManager.setTransformRequest(e),this}_getUIString(e){let r=this._locale[e];if(r==null)throw new Error("Missing UI string '".concat(e,"'"));return r}_updateStyle(e,r){if(r.transformStyle&&this.style&&!this.style._loaded){this.style.once("style.load",()=>this._updateStyle(e,r));return}let i=this.style&&r.transformStyle?this.style.serialize():void 0;if(this.style&&(this.style.setEventedParent(null),this.style._remove(!e)),e)this.style=new Qt(this,r||{});else return delete this.style,this;return this.style.setEventedParent(this,{style:this.style}),typeof e=="string"?this.style.loadURL(e,r,i):this.style.loadJSON(e,r,i),this}_lazyInitEmptyStyle(){this.style||(this.style=new Qt(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(e,r){if(typeof e=="string"){let i=e,o=this._requestManager.transformRequest(i,"Style");Bt(o,(a,s)=>{a?this.fire(new j(a)):s&&this._updateDiff(s,r)})}else typeof e=="object"&&this._updateDiff(e,r)}_updateDiff(e,r){try{this.style.setState(e,r)&&this._update(!0)}catch(i){xe("Unable to perform style diff: ".concat(i.message||i.error||i,". Rebuilding the style from scratch.")),this._updateStyle(e,r)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():xe("There is no style added to the map.")}addSource(e,r){return this._lazyInitEmptyStyle(),this.style.addSource(e,r),this._update(!0)}isSourceLoaded(e){let r=this.style&&this.style.sourceCaches[e];if(r===void 0){this.fire(new j(new Error("There is no source with ID '".concat(e,"'"))));return}return r.loaded()}setTerrain(e){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),!e)this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.updateElevation(this.terrain);else{let r=this.style.sourceCaches[e.source];if(!r)throw new Error("cannot load terrain, because there exists no source with ID: ".concat(e.source));for(let i in this.style._layers){let o=this.style._layers[i];o.type==="hillshade"&&o.source===e.source&&xe("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Es(this.painter,r,e),this.painter.renderToTexture=new Ls(this.painter,this.terrain),this.transform.updateElevation(this.terrain),this._terrainDataCallback=i=>{i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId===e.source&&this.transform.updateElevation(this.terrain),this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}return this.fire(new E("terrain",{terrain:e})),this}getTerrain(){return this.terrain&&this.terrain.options}areTilesLoaded(){let e=this.style&&this.style.sourceCaches;for(let r in e){let o=e[r]._tiles;for(let a in o){let s=o[a];if(!(s.state==="loaded"||s.state==="errored"))return!1}}return!0}addSourceType(e,r,i){return this._lazyInitEmptyStyle(),this.style.addSourceType(e,r,i)}removeSource(e){return this.style.removeSource(e),this._update(!0)}getSource(e){return this.style.getSource(e)}addImage(e,r,i={}){let{pixelRatio:o=1,sdf:a=!1,stretchX:s,stretchY:l,content:c}=i;this._lazyInitEmptyStyle();let p=0;if(r instanceof HTMLImageElement||ct(r)){let{width:m,height:h,data:d}=ee.getImageData(r);this.style.addImage(e,{data:new _e({width:m,height:h},d),pixelRatio:o,stretchX:s,stretchY:l,content:c,sdf:a,version:p})}else{if(r.width===void 0||r.height===void 0)return this.fire(new j(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`")));{let{width:m,height:h,data:d}=r,g=r;return this.style.addImage(e,{data:new _e({width:m,height:h},new Uint8Array(d)),pixelRatio:o,stretchX:s,stretchY:l,content:c,sdf:a,version:p,userImage:g}),g.onAdd&&g.onAdd(this,e),this}}}updateImage(e,r){let i=this.style.getImage(e);if(!i)return this.fire(new j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));let o=r instanceof HTMLImageElement||ct(r)?ee.getImageData(r):r,{width:a,height:s,data:l}=o;if(a===void 0||s===void 0)return this.fire(new j(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(a!==i.data.width||s!==i.data.height)return this.fire(new j(new Error("The width and height of the updated image must be that same as the previous version of the image")));let c=!(r instanceof HTMLImageElement||ct(r));return i.data.replace(l,c),this.style.updateImage(e,i),this}getImage(e){return this.style.getImage(e)}hasImage(e){return e?!!this.style.getImage(e):(this.fire(new j(new Error("Missing required image id"))),!1)}removeImage(e){this.style.removeImage(e)}loadImage(e,r){He.getImage(this._requestManager.transformRequest(e,"Image"),r)}listImages(){return this.style.listImages()}addLayer(e,r){return this._lazyInitEmptyStyle(),this.style.addLayer(e,r),this._update(!0)}moveLayer(e,r){return this.style.moveLayer(e,r),this._update(!0)}removeLayer(e){return this.style.removeLayer(e),this._update(!0)}getLayer(e){return this.style.getLayer(e)}setLayerZoomRange(e,r,i){return this.style.setLayerZoomRange(e,r,i),this._update(!0)}setFilter(e,r,i={}){return this.style.setFilter(e,r,i),this._update(!0)}getFilter(e){return this.style.getFilter(e)}setPaintProperty(e,r,i,o={}){return this.style.setPaintProperty(e,r,i,o),this._update(!0)}getPaintProperty(e,r){return this.style.getPaintProperty(e,r)}setLayoutProperty(e,r,i,o={}){return this.style.setLayoutProperty(e,r,i,o),this._update(!0)}getLayoutProperty(e,r){return this.style.getLayoutProperty(e,r)}setGlyphs(e,r={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(e,r),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(e,r,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(e,r,i,o=>{o||this._update(!0)}),this}removeSprite(e){return this._lazyInitEmptyStyle(),this.style.removeSprite(e),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(e,r={}){return this._lazyInitEmptyStyle(),this.style.setSprite(e,r,i=>{i||this._update(!0)}),this}setLight(e,r={}){return this._lazyInitEmptyStyle(),this.style.setLight(e,r),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(e,r){return this.style.setFeatureState(e,r),this._update()}removeFeatureState(e,r){return this.style.removeFeatureState(e,r),this._update()}getFeatureState(e){return this.style.getFeatureState(e)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let e=0,r=0;return this._container&&(e=this._container.clientWidth||400,r=this._container.clientHeight||300),[e,r]}_setupContainer(){let e=this._container,r=this._containerDimensions(),i=this._getClampedPixelRatio(r[0],r[1]);this._resizeCanvas(r[0],r[1],i)}_setupCooperativeGestures(){let e=this._container;this._cooperativeGesturesScreen=M.create("div","maplibregl-cooperative-gesture-screen",e);let r=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(r=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use \u2318 + scroll to zoom the map");let i=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map";this._cooperativeGesturesScreen.innerHTML='\n <div class="maplibregl-desktop-message">'.concat(r,'</div>\n <div class="maplibregl-mobile-message">').concat(i,"</div>\n "),this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){M.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(e,r,i){}_setupPainter(){let e={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1},r=null;this._canvas.addEventListener("webglcontextcreationerror",o=>{r={requestedAttributes:e},o&&(r.statusMessage=o.statusMessage,r.type=o.type)},{once:!0});let i=this._canvas.getContext("webgl2",e)||this._canvas.getContext("webgl",e);if(!i){let o="Failed to initialize WebGL";throw r?(r.message=o,new Error(JSON.stringify(r))):new Error(o)}this.painter=new us(i,this.transform),_i.testSupport(i)}_onCooperativeGesture(e,r,i){return!r&&i<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(e){return!this.style||!this.style._loaded?this:(this._styleDirty=this._styleDirty||e,this._sourcesDirty=!0,this.triggerRepaint(),this)}_requestRenderFrame(e){return this._update(),this._renderTaskQueue.add(e)}_cancelRenderFrame(e){this._renderTaskQueue.remove(e)}_render(e){let r=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(e),this._removed)return;let i=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;let a=this.transform.zoom,s=ee.now();this.style.zoomHistory.update(a,s);let l=new le(a,{now:s,fadeDuration:r,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),c=l.crossFadingFactor();(c!==1||c!==this._crossFadingFactor)&&(i=!0,this._crossFadingFactor=c),this.style.update(l)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain&&this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.updateElevation(this.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,r,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:!1,zooming:!1,moving:!1,fadeDuration:r,showPadding:this.showPadding}),this.fire(new E("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,er.mark("load"),this.fire(new E("load"))),this.style&&(this.style.hasTransitions()||i)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();let o=this._sourcesDirty||this._styleDirty||this._placementDirty;return o||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new E("idle")),this._loaded&&!this._fullyLoaded&&!o&&(this._fullyLoaded=!0,er.mark("fullLoad")),this._fullyLoaded=!0,this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var r;this._hash&&this._hash.remove();for(let i of this._controls)i.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),He.removeThrottleControl(this._imageQueueHandle),(r=this._resizeObserver)==null||r.disconnect();let e=this.painter.context.gl.getExtension("WEBGL_lose_context");e&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),M.remove(this._canvasContainer),M.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),er.clearMetrics(),this._removed=!0,this.fire(new E("remove"))}triggerRepaintSync(){this._render(performance.now())}triggerRepaint(){this.style&&!this._frame&&(this._frame=ee.frame(e=>{er.frame(e),this._frame=null,this._render(e)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(e){this._showTileBoundaries!==e&&(this._showTileBoundaries=e,this._update())}get showPadding(){return!!this._showPadding}set showPadding(e){this._showPadding!==e&&(this._showPadding=e,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(e){this._showCollisionBoxes!==e&&(this._showCollisionBoxes=e,e?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(e){this._showOverdrawInspector!==e&&(this._showOverdrawInspector=e,this._update())}get repaint(){return!!this._repaint}set repaint(e){this._repaint!==e&&(this._repaint=e,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(e){this._vertices=e,this._update()}get version(){return Cv}getCameraTargetElevation(){return this.transform.elevation}};u(sh,"Map");var Fs=sh;f();f();f();var lh=class lh{constructor(t){this._enabled=!!t.enable,this._moveStateManager=t.moveStateManager,this._clickTolerance=t.clickTolerance||1,this._moveFunction=t.move,this._activateOnStart=!!t.activateOnStart,t.assignEvents(this),this.reset()}reset(t){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(t)}_move(...t){let e=this._moveFunction(...t);if(e.bearingDelta||e.pitchDelta||e.around||e.panDelta)return this._active=!0,e}dragStart(t,e){!this.isEnabled()||this._lastPoint||this._moveStateManager.isValidStartEvent(t)&&(this._moveStateManager.startMove(t),this._lastPoint=e.length?e[0]:e,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(t,e){if(!this.isEnabled())return;let r=this._lastPoint;if(!r)return;if(t.preventDefault(),!this._moveStateManager.isValidMoveEvent(t)){this.reset(t);return}let i=e.length?e[0]:e;if(!(!this._moved&&i.dist(r)<this._clickTolerance))return this._moved=!0,this._lastPoint=i,this._move(r,i)}dragEnd(t){!this.isEnabled()||!this._lastPoint||this._moveStateManager.isValidEndEvent(t)&&(this._moved&&M.suppressClick(),this.reset(t))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}};u(lh,"DragHandler");var rr=lh;f();var Mv=0,Lv=2,kv={[Mv]:1,[Lv]:2};function Dv(n,t){let e=kv[t];return n.buttons===void 0||(n.buttons&e)!==e}u(Dv,"buttonNoLongerPressed");var uh=class uh{constructor(t){this._correctEvent=t.checkCorrectEvent}startMove(t){let e=M.mouseButton(t);this._eventButton=e}endMove(t){delete this._eventButton}isValidStartEvent(t){return this._correctEvent(t)}isValidMoveEvent(t){return!Dv(t,this._eventButton)}isValidEndEvent(t){return M.mouseButton(t)===this._eventButton}};u(uh,"MouseMoveStateManager");var vn=uh,ch=class ch{constructor(){this._firstTouch=void 0}_isOneFingerTouch(t){return t.targetTouches.length===1}_isSameTouchEvent(t){return t.targetTouches[0].identifier===this._firstTouch}startMove(t){let e=t.targetTouches[0].identifier;this._firstTouch=e}endMove(t){delete this._firstTouch}isValidStartEvent(t){return this._isOneFingerTouch(t)}isValidMoveEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}isValidEndEvent(t){return this._isOneFingerTouch(t)&&this._isSameTouchEvent(t)}};u(ch,"OneFingerTouchMoveStateManager");var wn=ch;var Gx=0,qx=2,jx=u(n=>{n.mousedown=n.dragStart,n.mousemoveWindow=n.dragMove,n.mouseup=n.dragEnd,n.contextmenu=function(t){t.preventDefault()}},"assignEvents");var Hx=u(({enable:n,clickTolerance:t,bearingDegreesPerPixelMoved:e=.8})=>{let r=new vn({checkCorrectEvent:i=>M.mouseButton(i)===Gx&&i.ctrlKey||M.mouseButton(i)===qx});return new rr({clickTolerance:t,move:(i,o)=>({bearingDelta:(o.x-i.x)*e}),moveStateManager:r,enable:n,assignEvents:jx})},"generateMouseRotationHandler"),Zx=u(({enable:n,clickTolerance:t,pitchDegreesPerPixelMoved:e=-.5})=>{let r=new vn({checkCorrectEvent:i=>M.mouseButton(i)===Gx&&i.ctrlKey||M.mouseButton(i)===qx});return new rr({clickTolerance:t,move:(i,o)=>({pitchDelta:(o.y-i.y)*e}),moveStateManager:r,enable:n,assignEvents:jx})},"generateMousePitchHandler");f();var Wx=u(n=>{n.touchstart=n.dragStart,n.touchmoveWindow=n.dragMove,n.touchend=n.dragEnd},"assignEvents"),Xx=u(({enable:n,clickTolerance:t,bearingDegreesPerPixelMoved:e=.8})=>{let r=new wn;return new rr({clickTolerance:t,move:(i,o)=>({bearingDelta:(o.x-i.x)*e}),moveStateManager:r,enable:n,assignEvents:Wx})},"generateOneFingerTouchRotationHandler"),Kx=u(({enable:n,clickTolerance:t,pitchDegreesPerPixelMoved:e=-.5})=>{let r=new wn;return new rr({clickTolerance:t,move:(i,o)=>({pitchDelta:(o.y-i.y)*e}),moveStateManager:r,enable:n,assignEvents:Wx})},"generateOneFingerTouchPitchHandler");var Fv={showCompass:!0,showZoom:!0,visualizePitch:!1},mh=class mh{constructor(t){this._updateZoomButtons=u(()=>{let t=this._map.getZoom(),e=t===this._map.getMaxZoom(),r=t===this._map.getMinZoom();this._zoomInButton.disabled=e,this._zoomOutButton.disabled=r,this._zoomInButton.setAttribute("aria-disabled",e.toString()),this._zoomOutButton.setAttribute("aria-disabled",r.toString())},"_updateZoomButtons");this._rotateCompassArrow=u(()=>{let t=this.options.visualizePitch?"scale(".concat(1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5),") rotateX(").concat(this._map.transform.pitch,"deg) rotateZ(").concat(this._map.transform.angle*(180/Math.PI),"deg)"):"rotate(".concat(this._map.transform.angle*(180/Math.PI),"deg)");this._compassIcon.style.transform=t},"_rotateCompassArrow");this._setButtonTitle=u((t,e)=>{let r=this._map._getUIString("NavigationControl.".concat(e));t.title=r,t.setAttribute("aria-label",r)},"_setButtonTitle");this.options=k({},Fv,t),this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),M.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),M.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=M.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(t){return this._map=t,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new ph(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){M.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(t,e){let r=M.create("button",t,this._container);return r.type="button",r.addEventListener("click",e),r}};u(mh,"NavigationControl");var zs=mh,hh=class hh{constructor(t,e,r=!1){this.mousedown=u(t=>{this.startMouse(k({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),M.mousePos(this.element,t)),M.addEventListener(window,"mousemove",this.mousemove),M.addEventListener(window,"mouseup",this.mouseup)},"mousedown");this.mousemove=u(t=>{this.moveMouse(t,M.mousePos(this.element,t))},"mousemove");this.mouseup=u(t=>{this.mouseRotate.dragEnd(t),this.mousePitch&&this.mousePitch.dragEnd(t),this.offTemp()},"mouseup");this.touchstart=u(t=>{t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=M.touchPos(this.element,t.targetTouches)[0],this.startTouch(t,this._startPos),M.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.addEventListener(window,"touchend",this.touchend))},"touchstart");this.touchmove=u(t=>{t.targetTouches.length!==1?this.reset():(this._lastPos=M.touchPos(this.element,t.targetTouches)[0],this.moveTouch(t,this._lastPos))},"touchmove");this.touchend=u(t=>{t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},"touchend");this.reset=u(()=>{this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},"reset");this._clickTolerance=10;let i=t.dragRotate._mouseRotate.getClickTolerance(),o=t.dragRotate._mousePitch.getClickTolerance();this.element=e,this.mouseRotate=Hx({clickTolerance:i,enable:!0}),this.touchRotate=Xx({clickTolerance:i,enable:!0}),this.map=t,r&&(this.mousePitch=Zx({clickTolerance:o,enable:!0}),this.touchPitch=Kx({clickTolerance:o,enable:!0})),M.addEventListener(e,"mousedown",this.mousedown),M.addEventListener(e,"touchstart",this.touchstart,{passive:!1}),M.addEventListener(e,"touchcancel",this.reset)}startMouse(t,e){this.mouseRotate.dragStart(t,e),this.mousePitch&&this.mousePitch.dragStart(t,e),M.disableDrag()}startTouch(t,e){this.touchRotate.dragStart(t,e),this.touchPitch&&this.touchPitch.dragStart(t,e),M.disableDrag()}moveMouse(t,e){let r=this.map,{bearingDelta:i}=this.mouseRotate.dragMove(t,e)||{};if(i&&r.setBearing(r.getBearing()+i),this.mousePitch){let{pitchDelta:o}=this.mousePitch.dragMove(t,e)||{};o&&r.setPitch(r.getPitch()+o)}}moveTouch(t,e){let r=this.map,{bearingDelta:i}=this.touchRotate.dragMove(t,e)||{};if(i&&r.setBearing(r.getBearing()+i),this.touchPitch){let{pitchDelta:o}=this.touchPitch.dragMove(t,e)||{};o&&r.setPitch(r.getPitch()+o)}}off(){let t=this.element;M.removeEventListener(t,"mousedown",this.mousedown),M.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),M.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.removeEventListener(window,"touchend",this.touchend),M.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){M.enableDrag(),M.removeEventListener(window,"mousemove",this.mousemove),M.removeEventListener(window,"mouseup",this.mouseup),M.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),M.removeEventListener(window,"touchend",this.touchend)}};u(hh,"MouseRotateWrapper");var ph=hh;f();f();var ir;function $x(n,t=!1){ir!==void 0&&!t?n(ir):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(e=>{ir=e.state!=="denied",n(ir)}).catch(()=>{ir=!!window.navigator.geolocation,n(ir)}):(ir=!!window.navigator.geolocation,n(ir))}u($x,"checkGeolocationSupport");f();var Os=te(be(),1);f();function Bs(n,t,e){if(n=new Q(n.lng,n.lat),t){let r=new Q(n.lng-360,n.lat),i=new Q(n.lng+360,n.lat),o=e.locationPoint(n).distSqr(t);e.locationPoint(r).distSqr(t)<o?n=r:e.locationPoint(i).distSqr(t)<o&&(n=i)}for(;Math.abs(n.lng-e.center.lng)>180;){let r=e.locationPoint(n);if(r.x>=0&&r.y>=0&&r.x<=e.width&&r.y<=e.height)break;n.lng>e.center.lng?n.lng-=360:n.lng+=360}return n}u(Bs,"smartWrap");f();var Sn={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Rs(n,t,e){let r=n.classList;for(let i in Sn)r.remove("maplibregl-".concat(e,"-anchor-").concat(i));r.add("maplibregl-".concat(e,"-anchor-").concat(t))}u(Rs,"applyAnchorClass");var fh=class fh extends se{constructor(e){super();this._onKeyPress=u(e=>{let r=e.code,i=e.charCode||e.keyCode;(r==="Space"||r==="Enter"||i===32||i===13)&&this.togglePopup()},"_onKeyPress");this._onMapClick=u(e=>{let r=e.originalEvent.target,i=this._element;this._popup&&(r===i||i.contains(r))&&this.togglePopup()},"_onMapClick");this._update=u(e=>{if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Bs(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let r="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?r="rotateZ(".concat(this._rotation,"deg)"):this._rotationAlignment==="map"&&(r="rotateZ(".concat(this._rotation-this._map.getBearing(),"deg)"));let i="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?i="rotateX(0deg)":this._pitchAlignment==="map"&&(i="rotateX(".concat(this._map.getPitch(),"deg)")),(!e||e.type==="moveend")&&(this._pos=this._pos.round()),M.setTransform(this._element,"".concat(Sn[this._anchor]," translate(").concat(this._pos.x,"px, ").concat(this._pos.y,"px) ").concat(i," ").concat(r)),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{let o=this._map.unproject(this._pos),a=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=o.distanceTo(this._lngLat)>a*20?"0.2":"1.0",this._opacityTimeout=null},100))},"_update");this._onMove=u(e=>{if(!this._isDragging){let r=this._clickTolerance||this._map._clickTolerance;this._isDragging=e.point.dist(this._pointerdownPos)>=r}this._isDragging&&(this._pos=e.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new E("dragstart"))),this.fire(new E("drag")))},"_onMove");this._onUp=u(()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new E("dragend")),this._state="inactive"},"_onUp");this._addDragHandler=u(e=>{this._element.contains(e.originalEvent.target)&&(e.preventDefault(),this._positionDelta=e.point.sub(this._pos).add(this._offset),this._pointerdownPos=e.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},"_addDragHandler");if(this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,!e||!e.element){this._defaultMarker=!0,this._element=M.create("div"),this._element.setAttribute("aria-label","Map marker");let r=M.createNS("http://www.w3.org/2000/svg","svg"),i=41,o=27;r.setAttributeNS(null,"display","block"),r.setAttributeNS(null,"height","".concat(i,"px")),r.setAttributeNS(null,"width","".concat(o,"px")),r.setAttributeNS(null,"viewBox","0 0 ".concat(o," ").concat(i));let a=M.createNS("http://www.w3.org/2000/svg","g");a.setAttributeNS(null,"stroke","none"),a.setAttributeNS(null,"stroke-width","1"),a.setAttributeNS(null,"fill","none"),a.setAttributeNS(null,"fill-rule","evenodd");let s=M.createNS("http://www.w3.org/2000/svg","g");s.setAttributeNS(null,"fill-rule","nonzero");let l=M.createNS("http://www.w3.org/2000/svg","g");l.setAttributeNS(null,"transform","translate(3.0, 29.0)"),l.setAttributeNS(null,"fill","#000000");let c=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(let b of c){let w=M.createNS("http://www.w3.org/2000/svg","ellipse");w.setAttributeNS(null,"opacity","0.04"),w.setAttributeNS(null,"cx","10.5"),w.setAttributeNS(null,"cy","5.80029008"),w.setAttributeNS(null,"rx",b.rx),w.setAttributeNS(null,"ry",b.ry),l.appendChild(w)}let p=M.createNS("http://www.w3.org/2000/svg","g");p.setAttributeNS(null,"fill",this._color);let m=M.createNS("http://www.w3.org/2000/svg","path");m.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),p.appendChild(m);let h=M.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"opacity","0.25"),h.setAttributeNS(null,"fill","#000000");let d=M.createNS("http://www.w3.org/2000/svg","path");d.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),h.appendChild(d);let g=M.createNS("http://www.w3.org/2000/svg","g");g.setAttributeNS(null,"transform","translate(6.0, 7.0)"),g.setAttributeNS(null,"fill","#FFFFFF");let y=M.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"transform","translate(8.0, 8.0)");let x=M.createNS("http://www.w3.org/2000/svg","circle");x.setAttributeNS(null,"fill","#000000"),x.setAttributeNS(null,"opacity","0.25"),x.setAttributeNS(null,"cx","5.5"),x.setAttributeNS(null,"cy","5.5"),x.setAttributeNS(null,"r","5.4999962");let v=M.createNS("http://www.w3.org/2000/svg","circle");v.setAttributeNS(null,"fill","#FFFFFF"),v.setAttributeNS(null,"cx","5.5"),v.setAttributeNS(null,"cy","5.5"),v.setAttributeNS(null,"r","5.4999962"),y.appendChild(x),y.appendChild(v),s.appendChild(l),s.appendChild(p),s.appendChild(h),s.appendChild(g),s.appendChild(y),r.appendChild(s),r.setAttributeNS(null,"height","".concat(i*this._scale,"px")),r.setAttributeNS(null,"width","".concat(o*this._scale,"px")),this._element.appendChild(r),this._offset=Os.default.convert(e&&e.offset||[0,-14])}else this._element=e.element,this._offset=Os.default.convert(e&&e.offset||[0,0]);if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",r=>{r.preventDefault()}),this._element.addEventListener("mousedown",r=>{r.preventDefault()}),Rs(this._element,this._anchor,"marker"),e&&e.className)for(let r of e.className.split(" "))this._element.classList.add(r);this._popup=null}addTo(e){return this.remove(),this._map=e,e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),M.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){let o=Math.sqrt(Math.pow(13.5,2)/2);e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[o,(38.1-13.5+o)*-1],"bottom-right":[-o,(38.1-13.5+o)*-1],left:[13.5,(38.1-13.5)*-1],right:[-13.5,(38.1-13.5)*-1]}:this._offset}this._popup=e,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){let e=this._popup;if(e)e.isOpen()?e.remove():e.addTo(this._map);else return this;return this}getOffset(){return this._offset}setOffset(e){return this._offset=Os.default.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}};u(fh,"Marker");var Er=fh;var zv={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0},Vs=0,Pn=!1,dh=class dh extends se{constructor(e){super();this._onSuccess=u(e=>{if(this._map){if(this._isOutOfMapMaxBounds(e)){this._setErrorState(),this.fire(new E("outofmaxbounds",e)),this._updateMarker(),this._finish();return}if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),(!this.options.trackUserLocation||this._watchState==="ACTIVE_LOCK")&&this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new E("geolocate",e)),this._finish()}},"_onSuccess");this._updateCamera=u(e=>{let r=new Q(e.coords.longitude,e.coords.latitude),i=e.coords.accuracy,o=this._map.getBearing(),a=k({bearing:o},this.options.fitBoundsOptions),s=We.fromLngLat(r,i);this._map.fitBounds(s,a,{geolocateSource:!0})},"_updateCamera");this._updateMarker=u(e=>{if(e){let r=new Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(r).addTo(this._map),this._userLocationDotMarker.setLngLat(r).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},"_updateMarker");this._onZoom=u(()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},"_onZoom");this._onError=u(e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&Pn)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new E("error",e)),this._finish()}},"_onError");this._finish=u(()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},"_finish");this._setupUI=u(e=>{if(this._map){if(this._container.addEventListener("contextmenu",r=>r.preventDefault()),this._geolocateButton=M.create("button","maplibregl-ctrl-geolocate",this._container),M.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",e===!1){xe("Geolocation support is not available so the GeolocateControl will be disabled.");let r=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r)}else{let r=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=r,this._geolocateButton.setAttribute("aria-label",r)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=M.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Er({element:this._dotElement}),this._circleElement=M.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Er({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=>{let i=r.originalEvent&&r.originalEvent.type==="resize";!r.geolocateSource&&this._watchState==="ACTIVE_LOCK"&&!i&&(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new E("trackuserlocationend")))})}},"_setupUI");this.options=k({},zv,e)}onAdd(e){return this._map=e,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),$x(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),M.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Vs=0,Pn=!1}_isOutOfMapMaxBounds(e){let r=this._map.getMaxBounds(),i=e.coords;return r&&(i.longitude<r.getWest()||i.longitude>r.getEast()||i.latitude<r.getSouth()||i.latitude>r.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}}_updateCircleRadius(){let e=this._map.getBounds(),r=e.getSouthEast(),i=e.getNorthEast(),o=r.distanceTo(i),a=this._map._container.clientHeight,s=Math.ceil(2*(this._accuracy/(o/a)));this._circleElement.style.width="".concat(s,"px"),this._circleElement.style.height="".concat(s,"px")}trigger(){if(!this._setup)return xe("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new E("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Vs--,Pn=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new E("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new E("trackuserlocationstart"));break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error("Unexpected watchState ".concat(this._watchState))}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Vs++;let e;Vs>1?(e={maximumAge:6e5,timeout:0},Pn=!0):(e=this.options.positionOptions,Pn=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,e)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}};u(dh,"GeolocateControl");var Us=dh;f();var Bv={maxWidth:100,unit:"metric"},yh=class yh{constructor(t){this._onMove=u(()=>{Jx(this._map,this._container,this.options)},"_onMove");this.setUnit=u(t=>{this.options.unit=t,Jx(this._map,this._container,this.options)},"setUnit");this.options=k({},Bv,t)}getDefaultPosition(){return"bottom-left"}onAdd(t){return this._map=t,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){M.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}};u(yh,"ScaleControl");var Ns=yh;function Jx(n,t,e){let r=e&&e.maxWidth||100,i=n._container.clientHeight/2,o=n.unproject([0,i]),a=n.unproject([r,i]),s=o.distanceTo(a);if(e&&e.unit==="imperial"){let l=3.2808*s;if(l>5280){let c=l/5280;Tn(t,r,c,n._getUIString("ScaleControl.Miles"))}else Tn(t,r,l,n._getUIString("ScaleControl.Feet"))}else if(e&&e.unit==="nautical"){let l=s/1852;Tn(t,r,l,n._getUIString("ScaleControl.NauticalMiles"))}else s>=1e3?Tn(t,r,s/1e3,n._getUIString("ScaleControl.Kilometers")):Tn(t,r,s,n._getUIString("ScaleControl.Meters"))}u(Jx,"updateScale");function Tn(n,t,e,r){let i=Ov(e),o=i/e;n.style.width="".concat(t*o,"px"),n.innerHTML="".concat(i," ").concat(r)}u(Tn,"setScale");function Rv(n){let t=Math.pow(10,Math.ceil(-Math.log(n)/Math.LN10));return Math.round(n*t)/t}u(Rv,"getDecimalRoundNum");function Ov(n){let t=Math.pow(10,"".concat(Math.floor(n)).length-1),e=n/t;return e=e>=10?10:e>=5?5:e>=3?3:e>=2?2:e>=1?1:Rv(e),t*e}u(Ov,"getRoundNum");f();var gh=class gh extends se{constructor(e={}){super();this._onFullscreenChange=u(()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},"_onFullscreenChange");this._onClickFullscreen=u(()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},"_onClickFullscreen");this._fullscreen=!1,e&&e.container&&(e.container instanceof HTMLElement?this._container=e.container:xe("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(e){return this._map=e,this._container||(this._container=this._map.getContainer()),this._controlContainer=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){M.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){let e=this._fullscreenButton=M.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);M.create("span","maplibregl-ctrl-icon",e).setAttribute("aria-hidden","true"),e.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){let e=this._getTitle();this._fullscreenButton.setAttribute("aria-label",e),this._fullscreenButton.title=e}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new E("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new E("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}};u(gh,"FullscreenControl");var Gs=gh;f();var xh=class xh{constructor(t){this._toggleTerrain=u(()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},"_toggleTerrain");this._updateTerrainIcon=u(()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},"_updateTerrainIcon");this.options=t}onAdd(t){return this._map=t,this._container=M.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=M.create("button","maplibregl-ctrl-terrain",this._container),M.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){M.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}};u(xh,"TerrainControl");var qs=xh;f();var ke=te(be(),1);var Vv={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Uv=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", "),_h=class _h extends se{constructor(e){super();this.remove=u(()=>(this._content&&M.remove(this._content),this._container&&(M.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new E("close")),this),"remove");this._onMouseUp=u(e=>{this._update(e.point)},"_onMouseUp");this._onMouseMove=u(e=>{this._update(e.point)},"_onMouseMove");this._onDrag=u(e=>{this._update(e.point)},"_onDrag");this._update=u(e=>{let r=this._lngLat||this._trackPointer;if(!this._map||!r||!this._content)return;if(!this._container){if(this._container=M.create("div","maplibregl-popup",this._map.getContainer()),this._tip=M.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(let l of this.options.className.split(" "))this._container.classList.add(l);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Bs(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!e)return;let i=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat),o=this.options.anchor,a=Yx(this.options.offset);if(!o){let l=this._container.offsetWidth,c=this._container.offsetHeight,p;i.y+a.bottom.y<c?p=["top"]:i.y>this._map.transform.height-c?p=["bottom"]:p=[],i.x<l/2?p.push("left"):i.x>this._map.transform.width-l/2&&p.push("right"),p.length===0?o="bottom":o=p.join("-")}let s=i.add(a[o]).round();M.setTransform(this._container,"".concat(Sn[o]," translate(").concat(s.x,"px,").concat(s.y,"px)")),Rs(this._container,o,"popup")},"_update");this._onClose=u(()=>{this.remove()},"_onClose");this.options=k(Object.create(Vv),e)}addTo(e){return this._map&&this.remove(),this._map=e,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new E("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=Q.convert(e),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(e){return this.setDOMContent(document.createTextNode(e))}setHTML(e){let r=document.createDocumentFragment(),i=document.createElement("body"),o;for(i.innerHTML=e;o=i.firstChild,!!o;)r.appendChild(o);return this.setDOMContent(r)}getMaxWidth(){var e;return(e=this._container)==null?void 0:e.style.maxWidth}setMaxWidth(e){return this.options.maxWidth=e,this._update(),this}setDOMContent(e){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=M.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(e),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(e){this._container&&this._container.classList.add(e)}removeClassName(e){this._container&&this._container.classList.remove(e)}setOffset(e){return this.options.offset=e,this._update(),this}toggleClassName(e){if(this._container)return this._container.classList.toggle(e)}_createCloseButton(){this.options.closeButton&&(this._closeButton=M.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;let e=this._container.querySelector(Uv);e&&e.focus()}};u(_h,"Popup");var js=_h;function Yx(n){if(n)if(typeof n=="number"){let t=Math.round(Math.sqrt(.5*Math.pow(n,2)));return{center:new ke.default(0,0),top:new ke.default(0,n),"top-left":new ke.default(t,t),"top-right":new ke.default(-t,t),bottom:new ke.default(0,-n),"bottom-left":new ke.default(t,-t),"bottom-right":new ke.default(-t,-t),left:new ke.default(n,0),right:new ke.default(-n,0)}}else if(n instanceof ke.default||Array.isArray(n)){let t=ke.default.convert(n);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}else return{center:ke.default.convert(n.center||[0,0]),top:ke.default.convert(n.top||[0,0]),"top-left":ke.default.convert(n["top-left"]||[0,0]),"top-right":ke.default.convert(n["top-right"]||[0,0]),bottom:ke.default.convert(n.bottom||[0,0]),"bottom-left":ke.default.convert(n["bottom-left"]||[0,0]),"bottom-right":ke.default.convert(n["bottom-right"]||[0,0]),left:ke.default.convert(n.left||[0,0]),right:ke.default.convert(n.right||[0,0])};else return Yx(new ke.default(0,0))}u(Yx,"normalizeOffset");var e_=te(be(),1);f();var Qx={extend(n,...t){return k(n,...t)},run(n){n()},logToElement(n,t=!1,e="log"){let r=window.document.getElementById(e);r&&(t&&(r.innerHTML=""),r.innerHTML+="<br>".concat(n))}};var Nv=zn.version,de=class de{static get version(){return Nv}static get workerCount(){return Yt.workerCount}static set workerCount(t){Yt.workerCount=t}static get maxParallelImageRequests(){return Ge.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(t){Ge.MAX_PARALLEL_IMAGE_REQUESTS=t}static get workerUrl(){return Ge.WORKER_URL}static set workerUrl(t){console.log("setting worker url",t),Ge.WORKER_URL=t}static addProtocol(t,e){Ge.REGISTERED_PROTOCOLS[t]=e}static removeProtocol(t){delete Ge.REGISTERED_PROTOCOLS[t]}};u(de,"MapLibreGL"),de.Map=Fs,de.NavigationControl=zs,de.GeolocateControl=Us,de.AttributionControl=ui,de.LogoControl=ci,de.ScaleControl=Ns,de.FullscreenControl=Gs,de.TerrainControl=qs,de.Popup=js,de.Marker=Er,de.Style=Qt,de.LngLat=Q,de.LngLatBounds=We,de.Point=e_.default,de.MercatorCoordinate=Se,de.Evented=se,de.AJAXError=zt,de.config=Ge,de.CanvasSource=ri,de.GeoJSONSource=ei,de.ImageSource=at,de.RasterDEMTileSource=Qr,de.RasterTileSource=$t,de.VectorTileSource=$r,de.VideoSource=ti,de.setRTLTextPlugin=xf,de.getRTLTextPluginStatus=bi,de.prewarm=iy,de.clearPrewarmedResources=ny;var Hs=de;Qx.extend(Hs,{isSafari:ar,getPerformanceMetrics:er.getPerformanceMetrics});var DH=Hs;export{DH as default};
|